From 0c04d16df0854e9be562bf0e565bfeace2e5bb30 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Wed, 20 Jan 2021 16:32:28 +0100 Subject: [PATCH] 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) --- presentation/src/main/AndroidManifest.xml | 25 +++++++++++++------ .../presenter/LicenseCheckPresenter.kt | 4 +-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/presentation/src/main/AndroidManifest.xml b/presentation/src/main/AndroidManifest.xml index 6c71db05..72983265 100644 --- a/presentation/src/main/AndroidManifest.xml +++ b/presentation/src/main/AndroidManifest.xml @@ -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"> @@ -122,15 +122,26 @@ - + + android:host="*" + android:scheme="cryptomator" /> + + + + + + + + diff --git a/presentation/src/main/java/org/cryptomator/presentation/presenter/LicenseCheckPresenter.kt b/presentation/src/main/java/org/cryptomator/presentation/presenter/LicenseCheckPresenter.kt index 8a321d0f..278a6dfb 100644 --- a/presentation/src/main/java/org/cryptomator/presentation/presenter/LicenseCheckPresenter.kt +++ b/presentation/src/main/java/org/cryptomator/presentation/presenter/LicenseCheckPresenter.kt @@ -16,8 +16,8 @@ class LicenseCheckPresenter @Inject internal constructor( private val sharedPreferencesHandler: SharedPreferencesHandler) : Presenter(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)