Browse Source

Create interface methods for GIDVerifyAccountDetail. (#381)

Brianna Morales 2 years ago
parent
commit
d7290dda4b

+ 4 - 0
.gitignore

@@ -16,3 +16,7 @@ Credentials.xcconfig
 Pods/
 gen/
 Podfile.lock
+
+# Swift Build
+.build/
+Package.resolved

+ 20 - 0
GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiableAccountDetail.m

@@ -0,0 +1,20 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h"
+
+@implementation GIDVerifiableAccountDetail
+@end

+ 20 - 0
GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifiedAccountDetailResult.m

@@ -0,0 +1,20 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h"
+
+@implementation GIDVerifiedAccountDetailResult
+@end

+ 32 - 0
GoogleSignIn/Sources/GIDVerifyAccountDetail/Implementations/GIDVerifyAccountDetail.m

@@ -16,5 +16,37 @@
 
 #import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h"
 
+#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h"
+#import "GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h"
+
 @implementation GIDVerifyAccountDetail
+
+#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
+
+- (void)verifyAccountDetails:(NSArray<GIDVerifiableAccountDetail *> *)accountDetails
+    presentingViewController:(UIViewController *)presentingViewController
+                  completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult,
+                                                NSError *_Nullable error))completion {
+    // TODO(#383): Implement this method.
+}
+
+- (void)verifyAccountDetails:(NSArray<GIDVerifiableAccountDetail *> *)accountDetails
+    presentingViewController:(UIViewController *)presentingViewController
+                        hint:(nullable NSString *)hint
+                  completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult,
+                                                NSError *_Nullable error))completion {
+    // TODO(#383): Implement this method.
+}
+
+- (void)verifyAccountDetails:(NSArray<GIDVerifiableAccountDetail *> *)accountDetails
+    presentingViewController:(UIViewController *)presentingViewController
+                        hint:(nullable NSString *)hint
+            additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
+                  completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult,
+                                                NSError *_Nullable error))completion {
+    // TODO(#383): Implement this method.
+}
+
+#endif // TARGET_OS_IOS || TARGET_OS_MACCATALYST
+
 @end

+ 22 - 0
GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiableAccountDetail.h

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+/// Helper object used to hold GIDAccountDetailType representing a list of
+/// account details that Google can verify via GSI.
+@interface GIDVerifiableAccountDetail : NSObject
+@end

+ 22 - 0
GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifiedAccountDetailResult.h

@@ -0,0 +1,22 @@
+/*
+ * Copyright 2024 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+/// A helper object that contains the result of a verification flow.
+/// This will pass back the necessary tokens to the requesting party.
+@interface GIDVerifiedAccountDetailResult : NSObject
+@end

+ 72 - 0
GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h

@@ -15,6 +15,78 @@
  */
 
 #import <Foundation/Foundation.h>
+#import <TargetConditionals.h>
 
+#if __has_include(<UIKit/UIKit.h>)
+#import <UIKit/UIKit.h>
+#elif __has_include(<AppKit/AppKit.h>)
+#import <AppKit/AppKit.h>
+#endif
+
+@class GIDVerifiableAccountDetail;
+@class GIDVerifiedAccountDetailResult;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// This class is used to verify a user's Google account details.
 @interface GIDVerifyAccountDetail : NSObject
+
+#if TARGET_OS_IOS || TARGET_OS_MACCATALYST
+
+/// Starts an interactive verification flow.
+///
+/// The completion will be called at the end of this process.  Any saved verification
+/// state will be replaced by the result of this flow.
+///
+/// @param accountDetails A list of verifiable account details.
+/// @param presentingViewController The view controller used to present `SFSafariViewController` on
+///     iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on
+///     iOS 13+.
+/// @param completion The optional block called asynchronously on the main queue upon completion.
+- (void)verifyAccountDetails:(NSArray<GIDVerifiableAccountDetail *> *)accountDetails 
+    presentingViewController:(UIViewController *)presentingViewController 
+                  completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, 
+                                                NSError *_Nullable error))completion;
+
+/// Starts an interactive verification flow using the provided hint.
+///
+/// The completion will be called at the end of this process.  Any saved verification
+/// state will be replaced by the result of this flow.
+///
+/// @param accountDetails A list of verifiable account details.
+/// @param presentingViewController The view controller used to present `SFSafariViewController` on
+///     iOS 9 and 10 and to supply `presentationContextProvider` for `ASWebAuthenticationSession` on
+///     iOS 13+.
+/// @param hint An optional hint for the authorization server, for example the user's ID or email
+///     address, to be prefilled if possible.
+/// @param completion The optional block called asynchronously on the main queue upon completion.
+- (void)verifyAccountDetails:(NSArray<GIDVerifiableAccountDetail *> *)accountDetails 
+    presentingViewController:(UIViewController *)presentingViewController 
+                        hint:(nullable NSString *)hint
+                  completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, 
+                                                NSError *_Nullable error))completion;
+
+/// Starts an interactive verification flow using the provided hint and additional scopes.
+///
+/// The completion will be called at the end of this process.  Any saved verification
+/// state will be replaced by the result of this flow.
+///
+/// @param accountDetails A list of verifiable account details.
+/// @param presentingViewController The view controller used to present `SFSafariViewController` on
+///     iOS 9 and 10.
+/// @param hint An optional hint for the authorization server, for example the user's ID or email
+///     address, to be prefilled if possible.
+/// @param additionalScopes An optional array of scopes to request in addition to the basic profile scopes.
+/// @param completion The optional block called asynchronously on the main queue upon completion.
+- (void)verifyAccountDetails:(NSArray<GIDVerifiableAccountDetail *> *)accountDetails 
+    presentingViewController:(UIViewController *)presentingViewController 
+                        hint:(nullable NSString *)hint
+            additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
+                  completion:(nullable void (^)(GIDVerifiedAccountDetailResult *_Nullable verifyResult, 
+                                                NSError *_Nullable error))completion;
+
+#endif
+
 @end
+
+NS_ASSUME_NONNULL_END

+ 2 - 0
GoogleSignIn/Sources/Public/GoogleSignIn/GoogleSignIn.h

@@ -22,6 +22,8 @@
 #import "GIDToken.h"
 #import "GIDSignInResult.h"
 #import "GIDVerifyAccountDetail.h"
+#import "GIDVerifiableAccountDetail.h"
+#import "GIDVerifiedAccountDetailResult.h"
 #if TARGET_OS_IOS || TARGET_OS_MACCATALYST
 #import "GIDSignInButton.h"
 #endif