Skip to content

Commit 867a882

Browse files
committed
Merge branch 'develop' into main
2 parents 906880e + 9f97865 commit 867a882

File tree

8 files changed

+72
-19
lines changed

8 files changed

+72
-19
lines changed

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ dependencies {
4444
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
4545

4646
// Gigya SDK core implementation.
47-
api 'com.github.SAP.gigya-android-sdk:gigya-android-sdk-core:core-v5.1.3'
47+
api 'com.github.SAP.gigya-android-sdk:gigya-android-sdk-core:core-v5.1.4'
4848
api 'com.google.code.gson:gson:2.8.6'
4949
}

android/src/main/kotlin/com/sap/gigya_flutter_plugin/GigyaFlutterPlugin.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class GigyaFlutterPlugin : FlutterPlugin, MethodCallHandler {
6060
"linkToSocial" -> sdk.resolveLinkToSocial(call.arguments, result)
6161
"resolveSetAccount" -> sdk.resolveSetAccount(call.arguments, result)
6262
"forgotPassword" -> sdk.forgotPassword(call.arguments, result)
63+
"initSdk" -> sdk.initSdk(call.arguments, result)
6364
else -> result.notImplemented()
6465
}
6566
}

android/src/main/kotlin/com/sap/gigya_flutter_plugin/GigyaSDKWrapper.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,29 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
249249
});
250250
}
251251

252+
/**
253+
* Init SDK.
254+
*/
255+
fun initSdk(arguments: Any, channelResult: MethodChannel.Result) {
256+
val apiKey: String? = (arguments as Map<*, *>)["apiKey"] as String?
257+
if (apiKey == null) {
258+
channelResult.success(mapOf("success" to false))
259+
260+
currentResult!!.error(MISSING_PARAMETER_ERROR, MISSING_PARAMETER_MESSAGE, mapOf<String, Any>())
261+
return
262+
}
263+
val apiDomain: String? = (arguments as Map<*, *>)["apiDomain"] as String?
264+
if (apiDomain == null) {
265+
channelResult.success(mapOf("success" to false))
266+
267+
currentResult!!.error(MISSING_PARAMETER_ERROR, MISSING_PARAMETER_MESSAGE, mapOf<String, Any>())
268+
return
269+
}
270+
sdk.init(apiKey, apiDomain);
271+
272+
channelResult.success(mapOf("success" to true))
273+
}
274+
252275
/**
253276
* Logout of existing session.
254277
*/

example/ios/Podfile.lock

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
PODS:
2-
- AppAuth (1.4.0):
3-
- AppAuth/Core (= 1.4.0)
4-
- AppAuth/ExternalUserAgent (= 1.4.0)
5-
- AppAuth/Core (1.4.0)
6-
- AppAuth/ExternalUserAgent (1.4.0)
72
- FBSDKCoreKit (5.15.1):
83
- FBSDKCoreKit/Basics (= 5.15.1)
94
- FBSDKCoreKit/Core (= 5.15.1)
@@ -39,17 +34,12 @@ DEPENDENCIES:
3934
- Flutter (from `Flutter`)
4035
- flutter_facebook_login (from `.symlinks/plugins/flutter_facebook_login/ios`)
4136
- gigya_flutter_plugin (from `.symlinks/plugins/gigya_flutter_plugin/ios`)
42-
- google_sign_in (from `.symlinks/plugins/google_sign_in/ios`)
4337

4438
SPEC REPOS:
4539
trunk:
46-
- AppAuth
4740
- FBSDKCoreKit
4841
- FBSDKLoginKit
4942
- Gigya
50-
- GoogleSignIn
51-
- GTMAppAuth
52-
- GTMSessionFetcher
5343

5444
EXTERNAL SOURCES:
5545
Flutter:
@@ -58,11 +48,8 @@ EXTERNAL SOURCES:
5848
:path: ".symlinks/plugins/flutter_facebook_login/ios"
5949
gigya_flutter_plugin:
6050
:path: ".symlinks/plugins/gigya_flutter_plugin/ios"
61-
google_sign_in:
62-
:path: ".symlinks/plugins/google_sign_in/ios"
6351

6452
SPEC CHECKSUMS:
65-
AppAuth: 31bcec809a638d7bd2f86ea8a52bd45f6e81e7c7
6653
FBSDKCoreKit: 1d5acf7c9d7a2f92bb1a242dc60cae5b7adb91df
6754
FBSDKLoginKit: f1ea8026a58b52d30c9f2e6a58ca7d813619fb83
6855
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c

ios/Classes/GigyaSdkWrapper.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
1818

