mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
Fixed Mobile Network Permission Dialog not showing
This commit is contained in:
parent
b0ff782cdd
commit
9cdac0aa56
@ -154,12 +154,7 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions {
|
||||
zimManageViewModel.networkStates.observe(viewLifecycleOwner, Observer(::onNetworkStateChange))
|
||||
zimManageViewModel.shouldShowWifiOnlyDialog.observe(viewLifecycleOwner, Observer {
|
||||
if (it) {
|
||||
dialogShower.show(
|
||||
WifiOnly,
|
||||
{ sharedPreferenceUtil.putPrefWifiOnly(false) },
|
||||
{ onRefreshStateChange(false) }
|
||||
)
|
||||
zimManageViewModel.shouldShowWifiOnlyDialog.value = false
|
||||
showAllowMobileNetworkDialog()
|
||||
}
|
||||
})
|
||||
|
||||
@ -171,6 +166,24 @@ class OnlineLibraryFragment : BaseFragment(), FragmentActivityExtensions {
|
||||
})
|
||||
}
|
||||
|
||||
private fun showAllowMobileNetworkDialog() {
|
||||
dialogShower.show(WifiOnly, {
|
||||
sharedPreferenceUtil.putPrefWifiOnly(false)
|
||||
zimManageViewModel.shouldShowWifiOnlyDialog.value = false
|
||||
}, {
|
||||
dialogShower.show(
|
||||
KiwixDialog.AllowMobileNetwork,
|
||||
::showAllowMobileNetworkDialog, {
|
||||
onRefreshStateChange(false)
|
||||
context.toast(
|
||||
resources.getString(R.string.denied_internet_permission_message),
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
super<BaseFragment>.onCreateOptionsMenu(menu, inflater)
|
||||
inflater.inflate(R.menu.menu_zim_manager, menu)
|
||||
|
@ -68,6 +68,13 @@ sealed class KiwixDialog(
|
||||
android.R.string.cancel
|
||||
)
|
||||
|
||||
object AllowMobileNetwork : KiwixDialog(
|
||||
null,
|
||||
R.string.allow_network_access,
|
||||
android.R.string.yes,
|
||||
android.R.string.cancel
|
||||
)
|
||||
|
||||
object EnableWifiP2pServices : KiwixDialog(
|
||||
null, R.string.request_enable_wifi, R.string.yes, android.R.string.no
|
||||
)
|
||||
|
@ -143,6 +143,7 @@
|
||||
<string name="next">Next</string>
|
||||
<string name="previous">Previous</string>
|
||||
<string name="wifi_only_title">Allow downloading content via mobile network?</string>
|
||||
<string name="allow_network_access">Since you are on mobile network we required network access or enable wifi</string>
|
||||
<string name="wifi_only_msg">If you choose “Yes” you won\'t be warned in future. However, you can always change this in Settings</string>
|
||||
<string name="pref_wifi_only">Download content only via WiFi</string>
|
||||
<string name="time_day" tools:keep="@string/time_day">day</string>
|
||||
@ -297,6 +298,7 @@
|
||||
<string name="all_files_permission_needed_message">In order to access all the zim files across device we need to have All Files Permission</string>
|
||||
<string name="allowed">Allowed</string>
|
||||
<string name="not_allowed">Not allowed</string>
|
||||
<string name="denied_internet_permission_message">Please enable wifi to download content</string>
|
||||
<string name="android_directory_seperator" translatable="false">/Android</string>
|
||||
<string name="select_folder" translatable="false">Please select a folder for external storage.</string>
|
||||
<string name="system_unable_to_grant_permission_message" translatable="false">System unable to grant permission!</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user