Giter VIP home page Giter VIP logo

flutter_account_kit's Introduction

flutter_account_kit

pub package Build Status Coverage Status A Flutter plugin for allowing users to authenticate with the native Android & iOS AccountKit SDKs

How do I use it?

For complete API documentation, just see the source code.

import 'package:flutter_account_kit/flutter_account_kit.dart';

FlutterAccountKit akt = new FlutterAccountKit();
LoginResult result = await akt.logInWithPhone();

switch (result.status) {
  case LoginStatus.loggedIn:
    _sendTokenToServer(result.accessToken.token);
    _showLoggedInUI();
    break;
  case LoginStatus.cancelledByUser:
    _showCancelledMessage();
    break;
  case LoginStatus.error:
    _showErrorOnUI();
    break;
}

Installation

To get things up and running, you'll have to declare a pubspec dependency in your Flutter project. Also some minimal Android & iOS specific configuration must be done, otherwise your app will crash.

On your Flutter project

See the installation instructions on pub.

Configuration

Find out your Facebook App ID and AccountKit Client Token from Facebook App's dashboard in the Facebook developer console.

Android
1. In **\/android/app/src/main/res/values/strings.xml**
  ...
  <string name="fb_app_id">YOUR_FACEBOOK_APP_ID</string>
  <string name="ak_client_token">YOUR_CLIENT_TOKEN</string>
  1. In <your project root>/android/app/src/main/AndroidManifest.xml
  ...
  <application>

      ...
      <meta-data
          android:name="com.facebook.sdk.ApplicationId"
          android:value="@string/fb_app_id" />
      <meta-data
          android:name="com.facebook.accountkit.ApplicationName"
          android:value="@string/app_name" />
      <meta-data
          android:name="com.facebook.accountkit.ClientToken"
          android:value="@string/ak_client_token" />
   </application>
   ...

This is the minimal required configuration. Take a look to the Account Kit documentation for Android for a more detailed guide.

(Optional) Exclude backup for Access Tokens on Android >= 6.0

As per this documentation, Account Kit does not support automated backup (introduced in Android 6.0). The following steps will exclude automated backup

  1. Create a file <your project root>/android/app/src/main/res/xml/backup_config.xml that contains the following:
  <?xml version="1.0" encoding="utf-8"?>
  <full-backup-content>
    <exclude domain="sharedpref" path="com.facebook.accountkit.AccessTokenManager.SharedPreferences.xml"/>
  </full-backup-content>
  1. In your AndroidManifest.xml add the following to exclude backup of Account Kit's Access Token.
  <application
    //other configurations here
    android:fullBackupContent="@xml/backup_config" // add this line
   >
iOS

Add your Facebook credentials to your project's Info.plist file

  <plist version="1.0">
    <dict>
      ...
      <key>FacebookAppID</key>
      <string>{your-app-id}</string>
      <key>AccountKitClientToken</key>
      <string>{your-account-kit-client-token}</string>
      <key>CFBundleURLTypes</key>
      <array>
        <dict>
          <key>CFBundleURLSchemes</key>
          <array>
            <string>ak{your-app-id}</string>
          </array>
        </dict>
      </array>
      ...
    </dict>
  </plist>

This is the minimal required configuration. Take a look to the Account Kit documentation for iOS for a more detailed guide.

Done!

Themes

iOS
import 'package:flutter/material.dart';
import 'package:flutter_account_kit/flutter_account_kit.dart';

final theme = AccountKitTheme(
    // Background
    backgroundColor: Color.fromARGB(255, 0, 120, 0,),
    backgroundImage: 'background.png',
    // Button
    buttonBackgroundColor: Color.fromARGB(255, 0, 153, 0),
    buttonBorderColor: Color.fromARGB(255, 0, 255, 0),
    buttonTextColor: Color.fromARGB(255, 0, 255, 0),
    // Button disabled
    buttonDisabledBackgroundColor: Color.fromARGB(255, 100, 153, 0),
    buttonDisabledBorderColor: Color.fromARGB(255, 100, 153, 0),
    buttonDisabledTextColor: Color.fromARGB(255, 100, 153, 0),
    // Header
    headerBackgroundColor: Color.fromARGB(255, 0, 153, 0),
    headerButtonTextColor: Color.fromARGB(255, 0, 153, 0),
    headerTextColor: Color.fromARGB(255, 0, 255, 0),
    // Input
    inputBackgroundColor: Color.fromARGB(255, 0, 255, 0),
    inputBorderColor: Color.hex('#ccc'),
    inputTextColor: Color(0xFFb74093),
    // Others
    iconColor: Color(0xFFFFFFFF),
    textColor: Color(0xFFb74093),
    titleColor: Color(0xFFb74093),
    // Header
    statusBarStyle: StatusBarStyle.lightStyle, // or StatusBarStyle.defaultStyle
   );
