Skip to content

Commit

Permalink
Create interface methods for GIDVerifyAccountDetail. (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
brnnmrls authored Mar 20, 2024
1 parent 01eddc5 commit d7290dd
Show file tree
Hide file tree
Showing 8 changed files with 194 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ Credentials.xcconfig
Pods/
gen/
Podfile.lock

# Swift Build
.build/
Package.resolved
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 changes: 72 additions & 0 deletions GoogleSignIn/Sources/Public/GoogleSignIn/GIDVerifyAccountDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 2 additions & 0 deletions GoogleSignIn/Sources/Public/GoogleSignIn/GoogleSignIn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit d7290dd

Please sign in to comment.