SAP CDC Gigya Flutter Plugin

SAP CDC Gigya Flutter Plugin

A Flutter plugin for interfacing Gigya's native SDKs into a Flutter application using Dart.

SAP CDC Gigya Flutter Plugin

A Flutter plugin for interfacing Gigya's native SDKs into a Flutter application using Dart.

Description

Flutter plugin that provides an interface for the Gigya API.

Developers Preview Status

The plugin allows you to use the core elements & business API flows available within the SAP Customer Data Cloud mobile SDKs. This plugin is currently in an early developers preview stage.

Setup & Gigya core integration

Android setup

Add the following to your native implementation.

class MainActivity : FlutterActivity() {

    override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
        GeneratedPluginRegistrant.registerWith(flutterEngine)

        // Copy this code to you Android app.
        //
        // Reference the plugin and register your SDK initialization parameters.
        val plugin: GigyaFlutterPlugin= flutterEngine.plugins.get(GigyaFlutterPlugin::class.java) as GigyaFlutterPlugin
        plugin.registerWith(application, GigyaAccount::class.java)
    }
}

Important: Make sure you have configured the basic steps needed for integrating the Android SDK

iOS setup

Navigate to <your project root>/ios/Runner/AppDelegate.swift and add the following:

import gigya_flutter_plugin
import Gigya

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {

    // Copy this code to you Android app.
    //
    GeneratedPluginRegistrant.register(with: self)
    SwiftGigyaFlutterPlugin.register(accountSchema: UserHost.self)

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Important: Make sure you have configured your info.plist file accordinglty.

Sending a simple request

Sending a request is available using the plugin send method.

GigyaSdk.instance.send('REQUEST-ENDPOINT', {PARAMETER-MAP}).then((result) {
      debugPrint(json.encode(result));
    }).catchError((error) {
      debugPrint(error.errorDetails);
    });

Example implementation is demonstrated in the send_request.dart class of the provided example application.

Business APIs

The plugin provides an interface to these core SDK business APIs: login, register, getAccount, getAccount, isLoggedIn ,logOut, addConnection, removeConnection Implement them using the same request structure as shown above. Example application includes the various implementations.

Social login

Use the "socialLogin" interface in order to perform social login using supported providers. The Flutter plugin supports the same *providers supported by the Core Gigya SDK.

Supported social login providers: google, facebook, line, wechat, apple, amazon, linkedin, yahoo.

Embedded social providers

Specific social providers (Facebook, Google) require additional setup. This due to the their requirement for specific (embedded) SDKs.

Example for both Facebook & Google are implemented in the example application.

Facebook

Follow the core SDK documentation and instructions for setting Facebook login. Android documentation iOS documentation

iOS: In addition add the following to your Runner's AppDelegate.swift file:

Gigya.sharedInstance(UserHost.self).registerSocialProvider(of: .facebook, wrapper: FacebookWrapper())
Instead of adding the provider's sdk using gradle/cocoapods you are able to add
the [flutter_facebook_login] plugin to your **pubspec.yaml** dependencies.

Google

Follow the core SDK documentation and instructions for setting Google login. Android documentation iOS documentation

iOS: In addition add the following to your Runner's AppDelegate.swift file:

Gigya.sharedInstance(UserHost.self).registerSocialProvider(of: .google, wrapper: GoogleWrapper())
Instead of adding the provider's sdk using gradle/cocoapods you are able to add
the [google_sign_in] plugin to your **pubspec.yaml** dependencies.

LINE

In order to provider support for LINE provider, please follow the core SDK documentation. Android documentation iOS documentation

WeChat

In order to provider support for WeChat provider, please follow the core SDK documentation. Android documentation iOS documentation

Using screen-sets

The plugin supports the use of Web screen-sets using the following:

GigyaSdk.instance.showScreenSet("Default-RegistrationLogin", (event, map) {
          debugPrint('Screen set event received: $event');
          debugPrint('Screen set event data received: $map');
});

Optional {parameters} map is available.

As in the core SDKs the plugin provides a streaming channel that will stream the Screen-Sets events (event, map).

event - actual event name. map - event data map.

Resolving interruptions

Much like the our core SDKs, resolving interruptions is available using the plugin.

Current supporting interruptions:

  • pendingRegistration using the PendingRegistrationResolver class.
  • pendingVerification using the PendingVerificationResolver class.
  • conflictingAccounts using the LinkAccountResolver class.

Example for resolving conflictingAccounts interruptions:

GigyaSdk.instance.login(loginId, password).then((result) {
      debugPrint(json.encode(result));
      final response = Account.fromJson(result);
      // Successfully logged in
    }).catchError((error) {
      // Interruption may have occurred.
      if (error.getInterruption() == Interruption.conflictingAccounts) {
        // Reference the correct resolver
        LinkAccountResolver resolver = GigyaSdk.instance.resolverFactory.getResolver(error);
      } else {
        setState(() {
          _inProgress = false;
          _requestResult = 'Register error\n\n${error.errorDetails}';
        });
      }
    });

Once you reference your resolver, create your relevant UI to determine if a site or social linking is required (see example app for details) and use the relevant "resolve" method.

Example of resolving link to site when trying to link a new social account to a site account.

final String password = _linkPasswordController.text.trim();
resolver.linkToSite(loginId, password).then((res) {
     final Account account = Account.fromJson(res);
     // Account successfully linked.
});

Known Issues

None

How to obtain support

Contributing

Via pull request to this repository.

To-Do (upcoming changes)

None

Download Details:

Author: SAP

Source Code: https://github.com/SAP/gigya-flutter-plugin

flutter dart mobile-apps

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Google's Flutter 1.20 stable announced with new features - Navoki

Google has announced new flutter 1.20 stable with many improvements, and features, enabling flutter for Desktop and Web

Top 25 Flutter Mobile App Templates in 2020

Flutter has been booming worldwide from the past few years. While there are many popular mobile app development technologies out there, Flutter has managed to leave its mark in the mobile application development world. In this article, we’ve curated the best Flutter app templates available on the market as of July 2020.

Flutter App Development Trends 2020

As the new decade dawns upon us, a slew of technologies has been making a lot of noise to grab the developers’ attention. While native app development is going strong, the trade winds are now blowing towards going cross-platform.

How To Succeed In Mobile App Wireframe Design?

This article covers everything about mobile app wireframe design: what to do and what not, tools used in designing a mobile or web app wireframe, and more.

Top 10 Mobile App Development Companies in India

The mobile application scenario has been continually changing over the years. In recent years India has become a center for mobile app development companies. The increase of smartphones has instantly increased the requirements for these apps. Every year new technological trends occur due to contin