Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sagishm committed May 4, 2021
2 parents df78b52 + 8589fbe commit 4b2bf18
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 26 deletions.
32 changes: 32 additions & 0 deletions GigyaAuth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserHost>) 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
Expand Down
11 changes: 6 additions & 5 deletions GigyaNss.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ 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|
ss.source_files = 'GigyaNss/GigyaNss/services/*/*.swift'
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'
Expand Down
12 changes: 0 additions & 12 deletions GigyaNss/GigyaNss/GigyaNss.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>.self) else {
GigyaLogger.error(with: GigyaNss.self, message: "`ScreenSetsBuilder` dependency not found.")
}
Expand Down
16 changes: 7 additions & 9 deletions GigyaNssRelease.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ 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|
ss.source_files = 'GigyaNss/GigyaNss/services/*/*.swift'
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'
Expand Down
34 changes: 34 additions & 0 deletions GigyaSwift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<dict>
<key>GigyaAccount</key>
<dict>
<key>include</key>
<array>
<string>data</string>
<string>profile</string>
<string>emails</string>
</array>
<key>cacheTime</key>
<integer>60</integer>
<key>extraProfileFields</key>
<array>
<string>languages</string>
<string>phones</string>
</array>
</dict>
</dict>
```

#### Explicit setting via the Gigya instance.
```swift
Gigya.sharedInstance().setAccountConfig(with: myAccountConfigObject)
```

### Initialization

Expand Down

0 comments on commit 4b2bf18

Please sign in to comment.