Merge branch 'freebeartogoodhome-androidLogin'

This commit is contained in:
Vincent Velociter
2026-05-26 12:06:58 +02:00
2 changed files with 24 additions and 5 deletions
+13 -5
View File
@@ -154,15 +154,23 @@
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
</application> </application>
<!-- Required to query activities that can process text, see: <!-- On Android 11+ (API 30) package visibility is restricted: the app can only see/resolve other
https://developer.android.com/training/package-visibility and apps it explicitly declares intents for here. See:
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT. https://developer.android.com/training/package-visibility -->
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries> <queries>
<!-- Lets the Flutter engine resolve text-processing apps (io.flutter.plugin.text.ProcessTextPlugin), see:
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT -->
<intent> <intent>
<action android:name="android.intent.action.PROCESS_TEXT"/> <action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/> <data android:mimeType="text/plain"/>
</intent> </intent>
<!-- Lets url_launcher discover a browser/Custom Tabs handler for https. Required for OAuth
login: without it, launchUrl() can't resolve a browser on Android 11+ and returns false,
so the in-app browser never opens and sign-in fails. -->
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries> </queries>
</manifest> </manifest>
@@ -2,6 +2,7 @@ package org.lichess.mobileV2
import android.app.ActivityManager import android.app.ActivityManager
import android.content.Context import android.content.Context
import android.content.Intent
import android.graphics.Rect import android.graphics.Rect
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
@@ -20,6 +21,16 @@ class MainActivity: FlutterActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
// The OAuth redirect (org.lichess.mobile://login-callback) is delivered here, not in onCreate,
// because OAuthCallbackActivity forwards it to this already-running singleTop instance. Flutter's
// default handling leaves getIntent() pointing at the stale launch intent, so app_links would read
// the wrong URI and the login flow would never receive the callback. setIntent() updates the
// activity's current intent to the one carrying the OAuth code so app_links surfaces it correctly.
override fun onNewIntent(intent: Intent) {
setIntent(intent)
super.onNewIntent(intent)
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine) super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, GESTURES_CHANNEL).setMethodCallHandler { MethodChannel(flutterEngine.dartExecutor.binaryMessenger, GESTURES_CHANNEL).setMethodCallHandler {