FlutterAccountKit akt = new FlutterAccountKit();
Config cfg = Config()
             ..theme = theme;
akt.configure(cfg);

To see the statusBarStyle reflected you must set the UIViewControllerBasedStatusBarAppearance property to true on your app's Info.plist file. You can do it from XCode screen shot 2016-08-02 at 11 44 07 am

Android

Check this commit to see how it's done in our sample app

  1. In your application styles.xml file (usually located in <your project root>/android/app/src/main/res/values folder) create a Theme with the following schema
<style name="LoginThemeYellow" parent="Theme.AccountKit">
    <item name="com_accountkit_primary_color">#f4bf56</item>
    <item name="com_accountkit_primary_text_color">@android:color/white</item>
    <item name="com_accountkit_secondary_text_color">#44566b</item>
    <item name="com_accountkit_status_bar_color">#ed9d00</item>

    <item name="com_accountkit_input_accent_color">?attr/com_accountkit_primary_color</item>
    <item name="com_accountkit_input_border_color">?attr/com_accountkit_primary_color</item>
</style>

See the full set of customizable fields here

  1. In your app AndroidManifest.xml file (usually under <your project root>/android/app/src/main folder) set that Theme to the AccountKitActivity
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" <-- Add this line
    ...>

    <!-- Set the AccountKitActivity theme -->
    <activity
      tools:replace="android:theme"
      android:name="com.facebook.accountkit.ui.AccountKitActivity"
      android:theme="@style/LoginThemeYellow" />

</manifest>

Troubleshooting

"A system issue occured, Please try again" when sending SMS

A. Check your FacebookAppID and AccountKitClientToken on iOS Info.plist and Android strings.xml are correct

B. If you have enabled the client access token flow in fb account kit dashboard, then responseType should be set to code when calling configure

// Configures the SDK with some options
import 'package:flutter_account_kit/flutter_account_kit.dart';

FlutterAccountKit akt = new FlutterAccountKit();
Config cfg = Config()
             ..responseType = ResponseType.code;
akt.configure(cfg);

Inspiration

This project was inspired by flutter_facebook_login and react-native-facebook-account-kit

flutter_account_kit's People

Contributors

ashutoshagrawal1010 avatar peerwaya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_account_kit's Issues

Getting Error: Invalid OAuth 2.0 Access Token in iOS

I tried to get account info after successful login but got all properties of Account object as null and also prints error log:

[AccountKit][Error]: Invalid OAuth 2.0 Access Token

Snippet:

await flutterAccountKit.configure(Config()
      ..facebookNotificationsEnabled = true
      ..receiveSMS = true
      ..readPhoneStateEnabled = true
      ..theme = FacebookitTheme.theme);
LoginResult result = await flutterAccountKit.logInWithPhone();
switch (result.status) {
    case LoginStatus.loggedIn:
      bool isLoggedIn = await flutterAccountKit.isLoggedIn;
      print(isLoggedIn) // false
       Account account = await flutterAccountKit.currentAccount;
       if (account != null) {
          print(account.phoneNumber); // null
          print(account.accountId); // null
       }
      return true;
    default:
       // do something else
 }
  1. Values in Info.plist is correct (triple checked it) and also enabled Enable Client Access Token Flow in App Dashboard.
  2. Only fails in iOS
