Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to install Play Store and debug builds on the same device #731

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

timmcca-be
Copy link
Contributor

@timmcca-be timmcca-be commented Jun 2, 2024

Summary

  • Change the application ID of the debug build on Android from org.lichess.mobileV2 to org.lichess.mobileV2.debug, so it is possible to have both installed at the same time
  • Rename the app from "Lichess beta" to "Lichess - DEBUG", so it is easy to tell which version is which

The 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:

  • Installed "Lichess beta" from the Play Store
  • Installed the debug build via flutter run --dart-define=LICHESS_HOST=lichess.dev --dart-define=LICHESS_WS_HOST=socket.lichess.dev
  • Verified that both builds are installed
  • Verified that the debug build is named "Lichess - DEBUG"
  • Verified that the debug build can still sign into lichess.dev (to ensure OAuth still works)

After additional request:

  • Built and installed the release build
  • Verified that the release build is still named "Lichess"

android:usesCleartextTraffic="true"/>
<application tools:replace="android:label"
android:usesCleartextTraffic="true"
android:label="Lichess beta - DEBUG"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say just call it Lichess - DEBUG.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah nice - I missed that you renamed the release app!

@veloce
Copy link
Contributor

veloce commented Jun 3, 2024

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?

@timmcca-be
Copy link
Contributor Author

@veloce verified!

@timmcca-be timmcca-be requested a review from veloce June 3, 2024 15:54
Copy link
Contributor

@veloce veloce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

It would be nice to do the same for iOS. But that can be done in another PR.

@veloce veloce merged commit f1591d2 into lichess-org:main Jun 3, 2024
1 check passed
@julien4215
Copy link
Contributor

julien4215 commented Jun 3, 2024

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.

@julien4215
Copy link
Contributor

We should change the appAuthRedirectScheme value used by flutter_appauth for debug mode. It should be org.lichess.mobileV2.debug.

By the way why the appAuthRedirectScheme value is org.lichess.mobile rather than org.lichess.mobileV2 ?

@veloce
Copy link
Contributor

veloce commented Jun 4, 2024

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?

@julien4215
Copy link
Contributor

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.

@veloce
Copy link
Contributor

veloce commented Jun 4, 2024

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.

@julien4215
Copy link
Contributor

This doesn't work with org.lichess.mobile.debug because this is not the app id.

@veloce
Copy link
Contributor

veloce commented Jun 4, 2024

But then why does it work with org.lichess.mobile? It is also not the app id.

@julien4215
Copy link
Contributor

julien4215 commented Jun 8, 2024

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.

@veloce
Copy link
Contributor

veloce commented Jun 8, 2024

Yes I think it's fine the way it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants