diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e634ae5d..effab375f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -72,9 +72,7 @@ workflows: jobs: - ios - macos - - carthage: - requires: - - ios + - carthage nightly: jobs: - carthage diff --git a/.travis.yml b/.travis.yml index 453b75758..8b7879a91 100644 --- a/.travis.yml +++ b/.travis.yml @@ -85,4 +85,3 @@ jobs: on: all_branches: true tags: true - diff --git a/CHANGELOG.md b/CHANGELOG.md index 091155905..f1d310a90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,21 +1,33 @@ # Parse-SDK-iOS-OSX Changelog ### master -[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.19.0...master) +[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.19.1...master) * _Contributing to this repo? Add info about your change here to be included in next release_ +### 1.19.1 +[Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.19.0...1.19.1) + +__Improvements__ +- Allow SDK to build for Mac Catalyst ([#1543](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1543)), thanks to [Martin Mann](https://github.com/mman). + +__Fixes__ +- Pass user details from Sign In With Apple to user ([#1551](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1551)), thanks to [Darren Black](https://github.com/drdaz). +- Bolts compilation error in Xcode 12 ([#1548](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1548)), thanks to [Derek Lee](https://github.com/derekleerock). +- App Store submission failed for MinimumOSVersion ([#1515](https://github.com/parse-community/Parse-SDK-iOS-OSX/issues/1515)), thanks to [Manuel Trezza](https://github.com/mtrezza). + ### 1.19.0 [Full Changelog](https://github.com/parse-community/Parse-SDK-iOS-OSX/compare/1.18.0...1.19.0) __New features__ -- Added Sign In With Apple support to ParseUI [#1475](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1475), thanks to [Darren Black](https://github.com/drdaz). Transparent icons thanks to [Donald Ness](https://github.com/programmarchy) +- Added Sign In With Apple support to ParseUI ([#1475](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1475)), thanks to [Darren Black](https://github.com/drdaz). +- Transparent icons ([#1530](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1530)), thanks to [Donald Ness](https://github.com/programmarchy). __Improvements__ -- Updated Facebook SDK to 6.x [#1504](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1504), thanks to [Markus Winkler](https://github.com/markuswinkler) +- Updated Facebook SDK to 6.x ([#1504](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1504)), thanks to [Markus Winkler](https://github.com/markuswinkler). __Fixes__ -- Removes deprecated UIWebView usage [#1511](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1511), thanks to [Nathan Kellert](https://github.com/parse-community/Parse-SDK-iOS-OSX/commits?author=noobs2ninjas) -- Fixes building with Xcode 12 [#1527](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1527), thanks to [Steffen Matthischke](https://github.com/HeEAaD) +- Removes deprecated UIWebView usage ([#1511](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1511)), thanks to [Nathan Kellert](https://github.com/parse-community/Parse-SDK-iOS-OSX/commits?author=noobs2ninjas). +- Fixes building with Xcode 12 ([#1527](https://github.com/parse-community/Parse-SDK-iOS-OSX/pull/1527)), thanks to [Steffen Matthischke](https://github.com/HeEAaD). ### 1.18.0 diff --git a/Parse.podspec b/Parse.podspec index 325a5e02c..b3fc56bc2 100644 --- a/Parse.podspec +++ b/Parse.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Parse' - s.version = '1.19.0' + s.version = '1.19.1' s.license = { :type => 'BSD', :file => 'LICENSE' } s.homepage = 'http://parseplatform.org/' s.summary = 'A library that gives you access to the powerful Parse cloud platform from your iOS/OS X/watchOS/tvOS app.' diff --git a/Parse/Parse.xcodeproj/project.pbxproj b/Parse/Parse.xcodeproj/project.pbxproj index cead8e74a..62bbf479b 100644 --- a/Parse/Parse.xcodeproj/project.pbxproj +++ b/Parse/Parse.xcodeproj/project.pbxproj @@ -9046,7 +9046,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -9065,7 +9065,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/Parse/Parse/PFConstants.h b/Parse/Parse/PFConstants.h index 67d328365..0beef720d 100644 --- a/Parse/Parse/PFConstants.h +++ b/Parse/Parse/PFConstants.h @@ -13,7 +13,7 @@ #pragma mark - SDK Version ///-------------------------------------- -#define PARSE_VERSION @"1.19.0" +#define PARSE_VERSION @"1.19.1" ///-------------------------------------- #pragma mark - Platform diff --git a/Parse/Parse/Resources/Parse-OSX.Info.plist b/Parse/Parse/Resources/Parse-OSX.Info.plist index bf500a111..19bfb4758 100644 --- a/Parse/Parse/Resources/Parse-OSX.Info.plist +++ b/Parse/Parse/Resources/Parse-OSX.Info.plist @@ -13,10 +13,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 diff --git a/Parse/Parse/Resources/Parse-iOS.Info.plist b/Parse/Parse/Resources/Parse-iOS.Info.plist index f4f37d9fb..d36e4b6fa 100644 --- a/Parse/Parse/Resources/Parse-iOS.Info.plist +++ b/Parse/Parse/Resources/Parse-iOS.Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -21,7 +21,7 @@ iPhoneOS CFBundleVersion - 1.19.0 + 1.19.1 MinimumOSVersion 8.0 diff --git a/Parse/Parse/Resources/Parse-tvOS.Info.plist b/Parse/Parse/Resources/Parse-tvOS.Info.plist index 6e6fb8c6b..7b7979128 100644 --- a/Parse/Parse/Resources/Parse-tvOS.Info.plist +++ b/Parse/Parse/Resources/Parse-tvOS.Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 NSPrincipalClass diff --git a/Parse/Parse/Resources/Parse-watchOS.Info.plist b/Parse/Parse/Resources/Parse-watchOS.Info.plist index 6e6fb8c6b..7b7979128 100644 --- a/Parse/Parse/Resources/Parse-watchOS.Info.plist +++ b/Parse/Parse/Resources/Parse-watchOS.Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 NSPrincipalClass diff --git a/ParseFacebookUtils/Resources/Info-iOS.plist b/ParseFacebookUtils/Resources/Info-iOS.plist index 4fd7fc513..a913d7b51 100644 --- a/ParseFacebookUtils/Resources/Info-iOS.plist +++ b/ParseFacebookUtils/Resources/Info-iOS.plist @@ -13,7 +13,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -21,8 +21,8 @@ iPhoneOS CFBundleVersion - 1.19.0 + 1.19.1 MinimumOSVersion - 6.0 + 8.0 - + \ No newline at end of file diff --git a/ParseFacebookUtils/Resources/Info-tvOS.plist b/ParseFacebookUtils/Resources/Info-tvOS.plist index d5008ffac..7394fe16d 100644 --- a/ParseFacebookUtils/Resources/Info-tvOS.plist +++ b/ParseFacebookUtils/Resources/Info-tvOS.plist @@ -13,10 +13,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 diff --git a/ParseStarterProject/OSX/ParseOSXStarterProject-Swift/Resources/Info.plist b/ParseStarterProject/OSX/ParseOSXStarterProject-Swift/Resources/Info.plist index 1cd8efe1c..4afa8b443 100644 --- a/ParseStarterProject/OSX/ParseOSXStarterProject-Swift/Resources/Info.plist +++ b/ParseStarterProject/OSX/ParseOSXStarterProject-Swift/Resources/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSMainNibFile diff --git a/ParseStarterProject/OSX/ParseOSXStarterProject/Resources/Info.plist b/ParseStarterProject/OSX/ParseOSXStarterProject/Resources/Info.plist index d466014a5..bbd250bbb 100644 --- a/ParseStarterProject/OSX/ParseOSXStarterProject/Resources/Info.plist +++ b/ParseStarterProject/OSX/ParseOSXStarterProject/Resources/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSMainNibFile diff --git a/ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Info.plist b/ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Info.plist index 5ade1365e..6bd11cb36 100644 --- a/ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Info.plist +++ b/ParseStarterProject/iOS/ParseStarterProject-Swift/Resources/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/ParseStarterProject/iOS/ParseStarterProject/Resources/Info.plist b/ParseStarterProject/iOS/ParseStarterProject/Resources/Info.plist index 631056140..0f3c3ac6a 100644 --- a/ParseStarterProject/iOS/ParseStarterProject/Resources/Info.plist +++ b/ParseStarterProject/iOS/ParseStarterProject/Resources/Info.plist @@ -19,11 +19,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 LSRequiresIPhoneOS NSMainNibFile diff --git a/ParseStarterProject/tvOS/ParseStarterProject-Swift/ParseStarter/Info.plist b/ParseStarterProject/tvOS/ParseStarterProject-Swift/ParseStarter/Info.plist index 9fafd39f6..c7e0260e8 100644 --- a/ParseStarterProject/tvOS/ParseStarterProject-Swift/ParseStarter/Info.plist +++ b/ParseStarterProject/tvOS/ParseStarterProject-Swift/ParseStarter/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 LSRequiresIPhoneOS UIMainStoryboardFile diff --git a/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter Extension/Info.plist b/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter Extension/Info.plist index 808d0557c..e033b6eaf 100644 --- a/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter Extension/Info.plist +++ b/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter Extension/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 NSExtension NSExtensionAttributes diff --git a/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter/Info.plist b/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter/Info.plist index 02e88d32e..f51e026d3 100644 --- a/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter/Info.plist +++ b/ParseStarterProject/watchOS/ParseStarterProject-Swift/ParseStarter/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/ParseStarterProject/watchOS/ParseStarterProject-Swift/Resources/Info.plist b/ParseStarterProject/watchOS/ParseStarterProject-Swift/Resources/Info.plist index cc4f34791..b0764258a 100644 --- a/ParseStarterProject/watchOS/ParseStarterProject-Swift/Resources/Info.plist +++ b/ParseStarterProject/watchOS/ParseStarterProject-Swift/Resources/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleVersion - 1.19.0 + 1.19.1 LSRequiresIPhoneOS UIMainStoryboardFile diff --git a/ParseTwitterUtils/Resources/Info.plist b/ParseTwitterUtils/Resources/Info.plist index ef64647bf..64358a89a 100644 --- a/ParseTwitterUtils/Resources/Info.plist +++ b/ParseTwitterUtils/Resources/Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -21,8 +21,8 @@ iPhoneOS CFBundleVersion - 1.19.0 + 1.19.1 MinimumOSVersion - 6.0 + 8.0 diff --git a/ParseUI/Classes/LogInViewController/PFLogInViewController.h b/ParseUI/Classes/LogInViewController/PFLogInViewController.h index f88cfed8d..be6cfe126 100644 --- a/ParseUI/Classes/LogInViewController/PFLogInViewController.h +++ b/ParseUI/Classes/LogInViewController/PFLogInViewController.h @@ -179,6 +179,15 @@ shouldBeginLogInWithUsername:(NSString *)username */ - (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController; +/** + Sent to the delegate when user data is received following successful login using Sign In With Apple. + + @param logInController The login view controller that received the credentials + @param credential The ASAuthorizationAppleIDCredential object received + */ + +-(void)logInViewController:(PFLogInViewController *)logInController didReceiveAppleCredential:(ASAuthorizationAppleIDCredential *)credential forUser:(PFUser *)user API_AVAILABLE(ios(13.0)); + @end NS_ASSUME_NONNULL_END diff --git a/ParseUI/Classes/LogInViewController/PFLogInViewController.m b/ParseUI/Classes/LogInViewController/PFLogInViewController.m index ccd126537..da388b9b3 100644 --- a/ParseUI/Classes/LogInViewController/PFLogInViewController.m +++ b/ParseUI/Classes/LogInViewController/PFLogInViewController.m @@ -30,6 +30,7 @@ #import "PFSignUpViewController.h" #import "PFTextField.h" #import "PFLogInView_Private.h" +#import "PFAppleUtils.h" NSString *const PFLogInSuccessNotification = @"com.parse.ui.login.success"; NSString *const PFLogInFailureNotification = @"com.parse.ui.login.failure"; @@ -332,7 +333,7 @@ - (void)_requestPasswordResetWithEmail:(NSString *)email { #pragma mark Sign in with Apple -(void)_loginWithApple API_AVAILABLE(ios(13.0)){ - + if (self.loading) { return; } @@ -344,28 +345,26 @@ -(void)_loginWithApple API_AVAILABLE(ios(13.0)){ __weak typeof(self) wself = self; - Class appleUtils = NSClassFromString(@"PFAppleUtils"); - SEL selector = NSSelectorFromString(@"logInInBackground"); - if ([appleUtils respondsToSelector:selector]) { - [[appleUtils logInInBackground] continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { - __strong typeof(wself) sself = wself; - dispatch_async(dispatch_get_main_queue(), ^{ - sself.loading = NO; - if ([sself.logInView.appleButton isKindOfClass:[PFActionButton class]]) { - [(PFActionButton *)sself.logInView.appleButton setLoading:NO]; - } - if (t.error) { - [sself _loginDidFailWithError:t.error]; - } - else - { - PFUser *user = t.result[@"user"]; - [sself _loginDidSucceedWithUser:user]; - } - }); - return nil; - }]; - } + [[PFAppleUtils logInInBackground] continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { + __strong typeof(wself) sself = wself; + dispatch_async(dispatch_get_main_queue(), ^{ + sself.loading = NO; + if ([sself.logInView.appleButton isKindOfClass:[PFActionButton class]]) { + [(PFActionButton *)sself.logInView.appleButton setLoading:NO]; + } + if (t.error) { + [sself _loginDidFailWithError:t.error]; + } + else + { + PFUser *user = t.result[PFAppleAuthUserKey]; + ASAuthorizationAppleIDCredential *cred = t.result[PFAppleAuthCredentialKey]; + [sself _loginDidSucceedWithUser:user]; + [sself.delegate logInViewController:sself didReceiveAppleCredential:cred forUser:user]; + } + }); + return nil; + }]; } #pragma mark Log In With Facebook diff --git a/ParseUI/ParseUI.xcodeproj/project.pbxproj b/ParseUI/ParseUI.xcodeproj/project.pbxproj index 8fdc75630..d14d34fde 100644 --- a/ParseUI/ParseUI.xcodeproj/project.pbxproj +++ b/ParseUI/ParseUI.xcodeproj/project.pbxproj @@ -184,14 +184,20 @@ B9DDA283243C322D0003061D /* ParseTwitterUtils.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A51E4272027CC2D0066DE1A /* ParseTwitterUtils.framework */; }; B9DDA284243C32E50003061D /* ParseFacebookUtilsV4.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A51E4362027CC330066DE1A /* ParseFacebookUtilsV4.framework */; }; BC0632E023ABCC8F0089096D /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC0632DC23ABCB1D0089096D /* AuthenticationServices.framework */; }; - BC0632E423AD005E0089096D /* PFAppleUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0632E323AD005E0089096D /* PFAppleUtils.m */; }; - BC0632E823AD03B30089096D /* PFAppleAuthenticationProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0632E723AD03B30089096D /* PFAppleAuthenticationProvider.m */; }; BC0632EA23AD3F050089096D /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A13523820282059000F5FD5 /* Bolts.framework */; }; BC488EA0246B196800947E3C /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC488E9F246B196800947E3C /* ParseUI.framework */; }; BC488EA1246B196800947E3C /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC488E9F246B196800947E3C /* ParseUI.framework */; }; BC488EA2246B196800947E3C /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC488E9F246B196800947E3C /* ParseUI.framework */; }; BC8C2923246B1873000AEE3F /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A9A9497200D0329005D8F4B /* ParseUI.framework */; }; BCA5CC8523BFCFB8003BC0A0 /* SignInWithAppleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BCCBE8CB23BFB89D0044A79C /* SignInWithAppleTests.m */; }; + BCB2A82E251D337E0030D987 /* PFAppleUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0632E223AD005E0089096D /* PFAppleUtils.h */; }; + BCB2A82F251D337E0030D987 /* PFAppleUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0632E323AD005E0089096D /* PFAppleUtils.m */; }; + BCB2A830251D337E0030D987 /* PFAppleAuthenticationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0632E623AD03B20089096D /* PFAppleAuthenticationProvider.h */; }; + BCB2A831251D337E0030D987 /* PFAppleAuthenticationProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0632E723AD03B30089096D /* PFAppleAuthenticationProvider.m */; }; + BCB2A840251D337F0030D987 /* PFAppleUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0632E223AD005E0089096D /* PFAppleUtils.h */; }; + BCB2A841251D337F0030D987 /* PFAppleUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0632E323AD005E0089096D /* PFAppleUtils.m */; }; + BCB2A842251D337F0030D987 /* PFAppleAuthenticationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = BC0632E623AD03B20089096D /* PFAppleAuthenticationProvider.h */; }; + BCB2A843251D337F0030D987 /* PFAppleAuthenticationProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = BC0632E723AD03B30089096D /* PFAppleAuthenticationProvider.m */; }; BCCBE8CE23BFB89D0044A79C /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A9A9497200D0329005D8F4B /* ParseUI.framework */; }; BCCBE8E023BFC8BF0044A79C /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCCBE8DF23BFC8BF0044A79C /* OCMock.framework */; }; F57F3D231B0C03D40087F60B /* DeletionCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F57F3D201B0C03C90087F60B /* DeletionCollectionViewController.m */; }; @@ -1332,6 +1338,7 @@ buildActionMask = 2147483647; files = ( 4A0ECC03200D8C0200BA84A3 /* PFLoadingView.h in Headers */, + BCB2A840251D337F0030D987 /* PFAppleUtils.h in Headers */, 4A0ECC04200D8C0200BA84A3 /* PFQueryCollectionViewController.h in Headers */, 4A0ECC05200D8C0200BA84A3 /* PFUIAlertView.h in Headers */, 4A0ECC06200D8C0200BA84A3 /* PFSignUpViewController.h in Headers */, @@ -1344,6 +1351,7 @@ 4A0ECC0D200D8C0200BA84A3 /* PFCollectionViewCell.h in Headers */, 4A0ECC0E200D8C0200BA84A3 /* PFDismissButton.h in Headers */, 4A0ECC0F200D8C0200BA84A3 /* PFActivityIndicatorCollectionReusableView.h in Headers */, + BCB2A842251D337F0030D987 /* PFAppleAuthenticationProvider.h in Headers */, 4A0ECC10200D8C0200BA84A3 /* PFQueryTableViewController.h in Headers */, 4A0ECC11200D8C0200BA84A3 /* PFLogInViewController.h in Headers */, 4A0ECC12200D8C0200BA84A3 /* PFPurchaseTableViewCell.h in Headers */, @@ -1368,6 +1376,7 @@ buildActionMask = 2147483647; files = ( 4A9A94C6200D03BA005D8F4B /* PFLoadingView.h in Headers */, + BCB2A82E251D337E0030D987 /* PFAppleUtils.h in Headers */, 4A9A94C9200D03BE005D8F4B /* PFQueryCollectionViewController.h in Headers */, 4A9A94B6200D03B6005D8F4B /* PFUIAlertView.h in Headers */, 4A9A94AD200D03B6005D8F4B /* PFSignUpViewController.h in Headers */, @@ -1380,6 +1389,7 @@ 4A9A94A8200D03B6005D8F4B /* PFCollectionViewCell.h in Headers */, 4A9A94BE200D03BA005D8F4B /* PFDismissButton.h in Headers */, 4A9A94AF200D03B6005D8F4B /* PFActivityIndicatorCollectionReusableView.h in Headers */, + BCB2A830251D337E0030D987 /* PFAppleAuthenticationProvider.h in Headers */, 4A9A94CA200D03C8005D8F4B /* PFQueryTableViewController.h in Headers */, 4A9A94D3200D03C8005D8F4B /* PFLogInViewController.h in Headers */, 4A9A94A4200D03B6005D8F4B /* PFPurchaseTableViewCell.h in Headers */, @@ -1826,7 +1836,9 @@ 4A0ECBFC200D8C0200BA84A3 /* PFTableViewCell.m in Sources */, 4A0ECBFD200D8C0200BA84A3 /* PFLogInViewController.m in Sources */, 4A0ECBFE200D8C0200BA84A3 /* PFSignUpView.m in Sources */, + BCB2A843251D337F0030D987 /* PFAppleAuthenticationProvider.m in Sources */, 4A0ECBFF200D8C0200BA84A3 /* PFTextField.m in Sources */, + BCB2A841251D337F0030D987 /* PFAppleUtils.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1859,7 +1871,9 @@ 4A9A94A9200D03B6005D8F4B /* PFTableViewCell.m in Sources */, 4A9A94D0200D03C8005D8F4B /* PFLogInViewController.m in Sources */, 4A9A94AC200D03B6005D8F4B /* PFSignUpView.m in Sources */, + BCB2A831251D337E0030D987 /* PFAppleAuthenticationProvider.m in Sources */, 4A9A94CE200D03C8005D8F4B /* PFTextField.m in Sources */, + BCB2A82F251D337E0030D987 /* PFAppleUtils.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1894,13 +1908,11 @@ 81C5993F1A64346000F574E8 /* SimpleCollectionViewController.m in Sources */, 81472FBB1A1AB37500FD6EED /* main.m in Sources */, 81C599421A6454C900F574E8 /* PaginatedCollectionViewController.m in Sources */, - BC0632E423AD005E0089096D /* PFAppleUtils.m in Sources */, 81472FB31A1AB37500FD6EED /* CustomSignUpViewController.m in Sources */, 81472FB41A1AB37500FD6EED /* CustomLogInViewController.m in Sources */, 81472FB91A1AB37500FD6EED /* CustomProductTableViewController.m in Sources */, 819A4B3A1A6808EA00D01241 /* SubtitleImageCollectionViewController.m in Sources */, F57F3D241B0C03DB0087F60B /* DeletionTableViewController.m in Sources */, - BC0632E823AD03B30089096D /* PFAppleAuthenticationProvider.m in Sources */, 812E5C041A7A8EFB000FBDE1 /* StoryboardCollectionViewController.m in Sources */, 81472FB51A1AB37500FD6EED /* SimpleTableViewController.m in Sources */, F57F3D231B0C03D40087F60B /* DeletionCollectionViewController.m in Sources */, diff --git a/ParseUI/Resources/Info.plist b/ParseUI/Resources/Info.plist index bc283b56d..9d622b5bd 100644 --- a/ParseUI/Resources/Info.plist +++ b/ParseUI/Resources/Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.19.0 + 1.19.1 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -21,7 +21,7 @@ iPhoneOS CFBundleVersion - 1.19.0 + 1.19.1 MinimumOSVersion 8.0 diff --git a/ParseUI/Sign In With Apple/PFAppleUtils.h b/ParseUI/Sign In With Apple/PFAppleUtils.h index b32a27d65..46020f290 100644 --- a/ParseUI/Sign In With Apple/PFAppleUtils.h +++ b/ParseUI/Sign In With Apple/PFAppleUtils.h @@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN extern NSString *const PFAppleUserAuthenticationType; +extern NSString *const PFAppleAuthUserKey; +extern NSString *const PFAppleAuthCredentialKey; API_AVAILABLE(ios(13.0)) @interface PFAppleLoginManager : NSObject diff --git a/ParseUI/Sign In With Apple/PFAppleUtils.m b/ParseUI/Sign In With Apple/PFAppleUtils.m index 984333620..d26bf418d 100644 --- a/ParseUI/Sign In With Apple/PFAppleUtils.m +++ b/ParseUI/Sign In With Apple/PFAppleUtils.m @@ -8,10 +8,12 @@ #import "PFAppleUtils.h" #import "PFAppleAuthenticationProvider.h" -@import AuthenticationServices; +#import #import NSString *const PFAppleUserAuthenticationType = @"apple"; +NSString *const PFAppleAuthUserKey = @"user"; +NSString *const PFAppleAuthCredentialKey = @"credential"; API_AVAILABLE(ios(13.0)) @interface PFAppleLoginManager () @@ -46,17 +48,16 @@ - (nonnull ASPresentationAnchor)presentationAnchorForAuthorizationController:(no - (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization { ASAuthorizationAppleIDCredential *cred = authorization.credential; NSString *userId = cred.user; - NSPersonNameComponents *fullName = cred.fullName; NSData *token = cred.identityToken; NSString *tokenString = [[NSString alloc] initWithData:token encoding:NSUTF8StringEncoding]; __weak typeof(self) wself = self; - [[[PFUser logInWithAuthTypeInBackground:@"apple" + [[[PFUser logInWithAuthTypeInBackground:PFAppleUserAuthenticationType authData:@{@"token" : tokenString, @"id" : userId}] continueWithSuccessBlock:^id _Nullable(BFTask<__kindof PFUser *> * _Nonnull t) { __strong typeof(wself) sself = wself; - [sself.completionSource setResult:@{@"user" : t.result, - @"name" : fullName}]; + [sself.completionSource setResult:@{PFAppleAuthUserKey : t.result, + PFAppleAuthCredentialKey : cred}]; sself.strongSelf = nil; return t; }] continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { diff --git a/ParseUI/SignInWithAppleTests/SignInWithAppleTests.m b/ParseUI/SignInWithAppleTests/SignInWithAppleTests.m index 7b63650d8..dca75dff0 100644 --- a/ParseUI/SignInWithAppleTests/SignInWithAppleTests.m +++ b/ParseUI/SignInWithAppleTests/SignInWithAppleTests.m @@ -8,6 +8,9 @@ #import #import "PFAppleUtils.h" +#import "Parse/PFUser.h" +#import "PFLoginViewController.h" + @import OCMock; @interface SignInWithAppleTests : XCTestCase @@ -59,7 +62,7 @@ - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. } -- (void)testLoginSuccess { +- (void)testAppleUtilsLoginSuccess { // Create test ASAuthorization and ASAuthorizationAppleIDCredential FakeAuth *fakeAuth = [FakeAuth new]; @@ -78,29 +81,33 @@ - (void)testLoginSuccess { id mockUser = OCMClassMock([PFUser class]); NSDictionary *authData = @{@"token" : aString, @"id" : aString }; - NSDictionary *result = @{ @"user" : aString, - @"name" : name }; - OCMStub(ClassMethod([mockUser logInWithAuthTypeInBackground:@"apple" authData:authData])).andReturn([BFTask taskWithResult:result]); + PFUser *loggedInUser = [PFUser new]; + OCMStub(ClassMethod([mockUser logInWithAuthTypeInBackground:@"apple" authData:authData])).andReturn([BFTask taskWithResult:loggedInUser]); // Create the login task PFAppleLoginManager *manager = [PFAppleLoginManager new]; BFTask *logInTask = [PFAppleUtils logInInBackgroundWithManager:manager]; - XCTestExpectation *expect = [self expectationWithDescription:@"Task should complete."]; + XCTestExpectation *expectLoginSuccess = [self expectationWithDescription:@"Login should complete."]; [logInTask continueWithSuccessBlock:^id _Nullable(BFTask * _Nonnull t) { - [expect fulfill]; + XCTAssert(t.result[@"user"] == loggedInUser); + ASAuthorizationAppleIDCredential *credential = t.result[@"credential"]; + XCTAssert([credential.fullName isEqual:cred.fullName]); + XCTAssert([credential.identityToken isEqual:cred.identityToken]); + XCTAssert([credential.user isEqual:cred.user]); + [expectLoginSuccess fulfill]; return nil; }]; // Call the success callback as Apple would [manager authorizationController:manager.controller didCompleteWithAuthorization:(ASAuthorization *)fakeAuth]; - [self waitForExpectations:@[expect] timeout:2]; + [self waitForExpectations:@[expectLoginSuccess] timeout:2]; [mockUser stopMocking]; } -- (void)testPFUserLoginFails { +- (void)testAppleUtilsLoginFailure { // Create test ASAuthorization and ASAuthorizationAppleIDCredential FakeAuth *fakeAuth = [FakeAuth new]; FakeCredential *cred = [FakeCredential new]; @@ -140,25 +147,4 @@ - (void)testPFUserLoginFails { [mockUser stopMocking]; } -- (void)testAppleAuthCompletesWithError { - - // Create the login task - PFAppleLoginManager *manager = [PFAppleLoginManager new]; - BFTask *logInTask = [PFAppleUtils logInInBackgroundWithManager:manager]; - - XCTestExpectation *expect = [self expectationWithDescription:@"Task should fail."]; - [logInTask continueWithBlock:^id _Nullable(BFTask * _Nonnull t) { - if (t.error) { - [expect fulfill]; - } - return nil; - }]; - - // Call the failure callback as Apple would - NSError *err = [[NSError alloc] initWithDomain:@"org.parseplatform.error" code:1337 userInfo:nil]; - [manager authorizationController:manager.controller didCompleteWithError:err]; - [self waitForExpectations:@[expect] timeout:2]; - -} - @end