GithubHelp home page GithubHelp logo

flutter-uaepass's Introduction

uaepass

Generic badge

Default

Installation

In your pubspec.yaml file within your Flutter Project:

dependencies:
  uaepass: <latest_version>

iOS

Add the below to info.plist

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>uaepass</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>{custom App Scheme}</string>
        </array>
    </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>uaepass</string> // for Production
    <string>uaepassstg</string> // for Staging
</array>

Update AppDelegate.swift as per below

import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
   private var methodChannel: FlutterMethodChannel?

  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    let controller = window.rootViewController as! FlutterViewController
    methodChannel = FlutterMethodChannel(name: "{custom App Scheme}.uaepass/channel", binaryMessenger: controller.binaryMessenger)

    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

   override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
      methodChannel?.invokeMethod("didRecieveTranscript", arguments: url.absoluteString)
      return true
    }
}

Android

Add the below to AndroidManifest.xml

<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data
        android:scheme="{custom App Scheme}"
        android:host="uaepass" />
</intent-filter>
<manifest>
   ...
    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="https" />
         </intent>
        <package android:name="ae.uaepass.mainapp" />
        <package android:name="ae.uaepass.mainapp.stg" />
    </queries>
</manifest>

Update MainActivity.kt as per below

import io.flutter.embedding.android.FlutterActivity
import android.content.Intent
import androidx.annotation.NonNull
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel

class MainActivity: FlutterActivity() {
    private val channel = "poc.uaepass/channel1"
    private var methodChannel: MethodChannel? = null

    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
        super.configureFlutterEngine(flutterEngine)
        methodChannel = MethodChannel(flutterEngine.dartExecutor, channel)
    }

    override fun onNewIntent(intent: Intent) {
        super.onNewIntent(intent)
        methodChannel?.invokeMethod("didRecieveTranscript", "")
    }
}

Use it

import 'package:uaepass/uaepass.dart';

UaepassLoginButton();

Example

import 'package:flutter/material.dart';
import 'package:uaepass/uaepass.dart';

void main() {
  Uaepass.init(
    env: UaePassEnv.stg,
    appScheme: '{custom App Scheme}',
    clientId: 'sandbox_stage',
    clientSecret: 'sandbox_stage',
  );
  runApp(
    const MaterialApp(
      home: Material(
        child: Center(
          child: UaepassLoginButton(),
        ),
      ),
    ),
  );
}

flutter-uaepass's People

Contributors

alkhajeh avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

flutter-uaepass's Issues

Bug: Android

Hello,

I would like to report a bug in this package related to the Android platform. The application is unable to listen to the return back URL information. Instead, it gets stuck in an endless loop

Steps to Reproduce:

Launch the demo application on an Android device.
Perform the action that triggers the return back URL functionality.
Observe that the application does not properly handle the return back URL and enters an endless loop.

could you please provide some information if this package is partially for Android?

for the IOS. it works well.
appreciate your efforts.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.