flutter_web_auth icon indicating copy to clipboard operation
flutter_web_auth copied to clipboard

Optimisation plugin for usage with Flutter module.

Open EgorLogachev opened this issue 3 years ago • 0 comments

Hi @LinusU . Thank you for your flutter_web_auth plugin. It helped us with our OAuth solution and saved our time. In our case we have 3 mobile apps on Native Android, iOS, and Flutter with the same functionality of authorization, so we've decided to implement the Flutter module and integrate it to the native side. We've faced some problems, so we have decided to optimize flutter_web_auth for Flutter modules. I suggest it can be useful for you and developers that use your solution.

Changes:

  • Android dependencies have been updated (repositories, Gradle plugin version, Kotlin version, etc.)
  • Android project migrated accordingly to new Android plugins APIs

BREAKING CHANGES:

  • Callback handling has been re-worked, so CallbackActivity has been removed as redundant. Right now enough register Intent Filter for your Flutter Activity only
<activity
    android:exported="true"
    android:name=".FlutterActivity"
    android:launchMode="singleTop"
    android:theme="@style/LaunchTheme"
    android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
    android:hardwareAccelerated="true"
    android:windowSoftInputMode="adjustResize" >

    <intent-filter android:label="flutter_web_auth">
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="YOU CALLBAK URI SCHEME" />
    </intent-filter>

</activity>
  • As I understood you were faced with the problem of handling browser results on Android, so you have added the cleanUpDanglingCalls feature. This feature has been re-worked and replaced from Flutter public interface to the Android native side.

  • We had a problem on the iOS side with obtaining FlutterViewController because in our case FlutterViewController was presented as a modal controller, so this line of code UIApplication.shared.delegate?.window??.rootViewController as? FlutterViewController didn't work for us. To fix that we have added FlutterPresentationContextProviding protocol, and each developer can implement it for AppDelegate and implement logic on how to obtain FlutterViewContorller.

EgorLogachev avatar Nov 06 '21 12:11 EgorLogachev