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

android: Set launchMode="singleTask" instead of "singleTop" #639

Merged
merged 2 commits into from May 7, 2024

Conversation

chrisbobbe
Copy link
Collaborator

This addresses #620 by making it so the whole app state isn't reset when coming back from Firefox in the web-auth flow. Discussion:
https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1776828

Later in that discussion, Greg found that this mode is the most appropriate for our app, and that setting taskAffinity="" is probably a good idea as a security-hardening measure.

Fixes: #620

@chrisbobbe chrisbobbe added a-Android Issues specific to Android, or requiring Android-specific work a-login a-first-hour Issues specific to using the app for the first time beta feedback Things beta users have specifically asked for labels Apr 30, 2024
@chrisbobbe chrisbobbe requested a review from gnprice April 30, 2024 21:36
@gnprice
Copy link
Member

gnprice commented Apr 30, 2024

Thanks for debugging and fixing this!

Let's make this two commits: first taskAffinity, which is an independent hardening measure, then launchMode. Otherwise all LGTM.

@chrisbobbe chrisbobbe force-pushed the pr-web-auth-sometimes-fails branch from 380df7d to 1e9a27d Compare May 2, 2024 00:04
@chrisbobbe
Copy link
Collaborator Author

Cool; done, PTAL.

This looks like a security-hardening measure that would be good to
do, independently of the upcoming change to launchMode="singleTask".
Discussion:
  https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1790071
@gnprice
Copy link
Member

gnprice commented May 7, 2024

Thanks! Looks good; merging, with two commit-message tweaks. One is a minor formatting change to make a paragraph wrap better, and the other a small correction or clarification:

$ git range-diff --creation-factor=90 origin pr/639 @
1:  7588b5a47 ! 1:  138b1e28b android: Set taskAffinity=""
    @@ Commit message
         android: Set taskAffinity=""
     
         This looks like a security-hardening measure that would be good to
    -    do, independently of the upcoming change to
    -    `launchMode="singleTask"`. Discussion:
    +    do, independently of the upcoming change to launchMode="singleTask".
    +    Discussion:
           https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1790071
     
      ## android/app/src/main/AndroidManifest.xml ##
2:  1e9a27d1f ! 2:  1251a0b06 android: Set launchMode="singleTask" instead of "singleTop"
    @@ Commit message
         This addresses #620 by making it so the whole app state isn't reset
         when coming back from Firefox in the web-auth flow. Discussion:
           https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1776828
    +
         Later in that discussion, Greg found that this mode is the most
    -    appropriate for our app.
    +    appropriate for the main activity of our app:
    +      https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1790019

         Fixes: #620

In particular the key about singleTask is that it's appropriate for the "main" or "root" activity of an app. We have some ancillary activities in our merged manifest, like this one (which I guess would get used if we passed [LaunchMode.inAppWebView] to launchUrl):

        <activity
            android:theme="@ref/0x1030007"
            android:name="io.flutter.plugins.urllauncher.WebViewActivity"
            android:exported="false" />

and those wouldn't be appropriate for android:launchMode="singleTask".

This addresses zulip#620 by making it so the whole app state isn't reset
when coming back from Firefox in the web-auth flow. Discussion:
  https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1776828

Later in that discussion, Greg found that this mode is the most
appropriate for the main activity of our app:
  https://chat.zulip.org/#narrow/stream/48-mobile/topic/Flutter.20app.20.2B.20SAML.20auth/near/1790019

Fixes: zulip#620
@gnprice gnprice force-pushed the pr-web-auth-sometimes-fails branch from 1e9a27d to 1135860 Compare May 7, 2024 00:50
@gnprice gnprice merged commit 1135860 into zulip:main May 7, 2024
1 check passed
@chrisbobbe chrisbobbe deleted the pr-web-auth-sometimes-fails branch May 7, 2024 02:30
@chrisbobbe
Copy link
Collaborator Author

I see; interesting. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-Android Issues specific to Android, or requiring Android-specific work a-first-hour Issues specific to using the app for the first time a-login beta feedback Things beta users have specifically asked for
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web auth sometimes fails
2 participants