Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calculate store percentage crash on Profile #697

Merged
merged 4 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package chat.sphinx.wrapper_common

import java.util.Locale


fun calculateStoragePercentage(storageData: StorageData): StoragePercentage {
val freeStorage = storageData.freeStorage?.value ?: 0L
Expand All @@ -8,11 +10,11 @@ fun calculateStoragePercentage(storageData: StorageData): StoragePercentage {
storageData.files.totalSize.value

return StoragePercentage(
freeStorage = String.format("%.3f", freeStorage.toFloat() / totalStorage).toFloat(),
image = String.format("%.3f", storageData.images.totalSize.value.toFloat() / totalStorage).toFloat(),
video = String.format("%.3f", storageData.video.totalSize.value.toFloat() / totalStorage).toFloat(),
audio = String.format("%.3f", storageData.audio.totalSize.value.toFloat() / totalStorage).toFloat(),
files = String.format("%.3f", storageData.files.totalSize.value.toFloat() / totalStorage).toFloat()
freeStorage = String.format(Locale.ENGLISH, "%.3f", freeStorage.toFloat() / totalStorage).toFloat(),
image = String.format(Locale.ENGLISH, "%.3f", storageData.images.totalSize.value.toFloat() / totalStorage).toFloat(),
video = String.format(Locale.ENGLISH, "%.3f", storageData.video.totalSize.value.toFloat() / totalStorage).toFloat(),
audio = String.format(Locale.ENGLISH, "%.3f", storageData.audio.totalSize.value.toFloat() / totalStorage).toFloat(),
files = String.format(Locale.ENGLISH, "%.3f", storageData.files.totalSize.value.toFloat() / totalStorage).toFloat()
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal class SphinxFirebaseMessagingService: FirebaseMessagingService() {

// Extract data from the message
// Extract data from the message
val title: String = p0.data["message"] ?: ""
val title: String = p0.data["title"] ?: ""
val messageBody: String = p0.data["body"] ?: ""
val chatId: Long? = (p0.data["chat_id"] ?: "").toLongOrNull()

Expand Down
Loading