Skip to content

Commit

Permalink
Update ios sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
victoriaplatogo committed Apr 29, 2024
1 parent 77d0ec8 commit c82f6cb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 66 deletions.
47 changes: 2 additions & 45 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
<a name="4.1.0"></a>

# [4.1.0](https://github.com/MaximBelov/cordova-plugin-fbsdk/releases/tag/v4.1.0) (2024-04-23)

## Features

* Updated the Facebook SDK to 17.0.0 for Android
* Updated the Facebook SDK to 17.0.0 for iOS
* Updated the Facebook JavaScript SDK used by the browser platform to v19.0

<a name="4.0.4"></a>
# [4.0.4](https://github.com/MaximBelov/cordova-plugin-fbsdk/releases/tag/v4.0.4) (2023-03-28)

## Features

* Updated the Facebook SDK to 16.0.1 for Android
* Updated the Facebook SDK to 16.0.1 for iOS
* Updated the Facebook JavaScript SDK used by the browser platform to v16.0

<a name="4.0.3"></a>
# [4.0.3](https://github.com/MaximBelov/cordova-plugin-fbsdk/releases/tag/v4.0.3) (2023-03-28)
## Bug fix

* iOS: Prefixing swizzling logic to avoid conflicts
* Android 11: sharing dialog cannot be opened successfully.

<a name="4.0.2"></a>
# [4.0.2](https://github.com/MaximBelov/cordova-plugin-fbsdk/releases/tag/v4.0.2) (2022-10-12)

## Features

* Android fix error INSTALL_FAILED_CONFLICTING_PROVIDER

<a name="4.0.1"></a>
# [4.0.1](https://github.com/MaximBelov/cordova-plugin-fbsdk/releases/tag/v4.0.1) (2022-09-07)

## Features

* Updated the Facebook SDK to 14.1.1 for Android
* Updated the Facebook SDK to 14.1.0 for iOS
* Updated the Facebook JavaScript SDK used by the browser platform to v14.0
* Update plugin id cordova-plugin-fbsdk

<a name="4.0.0"></a>
# [4.0.0](https://github.com/MaximBelov/cordova-plugin-facebook-connect/releases/tag/v4.0.0) (2022-09-06)
# [4.0.0](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/releases/tag/v4.0.0) (TBD)

## Breaking Changes

Expand Down Expand Up @@ -249,4 +206,4 @@ v1.0.0 is the initial release of the plugin, created as a fork of the now-deprec
* Fixed an issue that previously caused a loop when logging into Facebook on iOS
* Removed all references to Open Graph Stories, which were [deprecated by Facebook in 2019](https://developers.facebook.com/docs/sharing/opengraph)
* Updated plugin.xml to only run after_prepare hook on the browser platform
* Updated browser after_prepare hook to get preferences including `APP_ID` and the new `FACEBOOK_BROWSER_SDK_VERSION` from package.json
* Updated browser after_prepare hook to get preferences including `APP_ID` and the new `FACEBOOK_BROWSER_SDK_VERSION` from package.json
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ These are just guidelines, not rules, use your best judgement and feel free to p
Before creating a Github issue make sure you...

- Check the [Troubleshooting Guide](./docs/TROUBLESHOOTING.md) for well known issues.
- Search the [issues list](https://github.com/MaximBelov/cordova-plugin-fbsdk/issues) for existing closed or still open issues
- Search the [issues list](https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues) for existing closed or still open issues
- Create a Github issue

#### Creating an Issue
Expand All @@ -29,4 +29,4 @@ Can you solve the problem yourself? If so see the next section on Pull Requests
- Include screenshots and animated GIFs in your pull request whenever possible.
- Try to follow the [JavaScript](https://github.com/Wizcorp/javascript-styleguide/blob/master/README.md), [Objective-C](http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml) or [Java](https://google-styleguide.googlecode.com/svn/trunk/javaguide.html) style guides. Although these are just guides, please at least support continuety (that means **using 4 spaces please**).
- **Send your pull request to the develop branch.**
- If you can, provide sample testing code.
- If you can, provide sample testing code.
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
<access origin="https://*.fbcdn.net" />
<access origin="https://*.akamaihd.net" />
</config-file>

<hook type="after_prepare" src="scripts/browser/after_prepare.js" />
</platform>
</plugin>
2 changes: 2 additions & 0 deletions src/ios/FacebookConnectPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <FBSDKShareKit/FBSDKShareKit.h>
#import <AdSupport/ASIdentifierManager.h>
#import <FBSDKGamingServicesKit/FBSDKGamingServicesKit-Swift.h>
#import <Cordova/CDV.h>
#import "AppDelegate.h"

@interface FacebookConnectPlugin : CDVPlugin <FBSDKSharingDelegate, FBSDKGameRequestDialogDelegate>
- (void)getAdvertiserId:(CDVInvokedUrlCommand *)command;
- (void)getApplicationId:(CDVInvokedUrlCommand *)command;
- (void)setApplicationId:(CDVInvokedUrlCommand *)command;
- (void)getClientToken:(CDVInvokedUrlCommand *)command;
Expand Down
45 changes: 27 additions & 18 deletions src/ios/FacebookConnectPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void) applicationDidFinishLaunching:(NSNotification *) notification {
}

[[FBSDKApplicationDelegate sharedInstance] application:[UIApplication sharedApplication] didFinishLaunchingWithOptions:launchOptions];

[FBSDKProfile enableUpdatesOnAccessTokenChange:YES];
}

Expand All @@ -77,6 +77,15 @@ - (void) handleOpenURLWithAppSourceAndAnnotation:(NSNotification *) notification

#pragma mark - Cordova commands

- (void)getAdvertiserId:(CDVInvokedUrlCommand *)command {
NSString *advertiserID = [[[ASIdentifierManager sharedManager]
advertisingIdentifier] UUIDString];

CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsString: advertiserID];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)getApplicationId:(CDVInvokedUrlCommand *)command {
NSString *appID = FBSDKSettings.sharedSettings.appID;
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:appID];
Expand All @@ -89,7 +98,7 @@ - (void)setApplicationId:(CDVInvokedUrlCommand *)command {
[self returnInvalidArgsError:command.callbackId];
return;
}

