Closed timmcca-be closed 3 weeks ago
Thanks for this! I didn't know we could achieve this with only this simple change.
Can you also make sure the release build works and is correctly named?
@veloce verified!
Not sure that this is a better solution but another way of doing it would be to add resValue "string", "app_name", "Lichess"
in the defaultConfig block and resValue "string", "app_name", "Lichess Debug"
in the debug block. The value can then be used in the main AndroidManifest with @string/app_name
. This would move the logic from the debug AndroidManifest to the build.gradle.
We should change the appAuthRedirectScheme
value used by flutter_appauth for debug mode. It should be org.lichess.mobileV2.debug
.
By the way why theappAuthRedirectScheme
value is org.lichess.mobile
rather than org.lichess.mobileV2
?
Is it really needed that the appAuthRedirectScheme
is the same as the app id? I guess not since it works like that?
Why would we want it to be the same then?
After logging in Lichess users are redirected to both the Lichess and Lichess-DEBUG app and have to choose one between the two. If the appAuthRedirectScheme
is the same as the app id, users will redirected to the right app but maybe this is not worth taking the risk of breaking things to save one click.
hmm. doesn't seem too risky though, does it?
Will accept a PR if you're willing to test that. I guess the only change should be done in the build.gradle
so it looks simple.
Do not use org.lichess.mobileV2
because the flutter appauth doc says it should be all in lowercase.
So just keep it the same and append .debug
in debug mode I'd say.
This doesn't work with org.lichess.mobile.debug
because this is not the app id.
But then why does it work with org.lichess.mobile
? It is also not the app id.
My fault, I was wrong, the redirect uri doesn't need match the app id, it just that it often does.
And it works with org.lichess.mobile.debug
, it didn't work when I tried because I just didn't set the redirect_uri
in the auth call.
There is still a small problem when I login. Since the redirect uri org.lichess.mobile.debug://login-callback
is not trusted by the server, there is warning like on the screenshot.
To remove this warning, it would require to replace the redirect_uri here on dev environments so in the end I am not sure if this is worth the change.
Yes I think it's fine the way it is.
Summary
org.lichess.mobileV2
toorg.lichess.mobileV2.debug
, so it is possible to have both installed at the same timeThe Android emulator performs poorly on my computer, so I have been using my personal phone to test changes. With this change, I will no longer have to uninstall the production app from the Play Store in order to develop.
Testing
Initial testing:
flutter run --dart-define=LICHESS_HOST=lichess.dev --dart-define=LICHESS_WS_HOST=socket.lichess.dev
After additional request: