From 180a2dd09a90916cf8e70fd84276267b91480154 Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Tue, 20 Jul 2021 10:02:17 -0500 Subject: [PATCH 1/8] Specify master branch of braintree_ios --- Package.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 33b11c01..678cbb90 100644 --- a/Package.swift +++ b/Package.swift @@ -14,7 +14,9 @@ let package = Package( ) ], dependencies: [ - .package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", from: "5.4.2") + //.package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", from: "5.4.2") + .package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", .branch("master") +) ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. From fd20b9486c2a6a03d319fb2670f40cc67c18a6c1 Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Tue, 20 Jul 2021 10:08:52 -0500 Subject: [PATCH 2/8] Add NS_EXTENSION_UNAVAILABLE annotation to methods using UIApplication.sharedApplication --- .../BraintreeDropIn/BTPaymentSelectionViewController.m | 2 +- Sources/BraintreeDropIn/BTVaultManagementViewController.m | 2 +- Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m b/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m index ec931a30..bc1e7652 100644 --- a/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m +++ b/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m @@ -160,7 +160,7 @@ - (void)configurationLoaded:(__unused BTConfiguration *)configuration error:(NSE #pragma mark - Accessors -- (id)application { +- (id)application NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { if (!_application) { _application = [UIApplication sharedApplication]; } diff --git a/Sources/BraintreeDropIn/BTVaultManagementViewController.m b/Sources/BraintreeDropIn/BTVaultManagementViewController.m index b80af922..95d02224 100644 --- a/Sources/BraintreeDropIn/BTVaultManagementViewController.m +++ b/Sources/BraintreeDropIn/BTVaultManagementViewController.m @@ -84,7 +84,7 @@ - (void)configurationLoaded:(__unused BTConfiguration *)configuration error:(NSE } } -- (void)fetchPaymentMethodsOnCompletion:(void(^)(void))completionBlock { +- (void)fetchPaymentMethodsOnCompletion:(void(^)(void))completionBlock NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { if (!self.apiClient.clientToken) { self.paymentMethodNonces = @[]; if (completionBlock) { diff --git a/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m b/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m index ff14afb9..02a8a97b 100644 --- a/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m +++ b/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m @@ -234,7 +234,7 @@ + (BTUIKVectorArtView *)vectorArtViewForVisualAssetType:(BTUIKVisualAssetType)ty } } -+ (BOOL)isLanguageLayoutDirectionRightToLeft { ++ (BOOL)isLanguageLayoutDirectionRightToLeft NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { return [UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; } @@ -246,7 +246,7 @@ + (NSTextAlignment)naturalTextAlignmentInverse { return [self isLanguageLayoutDirectionRightToLeft] ? NSTextAlignmentLeft : NSTextAlignmentRight; } -+ (UIWindowScene *)activeWindowScene API_AVAILABLE(ios(13.0)) { ++ (UIWindowScene *)activeWindowScene API_AVAILABLE(ios(13.0)) NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) { if (scene.activationState == UISceneActivationStateForegroundActive) { return (UIWindowScene *)scene; @@ -256,7 +256,7 @@ + (UIWindowScene *)activeWindowScene API_AVAILABLE(ios(13.0)) { return nil; } -+ (BOOL)isOrientationLandscape { ++ (BOOL)isOrientationLandscape NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { if (@available(iOS 13, *)) { return UIInterfaceOrientationIsLandscape([self activeWindowScene].interfaceOrientation); } else { @@ -264,7 +264,7 @@ + (BOOL)isOrientationLandscape { } } -+ (CGFloat)statusBarHeight { ++ (CGFloat)statusBarHeight NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { if (@available(iOS 13, *)) { return CGRectGetHeight([self activeWindowScene].statusBarManager.statusBarFrame); } else { From 2425f34ce5966b2a3b1dbe1a4b2ca45223a28def Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Tue, 20 Jul 2021 14:46:23 -0500 Subject: [PATCH 3/8] Use dot syntax --- Sources/BraintreeDropIn/BTPaymentSelectionViewController.m | 2 +- Sources/BraintreeDropIn/BTVaultManagementViewController.m | 4 ++-- Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m b/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m index bc1e7652..5968de27 100644 --- a/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m +++ b/Sources/BraintreeDropIn/BTPaymentSelectionViewController.m @@ -162,7 +162,7 @@ - (void)configurationLoaded:(__unused BTConfiguration *)configuration error:(NSE - (id)application NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { if (!_application) { - _application = [UIApplication sharedApplication]; + _application = UIApplication.sharedApplication; } return _application; } diff --git a/Sources/BraintreeDropIn/BTVaultManagementViewController.m b/Sources/BraintreeDropIn/BTVaultManagementViewController.m index 95d02224..cf22317b 100644 --- a/Sources/BraintreeDropIn/BTVaultManagementViewController.m +++ b/Sources/BraintreeDropIn/BTVaultManagementViewController.m @@ -93,10 +93,10 @@ - (void)fetchPaymentMethodsOnCompletion:(void(^)(void))completionBlock NS_EXTENS return; } - [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; + [UIApplication.sharedApplication setNetworkActivityIndicatorVisible:YES]; [self.apiClient fetchPaymentMethodNonces:YES completion:^(NSArray *paymentMethodNonces, NSError *error) { - [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; + [UIApplication.sharedApplication setNetworkActivityIndicatorVisible:NO]; if (error) { // no action diff --git a/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m b/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m index 02a8a97b..5e60b699 100644 --- a/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m +++ b/Sources/BraintreeDropIn/Helpers/BTUIKViewUtil.m @@ -235,7 +235,7 @@ + (BTUIKVectorArtView *)vectorArtViewForVisualAssetType:(BTUIKVisualAssetType)ty } + (BOOL)isLanguageLayoutDirectionRightToLeft NS_EXTENSION_UNAVAILABLE("Uses APIs (i.e UIApplication.sharedApplication) not available for use in App Extensions.") { - return [UIApplication sharedApplication].userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; + return UIApplication.sharedApplication.userInterfaceLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; } + (NSTextAlignment)naturalTextAlignment { From 72b68e0ad2b4129a0d278af42ec423fd15975de3 Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Tue, 20 Jul 2021 14:47:15 -0500 Subject: [PATCH 4/8] Add TODO for updating Package.swift back to Braintree GH URL once new version released --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 678cbb90..ed1f327b 100644 --- a/Package.swift +++ b/Package.swift @@ -14,6 +14,7 @@ let package = Package( ) ], dependencies: [ + // TODO: Update to use latest release of braintree_ios //.package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", from: "5.4.2") .package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", .branch("master") ) From afb95a68dad0d4b7c39bcf17c071fbf7404f40dc Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Tue, 20 Jul 2021 14:50:18 -0500 Subject: [PATCH 5/8] Add CHANGELOG entry --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f132147..a422224e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## unreleased * Add `deviceData` to `BTDropInResult` +* Swift Package Manager + * Adds `NS_EXTENSION_UNAVAILABLE` annotations to methods unavailable for use in app extensions (fixes #343 for Xcode 13-beta3) ## 9.1.0 (2021-07-01) * Increase valid Discover card length to 19 digits From 0ba322ba7d9e021eb4a406aa19fe704effd0aff6 Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Thu, 22 Jul 2021 11:46:13 -0500 Subject: [PATCH 6/8] Update InAppSettingsKit to v3.3.2 with XCode13-beta3 fixes --- .../xcshareddata/swiftpm/Package.resolved | 10 +++++----- Demo.xcodeproj/project.pbxproj | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BraintreeDropIn.xcworkspace/xcshareddata/swiftpm/Package.resolved b/BraintreeDropIn.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6d204f84..03a4e863 100644 --- a/BraintreeDropIn.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/BraintreeDropIn.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,9 +5,9 @@ "package": "braintree_ios", "repositoryURL": "https://github.com/braintree/braintree_ios", "state": { - "branch": null, - "revision": "6be5b6ceabe6acf3353a986da272bc604c8cd010", - "version": "5.4.2" + "branch": "master", + "revision": "ca0cbc19dc767ae5f1c757101437cd7c1e482976", + "version": null } }, { @@ -15,8 +15,8 @@ "repositoryURL": "https://github.com/futuretap/InAppSettingsKit.git", "state": { "branch": null, - "revision": "e4985e0dc0de36f12801f67cc984b3d1cb7f3d52", - "version": "3.3.1" + "revision": "71e03ebad8462618f96c575c86d2e9220f880676", + "version": "3.3.2" } } ] diff --git a/Demo.xcodeproj/project.pbxproj b/Demo.xcodeproj/project.pbxproj index a87a496d..c60fb512 100644 --- a/Demo.xcodeproj/project.pbxproj +++ b/Demo.xcodeproj/project.pbxproj @@ -907,7 +907,7 @@ repositoryURL = "https://github.com/futuretap/InAppSettingsKit.git"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 3.1.8; + minimumVersion = 3.0.0; }; }; 8021E365268A1CB4003BBA53 /* XCRemoteSwiftPackageReference "braintree-ios-drop-in" */ = { From fcae56d2802cadbc9b7b0af225f3a304c24ac870 Mon Sep 17 00:00:00 2001 From: Samantha Cannillo Date: Thu, 22 Jul 2021 11:47:01 -0500 Subject: [PATCH 7/8] Update Package.swift to require Braintree v5.4.3+ --- Package.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index ed1f327b..0d08bf39 100644 --- a/Package.swift +++ b/Package.swift @@ -14,10 +14,7 @@ let package = Package( ) ], dependencies: [ - // TODO: Update to use latest release of braintree_ios - //.package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", from: "5.4.2") - .package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", .branch("master") -) + .package(name: "Braintree", url: "https://github.com/braintree/braintree_ios", from: "5.4.3") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. From cebb5b61368d668e6c6bd70eba3f96614a34b37f Mon Sep 17 00:00:00 2001 From: scannillo <35243507+scannillo@users.noreply.github.com> Date: Mon, 26 Jul 2021 15:37:09 -0500 Subject: [PATCH 8/8] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a422224e..31eef6ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## unreleased * Add `deviceData` to `BTDropInResult` +* Require `braintree_ios` 5.4.3 or higher (includes Xcode 13-beta3 fixes) * Swift Package Manager * Adds `NS_EXTENSION_UNAVAILABLE` annotations to methods unavailable for use in app extensions (fixes #343 for Xcode 13-beta3)