Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Releases/v12.2.0 #2527

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ workflows:
- publish-cocoapods:
<<: *onlyRunOnTags
<<: *requiresSetup
fodboldbane
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,32 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## Unreleased

### Deprecated


- Starting with v12.2.0 apps no longer need to embed numerous custom URL schemes in `LSApplicationQueriesSchemes` for their `Info.plist`. Only the `fbapi` and `fb-messenger-share-api` custom URL schemes are needed. With the change to iOS 15 that limits `LSApplicationQueriesSchemes` to 50 schemes, this should relieve some pressure that apps may face when running up against this limit. As part of this change the following symbols are deprecated:
- `URLScheme.facebookApp`
- `URLScheme.facebookShareExtension`
- `URLScheme.masqueradePlayer`

[Full Changelog](https://github.com/facebook/facebook-ios-sdk/compare/v12.2.0...HEAD)

## 12.2.0

### Fixed

- Fixed NSKeyedUnarchiver validateAllowedClass Warnings in Xcode Console. Fixes #1941 and #1930
- An implementation bug in `ApplicationDelegate` where added application observers were notified twice for `application:didFinishLaunchingWithOptions:`.
The return type of `ApplicationDelegate.application:didFinishLaunchingWithOptions:` was also incorrectly stated as, "YES if the url was intended for the Facebook SDK, NO if not". In actuality, the method returns whether there are any application observers that themselves return true from calling their implementation of `application:didFinishLaunchingWithOptions:`.
This fix means that application observers will now only be notified once per app launch, however, if `ApplicationDelegate.application:didFinishLaunchingWithOptions:` is called after calling `ApplicationDelegate.initializeSDK` then the return type will always be false regardless of any application observers.
- Using share dialogs via share sheet mode fails to show the dialog (Issue #1938)
- Fixed: aem_conversion_configs should contain an explicit "fields" parameter (Issue #1933)

### Deprecated
- The class-based interface of `AppEvents` has been deprecated. Please use the instance properties and methods on `AppEvents.shared` instead.

[Full Changelog](https://github.com/facebook/facebook-ios-sdk/compare/v12.1.0...HEAD)
[2021-12-01](https://github.com/facebook/facebook-ios-sdk/releases/tag/v12.2.0) |
[Full Changelog](https://github.com/facebook/facebook-ios-sdk/compare/v12.1.0...v12.2.0)

## 12.1.0

Expand Down
2 changes: 1 addition & 1 deletion Configurations/Version.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
// LICENSE file in the root directory of this source tree.

// The versions for FBSDK and Messenger SDK.
FBSDK_PROJECT_VERSION=12.1.0
FBSDK_PROJECT_VERSION=12.2.0
MNSDK_PROJECT_VERSION=TODO_SUPPORT_MNSDK

4 changes: 2 additions & 2 deletions FBAEMKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = 'FBAEMKit'
s.version = '12.1.0'
s.version = '12.2.0'
s.summary = 'The kernal module for Facebook AEM solution'

s.description = <<-DESC
Expand Down Expand Up @@ -47,7 +47,7 @@ Pod::Spec.new do |s|

s.source = {
http: "https://github.com/facebook/facebook-ios-sdk/releases/download/v#{s.version}/FacebookSDK_Dynamic.xcframework.zip",
sha1: '900beb35f7cbab2f2a83c1ac51fc2584182a99b9'
sha1: '0d224ddaaaf248a79f0a9d5abaf125ad6c29aa15'
}
s.vendored_frameworks = 'XCFrameworks/FBAEMKit.xcframework'
s.dependency 'FBSDKCoreKit_Basics', "#{s.version}"
Expand Down
23 changes: 23 additions & 0 deletions FBAEMKit/FBAEMKitTests/FBAEMInvocationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,27 @@ class FBAEMInvocationTests: XCTestCase { // swiftlint:disable:this type_body_len
)
}

func testProcessedParametersWithValidContentAndContentID() {
let invocation: AEMInvocation? = self.validInvocation
let content: [String: AnyHashable] = ["id": "123", "quantity": 5]
let contentIDs: [String] = ["id123", "id456"]

let parameters = invocation?.processedParameters([
Keys.content: "[{\"id\":\"123\",\"quantity\":5}]",
Keys.contentID: "[\"id123\", \"id456\"]",
Keys.contentType: "product"
]) as? [String: AnyHashable]
XCTAssertEqual(
parameters,
[
Keys.content: [content],
Keys.contentID: contentIDs,
Keys.contentType: "product"
],
"Processed parameters are not expected"
)
}

func testProcessedParametersWithValidContent() {
let invocation: AEMInvocation? = self.validInvocation
let content: [String: AnyHashable] = ["id": "123", "quantity": 5]
Expand Down Expand Up @@ -485,6 +506,8 @@ class FBAEMInvocationTests: XCTestCase { // swiftlint:disable:this type_body_len

configList = invocation._getConfigList(Values.brandMode, configs: configs)
XCTAssertEqual(configList.count, 2, "Should only find the brand or cpas config")
XCTAssertEqual(configList.first?.configMode, Values.cpasMode, "Should have the caps config first")
XCTAssertEqual(configList.last?.configMode, Values.brandMode, "Should have the brand config last")
}

func testAttributeEventWithValue() {
Expand Down
3 changes: 2 additions & 1 deletion FBAEMKit/FBAEMKitTests/FBAEMReporter+Testing.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ typedef void (^FBAEMReporterBlock)(NSError *_Nullable);
@property (class, nonatomic) NSMutableArray<FBAEMReporterBlock> *completionBlocks;
@property (class, nonatomic) NSString *reportFilePath;
@property (class, nullable, nonatomic) id<FBAEMNetworking> networker;
@property (class, nullable, nonatomic) id<FBAEMNetworking> catalogNetworker;
@property (class, nullable, nonatomic) id<FBSKAdNetworkReporting> reporter;

+ (void)enable;
Expand Down Expand Up @@ -79,6 +78,8 @@ typedef void (^FBAEMReporterBlock)(NSError *_Nullable);

+ (void)_clearCache;

+ (void)_clearConfigs;

+ (void)reset;

@end
Expand Down
40 changes: 31 additions & 9 deletions FBAEMKit/FBAEMKitTests/FBAEMReporterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FBAEMReporterTests: XCTestCase {
static let businessID = "advertiser_id"
static let campaignID = "campaign_id"
static let catalogID = "catalog_id"
static let contentID = "fb_content_id"
static let contentID = "fb_content_ids"
static let token = "token"
}

Expand All @@ -36,6 +36,7 @@ class FBAEMReporterTests: XCTestCase {
static let donate = "Donate"
static let defaultMode = "DEFAULT"
static let brandMode = "BRAND"
static let cpasMode = "CPAS"
static let USD = "USD"
}

Expand Down Expand Up @@ -86,7 +87,6 @@ class FBAEMReporterTests: XCTestCase {
AEMReporter.enable()

XCTAssertTrue(AEMReporter.isEnabled, "AEM Report should be enabled")
XCTAssertNotNil(AEMReporter.catalogNetworker, "AEM catalog networker should be created when AEM is enabled")
}

func testCatalogReportDefaultConfigure() {
Expand All @@ -101,10 +101,6 @@ class FBAEMReporterTests: XCTestCase {
}

func testConfigure() {
XCTAssertNil(
AEMReporter.catalogNetworker,
"Should not configure catalog networker before enable"
)
XCTAssertEqual(
networker,
AEMReporter.networker as? TestAEMNetworker,
Expand Down Expand Up @@ -243,6 +239,34 @@ class FBAEMReporterTests: XCTestCase {
XCTAssertEqual(configList?[1].validFrom, 20000, "Should keep the expected config")
}

func testClearConfigs() {
AEMReporter.configs = [
Values.defaultMode: NSMutableArray(array: [SampleAEMConfigurations.createConfigWithoutBusinessID()]),
Values.brandMode: NSMutableArray(array: [SampleAEMConfigurations.createConfigWithBusinessIDAndContentRule()]),
Values.cpasMode: NSMutableArray(array: [SampleAEMConfigurations.createCpasConfig()])
]

AEMReporter._clearConfigs()
let defaultConfigs = AEMReporter.configs[Values.defaultMode] as? [AEMConfiguration]
let brandConfigs = AEMReporter.configs[Values.brandMode] as? [AEMConfiguration]
let cpasConfigs = AEMReporter.configs[Values.cpasMode] as? [AEMConfiguration]
XCTAssertEqual(
defaultConfigs?.count,
1,
"Should have default mode config"
)
XCTAssertEqual(
brandConfigs?.count,
0,
"Should not have brand mode config"
)
XCTAssertEqual(
cpasConfigs?.count,
0,
"Should not have cpas mode config"
)
}

func testHandleURL() throws {
let url = try XCTUnwrap(
URL(string: "fb123://test.com?al_applink_data=%7B%22acs_token%22%3A+%22test_token_1234567%22%2C+%22campaign_ids%22%3A+%22test_campaign_1234%22%7D"),
Expand Down Expand Up @@ -853,14 +877,13 @@ class FBAEMReporterTests: XCTestCase {

func testLoadCatalogOptimizationWithOptimizedContent() {
let invocation = SampleAEMInvocations.createCatalogOptimizedInvocation()
AEMReporter.catalogNetworker = self.networker
var blockCall = 0

AEMReporter._loadCatalogOptimization(with: invocation, contentID: "test_content_id") {
blockCall += 1
}
XCTAssertTrue(
(self.networker.capturedGraphPath?.contains("da_content_id_belongs_to_catalog_id")) == true,
(self.networker.capturedGraphPath?.contains("aem_conversion_filter")) == true,
"Should start the catalog request"
)
self.networker.capturedCompletionHandler?(nil, SampleAEMError())
Expand All @@ -873,7 +896,6 @@ class FBAEMReporterTests: XCTestCase {

func testLoadCatalogOptimizationWithFuzzyInput() {
let invocation = SampleAEMInvocations.createCatalogOptimizedInvocation()
AEMReporter.catalogNetworker = self.networker

AEMReporter._loadCatalogOptimization(with: invocation, contentID: "test_content_id") {}
for _ in 0..<100 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ enum SampleAEMConfigurations {
static let addToCart = "fb_mobile_add_to_cart"
static let donate = "Donate"
static let defaultMode = "DEFAULT"
static let brandMode = "BRAND"
static let cpasMode = "CPAS"
static let USD = "USD"
}
Expand Down Expand Up @@ -139,7 +140,7 @@ enum SampleAEMConfigurations {
Keys.defaultCurrency: Values.USD,
Keys.cutoffTime: 1,
Keys.validFrom: 10000,
Keys.configMode: Values.defaultMode,
Keys.configMode: Values.brandMode,
Keys.businessID: "test_advertiserid_content_test",
Keys.paramRule: "{\"or\":[{\"fb_content[*].id\":{\"eq\":\"abc\"}}]}",
Keys.conversionValueRules: [
Expand Down
4 changes: 2 additions & 2 deletions FBSDKCoreKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Pod::Spec.new do |s|

s.name = 'FBSDKCoreKit'
s.version = '12.1.0'
s.version = '12.2.0'
s.summary = 'Official Facebook SDK for iOS to access Facebook Platform core features'

s.description = <<-DESC
Expand Down Expand Up @@ -50,7 +50,7 @@ Pod::Spec.new do |s|

s.source = {
http: "https://github.com/facebook/facebook-ios-sdk/releases/download/v#{s.version}/FacebookSDK_Dynamic.xcframework.zip",
sha1: '900beb35f7cbab2f2a83c1ac51fc2584182a99b9'
sha1: '0d224ddaaaf248a79f0a9d5abaf125ad6c29aa15'
}
s.vendored_frameworks = 'XCFrameworks/FBSDKCoreKit.xcframework'
s.dependency 'FBSDKCoreKit_Basics', "#{s.version}"
Expand Down
5 changes: 2 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKBridgeAPIRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ + (FBSDKBridgeAPIProtocolMap)protocolMap
if (!map) {
map = @{
@(FBSDKBridgeAPIProtocolTypeNative) : @{
FBSDKURLSchemeFacebookApp : [[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fbapi"],
FBSDKURLSchemeMessengerApp : [[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-share-api"],
FBSDKURLSchemeMasqueradePlayer : [[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"msqrdplayer-api20170208"]
FBSDKURLSchemeFacebookAPI : [[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fbapi"],
FBSDKURLSchemeMessengerApp : [[FBSDKBridgeAPIProtocolNativeV1 alloc] initWithAppScheme:@"fb-messenger-share-api"]
},
@(FBSDKBridgeAPIProtocolTypeWeb) : @{
FBSDKURLSchemeHTTPS : [FBSDKBridgeAPIProtocolWebV1 new],
Expand Down
20 changes: 3 additions & 17 deletions FBSDKCoreKit/FBSDKCoreKit/FBSDKInternalUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ @implementation FBSDKInternalUtility
static dispatch_once_t fetchApplicationQuerySchemesToken;
static dispatch_once_t checkIfFacebookAppInstalledToken;
static dispatch_once_t checkIfMessengerAppInstalledToken;
static dispatch_once_t checkIfMSQRDPlayerAppInstalledToken;
static dispatch_once_t checkRegisteredCanOpenUrlSchemesToken;
static dispatch_once_t checkOperatingSystemVersionToken;
static dispatch_once_t fetchUrlSchemesToken;
Expand Down Expand Up @@ -393,9 +392,9 @@ - (nullable UIViewController *)viewControllerForView:(UIView *)view
- (BOOL)isFacebookAppInstalled
{
dispatch_once(&checkIfFacebookAppInstalledToken, ^{
[FBSDKInternalUtility.sharedUtility checkRegisteredCanOpenURLScheme:FBSDKURLSchemeFacebookApp];
[FBSDKInternalUtility.sharedUtility checkRegisteredCanOpenURLScheme:FBSDKURLSchemeFacebookAPI];
});
return [self _canOpenURLScheme:FBSDKURLSchemeFacebookApp];
return [self _canOpenURLScheme:FBSDKURLSchemeFacebookAPI];
}

- (BOOL)isMessengerAppInstalled
Expand All @@ -406,14 +405,6 @@ - (BOOL)isMessengerAppInstalled
return [self _canOpenURLScheme:FBSDKURLSchemeMessengerApp];
}

- (BOOL)isMSQRDPlayerAppInstalled
{
dispatch_once(&checkIfMSQRDPlayerAppInstalledToken, ^{
[FBSDKInternalUtility.sharedUtility checkRegisteredCanOpenURLScheme:FBSDKURLSchemeMasqueradePlayer];
});
return [self _canOpenURLScheme:FBSDKURLSchemeMasqueradePlayer];
}

- (BOOL)_canOpenURLScheme:(NSString *)scheme
{
scheme = [FBSDKTypeUtility coercedToStringValue:scheme];
Expand Down Expand Up @@ -470,10 +461,8 @@ - (void)validateURLSchemes
- (void)validateFacebookReservedURLSchemes
{
NSArray<FBSDKURLScheme> *schemes = @[
FBSDKURLSchemeFacebookApp,
FBSDKURLSchemeMessengerApp,
FBSDKURLSchemeFacebookAPI,
FBSDKURLSchemeFacebookShareExtension
FBSDKURLSchemeFacebookAPI
];

for (FBSDKURLScheme scheme in schemes) {
Expand Down Expand Up @@ -694,9 +683,6 @@ + (void)reset
if (checkIfMessengerAppInstalledToken) {
checkIfMessengerAppInstalledToken = 0;
}
if (checkIfMSQRDPlayerAppInstalledToken) {
checkIfMSQRDPlayerAppInstalledToken = 0;
}
if (checkOperatingSystemVersionToken) {
checkOperatingSystemVersionToken = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion FBSDKCoreKit/FBSDKCoreKit/include/FBSDKCoreKitVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
* LICENSE file in the root directory of this source tree.
*/

#define FBSDK_VERSION_STRING @"12.1.0"
#define FBSDK_VERSION_STRING @"12.2.0"
#define FBSDK_DEFAULT_GRAPH_API_VERSION @"v12.0"
6 changes: 3 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/include/FBSDKInternalUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
NS_ASSUME_NONNULL_BEGIN

FOUNDATION_EXPORT NSString *const FBSDK_CANOPENURL_FACEBOOK
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_FACEBOOK` is deprecated and will be removed in the next major release; please use `URLScheme.facebookApp` instead");
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_FACEBOOK` is deprecated and will be removed in the next major release; please use `URLScheme.facebookAPI` instead");
FOUNDATION_EXPORT NSString *const FBSDK_CANOPENURL_FBAPI
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_FBAPI` is deprecated and will be removed in the next major release; please use `URLScheme.facebookAPI` instead");
FOUNDATION_EXPORT NSString *const FBSDK_CANOPENURL_MESSENGER
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_MESSENGER` is deprecated and will be removed in the next major release; please use `URLScheme.messengerApp` instead");
FOUNDATION_EXPORT NSString *const FBSDK_CANOPENURL_MSQRD_PLAYER
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_MSQRD_PLAYER` is deprecated and will be removed in the next major release; please use `URLScheme.masqueradePlayer` instead");
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_MSQRD_PLAYER` is deprecated and will be removed in the next major release");
FOUNDATION_EXPORT NSString *const FBSDK_CANOPENURL_SHARE_EXTENSION
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_SHARE_EXTENSION` is deprecated and will be removed in the next major release; please use `URLScheme.facebookShareExtension` instead");
DEPRECATED_MSG_ATTRIBUTE("`FBSDK_CANOPENURL_SHARE_EXTENSION` is deprecated and will be removed in the next major release; please use `URLScheme.facebookAPI`");

NS_SWIFT_NAME(InternalUtility)
@interface FBSDKInternalUtility : NSObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,18 @@

NS_ASSUME_NONNULL_BEGIN

/**
Internal type exposed to facilitate transition to Swift.
API Subject to change or removal without warning. Do not use.

@warning INTERNAL - DO NOT USE
*/
NS_SWIFT_NAME(InternalUtilityProtocol)
@protocol FBSDKInternalUtility

#pragma mark - FB Apps Installed

@property (nonatomic, readonly) BOOL isFacebookAppInstalled;
@property (nonatomic, readonly) BOOL isMSQRDPlayerAppInstalled;

/**
Constructs an NSURL.
Expand Down
16 changes: 13 additions & 3 deletions FBSDKCoreKit/FBSDKCoreKit/include/FBSDKURLScheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@

typedef NSString *FBSDKURLScheme NS_TYPED_EXTENSIBLE_ENUM NS_SWIFT_NAME(URLScheme);

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeFacebookApp;
FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeFacebookApp
DEPRECATED_MSG_ATTRIBUTE("`URLScheme.facebookApp` is deprecated and will be removed in the next major release; please use `URLScheme.facebookAPI` instead");

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeFacebookAPI;
FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeFacebookShareExtension;

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeFacebookShareExtension
DEPRECATED_MSG_ATTRIBUTE("`URLScheme.facebookShareExtension` is deprecated and will be removed in the next major release; please use `URLScheme.facebookAPI` instead");

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeMessengerApp;
FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeMasqueradePlayer;

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeMasqueradePlayer
DEPRECATED_MSG_ATTRIBUTE("`URLScheme.masqueradePlayer` is deprecated and will be removed in the next major release");

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeHTTPS NS_SWIFT_NAME(https);

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeHTTP NS_SWIFT_NAME(http);

FOUNDATION_EXPORT FBSDKURLScheme const FBSDKURLSchemeWeb;
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class BridgeAPIRequestTests: XCTestCase {

func testOpenableURL() {
XCTAssertNotNil(
makeRequest(protocolType: .native, scheme: .facebookApp),
makeRequest(protocolType: .native, scheme: .facebookAPI),
"BridgeAPIRequests should only be created for openable URLs"
)
}
Expand Down
Loading