$ flutter doctor -v
[✓] Flutter (Channel beta, v1.2.1, on Mac OS X 10.14.4 18E226, locale en-GB)
    • Flutter version 1.2.1 at /usr/local/flutter
    • Framework revision 8661d8aecd (3 months ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

AccountKit was renamed as FlutterAccountKit

You need update the readme
AccountKit akt = new AccountKit(); to
FlutterAccountKit akt = new FlutterAccountKit();
because it gives an error
Undefined class 'AccountKit'.
other than that it works perfect.
Thank you for your effort 👍

App Event Dropped

Hi,

after successful log in by SMS my logs are spammed with the following message:
com.facebook.accountkit.internal.AppEventsLogger( 7772): App Event Dropped

What can I do about it? It looks like that is not the intended behavior, so what does cause this?

Thanks,
Giorgio

Crash With Firebase messaging

When use account kit with project which uses firebase messaging, it crash as

E/AndroidRuntime( 7191): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
E/AndroidRuntime( 7191): at com.google.android.gms.auth.api.Auth.(Unknown Source)
E/AndroidRuntime( 7191): at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:281)
E/AndroidRuntime( 7191): at android.app.Activity.performCreate(Activity.java:6355)
E/AndroidRuntime( 7191): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
E/AndroidRuntime( 7191): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2438)
E/AndroidRuntime( 7191): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2545)
E/AndroidRuntime( 7191): at android.app.ActivityThread.access$1100(ActivityThread.java:151)
E/AndroidRuntime( 7191): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1396)
E/AndroidRuntime( 7191): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 7191): at android.os.Looper.loop(Looper.java:157)
E/AndroidRuntime( 7191): at android.app.ActivityThread.main(ActivityThread.java:5601)
E/AndroidRuntime( 7191): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7191): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
E/AndroidRuntime( 7191): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
E/AndroidRuntime( 7191): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/com.eg-1/base.apk"],nativeLibraryDirectories=[/data/app/com.eg-1/lib/arm64, /data/app/com.eg-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]
E/AndroidRuntime( 7191): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime( 7191): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
E/AndroidRuntime( 7191): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
E/AndroidRuntime( 7191): ... 14 more
E/AndroidRuntime( 7191): Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.api.Api$zzf
E/AndroidRuntime( 7191): at java.lang.Class.classForName(Native Method)
E/AndroidRuntime( 7191): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
E/AndroidRuntime( 7191): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
E/AndroidRuntime( 7191): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
E/AndroidRuntime( 7191): ... 15 more
E/AndroidRuntime( 7191): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I/Process ( 7191): Sending signal. PID: 7191 SIG: 9

And when remove firebase messaging pub, its working as expected.

flutter_account_kit version ^0.6.4
firebase_messaging version ^2.1.0

Please Note : It crash your sample project also, after include firebase_messaging.

IOS login with token problem

Hi,

I found 1 problem, if you want to check user's login state before login, using somethith like Account account = await FlutterAccountKit().currentAccount; and then log in, if phone is empty, AKFResponseTypeAuthorizationCode is always the case, no matter what ResponseType I'll choose in configs. It leads to error in my case.
So for those, who faced this problem, you should config your FlutterAccountKit first, or comment out if-statement like i did on the screenshot
Screen Shot 2019-07-05 at 15 59 05

AccountKitConfiguration class not found

I run the example for you provider, then click Login button Logcat show error

flutter environment

 flutter doctor -v
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-HK)
    • Flutter version 1.2.1 at /Users/xx/development/flutter
    • Framework revision 8661d8aecd (5 weeks ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/wu/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/wu/Android/Sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

Error

Parcel: Class not found when unmarshalling: com.facebook.accountkit.ui.AccountKitConfiguration
    java.lang.ClassNotFoundException: com.facebook.accountkit.ui.AccountKitConfiguration
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:309)
        at java.lang.Class.forName(Class.java:273)
        at android.os.Parcel.readParcelableCreator(Parcel.java:2281)
        at android.os.Parcel.readParcelable(Parcel.java:2245)
        at android.os.Parcel.readValue(Parcel.java:2152)
        at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
        at android.os.BaseBundle.unparcel(BaseBundle.java:221)
        at android.os.BaseBundle.getString(BaseBundle.java:918)
        at android.content.Intent.getStringExtra(Intent.java:5236)
        at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1502)
        at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1086)
        at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4345)
        at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4244)
        at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:144)
        at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2789)
        at android.os.Binder.execTransact(Binder.java:446)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.accountkit.ui.AccountKitConfiguration" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at java.lang.Class.classForName(Native Methodat java.lang.Class.forName(Class.java:309at java.lang.Class.forName(Class.java:273at android.os.Parcel.readParcelableCreator(Parcel.java:2281at android.os.Parcel.readParcelable(Parcel.java:2245at android.os.Parcel.readValue(Parcel.java:2152at android.os.Parcel.readArrayMapInternal(Parcel.java:2485at android.os.BaseBundle.unparcel(BaseBundle.java:221at android.os.BaseBundle.getString(BaseBundle.java:918at android.content.Intent.getStringExtra(Intent.java:5236at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1502at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1086at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4345at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4244at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:144at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2789at android.os.Binder.execTransact(Binder.java:446Suppressed: java.lang.ClassNotFoundException: com.facebook.accountkit.ui.AccountKitConfiguration
        at java.lang.Class.classForName(Native Method)
        at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
        at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
        		... 18 more
     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Account kit conflicts with Firestore on google play services

