mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
Merge remote-tracking branch 'origin/develop' into release/3.4.1
This commit is contained in:
commit
4c529ecb6b
@ -38,11 +38,9 @@ class KiwixMockServer {
|
||||
mockWebServer.shutdown()
|
||||
}
|
||||
|
||||
fun map(
|
||||
vararg pathsToResponses: Pair<String, Any>
|
||||
) {
|
||||
fun map(vararg pathsToResponses: Pair<String, Any>) {
|
||||
val mapOfPathsToResponses = mapOf(*pathsToResponses)
|
||||
mockWebServer.setDispatcher(object : Dispatcher() {
|
||||
mockWebServer.dispatcher = object : Dispatcher() {
|
||||
override fun dispatch(request: RecordedRequest) =
|
||||
mapOfPathsToResponses[request.path]?.let(::successfulResponse)
|
||||
?: forcedResponse?.let { return@let it }
|
||||
@ -50,7 +48,7 @@ class KiwixMockServer {
|
||||
"No response mapped for ${request.path}" +
|
||||
"\nmapped $mapOfPathsToResponses\nqueued $forcedResponse"
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun successfulResponse(bodyObject: Any) = MockResponse().apply {
|
||||
|
@ -18,11 +18,14 @@
|
||||
|
||||
package org.kiwix.kiwixmobile.webserver
|
||||
|
||||
import android.Manifest
|
||||
import android.app.ProgressDialog
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ServiceConnection
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.IBinder
|
||||
import android.provider.Settings
|
||||
@ -32,6 +35,8 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import kotlinx.android.synthetic.main.activity_zim_host.recyclerViewZimHost
|
||||
import kotlinx.android.synthetic.main.activity_zim_host.serverTextView
|
||||
import kotlinx.android.synthetic.main.activity_zim_host.startServerButton
|
||||
@ -132,7 +137,54 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
}
|
||||
}
|
||||
|
||||
startServerButton.setOnClickListener { startStopServer() }
|
||||
startServerButton.setOnClickListener {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P || checkCoarseLocationAccessPermission()) {
|
||||
startStopServer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkCoarseLocationAccessPermission(): Boolean =
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
requireActivity(),
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) == PackageManager.PERMISSION_DENIED
|
||||
) {
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
requireActivity(),
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
)
|
||||
) {
|
||||
alertDialogShower.show(
|
||||
KiwixDialog.LocationPermissionRationaleOnHostZimFile,
|
||||
::askCoarseLocationPermission
|
||||
)
|
||||
} else {
|
||||
askCoarseLocationPermission()
|
||||
}
|
||||
false
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
if (requestCode == PERMISSION_REQUEST_CODE_COARSE_LOCATION) {
|
||||
startStopServer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun askCoarseLocationPermission() {
|
||||
ActivityCompat.requestPermissions(
|
||||
requireActivity(), arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION),
|
||||
PERMISSION_REQUEST_CODE_COARSE_LOCATION
|
||||
)
|
||||
}
|
||||
|
||||
private fun startStopServer() {
|
||||
@ -316,5 +368,6 @@ class ZimHostFragment : BaseFragment(), ZimHostCallbacks, ZimHostContract.View {
|
||||
|
||||
companion object {
|
||||
const val SELECTED_ZIM_PATHS_KEY = "selected_zim_paths"
|
||||
private const val PERMISSION_REQUEST_CODE_COARSE_LOCATION = 10
|
||||
}
|
||||
}
|
||||
|
8
app/src/main/res/values-bn/strings.xml
Normal file
8
app/src/main/res/values-bn/strings.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Authors:
|
||||
* Al Riaz Uddin Ripon
|
||||
-->
|
||||
<resources>
|
||||
<string name="send_files_title">ফাইলসমূহ পাঠান</string>
|
||||
<string name="receive_files_title">ফাইলসমূহ গ্রহণ করুন</string>
|
||||
</resources>
|
@ -16,9 +16,9 @@ object Versions {
|
||||
|
||||
const val androidx_test_espresso: String = "3.2.0" // available: "3.3.0"
|
||||
|
||||
const val com_squareup_retrofit2: String = "2.5.0" // available: "2.9.0"
|
||||
const val com_squareup_retrofit2: String = "2.9.0"
|
||||
|
||||
const val com_squareup_okhttp3: String = "3.6.0" // available: "4.9.0"
|
||||
const val com_squareup_okhttp3: String = "4.9.0"
|
||||
|
||||
const val org_jetbrains_kotlin: String = "1.3.72" // available: "1.4.10"
|
||||
|
||||
@ -36,11 +36,11 @@ object Versions {
|
||||
|
||||
const val org_jacoco: String = "0.7.9"
|
||||
|
||||
const val io_mockk: String = "1.10.0"
|
||||
const val io_mockk: String = "1.10.0" // available: "1.10.2"
|
||||
|
||||
const val android_arch_lifecycle_extensions: String = "1.1.1"
|
||||
|
||||
const val com_android_tools_build_gradle: String = "4.0.1"
|
||||
const val com_android_tools_build_gradle: String = "4.0.1" // available: "4.0.2"
|
||||
|
||||
const val de_fayard_buildsrcversions_gradle_plugin: String = "0.7.0"
|
||||
|
||||
@ -50,9 +50,9 @@ object Versions {
|
||||
|
||||
const val ink_page_indicator: String = "1.3.0"
|
||||
|
||||
const val leakcanary_android: String = "2.4"
|
||||
const val leakcanary_android: String = "2.4" // available: "2.5"
|
||||
|
||||
const val constraintlayout: String = "1.1.3" // available: "2.0.1"
|
||||
const val constraintlayout: String = "1.1.3" // available: "2.0.2"
|
||||
|
||||
const val collection_ktx: String = "1.1.0"
|
||||
|
||||
@ -60,7 +60,7 @@ object Versions {
|
||||
|
||||
const val junit_jupiter: String = "5.6.2" // available: "5.7.0"
|
||||
|
||||
const val xfetch2okhttp: String = "3.1.4" // available: "3.1.5"
|
||||
const val xfetch2okhttp: String = "3.1.5"
|
||||
|
||||
const val assertj_core: String = "3.16.1" // available: "3.17.2"
|
||||
|
||||
@ -68,7 +68,7 @@ object Versions {
|
||||
|
||||
const val fragment_ktx: String = "1.2.5"
|
||||
|
||||
const val lint_gradle: String = "27.0.1"
|
||||
const val lint_gradle: String = "27.0.1" // available: "27.0.2"
|
||||
|
||||
const val testing_ktx: String = "1.1.2"
|
||||
|
||||
@ -84,7 +84,7 @@ object Versions {
|
||||
|
||||
const val rxandroid: String = "2.1.1"
|
||||
|
||||
const val core_ktx: String = "1.3.1"
|
||||
const val core_ktx: String = "1.3.1" // available: "1.3.2"
|
||||
|
||||
const val kiwixlib: String = "9.4.0"
|
||||
|
||||
@ -92,19 +92,19 @@ object Versions {
|
||||
|
||||
const val multidex: String = "2.0.1"
|
||||
|
||||
const val barista: String = "2.7.1" // available: "3.6.0"
|
||||
const val barista: String = "2.7.1" // available: "3.7.0"
|
||||
|
||||
const val xfetch2: String = "3.1.4" // available: "3.1.5"
|
||||
const val xfetch2: String = "3.1.5"
|
||||
|
||||
const val jsr305: String = "3.0.2"
|
||||
|
||||
const val ktlint: String = "0.36.0" // available: "0.39.0"
|
||||
|
||||
const val rxjava: String = "2.2.19"
|
||||
const val rxjava: String = "2.2.19" // available: "2.2.20"
|
||||
|
||||
const val webkit: String = "1.2.0" // available: "1.3.0"
|
||||
|
||||
const val aapt2: String = "4.0.1-6197926"
|
||||
const val aapt2: String = "4.0.1-6197926" // available: "4.0.2-6197926"
|
||||
|
||||
const val junit: String = "1.1.1" // available: "1.1.2"
|
||||
|
||||
|
@ -716,6 +716,7 @@ public abstract class CoreReaderFragment extends BaseFragment
|
||||
actionBar = null;
|
||||
mainMenu = null;
|
||||
tabRecyclerView.setAdapter(null);
|
||||
tableDrawerRight.setAdapter(null);
|
||||
tableDrawerAdapter = null;
|
||||
unbinder.unbind();
|
||||
webViewList.clear();
|
||||
|
@ -47,6 +47,13 @@ sealed class KiwixDialog(
|
||||
android.R.string.cancel
|
||||
)
|
||||
|
||||
object LocationPermissionRationaleOnHostZimFile : KiwixDialog(
|
||||
null,
|
||||
R.string.permission_rationale_location_on_host_zim_file,
|
||||
android.R.string.yes,
|
||||
android.R.string.cancel
|
||||
)
|
||||
|
||||
object StoragePermissionRationale : KiwixDialog(
|
||||
null,
|
||||
R.string.request_storage,
|
||||
|
@ -25,6 +25,7 @@
|
||||
<string name="search_label">অনুসন্ধান</string>
|
||||
<string name="choose_file">একটি বিষয়বস্তুর ফাইল নির্বাচন করুন (*.zim)</string>
|
||||
<string name="open_in_new_tab">নতুন ট্যাবে লিঙ্ক খোলা হবে?</string>
|
||||
<string name="connection_refused">সংযোগ প্রত্যাখান করা হয়েছে।</string>
|
||||
<string name="error_file_not_found">ত্রুটি: নির্বাচিত ZIM ফাইলটি খুঁজে পাওয়া যায় নি।</string>
|
||||
<string name="error_file_invalid">ত্রুটি: নির্বাচিত ফাইলটি বৈধ ZIM ফাইল নয়।</string>
|
||||
<string name="error_article_url_not_found">ত্রুটি: নিবন্ধ লোডে (Url: %1$s) ব্যর্থ।</string>
|
||||
|
@ -40,6 +40,7 @@
|
||||
<string name="hotspot_failed_title">Échec de démarrage du point d’accès</string>
|
||||
<string name="hotspot_failed_message">il semble que votre point d’accès soit déjà activé. Veuillez d’abord désactiver votre point d’accès WiFi pour continuer.</string>
|
||||
<string name="go_to_wifi_settings_label">Aller aux paramètres WiFi</string>
|
||||
<string name="connection_refused">Connexion refusée.</string>
|
||||
<string name="hotspot_running">Point d’accès WiFi actif</string>
|
||||
<string name="no_books_selected_toast_message">Veuillez d’abord choisir les livres</string>
|
||||
<string name="server_failed_message">Impossible de démarrer le serveur. Veuillez activer votre point d’accès WiFi</string>
|
||||
|
@ -6,6 +6,7 @@
|
||||
* Csega
|
||||
* Dj
|
||||
* Fitoschido
|
||||
* Hanna Tardos
|
||||
* Kelson
|
||||
* Macofe
|
||||
* Tacsipacsi
|
||||
@ -28,6 +29,7 @@
|
||||
<string name="search_label">Keresés</string>
|
||||
<string name="choose_file">Tartalomfájl kiválasztása (*.zim)</string>
|
||||
<string name="open_in_new_tab">Hivatkozás megnyitása új lapon?</string>
|
||||
<string name="connection_refused">Csatlakozás elutasítva.</string>
|
||||
<string name="error_file_not_found">Hiba: A kijelölt ZIM-fájl nem található.</string>
|
||||
<string name="error_file_invalid">Hiba: A kijelölt fájl nem érvényes ZIM-fájl.</string>
|
||||
<string name="error_article_url_not_found">Hiba: A cikk (URL: %1$s) betöltése nem sikerült.</string>
|
||||
|
@ -6,6 +6,7 @@
|
||||
* G.garatti
|
||||
* Gianfranco
|
||||
* Matteocng
|
||||
* Mpayansilva
|
||||
* Nivit
|
||||
* Purodha
|
||||
-->
|
||||
@ -26,6 +27,7 @@
|
||||
<string name="search_label">Ricerca</string>
|
||||
<string name="choose_file">Seleziona un file di contenuto (*.zim)</string>
|
||||
<string name="open_in_new_tab">Apri il collegamento in una nuova scheda?</string>
|
||||
<string name="connection_refused">Collegamento negato.</string>
|
||||
<string name="hotspot_dialog_title">Istruzioni per ospitare libri</string>
|
||||
<string name="hotspot_dialog_neutral_button">PROCEDI</string>
|
||||
<string name="error_file_not_found">Errore: il file ZIM selezionato non è stato trovato.</string>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<string name="hotspot_failed_title">הפעלת נקודת חיבור לא עבדה</string>
|
||||
<string name="hotspot_failed_message">נראה שנקודת החיבור כבר מופעלת אצלך. נא לכבות את נקודת החיבור שלך כדי להמשיך.</string>
|
||||
<string name="go_to_wifi_settings_label">לעבור להגדרות וייפיי</string>
|
||||
<string name="connection_refused">החיבור סורב.</string>
|
||||
<string name="hotspot_running">נקודת החיבור פועלת</string>
|
||||
<string name="no_books_selected_toast_message">נא לבחור ספרים קודם</string>
|
||||
<string name="server_failed_message">לא היה אפשר להתחיל את השרת. נא להפעיל את נקודת החיבור שלך</string>
|
||||
|
@ -26,6 +26,7 @@
|
||||
<string name="hotspot_failed_title">Не успеав да ја покренам пристапната точка</string>
|
||||
<string name="hotspot_failed_message">Се чини дека точката за безжичен пристап е веќе вклучена. Исклучете ја за да продолжите.</string>
|
||||
<string name="go_to_wifi_settings_label">Оди во поставките за безжичен пристап</string>
|
||||
<string name="connection_refused">Поврзувањето е одбиено.</string>
|
||||
<string name="hotspot_running">Активна пристапна точка</string>
|
||||
<string name="no_books_selected_toast_message">Најпрвин одберете книги</string>
|
||||
<string name="server_failed_message">Не можев да го покренам опслужувачот. Вклучете ја пристапната точка</string>
|
||||
|
@ -32,6 +32,7 @@
|
||||
<string name="hotspot_failed_title">Falha ao iniciar o ponto de acesso</string>
|
||||
<string name="hotspot_failed_message">Parece que seu ponto de acesso já está ativado. Desative seu ponto de acesso wi-fi para continuar.</string>
|
||||
<string name="go_to_wifi_settings_label">Vá para configurações de wi-fi</string>
|
||||
<string name="connection_refused">Conexão recusada.</string>
|
||||
<string name="hotspot_running">Rede wi-fi em execução</string>
|
||||
<string name="no_books_selected_toast_message">Selecione primeiro os livros</string>
|
||||
<string name="server_failed_message">Não foi possível iniciar o servidor. Por favor, ligue seu ponto de acesso</string>
|
||||
@ -280,4 +281,6 @@
|
||||
<string name="tab_restored">Guia restaurada</string>
|
||||
<string name="open_drawer">Abrir gaveta</string>
|
||||
<string name="close_drawer">Fechar gaveta</string>
|
||||
<string name="how_to_update_content">Como atualizar o conteúdo?</string>
|
||||
<string name="update_content_description">Para atualizar o conteúdo (um arquivo zim), você precisa baixar a versão completa mais recente desse mesmo conteúdo. Você pode fazer isso através da seção de download.</string>
|
||||
</resources>
|
||||
|
@ -61,4 +61,5 @@
|
||||
<string name="no_open_book">Tell the user that they have not opened a book.</string>
|
||||
<string name="open_library">The action of opening the library destination, used on a button.</string>
|
||||
<string name="tab_restored">Tell the user that a tab has been restored.</string>
|
||||
<string name="permission_rationale_location_on_host_zim_file">Tell the user Location permission required for hosting zim file.</string>
|
||||
</resources>
|
||||
|
@ -31,6 +31,7 @@
|
||||
<string name="hotspot_failed_title">開啟熱點失敗</string>
|
||||
<string name="hotspot_failed_message">看起來似乎是您的熱點已開啟,請停用您的 WiFi 熱點來繼續。</string>
|
||||
<string name="go_to_wifi_settings_label">前往 WIFI 設定</string>
|
||||
<string name="connection_refused">連線被拒絕。</string>
|
||||
<string name="hotspot_running">運行熱點</string>
|
||||
<string name="no_books_selected_toast_message">請先選擇書籍</string>
|
||||
<string name="server_failed_message">無法開啟伺服器,請啟動您的熱點</string>
|
||||
|
@ -38,6 +38,7 @@
|
||||
<string name="hotspot_failed_title">未能启动热点</string>
|
||||
<string name="hotspot_failed_message">你的热点好像已经打开了。请先关闭 Wi-Fi 热点再继续。</string>
|
||||
<string name="go_to_wifi_settings_label">转到WIFI设置</string>
|
||||
<string name="connection_refused">拒绝连接</string>
|
||||
<string name="hotspot_running">运行热点</string>
|
||||
<string name="no_books_selected_toast_message">请先选择书籍</string>
|
||||
<string name="server_failed_message">未能启动服务器。请打开热点。</string>
|
||||
|
@ -230,6 +230,7 @@
|
||||
<string name="severe_loss_error" tools:keep="@string/severe_loss_error">Severe error! Try Disable/Re-enable WiFi P2P</string>
|
||||
<string name="connection_failed" tools:keep="@string/connection_failed">Connection failed</string>
|
||||
<string name="permission_rationale_location">Location permission is required by Android to allow the app to detect peer devices</string>
|
||||
<string name="permission_rationale_location_on_host_zim_file">Location permission is required by Android to allow the app to Host Zim files</string>
|
||||
<string name="permission_refused_location" tools:keep="@string/permission_refused_location">Cannot locate peer devices without location permissions</string>
|
||||
<string name="permission_refused_storage" tools:keep="@string/permission_refused_storage">Cannot access zim files without storage permission</string>
|
||||
<string name="request_enable_location">Enable location to allow detection of peers</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user