diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a67ab316..3b8a415ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,48 +1,5 @@ - - -# [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 - - -# [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 - - -# [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. - - -# [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 - - -# [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 - -# [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 @@ -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 \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cad3cf658..fdbc11ea2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 @@ -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. \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index f1392b953..3d12f48c9 100644 --- a/plugin.xml +++ b/plugin.xml @@ -225,7 +225,7 @@ - + diff --git a/src/ios/FacebookConnectPlugin.h b/src/ios/FacebookConnectPlugin.h index cde7c5127..7598da73a 100644 --- a/src/ios/FacebookConnectPlugin.h +++ b/src/ios/FacebookConnectPlugin.h @@ -13,11 +13,13 @@ #import #import #import +#import #import #import #import "AppDelegate.h" @interface FacebookConnectPlugin : CDVPlugin +- (void)getAdvertiserId:(CDVInvokedUrlCommand *)command; - (void)getApplicationId:(CDVInvokedUrlCommand *)command; - (void)setApplicationId:(CDVInvokedUrlCommand *)command; - (void)getClientToken:(CDVInvokedUrlCommand *)command; diff --git a/src/ios/FacebookConnectPlugin.m b/src/ios/FacebookConnectPlugin.m index c11b0e420..19b6c5640 100644 --- a/src/ios/FacebookConnectPlugin.m +++ b/src/ios/FacebookConnectPlugin.m @@ -54,7 +54,7 @@ - (void) applicationDidFinishLaunching:(NSNotification *) notification { } [[FBSDKApplicationDelegate sharedInstance] application:[UIApplication sharedApplication] didFinishLaunchingWithOptions:launchOptions]; - + [FBSDKProfile enableUpdatesOnAccessTokenChange:YES]; } @@ -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]; @@ -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]; @@ -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]; @@ -136,7 +145,7 @@ - (void)getLoginStatus:(CDVInvokedUrlCommand *)command { [self returnLimitedLoginMethodError:command.callbackId]; return; } - + BOOL force = [[command argumentAtIndex:0] boolValue]; if (force) { [FBSDKAccessToken refreshCurrentAccessTokenWithCompletion:^(id _Nullable connection, id _Nullable result, NSError * _Nullable error) { @@ -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 @@ -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) { @@ -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) { @@ -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]; @@ -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"; @@ -470,7 +479,7 @@ - (void) reauthorizeDataAccess:(CDVInvokedUrlCommand *)command { [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } }; - + [self.loginManager reauthorizeDataAccess:[self topMostController] handler:reauthorizeHandler]; } @@ -639,7 +648,7 @@ - (void) graphApi:(CDVInvokedUrlCommand *)command [self returnLimitedLoginMethodError:command.callbackId]; return; } - + CDVPluginResult *pluginResult; if (! [FBSDKAccessToken currentAccessToken]) { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR @@ -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; } @@ -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]; } @@ -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