Hello. I am trying to set up new flutter application with AccountKit and Firebase Firestore. When tried to compile it I got an error corresponding to firebase. Account Kit depends on firebase 11.8.0 (why firebase at all?) and firestore works with 15.0.1.
After setting up multidex - application compiles but crashes when trying to run AccountKit.
Error:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
at com.google.android.gms.auth.api.Auth.(Unknown Source)
at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:281)
at android.app.Activity.performCreate(Activity.java:6865)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2435)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5375)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/com.mutu.ru-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mutu.ru-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.google.android.gms.auth.api.Auth.(Unknown Source) 
at com.facebook.accountkit.ui.AccountKitActivity.onCreate(AccountKitActivity.java:281) 
at android.app.Activity.performCreate(Activity.java:6865) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2435) 
at android.app.ActivityThread.access$900(ActivityThread.java:153) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5375) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699) 
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.api.Api$zzf
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 16 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

pubspec.yaml:

name: ru
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
flutter_account_kit: ^0.5.2
cupertino_icons: ^0.1.2
cloud_firestore: ^0.8.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true

android/build.gradle:

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "27.1.0"
}
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

android\app\build.gradle:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.mutu.ru"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so flutter run --release works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services

Error while `flutter build apk`

I am getting this error from flutter_account_kit 0.5.2. Where did it go wrong?

Initializing gradle...                                       1.5s
Resolving dependencies...                                   10.4s
Running 'gradlew assembleDebug'...                               

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:appcompat-v7' has different version for the compile (25.3.1) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
 6.1s
Gradle build failed: 1
➜  flutter --version
Flutter 0.8.2 • channel beta • https://github.com/flutter/flutter.git
Framework • revision 5ab9e70727 (4 weeks ago) • 2018-09-07 12:33:05 -0700
Engine • revision 58a1894a1c
Tools • Dart 2.1.0-dev.3.1.flutter-760a9690c2

How to change UI color/configuration

I want to customize the UI of AccountKit used in my Application.

I have tried to edit the customization options shown in the Facebook App Dashboard, but I realized that is not reflected on the app directly.

On native android, I know that this can be done by creating a UIManager to hold the settings and then using the AccountKitConfigurationBuilder object to set them for the app.

What is the equivalent in Flutter?

Is there any example anywhere?

Broken

This is broken with the recent flutter release. Code doesn't run and returns error from the Java end.

too many print statements in flutter

I had successfully integrated account kit & it's working perfectly in my flutter app. But I am getting too many print statements in the terminal when I run the app. The following is a bunch of the prints that account kit puts in my terminal:

I/System.out(13597): [CDS]rx timeout:10000
I/System.out(13597): [CDS]rx timeout:10000
I/System.out(13597): [CDS]rx timeout:10000
I/System.out(13597): [CDS]rx timeout:10000
I/System.out(13597): [CDS]SO_SND_TIMEOUT:0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=355 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=7 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=2048 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=107 write_timeout_millis=0
I/System.out(13597): [OkHttp] sendRequest<<
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslWrite buf=0x7f4aeb3000 len=5 write_timeout_millis=0
D/NativeCrypto(13597): ssl=0x7f4d8e0980 sslRead buf=0x7f4aeb3000 len=2048,timeo=10000

Though this is not an issue, this is causing me a difficulty in tracing the program execution. I used to have a bunch of debugPrint statements, and because of this issue, I can't find the debugPrint statements as these print statements are flooding.

I need help in solving this issue, and I hope to get this issue solved at the earliest!

Crash on Release Run

