diff --git a/GigyaAuth/README.md b/GigyaAuth/README.md index d788db67..e782549d 100644 --- a/GigyaAuth/README.md +++ b/GigyaAuth/README.md @@ -97,6 +97,38 @@ GigyaAuth.shared.registerForAuthPush { result in ​ Once the device is successfully registered, when the user starts a login process on a separate device (e.g. desktop), the registered mobile device will receive a push notification which they can approve or deny. ​ + +## OTP Phone number login (v1.1.+) +**In order to use this method you will require a minumim Gigya Core SDK version of 1.2.0.** +Initiating a phone number login is available using the following flow. +1. Initiate the login flow providing a phone number. This will result in a verification message to be sent to the provided +Phone number. +```swift +GigyaAuth.shared.otp.login(phone: phone) { (result: GigyaOtpResult) in + switch result { + case .success(let data): + // Success + case .pendingOtpVerification(let resolver): + // Code sent + case .failure(let error): + // error + } +} +``` +2. Verify the recieved code to complete login flow. +Using the *IGigyaOtpResult* resolve class received in the *onPendingOTPVerification* callback you are now able to +verify the code and complete the login flow. The flow will resolve in the original callback. +```swift +resolver.verify(code: code) +``` +Updating the user phone number is also available. The flow is the same but will start with the **update** option +rather than the **login** option. +```swift +GigyaAuth.shared.otp.update(phone: ... +``` +NOTE: +OTP phone number supports the following format +[country code][number] only. + ## Limitations None ​ diff --git a/GigyaNss.podspec b/GigyaNss.podspec index a649ce68..9f41f18b 100644 --- a/GigyaNss.podspec +++ b/GigyaNss.podspec @@ -20,9 +20,12 @@ Pod::Spec.new do |spec| spec.subspec 'Core' do |ss| ss.source_files = 'GigyaNss/GigyaNss/*.swift', 'GigyaNss/GigyaNss/*/*.swift', 'GigyaNss/GigyaNss/*/*/*.swift' - ss.exclude_files = 'GigyaNss/GigyaNss/services/*/*.swift' + ss.exclude_files = 'GigyaNss/GigyaNss/services/Otp/OtpService.swift' - spec.dependency 'Gigya', '>= 1.2.0' + ss.dependency 'Gigya', '>= 1.2.0' + ss.framework = 'SystemConfiguration' + ss.library = 'c++', 'z' + ss.vendored_frameworks = 'GigyaNss/Flutter/Debug/Flutter.framework', 'GigyaNss/Flutter/Debug/App.framework' end spec.subspec 'Auth' do |ss| @@ -30,9 +33,7 @@ Pod::Spec.new do |spec| ss.dependency 'GigyaAuth' end - spec.framework = 'SystemConfiguration' - spec.library = 'c++', 'z' - spec.vendored_frameworks = 'GigyaNss/Flutter/Debug/Flutter.framework', 'GigyaNss/Flutter/Debug/App.framework' + spec.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' diff --git a/GigyaNss/GigyaNss/GigyaNss.swift b/GigyaNss/GigyaNss/GigyaNss.swift index 1da2c118..3df31b89 100644 --- a/GigyaNss/GigyaNss/GigyaNss.swift +++ b/GigyaNss/GigyaNss/GigyaNss.swift @@ -215,24 +215,12 @@ final public class GigyaNss { dependenciesContainer.register(service: EventsClosuresManager.self) { _ in return EventsClosuresManager() } -// let bundle = Bundle(identifier: GigyaNss.wrapperBundle) -// -// // check if GigyaNss Auth wrappers is exists is exists. -// if let otpClass = bundle?.classNamed("GigyaNss.OtpHelper"), -// let otpHelper = otpClass as AnyClass as? OtpProtocol.Type { -// -// // register the relevent helper -// dependenciesContainer.register(service: OtpProtocol.self) { _ in -// return OtpHead() -// } -// } dependenciesContainer.register(service: OtpProtocol.self) { _ in let otp = OtpHead() return otp } - dependenciesContainer.resolve(OtpProtocol.self)?.isAvailable() guard let builder = GigyaNss.shared.dependenciesContainer.resolve(ScreenSetsBuilder.self) else { GigyaLogger.error(with: GigyaNss.self, message: "`ScreenSetsBuilder` dependency not found.") } diff --git a/GigyaNssRelease.podspec b/GigyaNssRelease.podspec index 721225a5..2aad21bd 100644 --- a/GigyaNssRelease.podspec +++ b/GigyaNssRelease.podspec @@ -20,9 +20,14 @@ Pod::Spec.new do |spec| spec.subspec 'Core' do |ss| ss.source_files = 'GigyaNss/GigyaNss/*.swift', 'GigyaNss/GigyaNss/*/*.swift', 'GigyaNss/GigyaNss/*/*/*.swift' - ss.exclude_files = 'GigyaNss/GigyaNss/services/*/*.swift' + ss.exclude_files = 'GigyaNss/GigyaNss/services/Otp/OtpService.swift' - spec.dependency 'Gigya', '>= 1.2.0' + ss.dependency 'Gigya', '>= 1.2.0' + ss.framework = 'SystemConfiguration' + ss.library = 'c++', 'z' + + ss.dependency 'Flutter', '1.22.4' + ss.vendored_frameworks = 'GigyaNss/Flutter/Release/App.framework' end spec.subspec 'Auth' do |ss| @@ -30,13 +35,6 @@ Pod::Spec.new do |spec| ss.dependency 'GigyaAuth' end - spec.framework = 'SystemConfiguration' - spec.dependency 'Gigya', '>= 1.2.0' - spec.library = 'c++', 'z' - - spec.dependency 'Flutter', '1.22.4' - spec.vendored_frameworks = 'GigyaNss/Flutter/Release/App.framework' - spec.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' diff --git a/GigyaSwift/README.md b/GigyaSwift/README.md index 37486641..447312e0 100644 --- a/GigyaSwift/README.md +++ b/GigyaSwift/README.md @@ -40,6 +40,40 @@ Once you have completed the changes above, run the following: pod install ``` +### Setting account configuration +In order to align all account related request we recommend that an account configuration setting will be applied. +This is a global SDK setting and will affect all account related requests. +Account configuration will include: + - cacheTime - The time the SDK will cache your account data until requested again to lower network usage. + - include - The default include fields used in every account request. + - extraProfileFieds - The default extra profile fields used in every account request. +In order to set the account configuration use one of the following methods: +#### Implicit settings via the *info.plist* file +```xml + + GigyaAccount + + include + + data + profile + emails + + cacheTime + 60 + extraProfileFields + + languages + phones + + + +``` + +#### Explicit setting via the Gigya instance. +```swift +Gigya.sharedInstance().setAccountConfig(with: myAccountConfigObject) +``` ### Initialization