Skip to content

Commit

Permalink
Merge branch 'rhunk:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bocajthomas authored Oct 25, 2024
2 parents 9b9f096 + fffe441 commit ce833b3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/assets/lang/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand All @@ -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) {
Expand All @@ -148,6 +147,7 @@ class MediaDownloader : MessagingRuleFeature("MediaDownloader", MessagingRuleTyp

context.inAppOverlay.showStatusToast(
icon = Icons.Outlined.Warning,
durationMs = 1300,
text = message,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand All @@ -290,7 +290,7 @@ class InAppOverlay(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.padding(12.dp)
) {
icon()
text()
Expand Down

0 comments on commit ce833b3

Please sign in to comment.