Support further schemes to enter the license

Most of  the app doesn't allow custom scheme URLs. Now we support the following schemes: 
* https://android.cryptomator.org/app/license#foo (preferred)
* https://android.cryptomator.org/app/license/foo
* cryptomator://license/foo (legacy)
This commit is contained in:
Julian Raufelder 2021-01-20 16:32:28 +01:00
parent 527dde9304
commit 0c04d16df0
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
2 changed files with 20 additions and 9 deletions

View File

@ -28,10 +28,10 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<!-- Necessary for OneDrive https://stackoverflow.com/a/50779232/825532 -->
<uses-library
android:name="org.apache.http.legacy"
@ -67,8 +67,8 @@
<activity
android:name=".ui.activity.SharedFilesActivity"
android:taskAffinity=".share"
android:excludeFromRecents="true"
android:taskAffinity=".share"
android:windowSoftInputMode="stateHidden|adjustPan">
<intent-filter android:label="@string/share_with_label">
<action android:name="android.intent.action.SEND" />
@ -122,15 +122,26 @@
<activity
android:name=".ui.activity.LicenseCheckActivity"
android:launchMode="singleTask">
<intent-filter android:label="@string/fab_transformation_scrim_behavior">
<intent-filter android:label="@string/dialog_enter_license_title">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="cryptomator"
android:host="*" />
android:host="*"
android:scheme="cryptomator" />
</intent-filter>
<intent-filter android:label="@string/dialog_enter_license_title">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="android.cryptomator.org"
android:pathPrefix="/app/license"
android:scheme="https" />
</intent-filter>
</activity>

View File

@ -16,8 +16,8 @@ class LicenseCheckPresenter @Inject internal constructor(
private val sharedPreferencesHandler: SharedPreferencesHandler) : Presenter<UpdateLicenseView>(exceptionHandlers) {
fun validate(data: Uri?) {
if (data != null) {
val license = data.lastPathSegment ?: ""
data?.let {
val license = it.fragment ?: it.lastPathSegment ?: ""
view?.showOrUpdateLicenseDialog(license)
doLicenseCheckUsecase
.withLicense(license)