I am getting an error when I ran flutter run --release. The error message contains the following information:
E/flutter (22170): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoSuchFieldError: No static field ACCOUNT_KIT_ACTIVITY_CONFIGURATION of type Ljava/lang/String; in class Lcom/facebook/accountkit/ui/AccountKitActivity; or its superclasses (declaration of 'com.facebook.accountkit.ui.AccountKitActivity' appears in base.apk) E/flutter (22170): at com.peerwaya.flutteraccountkit.FlutterAccountKitPlugin$AccountKitDelegate.a(:12) E/flutter (22170): at com.peerwaya.flutteraccountkit.FlutterAccountKitPlugin.onMethodCall(:8) E/flutter (22170): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(:2) E/flutter (22170): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(:5) E/flutter (22170): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(:2) E/flutter (22170): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter (22170): at android.os.MessageQueue.next(MessageQueue.java:326) E/flutter (22170): at android.os.Looper.loop(Looper.java:181) E/flutter (22170): at android.app.ActivityThread.main(ActivityThread.java:6986) E/flutter (22170): at java.lang.reflect.Method.invoke(Native Method) E/flutter (22170): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) E/flutter (22170): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445) E/flutter (22170): F/flutter (22170): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env).

On debug run, it works just fine.

Error when define config "initialPhoneNumber"

Hello..

I want to give example to my users how to fill the phone number field. Because I have configured "defaultCountry" but its just set the flag country and "countryCode" does not appear. This will be confusing for some users.
So I put "initialPhoneNumber"

await akt.configure(Config()
..facebookNotificationsEnabled = true
..receiveSMS = true
..readPhoneStateEnabled = true
..theme = theme
..initialPhoneNumber = PhoneNumber(countryCode: "62", number: "8123456789")
..defaultCountry = "ID");

And I got an error in this line

final result = await akt.logInWithPhone();

this is the error

E/flutter (26144): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter (26144): PlatformException(error, java.util.HashMap cannot be cast to java.lang.String, null)
E/flutter (26144): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:551:7)
E/flutter (26144): #1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:279:18)
E/flutter (26144):
E/flutter (26144): #2 FlutterAccountKit.logInWithPhone (package:flutter_account_kit/src/account_kit.dart:171:56)
E/flutter (26144):
E/flutter (26144): #3 _Login.login (package:user/login.dart:191:30)
E/flutter (26144):
E/flutter (26144): #4 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:503:14)
E/flutter (26144): #5 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:558:30)
E/flutter (26144): #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:102:24)
E/flutter (26144): #7 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter (26144): #8 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:175:7)
E/flutter (26144): #9 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:315:9)
E/flutter (26144): #10 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
E/flutter (26144): #11 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
E/flutter (26144): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:143:19)
E/flutter (26144): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:121:22)
E/flutter (26144): #14 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (26144): #15 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:64:7)
E/flutter (26144): #16 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:48:7)
E/flutter (26144): #17 _invoke1 (dart:ui/hooks.dart:142:13)
E/flutter (26144): #18 _dispatchPointerDataPacket (dart:ui/hooks.dart:99:5)

I hope for next update the "countryCode" will appear when the "defaultCountry" have configured
Thx

Signing up after deleting account results in an error

Hi,

I deleted my account kit account (deleted from facebook servers) and by calling logOut() and then tried to log in again with the same number. It works well until the SMS code is checked. This step always shows me A system issue occurred. Try again later. I guess account kit is properly configured as it works fine on several devices on iOS and Android for the first log in.
Weird thing is: When I try to log in that second time after deleting the account, then close the account kit screen, and then reopen it again, everything works fine.

Any clues what could cause this? I'm using account kit with token flow :)

Crash on release build only (Android Appbundle)

Using the new app-bundle format ( flutter command: flutter build appbundle ), after building the app as an app bundle and downloading from the store, attempting to use the plugin crashes on device.

During testing with debug build everything works, and ios is also working perfectly; but release android builds using appbundle are failing.

Optional SMS feature

Hi, could we have an option to disable the SMS button in the Account Kit UI?

FlutterAccountKitPlugin.java:

if (this.options.containsKey("enableSMS")) {
    boolean enableSMS = (Boolean) this.options.get("enableSMS");
    configurationBuilder.setEnableSms(enableSMS);
}

config.dart:

  /// Enables the SMS button in the Account Kit UI.
  ///
  bool enableSMS;
...
  Map<String, dynamic> map = <String, dynamic>{
      'initialAuthState': initialAuthState,
      'facebookNotificationsEnabled': facebookNotificationsEnabled,
      'readPhoneStateEnabled': readPhoneStateEnabled,
      'enableSMS': enableSMS,
      'receiveSMS': receiveSMS,
      'defaultCountry': defaultCountry,
      'responseType': _responseTypeAsString(),
      'titleType': _titleTypeAsString(),
      'initialEmail': initialEmail,
      'initialPhoneCountryPrefix': initialPhoneNumber != null ? initialPhoneNumber.countryCode : null,
      'initialPhoneNumber': initialPhoneNumber != null ? initialPhoneNumber.number : null,
    };
 ...

