From e3674bd4e97092f39c93945ad6b2dbfbcb1228df Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Mon, 29 Apr 2024 21:45:03 +0300 Subject: [PATCH] sync: new server check fail popup (fixes #3412) (#3414) Co-authored-by: dogi --- app/build.gradle | 4 ++-- .../ole/planet/myplanet/datamanager/Service.kt | 15 ++++++++++++++- app/src/main/res/values-ar/strings.xml | 1 + app/src/main/res/values-es/strings.xml | 1 + app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-ne/strings.xml | 1 + app/src/main/res/values-so/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 8 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index bf1542dce3..e22a789cb8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.ole.planet.myplanet" minSdkVersion 21 targetSdkVersion 34 - versionCode 1500 - versionName "0.15.0" + versionCode 1501 + versionName "0.15.1" ndkVersion '21.3.6528147' testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true diff --git a/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt b/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt index c558823b41..e7bde5e05b 100644 --- a/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt +++ b/app/src/main/java/org/ole/planet/myplanet/datamanager/Service.kt @@ -1,6 +1,8 @@ package org.ole.planet.myplanet.datamanager +import android.app.AlertDialog import android.content.Context +import android.content.DialogInterface import android.content.SharedPreferences import android.net.Uri import android.text.TextUtils @@ -18,6 +20,7 @@ import org.ole.planet.myplanet.model.RealmCommunity import org.ole.planet.myplanet.model.RealmUserModel.Companion.isUserExists import org.ole.planet.myplanet.model.RealmUserModel.Companion.populateUsersTable import org.ole.planet.myplanet.service.UploadToShelfService +import org.ole.planet.myplanet.ui.sync.ProcessUserDataActivity import org.ole.planet.myplanet.utilities.AndroidDecrypter.Companion.generateIv import org.ole.planet.myplanet.utilities.AndroidDecrypter.Companion.generateKey import org.ole.planet.myplanet.utilities.Constants.KEY_UPGRADE_MAX @@ -324,18 +327,28 @@ class Service(private val context: Context) { customProgressDialog.dismiss() } } else { - Utilities.log("Failed to get id") customProgressDialog.dismiss() + showAlertDialog(context.getString(R.string.failed_to_get_configuration_id)) } } override fun onFailure(call: Call, t: Throwable) { t.message?.let { Utilities.log(it) } customProgressDialog.dismiss() + showAlertDialog(context.getString(R.string.device_couldn_t_reach_server_check_and_try_again)) } }) } + fun showAlertDialog(message: String?) { + val builder = AlertDialog.Builder(context) + builder.setMessage(message) + builder.setCancelable(true) + builder.setNegativeButton(R.string.okay) { dialog: DialogInterface, _: Int -> dialog.cancel() } + val alert = builder.create() + alert.show() + } + private fun getUrl(couchdbURL: String): String { var url = couchdbURL diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index b6582f9291..392397c164 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -1031,5 +1031,6 @@ الموقع: متكرر: تم إنشاؤه بواسطة: + فشل في الحصول على معرف التكوين. يرجى الاتصال بالمسؤول \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cd450523dd..abf9bbfba7 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -1031,5 +1031,6 @@ ubicación: recurrente: creado por: + No se pudo obtener el ID de configuración. Por favor, contacte al administrador \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4a03edac7e..c4e11afbd5 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1031,5 +1031,6 @@ emplacement: récurrent: créé par: + Impossible de récupérer l\'identifiant de configuration. Veuillez contacter l\'administrateur \ No newline at end of file diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index c98a159ff2..948c0c7cbc 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -1031,5 +1031,6 @@ स्थान: आवर्तमान: बनाएको: + बनावट आईडी प्राप्त गर्न असफल भयो। कृपया व्यवस्थापकसँग सम्पर्क गर्नुहोस्। \ No newline at end of file diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 70f35d927a..653bf60c04 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -1031,5 +1031,6 @@ goobta: ku dhaqan: lagu sameeyay: + Ma jirin ID-ka qaababka. Fadlan la xiriir maamulaha \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e94a81db6d..b4c854ee3d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1031,5 +1031,6 @@ location: recurring: created by: + failed to get configuration id. kindly contact admin \ No newline at end of file