Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/mobile/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
<action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
</intent-filter>

<!-- Deeplink intent filter for audius.co and redirect.audius.co -->
<!-- Note: /oauth routes are black-listed via separate intent filter below -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand All @@ -63,6 +65,18 @@
<data android:host="redirect.audius.co" />
<data android:host="audius.co" />
</intent-filter>
<!-- Intent filter for oauth routes with autoVerify=false to black-list from App Links verification -->
<!-- These routes will still reach MainActivity which redirects them to browser -->
<intent-filter android:autoVerify="false">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:host="redirect.audius.co" />
Copy link
Member

Choose a reason for hiding this comment

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

just fyi i made changes in the embed player to not use redirect.audius.co, so i think we can probably drop it soon

<data android:host="audius.co" />
<data android:pathPrefix="/oauth" />
Copy link
Member

Choose a reason for hiding this comment

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

how is this a blacklist? it seems like it would match on this?

</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,19 @@ class MainActivity : ReactActivity() {
val path = data.path
// If the path starts with /oauth, open in browser instead
if (path != null && path.startsWith("/oauth")) {
val browserIntent = Intent(Intent.ACTION_VIEW, data)
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(browserIntent)
return true
try {
val browserIntent = Intent(Intent.ACTION_VIEW, data)
browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP)
// Verify that an activity can handle this intent
if (browserIntent.resolveActivity(packageManager) != null) {
startActivity(browserIntent)
return true
}
} catch (e: Exception) {
// If opening browser fails, at least prevent the app from handling the deeplink
e.printStackTrace()
return true
}
}
}

Expand Down