-
Notifications
You must be signed in to change notification settings - Fork 57
fix(#401): update OIDC handling to use custom tabs #405
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,9 +39,18 @@ | |
</intent-filter> | ||
</activity> | ||
<activity android:name="EmbeddedBrowserActivity" | ||
android:screenOrientation="portrait" | ||
android:configChanges="orientation|screenSize" | ||
tools:ignore="DiscouragedApi"/> | ||
android:screenOrientation="portrait" | ||
android:configChanges="orientation|screenSize" | ||
android:launchMode="singleTask" | ||
android:exported="true" | ||
tools:ignore="DiscouragedApi"> | ||
<intent-filter android:autoVerify="true"> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
<category android:name="android.intent.category.BROWSABLE" /> | ||
<data android:scheme="@string/scheme" android:host="@string/app_host" android:pathPattern=".*"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that this section was added for token login. Does this still open the existent activity when an intent is triggered from SMS? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Correct. This is how token login links (and really any other kind of deep-linking) works.
Yes, this is key and is the whole point of the |
||
</intent-filter> | ||
</activity> | ||
<activity android:name="ConnectionErrorActivity" | ||
android:screenOrientation="portrait" | ||
android:configChanges="orientation|screenSize" | ||
|
@@ -65,16 +74,6 @@ | |
<activity android:name="DomainVerificationActivity" | ||
android:screenOrientation="portrait" | ||
tools:ignore="DiscouragedApi" /> | ||
<activity android:name="AppUrlIntentActivity" | ||
android:launchMode="singleInstance" | ||
android:exported="true"> | ||
<intent-filter android:autoVerify="true"> | ||
<action android:name="android.intent.action.VIEW" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
<category android:name="android.intent.category.BROWSABLE" /> | ||
<data android:scheme="@string/scheme" android:host="@string/app_host" android:pathPattern=".*"/> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name="UpgradingActivity" | ||
android:screenOrientation="portrait" | ||
android:configChanges="orientation|screenSize" | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,22 +114,33 @@ public void onReceiveValue(String result) { | |
|
||
enableUrlHandlers(container); | ||
|
||
Intent appLinkIntent = getIntent(); | ||
Uri appLinkData = appLinkIntent.getData(); | ||
browseTo(appLinkData); | ||
|
||
if (settings.allowsConfiguration()) { | ||
toast(redactUrl(appUrl)); | ||
} | ||
|
||
registerRetryConnectionBroadcastReceiver(); | ||
|
||
String recentNavigation = settings.getLastUrl(); | ||
if (isValidNavigationUrl(appUrl, recentNavigation)) { | ||
Intent appLinkIntent = getIntent(); | ||
Uri appLinkData = appLinkIntent.getData(); | ||
if (appLinkData != null) { | ||
// The app has been opened via an app link. | ||
browseTo(appLinkData); | ||
} else if (isValidNavigationUrl(appUrl, recentNavigation)) { | ||
// The app has been opened normally, and the user can start where they left off. | ||
container.loadUrl(recentNavigation); | ||
} else { | ||
// The app has been opened normally, but no previous URL is available. (Maybe it is the first time.) | ||
browseTo(null); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onNewIntent(Intent intent) { | ||
Uri appLinkData = intent.getData(); | ||
browseTo(appLinkData); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this what makes token login not launch a new instance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically, it is the One thing to note is that based on my testing, there is a bit of a difference between the code flows for launching an app link when no cht-android instance is currently running, vs when you already have an instance running in the background or something. In the first case, the |
||
} | ||
|
||
@SuppressWarnings("PMD.CallSuperFirst") | ||
@Override | ||
protected void onStart() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One subtle change here is switching the launchMode from
singleInstance
tosingleTask
. As far as I could tell, we always hadsingleInstace
set for theAppUrlIntentActivity
, but just reading the documentation, it feels like that is not really the right choice. With the way I currently understand things,singleTask
will allow us to always re-use the existing instance ofEmbeddedBrowserActivity
and continue the task chain as normal. ThesingleInstance
docs note that any additional activities launched off of the root are not part of the same task chain.TLDR, as far as I can tell,
singleTask
is "more normal" thansingleInstance
and we get the desired behavior.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this was a good read. I remember we had one version of the App that ended up launching multiple instances. Of course the background instances could not be reached or removed, and the only way they disappeared was when the whole app was killed.
:(
singleTask
sounds like would not create a new activity for our use case, but we should be careful none the less.