From 3f02439d0e5ac6185505d4fd98757b4d84150431 Mon Sep 17 00:00:00 2001 From: Stefan Niedermann Date: Thu, 18 Nov 2021 13:59:07 +0100 Subject: [PATCH] Add crash hint for SSO 0.6.0 / Files < 3.18 Signed-off-by: Stefan Niedermann --- app/build.gradle | 6 +++--- .../owncloud/notes/exception/tips/TipsAdapter.java | 14 +++++++++----- app/src/main/res/values/strings.xml | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 58e8df8a..6768737c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -91,13 +91,13 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0' // Android X - implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'androidx.appcompat:appcompat:1.4.0' implementation 'androidx.fragment:fragment:1.3.6' implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.recyclerview:recyclerview-selection:1.1.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'androidx.work:work-runtime:2.7.0' + implementation 'androidx.work:work-runtime:2.7.1' implementation 'com.google.android.material:material:1.4.0' // Database @@ -118,7 +118,7 @@ dependencies { testImplementation 'androidx.arch.core:core-testing:2.1.0' testImplementation 'junit:junit:4.13.2' testImplementation 'org.mockito:mockito-core:4.0.0' - testImplementation 'org.robolectric:robolectric:4.7' + testImplementation 'org.robolectric:robolectric:4.7.1' implementation fileTree(dir: 'libs', include: ['*.jar']) } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/exception/tips/TipsAdapter.java b/app/src/main/java/it/niedermann/owncloud/notes/exception/tips/TipsAdapter.java index dea80ed8..f82b612d 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/exception/tips/TipsAdapter.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/exception/tips/TipsAdapter.java @@ -1,13 +1,14 @@ package it.niedermann.owncloud.notes.exception.tips; +import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS; +import static it.niedermann.owncloud.notes.exception.ExceptionDialogFragment.INTENT_EXTRA_BUTTON_TEXT; + import android.content.Intent; import android.net.Uri; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.provider.Settings; -import android.util.Log; import android.view.LayoutInflater; -import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; @@ -20,6 +21,7 @@ import com.nextcloud.android.sso.exceptions.NextcloudApiNotRespondingException; import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotSupportedException; import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException; import com.nextcloud.android.sso.exceptions.TokenMismatchException; +import com.nextcloud.android.sso.exceptions.UnknownErrorException; import org.json.JSONException; @@ -31,9 +33,6 @@ import java.util.List; import it.niedermann.owncloud.notes.BuildConfig; import it.niedermann.owncloud.notes.R; -import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS; -import static it.niedermann.owncloud.notes.exception.ExceptionDialogFragment.INTENT_EXTRA_BUTTON_TEXT; - public class TipsAdapter extends RecyclerView.Adapter { @NonNull @@ -107,6 +106,11 @@ public class TipsAdapter extends RecyclerView.Adapter { add(R.string.error_dialog_insufficient_storage); break; } + } else if (throwable instanceof UnknownErrorException) { + if ("com.nextcloud.android.sso.QueryParam".equals(throwable.getMessage())) { + add(R.string.error_dialog_min_version, new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.nextcloud.client")) + .putExtra(INTENT_EXTRA_BUTTON_TEXT, R.string.error_action_update_files_app)); + } } } notifyDataSetChanged(); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c312022f..8ff3b9ca 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -196,6 +196,7 @@ Please make sure you have installed and enabled the "Notes" app on your server. Your server did respond with a HTTP 302 status code, which implies, that you do not have installed the Notes app on your server or something is misconfigured. This can be caused by custom overrides in a .htaccess-file or by Nextcloud apps like OID Client. Please disable all battery optimizations for Nextcloud and the Notes app. + The Notes Android app requires the Nextcloud Android app to be at least version 3.18. Added "%1$s" Shared text was empty Append to note @@ -321,6 +322,7 @@ Battery settings Open App info Network settings + Update No account configured yet You don\'t have configured any other accounts yet. Choose account