NSString *appId = [command argumentAtIndex:0];
[FBSDKSettings.sharedSettings setAppID:appId];
[self returnGenericSuccess:command.callbackId];
Expand Down Expand Up @@ -125,7 +134,7 @@ - (void)setApplicationName:(CDVInvokedUrlCommand *)command {
[self returnInvalidArgsError:command.callbackId];
return;
}

NSString *displayName = [command argumentAtIndex:0];
[FBSDKSettings.sharedSettings setDisplayName:displayName];
[self returnGenericSuccess:command.callbackId];
Expand All @@ -136,7 +145,7 @@ - (void)getLoginStatus:(CDVInvokedUrlCommand *)command {
[self returnLimitedLoginMethodError:command.callbackId];
return;
}

BOOL force = [[command argumentAtIndex:0] boolValue];
if (force) {
[FBSDKAccessToken refreshCurrentAccessTokenWithCompletion:^(id<FBSDKGraphRequestConnecting> _Nullable connection, id _Nullable result, NSError * _Nullable error) {
Expand All @@ -156,7 +165,7 @@ - (void)getAccessToken:(CDVInvokedUrlCommand *)command {
[self returnLimitedLoginMethodError:command.callbackId];
return;
}

// Return access token if available
CDVPluginResult *pluginResult;
// Check if the session is open or not
Expand Down Expand Up @@ -286,7 +295,7 @@ - (void)logPurchase:(CDVInvokedUrlCommand *)command {
[self.commandDelegate runInBackground:^{
double value = [[command.arguments objectAtIndex:0] doubleValue];
NSString *currency = [command.arguments objectAtIndex:1];

if ([command.arguments count] == 2 ) {
[FBSDKAppEvents.shared logPurchase:value currency:currency];
} else if ([command.arguments count] >= 3) {
Expand Down Expand Up @@ -412,7 +421,7 @@ - (void) checkHasCorrectPermissions:(CDVInvokedUrlCommand*)command
if ([command.arguments count] > 0) {
permissions = command.arguments;
}

NSSet *grantedPermissions = [FBSDKAccessToken currentAccessToken].permissions;

for (NSString *value in permissions) {
Expand All @@ -424,7 +433,7 @@ - (void) checkHasCorrectPermissions:(CDVInvokedUrlCommand*)command
return;
}
}

CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsString:@"All permissions have been accepted"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
Expand All @@ -448,12 +457,12 @@ - (void) reauthorizeDataAccess:(CDVInvokedUrlCommand *)command {
[self returnLimitedLoginMethodError:command.callbackId];
return;
}

if (self.loginManager == nil) {
self.loginManager = [[FBSDKLoginManager alloc] init];
}
self.loginTracking = FBSDKLoginTrackingEnabled;

FBSDKLoginManagerLoginResultBlock reauthorizeHandler = ^void(FBSDKLoginManagerLoginResult *result, NSError *error) {
if (error) {
NSString *errorCode = @"-2";
Expand All @@ -470,7 +479,7 @@ - (void) reauthorizeDataAccess:(CDVInvokedUrlCommand *)command {
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
};

[self.loginManager reauthorizeDataAccess:[self topMostController] handler:reauthorizeHandler];
}

Expand Down Expand Up @@ -639,7 +648,7 @@ - (void) graphApi:(CDVInvokedUrlCommand *)command
[self returnLimitedLoginMethodError:command.callbackId];
return;
}

CDVPluginResult *pluginResult;
if (! [FBSDKAccessToken currentAccessToken]) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
Expand Down Expand Up @@ -887,17 +896,17 @@ - (NSDictionary *)profileObject {
if ([FBSDKProfile currentProfile] == nil) {
return @{};
}

NSMutableDictionary *response = [[NSMutableDictionary alloc] init];
FBSDKProfile *profile = [FBSDKProfile currentProfile];
NSString *userID = profile.userID;

response[@"userID"] = userID ? userID : @"";

if (self.loginTracking == FBSDKLoginTrackingLimited) {
NSString *name = profile.name;
NSString *email = profile.email;

if (name) {
response[@"name"] = name;
}
Expand All @@ -907,11 +916,11 @@ - (NSDictionary *)profileObject {
} else {
NSString *firstName = profile.firstName;
NSString *lastName = profile.lastName;

response[@"firstName"] = firstName ? firstName : @"";
response[@"lastName"] = lastName ? lastName : @"";
}

return [response copy];
}

Expand Down Expand Up @@ -1051,7 +1060,7 @@ - (BOOL)FacebookConnectPlugin_application:(UIApplication *)application openURL:(
}
// Required by FBSDKCoreKit for deep linking/to complete login
[[FBSDKApplicationDelegate sharedInstance] application:application openURL:url sourceApplication:[options valueForKey:@"UIApplicationOpenURLOptionsSourceApplicationKey"] annotation:0x0];

// NOTE: Cordova will run a JavaScript method here named handleOpenURL. This functionality is deprecated
// but will cause you to see JavaScript errors if you do not have window.handleOpenURL defined:
// https://github.com/Wizcorp/phonegap-facebook-plugin/issues/703#issuecomment-63748816
Expand Down

0 comments on commit c82f6cb

Please sign in to comment.