1919
init(accountSchema: T.Type) {
2020
// Initializing the Gigya SDK instance.
21-
GigyaDefinitions.versionPrefix = "flutter_0.0.2_"
21+
GigyaDefinitions.versionPrefix = "flutter_0.1.2_"
2222
sdk = Gigya.sharedInstance(accountSchema)
2323
}
2424

@@ -212,6 +212,23 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
212212
}
213213
})
214214
}
215+
216+
/**
217+
Init SDK
218+
*/
219+
func initSdk(arguments: [String: Any], result: @escaping FlutterResult) {
220+
guard let apiKey = arguments["apiKey"] as? String else {
221+
result(FlutterError(code: PluginErrors.missingParameterError, message: PluginErrors.missingParameterMessage, details: nil))
222+
return
223+
}
224+
guard let apiDomain = arguments["apiDomain"] as? String else {
225+
result(FlutterError(code: PluginErrors.missingParameterError, message: PluginErrors.missingParameterMessage, details: nil))
226+
return
227+
}
228+
sdk?.initFor(apiKey: apiKey, apiDomain: apiDomain)
229+
230+
result(["success": true])
231+
}
215232

216233
/**
217234
Social login with given provider & provider sessions.
@@ -322,7 +339,9 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
322339
let screenSet = arguments["screenSet"] as? String else {
323340
return
324341
}
325-
342+
343+
let parameters = arguments["parameters"] as? [String: Any] ?? [:]
344+
326345
// Create streamer
327346
var screenSetsEventHandler: ScreenSetsStreamHandler? = ScreenSetsStreamHandler()
328347
let eventChannel = FlutterEventChannel(name: "screensetEvents", binaryMessenger: SwiftGigyaFlutterPlugin.registrar!.messenger())
@@ -336,7 +355,7 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
336355
sdk?.showScreenSet(
337356
with: screenSet,
338357
viewController: viewController,
339-
params: arguments) { [weak self] event in
358+
params: parameters) { [weak self] event in
340359
switch event {
341360
case .error(let event):
342361
screenSetsEventHandler?.sink?(["event":"onError", "data" : event])

ios/Classes/SwiftGigyaFlutterPluginTyped.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class SwiftGigyaFlutterPluginTyped<T: GigyaAccountProtocol> : NSObject, F
66

77
enum GigyaMethods: String {
88
case getPlatformVersion
9+
case initSdk
910
case sendRequest
1011
case loginWithCredentials
1112
case registerWithCredentials
@@ -94,6 +95,8 @@ public class SwiftGigyaFlutterPluginTyped<T: GigyaAccountProtocol> : NSObject, F
9495
sdk?.resolveSetAccount(arguments: args, result: result)
9596
case .forgotPassword:
9697
sdk?.forgotPassword(arguments: args, result: result)
98+
case .initSdk:
99+
sdk?.initSdk(arguments: args, result: result)
97100
default:
98101
result(nil)
99102
}

lib/gigya_flutter_plugin.dart

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ enum Methods {
1919
removeConnection,
2020
showScreenSet,
2121
forgotPassword,
22+
initSdk,
2223
}
2324

2425
extension MethodsExt on Methods {
@@ -195,9 +196,28 @@ class GigyaSdk with DataMixin {
195196
return result;
196197
}
197198

199+
/// Init SDK using apiKey and apiDomain
200+
Future<Map<String, dynamic>?> initSdk(String apiKey, String apiDomain, [bool forceLogout = true]) async {
201+
if (forceLogout) {
202+
await logout();
203+
}
204+
205+
final result = await _channel.invokeMapMethod<String, dynamic>(
206+
Methods.initSdk.name,
207+
{
208+
'apiKey': apiKey,
209+
'apiDomain': apiDomain,
210+
},
211+
).timeout(_getTimeout(Methods.initSdk), onTimeout: () {
212+
debugPrint('A timeout that was defined in the request is reached');
213+
return _timeoutError();
214+
});
215+
return result;
216+
}
217+
198218
/// Perform a social login given the [provider] identity.
199219
/// This call will specifically call the "notifySocialLogin" endpoint.
200-
/// All social provider integration is the host's responsibility.
220+
/// All social provider integration is the host's responsibiliy.
201221
///
202222
/// Long timeout is set (5 minutes) in order to make sure that long sign in processes will not break.
203223
Future<Map<String, dynamic>?> socialLogin(SocialProvider provider,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: gigya_flutter_plugin
22
description: SAP Gigya Flutter plugin
3-
version: 0.1.1
3+
version: 0.1.2
44
homepage: https://github.com/SAP/gigya-flutter-plugin
55

66
environment:

0 commit comments

Comments
 (0)