Skip to content

Commit

Permalink
Fixed: we can't discover the peers for sending/receiving ZIM files if…
Browse files Browse the repository at this point in the history
… we disallow the location/nearby or storage permission twice.

* Improved the message shown in `NearbyWifiPermission` dialog.
* Removed the unused and extra translation from project.
  • Loading branch information
MohitMaliDeveloper committed Feb 26, 2024
1 parent e6b10c0 commit 5d483f5
Show file tree
Hide file tree
Showing 41 changed files with 8 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import org.kiwix.kiwixmobile.core.extensions.getToolbarNavigationIcon
import org.kiwix.kiwixmobile.core.extensions.setToolTipWithContentDescription
import org.kiwix.kiwixmobile.core.extensions.toast
import org.kiwix.kiwixmobile.core.main.CoreMainActivity
import org.kiwix.kiwixmobile.core.navigateToAppSettings
import org.kiwix.kiwixmobile.core.utils.SharedPreferenceUtil
import org.kiwix.kiwixmobile.core.utils.dialog.AlertDialogShower
import org.kiwix.kiwixmobile.core.utils.dialog.KiwixDialog
Expand Down Expand Up @@ -325,8 +326,8 @@ class LocalFileTransferFragment :
if (!permissionGranted) {
if (shouldShowRationale(NEARBY_WIFI_DEVICES)) {
alertDialogShower.show(
KiwixDialog.NearbyWifiPermissionRationaleOnHostZimFile,
::askNearbyWifiDevicesPermission
KiwixDialog.NearbyWifiPermissionRationale,
requireActivity()::navigateToAppSettings

Check warning on line 330 in app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/LocalFileTransferFragment.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/LocalFileTransferFragment.kt#L329-L330

Added lines #L329 - L330 were not covered by tests
)
} else {
askNearbyWifiDevicesPermission()
Expand All @@ -339,7 +340,7 @@ class LocalFileTransferFragment :
if (shouldShowRationale(ACCESS_FINE_LOCATION)) {
alertDialogShower.show(
KiwixDialog.LocationPermissionRationale,
::requestLocationPermission
requireActivity()::navigateToAppSettings

Check warning on line 343 in app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/LocalFileTransferFragment.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/LocalFileTransferFragment.kt#L343

Added line #L343 was not covered by tests
)
} else {
requestLocationPermission()
Expand Down Expand Up @@ -369,7 +370,7 @@ class LocalFileTransferFragment :
if (shouldShowRationale(WRITE_EXTERNAL_STORAGE)) {
alertDialogShower.show(
KiwixDialog.StoragePermissionRationale,
::requestStoragePermissionPermission
requireActivity()::navigateToAppSettings

Check warning on line 373 in app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/LocalFileTransferFragment.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/org/kiwix/kiwixmobile/localFileTransfer/LocalFileTransferFragment.kt#L373

Added line #L373 was not covered by tests
)
} else {
requestStoragePermissionPermission()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ sealed class KiwixDialog(
android.R.string.cancel
)

object NearbyWifiPermissionRationaleOnHostZimFile : KiwixDialog(
object NearbyWifiPermissionRationale : KiwixDialog(

Check warning on line 52 in core/src/main/java/org/kiwix/kiwixmobile/core/utils/dialog/KiwixDialog.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/utils/dialog/KiwixDialog.kt#L52

Added line #L52 was not covered by tests
null,
R.string.permission_rationale_location_on_host_zim_file,
R.string.permission_rationale_nearby,

Check warning on line 54 in core/src/main/java/org/kiwix/kiwixmobile/core/utils/dialog/KiwixDialog.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/utils/dialog/KiwixDialog.kt#L54

Added line #L54 was not covered by tests
android.R.string.ok,
android.R.string.cancel
)
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,6 @@
<string name="severe_loss_error">خطأ شديد! حاول تعطيل/إعادة تمكين الواي فاي P2P</string>
<string name="connection_failed">فشل الاتصال</string>
<string name="permission_rationale_location">مطلوب إذن للموقع بواسطة أندرويد للسماح للتطبيق باكتشاف الأجهزة المقترنة</string>
<string name="permission_rationale_location_on_host_zim_file">مطلوب إذن للموقع بواسطة أندرويد للسماح للتطبيق باكتشاف ملفات زيم (Zim) المستضافة</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">يتطلب Android إذنًا لأجهزة wifi المجاورة للسماح للتطبيق باستضافة ملفات Zim</string>
<string name="permission_refused_location">لا يمكن تحديد موقع الأجهزة المقترنة دون أذونات الموقع</string>
<string name="permission_refused_storage">لا يمكن الوصول إلى ملفات زيم (ZIM) دون إذن وحدة تخزين</string>
<string name="request_enable_location">تمكين الموقع للسماح باكتشاف الأجهزة المقترنة</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@
<string name="severe_loss_error">Závažná chyba! Zkuste vypnout/znovu zapnout WiFi P2P</string>
<string name="connection_failed">Spojení selhalo</string>
<string name="permission_rationale_location">Systém Android vyžaduje povolení polohy, aby aplikace mohla detekovat zařízení v okolí</string>
<string name="permission_rationale_location_on_host_zim_file">Android vyžaduje povolení umístění, aby aplikace mohla hostovat soubory Zim</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Android vyžaduje povolení zařízení Wi-Fi v okolí, aby mohla aplikace hostovat soubory Zim</string>
<string name="permission_refused_location">Nelze nalézt zařízení v okolí bez přístupu k poloze</string>
<string name="permission_refused_storage">Nelze získat přístup k souborům zim bez povolení přístupu do úložiště</string>
<string name="request_enable_location">Povolit přístup k poloze a umožnit vyhledávání zařízení</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-dag/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@
<string name="severe_loss_error">Chiriŋ din mali yaa! Labi niŋ ŋmaabu labi\'niŋ WiFi P2P</string>
<string name="connection_failed">Laɣimbu zaɣisiya</string>
<string name="permission_rationale_location">Dooshee soli nyɛla binshɛli Android ni bora ni di tooi chɛ ka app ŋɔ tooi baŋ di taba</string>
<string name="permission_rationale_location_on_host_zim_file">Dooshee soli nyɛla binshɛli Android ni bora ni di tooi chɛ ka app ŋɔ gbubi Zim fasara nima</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">WiFi din miri na bimbuɣisira soli nyɛla Android ni bori shɛli ni di tooi chɛ ka app ŋɔ gbubi Zim fasara nima</string>
<string name="permission_refused_location">Ku tooi m-bo gbaai di taba shee di yi niŋ ka a bi ti dooshee soya</string>
<string name="permission_refused_storage">Ku tooi nya zim fasara nima di yi niŋ ka a bi ti deei niŋ shee soli</string>
<string name="request_enable_location">Tim dooshee soli di yɛn chɛ ka di gbaai di taba</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@
<string name="severe_loss_error">Schwerer Fehler! Versuchen Sie, Wi-Fi P2P auszuschalten und wieder einzuschalten</string>
<string name="connection_failed">Verbindung fehlgeschlagen</string>
<string name="permission_rationale_location">Android benötigt eine Standorterlaubnis, damit die App Peer-Geräte erkennen kann.</string>
<string name="permission_rationale_location_on_host_zim_file">Android benötigt eine Standorterlaubnis, damit die App Zim-Dateien hosten kann</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Android erfordert die Berechtigung für WLAN-Geräte in der Nähe, damit die App Zim-Dateien hosten kann</string>
<string name="permission_refused_location">Ohne Standortberechtigungen können Peer-Geräte nicht lokalisiert werden</string>
<string name="permission_refused_storage">Ohne Speichererlaubnis ist kein Zugriff auf ZIM-Dateien möglich</string>
<string name="request_enable_location">Standort aktivieren, um Peer-Geräte zu finden</string>
Expand Down
1 change: 0 additions & 1 deletion core/src/main/res/values-diq/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@
<string name="severe_loss_error">Xetaya gırane! Bıcerebnê ke WiFi P2P’yi dewre ra vecê/reyêna aktif kerê</string>
<string name="connection_failed">Gıreyin nêbiya</string>
<string name="permission_rationale_location">Cihazê takêşan ra ferq bıyayışi rê terefê Androidi ra mısadey mehali ganiyo.</string>
<string name="permission_rationale_location_on_host_zim_file">Dosyayanê ZIMi darênayışê aplikasyoni rê terefê Androidi ra mısadey mehali ganiyo.</string>
<string name="permission_refused_location">Bêmısadey mehali cihazanê takêşi nêvineyênê</string>
<string name="permission_refused_storage">Bêmısadey depo kerdışi nêresiyeno dosyayanê ZIMi</string>
<string name="request_enable_location">Taypêyan his kerdışi rê seba mısade dayışi mehali aktiv kerê</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,6 @@
<string name="severe_loss_error">¡Error grave! Prueba inhabilitando / rehabilitando WiFi punto a punto</string>
<string name="connection_failed">Falló la conexión</string>
<string name="permission_rationale_location">Se requieren permisos de localización en Android para detectar dispositivos participantes</string>
<string name="permission_rationale_location_on_host_zim_file">Android requiere permiso de ubicación para permitir que la aplicación aloje archivos Zim</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Android permiso de los dispositivos WiFi cercanos para permitir a la aplicación alojar archivos zim.</string>
<string name="permission_refused_location">No se pueden ubicar dispositivos de pares sin permisos de ubicación</string>
<string name="permission_refused_storage">No se puede acceder a archivos ZIM sin permisos de almacenamiento</string>
<string name="request_enable_location">Habilite la ubicación para permitir la detección de compañeros</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,6 @@
<string name="severe_loss_error">Erreur grave! Essayez de désactiver/réactiver l’appairage WiFi</string>
<string name="connection_failed">La connexion a échoué</string>
<string name="permission_rationale_location">L’autorisation de géolocalisation est requise par Android pour permettre à l’application de détecter des appareils à proximité.</string>
<string name="permission_rationale_location_on_host_zim_file">La permission locale est demandée par Android pour autoriser l’application à héberger des fichiers Zim.</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Une autorisation des appareils Wi-Fi à proximité est requise par Android pour permettre à l’application d’héberger des fichiers Zim.</string>
<string name="permission_refused_location">Impossible de trouver des appareils proches sans les autorisations de géolocalisation</string>
<string name="permission_refused_storage">Impossible d’accéder aux fichiers ZIM sans autorisation d’accès au stockage</string>
<string name="request_enable_location">Activer la géolocalisation pour permettre la détection d’appareils proches</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-ha/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,6 @@
<string name="severe_loss_error">Kuskure mai tsanani! Gwada Kashe/Sake kunna WiFi P2P</string>
<string name="connection_failed">Haɗin ya gaza</string>
<string name="permission_rationale_location">Android na buƙatar izinin wuri don ba da damar ƙa’idar ta gano na’urorin tsara</string>
<string name="permission_rationale_location_on_host_zim_file">Ana buƙatar izinin wuri ta Android don ba da damar ƙa’idar ta dauki nauyin fayilolin Zim</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Ana buƙatar izinin na’urorin wifi kusa da Android don ba da damar ƙa’idar ta dauki nauyin fayilolin Zim</string>
<string name="permission_refused_location">Ba za a iya gano na’urorin takwarorinsu ba tare da izinin wuri ba</string>
<string name="permission_refused_storage">Ba za a iya samun damar yin amfani da fayilolin zim ba tare da izinin ajiya ba</string>
<string name="request_enable_location">Kunna wurin don ba da damar gano takwarorinsu</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-hi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@
<string name="severe_loss_error">गंभीर त्रुटि! वाईफ़ाई पी2पी को अक्षम/पुन: सक्षम करने का प्रयास करें</string>
<string name="connection_failed">कनेक्शन विफल</string>
<string name="permission_rationale_location">ऐप को सहकर्मी उपकरणों का पता लगाने की अनुमति देने के लिए एंड्रॉइड द्वारा स्थान अनुमति की आवश्यकता होती है</string>
<string name="permission_rationale_location_on_host_zim_file">ऐप को ZIM फ़ाइलों को होस्ट करने की अनुमति देने के लिए एंड्रॉइड द्वारा स्थान अनुमति की आवश्यकता होती है</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">ऐप को Zim फ़ाइलों को होस्ट करने की अनुमति देने के लिए एंड्रॉइड द्वारा आस-पास के वाईफाई डिवाइस की अनुमति आवश्यक है</string>
<string name="permission_refused_location">स्थान अनुमतियों के बिना सहकर्मी उपकरणों का पता नहीं लगाया जा सकता</string>
<string name="permission_refused_storage">भंडारण अनुमति के बिना ZIM फ़ाइलों तक नहीं पहुंच सकते</string>
<string name="request_enable_location">साथियों का पता लगाने की अनुमति देने के लिए स्थान सक्षम करें</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-ia/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@
<string name="severe_loss_error">Error grave! Tenta disactivar/reactivar WiFi P2P</string>
<string name="connection_failed">Connexion fallite</string>
<string name="permission_rationale_location">Android require accesso al position geographic pro permitter al application deteger apparatos a proximitate.</string>
<string name="permission_rationale_location_on_host_zim_file">Android require accesso al position geographic pro permitter al application albergar files Zim.</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Android require un autorisation de apparatos Wi-Fi a proximitate pro permitter al application albergar files Zim.</string>
<string name="permission_refused_location">Non pote localisar apparatos a proximitate sin accesso al position geographic</string>
<string name="permission_refused_storage">Non pote acceder a files Zim sin accesso al immagazinage</string>
<string name="request_enable_location">Activa position geographic pro permitter detection de apparatos proxime</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-ig/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@
<string name="severe_loss_error">siri ike\n mperi! Gbalịa gbanyụọ/nyegharịa WiFi P2P</string>
<string name="connection_failed">Njikọ\n dara</string>
<string name="permission_rationale_location">Ebe\n Android chọrọ ikike iji kwe ka ngwa ahụ chọpụta ngwaọrụ ndị ọgbọ</string>
<string name="permission_rationale_location_on_host_zim_file">Ebe\n Android chọrọ ikike iji kwe ka ngwa ahụ kwado faịlụ Zim</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">N’akụkụ\n Android chọrọ ikike wifi ngwaọrụ iji kwe ka ngwa ahụ kwado faịlụ Zim</string>
<string name="permission_refused_location">Enweghị ike\n chọta ngwaọrụ ndị ọgbọ na-enweghị ikike ebe</string>
<string name="permission_refused_storage">Enweghị ike\n nweta faịlụ zim na-enweghị ikike nchekwa</string>
<string name="request_enable_location">Gbanye ngosi ebe iji nabata nchọpụta nke otu</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,6 @@
<string name="severe_loss_error">Errore grave rilevato! Prova a disabilitare e a riabilitare Wi-Fi Direct</string>
<string name="connection_failed">Connessione fallita</string>
<string name="permission_rationale_location">L’accesso alla posizione è richiesto da Android per consentire all’app di rilevare i dispositivi nelle vicinanze</string>
<string name="permission_rationale_location_on_host_zim_file">L’accesso alla posizione è richiesto da Android per consentire all’app di ospitare file ZIM</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">L’autorizzazione dei dispositivi Wi-Fi nelle vicinanze è richiesta da Android per consentire all’app di ospitare file Zim</string>
<string name="permission_refused_location">Impossibile cercare i dispositivi nelle vicinanze senza l’accesso alla posizione</string>
<string name="permission_refused_storage">Impossibile accedere ai file ZIM senza l’accesso allo spazio di archiviazione</string>
<string name="request_enable_location">Abilita la geolocalizzazione per poter cercare i dispositivi nelle vicinanze</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-iw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@
<string name="severe_loss_error">שגיאה חמורה! נא לנסות לכבות ולהדליק מחדש את ה־P2P בווייפיי</string>
<string name="connection_failed">החיבור נכשל</string>
<string name="permission_rationale_location">נדרשת הרשאת גישה באנדרואיד כדי לאפשר ליישום לזהות מכשירים עמיתים</string>
<string name="permission_rationale_location_on_host_zim_file">הרשאת גישה למיקום נדרשת על־ידי אנדרואיד כדי לאפשר ליישום לארח קובצי Zim</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">הרשאת התקני וייפיי בקרבת מקום נדרשת על־ידי אנדרואיד כדי לאפשר ליישום לארח קובצי Zim</string>
<string name="permission_refused_location">לא ניתן לאתר מגשירים עמיתים ללא הרשאות מיקום</string>
<string name="permission_refused_storage">לא ניתן לגשת לקובצי zim ללא הרשאות אחסון</string>
<string name="request_enable_location">נא להפעיל מיקום כדי לאפשר זיהוי עמיתים</string>
Expand Down
1 change: 0 additions & 1 deletion core/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@
<string name="severe_loss_error">서버 오류! 와이파이 P2P를 비활성화/재활성화해 보십시오</string>
<string name="connection_failed">연결 실패</string>
<string name="permission_rationale_location">안드로이드에서 앱의 피어 장치 찾기를 허용하려면 위치 권한이 필요합니다</string>
<string name="permission_rationale_location_on_host_zim_file">안드로이드에서 앱의 Zim 파일 호스팅을 허용하려면 위치 권한이 필요합니다</string>
<string name="permission_refused_location">위치 권한 없이 피어 장치를 찾을 수 없습니다</string>
<string name="permission_refused_storage">스토리지 권한 없이 zim 파일에 접근할 수 없습니다</string>
<string name="request_enable_location">친구를 찾기 위해 위치 접근을 활성화합니다</string>
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/res/values-ku/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@
<string name="severe_loss_error">Çewtiya dijwar! WiFi P2P-yê neçalak bike/dîsa aktîv bike</string>
<string name="connection_failed">Girêdan têk çû</string>
<string name="permission_rationale_location">Destûra lokasyonê lazim e ji aliyê Androîdê ve ji bo destûr bidin sepanê ku karibe cîhazên din ên wekhev tesbît bike.</string>
<string name="permission_rationale_location_on_host_zim_file">Ji bo sepan karibe dosyeyên Zim-ê bihewîne destûra lokasyonê ji aliyê Androîdê ve lazim e.</string>
<string name="permission_rationale_nearby_device_on_host_zim_file">Ji bo destûr bide sepanê ku dosyeyên Zi-ê bihewîne, destûra cîhazên wîfiyê yên li nêzîkê lazim e ji aliyê Androîdê ve.</string>
<string name="permission_refused_location">Nikare cîhazên wekhev tesbît bike bêyî destûrên lokasyonê</string>
<string name="permission_refused_storage">Nikare bigihe pelên zim-ê bêyî destûra depoyê</string>
<string name="request_enable_location">Lokasyonê aktîv bike ji bo destûr vidî tesbîtkirina hevcinsan</string>
Expand Down
Loading

0 comments on commit 5d483f5

Please sign in to comment.