mirror of
https://github.com/Myzel394/Alibi.git
synced 2025-06-18 23:05:26 +02:00
fix: Show low storage message dependent on whether user uses internal or external storage
Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
parent
a6856476ce
commit
5cdbb605f2
@ -522,8 +522,8 @@ abstract class BatchesFolder(
|
||||
return uri!!
|
||||
}
|
||||
|
||||
fun getAvailableBytes(): Long {
|
||||
val storageManager = context.getSystemService(StorageManager::class.java) ?: return -1
|
||||
fun getAvailableBytes(): Long? {
|
||||
val storageManager = context.getSystemService(StorageManager::class.java) ?: return null
|
||||
val file = when (type) {
|
||||
BatchType.INTERNAL -> context.filesDir
|
||||
BatchType.CUSTOM -> customFolder!!.uri.toFile()
|
||||
@ -545,8 +545,8 @@ abstract class BatchesFolder(
|
||||
|
||||
companion object {
|
||||
fun requiredBytesForOneMinuteOfRecording(appSettings: AppSettings): Long {
|
||||
// 300 MiB sounds like a good default
|
||||
return 300 * 1024 * 1024
|
||||
// 250 MiB sounds like a good default
|
||||
return 250 * 1024 * 1024
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,10 @@ fun LowStorageInfo(
|
||||
val availableBytes =
|
||||
VideoBatchesFolder.importFromFolder(appSettings.saveFolder, context).getAvailableBytes()
|
||||
|
||||
if (availableBytes == null) {
|
||||
return
|
||||
}
|
||||
|
||||
val bytesPerMinute = BatchesFolder.requiredBytesForOneMinuteOfRecording(appSettings)
|
||||
val requiredBytes = appSettings.maxDuration / 1000 / 60 * bytesPerMinute
|
||||
|
||||
@ -35,7 +39,9 @@ fun LowStorageInfo(
|
||||
) {
|
||||
MessageBox(
|
||||
type = MessageType.WARNING,
|
||||
message = stringResource(R.string.ui_recorder_lowOnStorage_hint),
|
||||
message = if (appSettings.saveFolder == null)
|
||||
stringResource(R.string.ui_recorder_lowOnStorage_hintANDswitchSaveFolder)
|
||||
else stringResource(R.string.ui_recorder_lowOnStorage_hint)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -194,4 +194,5 @@
|
||||
<string name="ui_recorder_action_saveCurrent">Save now?</string>
|
||||
<string name="ui_recorder_action_saveCurrent_explanation">You can save the current ongoing recording by pressing and holding down on the save button. The recording will continue in the background.</string>
|
||||
<string name="ui_recorder_lowOnStorage_hint">You are low on storage. Alibi may not function properly. Please free up some space.</string>
|
||||
<string name="ui_recorder_lowOnStorage_hintANDswitchSaveFolder">You are low on storage. Alibi may not function properly. Please free up some space. Alternatively, change the batches folder to a different location in the settings.</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user