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

Create interface methods for GIDVerifyAccountDetail. #381

Merged
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
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
Loading