diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt index dd785b16e..1a52d26c3 100644 --- a/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt +++ b/app/src/main/kotlin/me/rhunk/snapenhance/ui/setup/screens/impl/MappingsScreen.kt @@ -10,6 +10,7 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.window.Dialog import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext import me.rhunk.snapenhance.ui.setup.screens.SetupScreen import me.rhunk.snapenhance.ui.util.AlertDialogs @@ -51,7 +52,9 @@ class MappingsScreen : SetupScreen() { return@launch } - goNext() + withContext(Dispatchers.Main) { + goNext() + } }.onFailure { isGenerating = false infoText = context.translation["setup.mappings.generate_failure"] + "\n\n" + it.message diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json index 161e5f9d7..cdaa23c1b 100644 --- a/common/src/main/assets/lang/en_US.json +++ b/common/src/main/assets/lang/en_US.json @@ -1614,7 +1614,7 @@ "no_attachments_toast": "No attachments found!", "already_queued_toast": "Media already in queue!", "already_downloaded_toast": "Media already downloaded!", - "saved_toast": "Saved to {path}", + "content_saved_toast": "Saved!", "download_toast": "Downloading {path}...", "processing_toast": "Processing {path}...", "failed_generic_toast": "Failed to download", diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/MediaDownloader.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/MediaDownloader.kt index c700286a3..0ab5e9c2d 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/MediaDownloader.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/downloader/MediaDownloader.kt @@ -11,10 +11,7 @@ import android.widget.LinearLayout import android.widget.ProgressBar import android.widget.TextView import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.outlined.CheckCircle -import androidx.compose.material.icons.outlined.Error -import androidx.compose.material.icons.outlined.Info -import androidx.compose.material.icons.outlined.Warning +import androidx.compose.material.icons.outlined.* import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import me.rhunk.snapenhance.bridge.DownloadCallback @@ -111,8 +108,9 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp if (!downloadLogging.contains("success")) return context.log.verbose("onSuccess: outputFile=$outputFile") context.inAppOverlay.showStatusToast( - icon = Icons.Outlined.CheckCircle, - text = translations.format("saved_toast", "path" to outputFile.split("/").takeLast(2).joinToString("/")).also { + icon = Icons.Outlined.DownloadDone, + durationMs = 1300, + text = translations["content_saved_toast"].also { if (context.isMainActivityPaused) { context.shortToast(it) } @@ -125,6 +123,7 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp context.log.verbose("onProgress: message=$message") context.inAppOverlay.showStatusToast( icon = Icons.Outlined.Info, + durationMs = 1300, text = message, ) if (context.isMainActivityPaused) { @@ -148,6 +147,7 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp context.inAppOverlay.showStatusToast( icon = Icons.Outlined.Warning, + durationMs = 1300, text = message, ) } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/SendOverride.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/SendOverride.kt index d8a5cd9f6..6b6bb15bc 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/SendOverride.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/messaging/SendOverride.kt @@ -63,9 +63,17 @@ class SendOverride : Feature("Send Override") { } // set back the original snap duration - remove(2) snapDocPlayback.getByteArray(2)?.let { + val originalHasSound = firstOrNull(2)?.toReader()?.getVarInt(5) + remove(2) addBuffer(2, it) + + originalHasSound?.let { hasSound -> + edit(2) { + remove(5) + addVarInt(5, hasSound) + } + } } } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt index b4ad9426b..bc4e9282a 100644 --- a/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt +++ b/core/src/main/kotlin/me/rhunk/snapenhance/core/ui/InAppOverlay.kt @@ -260,7 +260,7 @@ class InAppOverlay( showToast( icon = { Icon(icon, contentDescription = "icon", modifier = Modifier.size(32.dp)) }, text = { - Text(text, modifier = Modifier.fillMaxWidth(), maxLines = maxLines, overflow = TextOverflow.Ellipsis, lineHeight = 15.sp, fontSize = 15.sp) + Text(text, modifier = Modifier.fillMaxWidth(), maxLines = maxLines, overflow = TextOverflow.Ellipsis, lineHeight = 15.sp, fontSize = 13.sp) }, durationMs = durationMs, showDuration = showDuration @@ -280,7 +280,7 @@ class InAppOverlay( composable = { ElevatedCard( modifier = Modifier - .padding(16.dp) + .padding(12.dp) .shadow(8.dp, RoundedCornerShape(8.dp)) .fillMaxWidth() .clip(RoundedCornerShape(8.dp)) @@ -290,7 +290,7 @@ class InAppOverlay( verticalAlignment = Alignment.CenterVertically, modifier = Modifier .fillMaxWidth() - .padding(16.dp) + .padding(12.dp) ) { icon() text()