Updated Playstore flow for URL handling.

This commit is contained in:
Koen 2023-11-27 16:27:56 +01:00
parent 3d2840fe15
commit 0ae90ecf03
4 changed files with 67 additions and 54 deletions

View file

@ -133,50 +133,6 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="polycentric" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="youtu.be" />
<data android:host="www.you.be" />
<data android:host="youtube.com" />
<data android:host="www.youtube.com" />
<data android:host="m.youtube.com" />
<data android:host="rumble.com" />
<data android:host="kick.com" />
<data android:host="nebula.tv" />
<data android:host="odysee.com" />
<data android:host="patreon.com" />
<data android:host="soundcloud.com" />
<data android:host="twitch.tv" />
<data android:pathPrefix="/" />
</intent-filter>
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain" />
<data android:host="youtu.be" />
<data android:host="www.you.be" />
<data android:host="youtube.com" />
<data android:host="www.youtube.com" />
<data android:host="m.youtube.com" />
<data android:host="rumble.com" />
<data android:host="kick.com" />
<data android:host="nebula.tv" />
<data android:host="odysee.com" />
<data android:host="patreon.com" />
<data android:host="soundcloud.com" />
<data android:host="twitch.tv" />
</intent-filter>
</activity>
<activity

View file

@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.util.Log
import android.util.TypedValue
import android.view.Gravity
import android.view.LayoutInflater
@ -109,17 +110,25 @@ class UIDialogs {
view.findViewById<LinearLayout>(R.id.button_yes).apply {
this.setOnClickListener {
try {
val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", context.packageName, null)
intent.data = uri
context.startActivity(intent)
} catch (e: Throwable) {
toast(context, context.getString(R.string.failed_to_show_settings))
}
if (BuildConfig.IS_PLAYSTORE_BUILD) {
dialog.dismiss()
showDialogOk(context, R.drawable.ic_error_pred, context.getString(R.string.play_store_version_does_not_support_default_url_handling)) {
onYes?.invoke()
}
} else {
try {
val intent =
Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", context.packageName, null)
intent.data = uri
context.startActivity(intent)
} catch (e: Throwable) {
toast(context, context.getString(R.string.failed_to_show_settings))
}
onYes?.invoke()
dialog.dismiss()
onYes?.invoke()
dialog.dismiss()
}
}
}

View file

@ -684,6 +684,7 @@
<string name="allow_grayjay_to_handle_specific_urls">Allow Grayjay to handle specific URLs?</string>
<string name="allow_grayjay_to_handle_specific_urls_please_set_it_as_default_in_the_app_settings">When you click \'Yes\', the Grayjay app settings will open.\n\nThere, navigate to:\n1. "Open by default" or "Set as default" section.\nYou might find this option directly or under \'Advanced\' settings, depending on your device.\n\n2. Choose \'Open supported links\' for Grayjay.\n\n(some devices have this listed under \'Default Apps\' in the main settings followed by selecting Grayjay for relevant categories)</string>
<string name="failed_to_show_settings">Failed to show settings</string>
<string name="play_store_version_does_not_support_default_url_handling">Play store version does not support default URL handling.</string>
<string-array name="home_screen_array">
<item>Recommendations</item>
<item>Subscriptions</item>

View file

@ -6,5 +6,52 @@
<application>
<receiver android:name=".receivers.InstallReceiver" />
<activity android:name=".activities.MainActivity">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="youtu.be" />
<data android:host="www.you.be" />
<data android:host="youtube.com" />
<data android:host="www.youtube.com" />
<data android:host="m.youtube.com" />
<data android:host="rumble.com" />
<data android:host="kick.com" />
<data android:host="nebula.tv" />
<data android:host="odysee.com" />
<data android:host="patreon.com" />
<data android:host="soundcloud.com" />
<data android:host="twitch.tv" />
<data android:pathPrefix="/" />
</intent-filter>
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain" />
<data android:host="youtu.be" />
<data android:host="www.you.be" />
<data android:host="youtube.com" />
<data android:host="www.youtube.com" />
<data android:host="m.youtube.com" />
<data android:host="rumble.com" />
<data android:host="kick.com" />
<data android:host="nebula.tv" />
<data android:host="odysee.com" />
<data android:host="patreon.com" />
<data android:host="soundcloud.com" />
<data android:host="twitch.tv" />
</intent-filter>
</activity>
</application>
</manifest>