mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-07-23 19:50:18 +00:00
Minor connectivity/VPN UI adaptions (bitfireAT/davx5#391)
* Low storage: don't show notification anymore, adapt info message - The impact of low storage is not as critical anymore that a notification is required. - Info message adapted * Update "account settings: ignore VPN" strings * Update "No internet" string
This commit is contained in:
parent
ba310762f9
commit
fd4872adb5
|
@ -4,18 +4,12 @@
|
|||
|
||||
package at.bitfire.davdroid
|
||||
|
||||
import android.app.PendingIntent
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.provider.Settings
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import at.bitfire.davdroid.log.Logger
|
||||
import at.bitfire.davdroid.ui.NotificationUtils
|
||||
import at.bitfire.davdroid.ui.NotificationUtils.notifyIfPossible
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
|
@ -36,7 +30,7 @@ class StorageLowReceiver private constructor(
|
|||
}
|
||||
|
||||
|
||||
val storageLow = MutableLiveData<Boolean>(false)
|
||||
val storageLow = MutableLiveData(false)
|
||||
|
||||
fun listen() {
|
||||
Logger.log.fine("Listening for device storage low/OK broadcasts")
|
||||
|
@ -63,28 +57,12 @@ class StorageLowReceiver private constructor(
|
|||
Logger.log.warning("Low storage, sync will not be started by Android!")
|
||||
|
||||
storageLow.postValue(true)
|
||||
|
||||
val notify = NotificationUtils.newBuilder(context, NotificationUtils.CHANNEL_SYNC_ERRORS)
|
||||
.setSmallIcon(R.drawable.ic_storage_notify)
|
||||
.setCategory(NotificationCompat.CATEGORY_ERROR)
|
||||
.setContentTitle(context.getString(R.string.storage_low_notify_title))
|
||||
.setContentText(context.getString(R.string.storage_low_notify_text))
|
||||
|
||||
val settingsIntent = Intent(Settings.ACTION_INTERNAL_STORAGE_SETTINGS)
|
||||
if (settingsIntent.resolveActivity(context.packageManager) != null)
|
||||
notify.setContentIntent(PendingIntent.getActivity(context, 0, settingsIntent, PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE))
|
||||
|
||||
val nm = NotificationManagerCompat.from(context)
|
||||
nm.notifyIfPossible(NotificationUtils.NOTIFY_LOW_STORAGE, notify.build())
|
||||
}
|
||||
|
||||
fun onStorageOk() {
|
||||
Logger.log.info("Storage OK again")
|
||||
|
||||
storageLow.postValue(false)
|
||||
|
||||
val nm = NotificationManagerCompat.from(context)
|
||||
nm.cancel(NotificationUtils.NOTIFY_LOW_STORAGE)
|
||||
}
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ object NotificationUtils {
|
|||
const val NOTIFY_SYNC_ERROR = 10
|
||||
const val NOTIFY_INVALID_RESOURCE = 11
|
||||
const val NOTIFY_WEBDAV_ACCESS = 12
|
||||
const val NOTIFY_LOW_STORAGE = 13
|
||||
// const val NOTIFY_LOW_STORAGE = 13
|
||||
const val NOTIFY_SYNC_EXPEDITED = 14
|
||||
const val NOTIFY_TASKS_PROVIDER_TOO_OLD = 20
|
||||
const val NOTIFY_PERMISSIONS = 21
|
||||
|
|
|
@ -141,9 +141,9 @@
|
|||
<string name="navigation_drawer_donate">Donate</string>
|
||||
<string name="navigation_drawer_privacy_policy">Privacy policy</string>
|
||||
<string name="account_list_no_notification_permission">Notifications disabled. You won\'t be notified about sync errors.</string>
|
||||
<string name="account_list_no_internet">No Internet connectivity. Android will not run synchronization.</string>
|
||||
<string name="account_list_no_internet">No validated Internet connectivity. Synchronization may not run.</string>
|
||||
<string name="account_list_manage_connections">Manage connections</string>
|
||||
<string name="account_list_low_storage">Storage space low. Android will not run synchronization.</string>
|
||||
<string name="account_list_low_storage">Storage space low. Android will not sync local changes immediately, but during the next regular sync.</string>
|
||||
<string name="account_list_manage_storage">Manage storage</string>
|
||||
<string name="account_list_datasaver_enabled">Data saver enabled. Background synchronization is restricted.</string>
|
||||
<string name="account_list_manage_datasaver">Manage data saver</string>
|
||||
|
@ -346,9 +346,9 @@
|
|||
<string name="settings_sync_wifi_only_ssids_permissions_required">WiFi SSID restriction requires further settings</string>
|
||||
<string name="settings_sync_wifi_only_ssids_permissions_action">Manage</string>
|
||||
<string name="settings_ignore_vpns_key" translatable="false">ignore_vpns</string>
|
||||
<string name="settings_ignore_vpns">VPN connectivity</string>
|
||||
<string name="settings_ignore_vpns_on">Non-VPN connection required (recommended)</string>
|
||||
<string name="settings_ignore_vpns_off">VPN counts as Internet connection</string>
|
||||
<string name="settings_ignore_vpns">VPN requires underlying Internet</string>
|
||||
<string name="settings_ignore_vpns_on">VPN without underlying validated Internet connection is not enough to run synchronization (recommended)</string>
|
||||
<string name="settings_ignore_vpns_off">VPN without underlying validated Internet connection is enough to run synchronization</string>
|
||||
<string name="settings_authentication">Authentication</string>
|
||||
<string name="settings_oauth_key" translatable="false">oauth</string>
|
||||
<string name="settings_oauth">Re-authenticate</string>
|
||||
|
@ -462,10 +462,6 @@
|
|||
<string name="exception_ioexception">An I/O error has occurred.</string>
|
||||
<string name="exception_show_details">Show details</string>
|
||||
|
||||
<!-- StorageLowReceiver -->
|
||||
<string name="storage_low_notify_title">Synchronization paused</string>
|
||||
<string name="storage_low_notify_text">Almost no free space left</string>
|
||||
|
||||
<!-- WebDAV accounts -->
|
||||
<string name="webdav_authority" translatable="false">at.bitfire.davdroid.webdav</string>
|
||||
<string name="webdav_mounts_title">WebDAV mounts</string>
|
||||
|
|
Loading…
Reference in a new issue