How to get CODE instead of TOKEN from AccountKit

Our App is currently implemented in Native Java - and uses the CODE returned by AccountKit in order to make further requests.

On Native Java (Android), here is how it works:

EITHER - the AccessToken Code you must Enable the Client Access Token Flow and set  new AccountKitConfiguration.AccountKitConfigurationBuilder(LoginType.PHONE, AccountKitActivity.ResponseType.TOKEN);

OR - the Authorization Code you must Disable the Client Access Token Flow and and set  new AccountKitConfiguration.AccountKitConfigurationBuilder(LoginType.PHONE, AccountKitActivity.ResponseType.CODE);

In our implementation, we need to use ResponseType.CODE in Java due to how the back-end is organized. This is currently implemented and working (without turning Enable Client Access Token Flow off in the backend.

Now, when it comes to AccountKit's Flutter Implementation by you, you mentioned here:

/// use [code] if the Enable Client Access Token Flow switch in your app's dashboard is OFF

But what happens when I turn off this:

image

Is that I face an error on my Flutter's End when logging in:

image

This means that unlike what you suggested (use CODE when this is turned OFF), I am actually facing an unknown error when this is turned off.

Any help regarding how we can get the CODE from the ResponseType would be much appreciated.

application crash

App is crash when backing enter OTP code activity .
E/AndroidRuntime( 5233): java.lang.IndexOutOfBoundsException: setSpan (-1 ... 12) starts before 0
E/AndroidRuntime( 5233): at android.text.SpannableStringInternal.checkRange(SpannableStringInternal.java:434)
E/AndroidRuntime( 5233): at android.text.SpannableStringInternal.setSpan(SpannableStringInternal.java:155)
E/AndroidRuntime( 5233): at android.text.SpannableString.setSpan(SpannableString.java:46)
E/AndroidRuntime( 5233): at com.facebook.accountkit.ui.LoginConfirmationCodeContentController$TitleFragment.setPhoneNumberView(LoginConfirmationCodeContentController.java:127)
E/AndroidRuntime( 5233): at com.facebook.accountkit.ui.ConfirmationCodeContentController$TitleFragment.onViewReadyWithState(ConfirmationCodeContentController.java:105)
E/AndroidRuntime( 5233): at com.facebook.accountkit.ui.ViewStateFragment.onActivityCreated(ViewStateFragment.java:66)
E/AndroidRuntime( 5233): at com.facebook.accountkit.ui.TitleFragmentFactory$TitleFragment.onActivityCreated(TitleFragmentFactory.java:50)
E/AndroidRuntime( 5233): at android.app.Fragment.performActivityCreated(Fragment.java:2361)
E/AndroidRuntime( 5233): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1014)
E/AndroidRuntime( 5233): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1171)
E/AndroidRuntime( 5233): at android.app.BackStackRecord.run(BackStackRecord.java:815)

Error on installing app

D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\flutter_account_kit-0.6.6\android\src\main\java\com\peerwaya\flutteraccountkit\FlutterAccountKitPlugin.java:7: error: package androidx.core.content does not exist
import androidx.core.content.ContextCompat;
^
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\flutter_account_kit-0.6.6\android\src\main\java\com\peerwaya\flutteraccountkit\FlutterAccountKitPlugin.java:208: error: cannot find symbol
if (readPhoneStateEnabled && PackageManager.PERMISSION_DENIED == ContextCompat.checkSelfPermission(
^
symbol: variable ContextCompat
location: class AccountKitDelegate
D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\flutter_account_kit-0.6.6\android\src\main\java\com\peerwaya\flutteraccountkit\FlutterAccountKitPlugin.java:217: error: cannot find symbol
if (receiveSMS && PackageManager.PERMISSION_DENIED == ContextCompat.checkSelfPermission(
^
symbol: variable ContextCompat
location: class AccountKitDelegate
Note: D:\Flutter\flutter.pub-cache\hosted\pub.dartlang.org\flutter_account_kit-0.6.6\android\src\main\java\com\peerwaya\flutteraccountkit\FlutterAccountKitPlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':flutter_account_kit:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 27s
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

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.