@@ -28,6 +28,12 @@ import com.gigya.android.sdk.ui.plugin.IGigyaWebBridge
2828import com.gigya.android.sdk.utils.CustomGSONDeserializer
2929import com.google.gson.GsonBuilder
3030import com.google.gson.reflect.TypeToken
31+ import com.sap.gigya_flutter_plugin.GigyaSDKWrapper.Companion.BIOMETRIC_RECOGNITION_FAILED
32+ import com.sap.gigya_flutter_plugin.GigyaSDKWrapper.Companion.CANCELED_ERROR
33+ import com.sap.gigya_flutter_plugin.GigyaSDKWrapper.Companion.CANCELED_ERROR_MESSAGE
34+ import com.sap.gigya_flutter_plugin.GigyaSDKWrapper.Companion.GENERAL_ERROR
35+ import com.sap.gigya_flutter_plugin.GigyaSDKWrapper.Companion.MISSING_PARAMETER_ERROR
36+ import com.sap.gigya_flutter_plugin.GigyaSDKWrapper.Companion.MISSING_PARAMETER_MESSAGE
3137import io.flutter.plugin.common.MethodChannel
3238import java.lang.ref.WeakReference
3339import java.util.*
@@ -229,6 +235,76 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
229235 })
230236 }
231237
238+ /* *
239+ * Login using custom identifier (identifier/identifierType/password combination with optional parameter map).
240+ */
241+ fun loginWithCustomIdentifier (arguments : Any , channelResult : MethodChannel .Result ) {
242+ currentResult = channelResult
243+ val identifier: String? = (arguments as Map <* , * >)[" identifier" ] as String?
244+ val identifierType: String? = (arguments as Map <* , * >)[" identifierType" ] as String?
245+ val password: String? = arguments[" password" ] as String?
246+ if (identifier == null || password == null || identifierType == null ) {
247+ currentResult?.error(
248+ MISSING_PARAMETER_ERROR ,
249+ MISSING_PARAMETER_MESSAGE ,
250+ mapOf<String , Any >()
251+ )
252+ return
253+ }
254+
255+ val parameters: Map <String , Any >? = arguments[" parameters" ] as Map <String , Any >?
256+ sdk.login(identifier, identifierType, password, parameters, object : GigyaLoginCallback <T >() {
257+ override fun onSuccess (p0 : T ) {
258+ resolverHelper.clear()
259+ val mapped = mapObject(p0)
260+ currentResult?.success(mapped)
261+ }
262+
263+ override fun onError (p0 : GigyaError ? ) {
264+ p0?.let {
265+ currentResult?.error(
266+ p0.errorCode.toString(),
267+ p0.localizedMessage,
268+ mapJson(p0.data)
269+ )
270+ } ? : currentResult?.notImplemented()
271+ }
272+
273+ override fun onConflictingAccounts (
274+ response : GigyaApiResponse ,
275+ resolver : ILinkAccountsResolver
276+ ) {
277+ resolverHelper.linkAccountResolver = resolver
278+ currentResult?.error(
279+ response.errorCode.toString(),
280+ response.errorDetails,
281+ response.asMap()
282+ )
283+ }
284+
285+ override fun onPendingRegistration (
286+ response : GigyaApiResponse ,
287+ resolver : IPendingRegistrationResolver
288+ ) {
289+ resolverHelper.pendingRegistrationResolver = resolver
290+ currentResult?.error(
291+ response.errorCode.toString(),
292+ response.errorDetails,
293+ response.asMap()
294+ )
295+ }
296+
297+ override fun onPendingVerification (response : GigyaApiResponse , regToken : String? ) {
298+ resolverHelper.regToken = regToken
299+ currentResult?.error(
300+ response.errorCode.toString(),
301+ response.errorDetails,
302+ response.asMap()
303+ )
304+ }
305+ })
306+ }
307+
232308 /* *
233309 * Register a new user using credentials (email/password combination with optional parameter map).
234310 */
@@ -583,7 +659,10 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
583659 }
584660
585661 override fun onOperationCanceled () {
586- currentResult?.error(CANCELED_ERROR , CANCELED_ERROR_MESSAGE , null )
662+ currentResult?.error(
663+ CANCELED_ERROR ,
664+ CANCELED_ERROR_MESSAGE ,
665+ null )
587666 }
588667
589668 override fun onConflictingAccounts (
@@ -708,9 +787,9 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
708787 })
709788 }
710789
711- // endregion
790+ // endregion
712791
713- // region SCREENSETS
792+ // region SCREENSETS
714793
715794 /* *
716795 * Trigger embedded web screen sets.
@@ -877,9 +956,9 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
877956 channelResult.success(null )
878957 }
879958
880- // endregion
959+ // endregion
881960
882- // region FIDO
961+ // region FIDO
883962
884963 /* *
885964 * Fido2/WebAuthn register.
@@ -1062,9 +1141,9 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
10621141 })
10631142 }
10641143
1065- // endregion
1144+ // endregion
10661145
1067- // region OTP
1146+ // region OTP
10681147
10691148 /* *
10701149 * Login via phone OTP.
@@ -1183,9 +1262,9 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
11831262 resolverHelper.otpResolver?.verify(code)
11841263 }
11851264
1186- // endregion
1265+ // endregion
11871266
1188- // region RESOLVERS
1267+ // region RESOLVERS
11891268
11901269 /* *
11911270 * Link account - handler for fetching conflicting accounts from current interruption state.
@@ -1248,9 +1327,9 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
12481327 } ? : currentResult?.notImplemented()
12491328 }
12501329
1251- // endregion
1330+ // endregion
12521331
1253- // region BIOMETRIC
1332+ // region BIOMETRIC
12541333
12551334 fun biometricIsAvailable (channelResult : MethodChannel .Result ) {
12561335 channelResult.success(sdkBiometric.isAvailable)
@@ -1394,7 +1473,7 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
13941473 })
13951474 }
13961475
1397- // endregion
1476+ // endregion
13981477
13991478 /* *
14001479 * Map typed object to a Map<String, Any> object in order to pass on to
0 commit comments