mirror of
https://github.com/Michatec/michas-droid.git
synced 2026-05-31 02:12:42 +02:00
Handle package web URIs
This commit is contained in:
@@ -52,6 +52,20 @@
|
||||
<data android:scheme="market" android:host="details" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<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="f-droid.org" />
|
||||
<data android:host="www.f-droid.org" />
|
||||
<data android:host="staging.f-droid.org" />
|
||||
<data android:pathPattern="/app/.*" />
|
||||
<data android:pathPattern="/packages/.*" />
|
||||
<data android:pathPattern="/.*/packages/.*" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
||||
@@ -176,9 +176,23 @@ abstract class ScreenActivity: AppCompatActivity() {
|
||||
get() {
|
||||
val uri = data
|
||||
return when {
|
||||
uri?.scheme == "package" || uri?.scheme == "fdroid.app" -> uri.schemeSpecificPart?.nullIfEmpty()
|
||||
uri?.scheme == "market" && uri.host == "details" -> uri.getQueryParameter("id")?.nullIfEmpty()
|
||||
else -> null
|
||||
uri?.scheme == "package" || uri?.scheme == "fdroid.app" -> {
|
||||
uri.schemeSpecificPart?.nullIfEmpty()
|
||||
}
|
||||
uri?.scheme == "market" && uri.host == "details" -> {
|
||||
uri.getQueryParameter("id")?.nullIfEmpty()
|
||||
}
|
||||
uri != null && uri.scheme in setOf("http", "https") -> {
|
||||
val host = uri.host.orEmpty()
|
||||
if (host == "f-droid.org" || host.endsWith(".f-droid.org")) {
|
||||
uri.lastPathSegment?.nullIfEmpty()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user