A new Flutter plugin project that implementation code for Android with fcl-android and iOS with fcl-swift to support blocto SDK.
Android:
- Min SDK 22 or newer
iOS:
- Swift version >= 5.6
- iOS version >= 13
Add below section to your project's pubspec.yaml
fcl_flutter:
git:
url: https://github.com/mirror-media/fcl_flutter.git
ref: master
and run
flutter pub get
There have serveral presets for specific platform to make package run correctly.
- Add
maven { url 'https://jitpack.io' }
to your project'sbuild.gradle
.
This is required by flow-jvm-sdk.
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
- Add FCL content provider and webview activity to
AndroidManifest.xml
.
<application>
...
<activity
android:name="com.portto.fcl.webview.WebViewActivity"
android:theme="@style/FCLTheme"
android:launchMode="singleTop"/>
<provider android:authorities="com.portto.fcl.context"
android:name="com.portto.fcl.lifecycle.FCLContentProvider" android:exported="false" />
...
</application>
You may get INSTALL FAILED CONFLICTING PROVIDER error due to provider's authorities, you can change it to ${applicationId}.com.portto.fcl.context
to prevent error.
- Add themes for package's webview activity.
In (your project)/android/app/src/main/res/values/styles.xml
<resources>
...
<!-- Theme applied to the package's webview while login when the OS's Dark Mode setting is off -->
<style name="FCLTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
...
</resources>
In (your project)/android/app/src/main/res/values-night/styles.xml
<resources>
...
<!-- Theme applied to the package's webview while login when the OS's Dark Mode setting is on -->
<style name="FCLTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
...
</resources>
If you get duplicate class error when building your project, you can add below line to your project's app/build.gradle
dependencies {
...
configurations.implementation.exclude(group: 'com.google.firebase', module: 'protolite-well-known-types')
configurations.implementation.exclude(group: 'com.google.protobuf', module: 'protobuf-javalite')
}
- Setting Universal Links & Custom URL Scheme for your app. See this documentation to know how to set.
- Open your project's
Info.plist
, and add the following. This make your app know whether user install Blocto app.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>blocto-staging</string>
<string>blocto</string>
</array>
- Open your projects's
AppDelegate.swift
, and add the following. This make Blocto can open your app after user authorized in Blocto app.
import FCL_SDK
override func application(
_ app: UIApplication,
open url: URL,
options: [UIApplication.OpenURLOptionsKey: Any] = [:]
) -> Bool {
fcl.application(open: url)
return true
}
override func application(
_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
fcl.continueForLinks(userActivity)
return true
}