diff --git a/config.json b/config.json index 9d4c1cce5..dedb37c39 100644 --- a/config.json +++ b/config.json @@ -11,8 +11,7 @@ "pushNotifyUrl": "https://cinny.cc/_matrix/push/v1/notify", "vapidPublicKey": "BHLwykXs79AbKNiblEtZZRAgnt7o5_ieImhVJD8QZ01MVwAHnXwZzNgQEJJEU3E5CVsihoKtb7yaNe5x3vmkWkI", "webPushAppID": "cc.cinny.web", - "unifiedPushAppID": "moe.sable.up", - "unifiedPushGatewayUrl": "https://cinny.cc/_matrix/push/v1/notify" + "unifiedPushAppID": "moe.sable.up" }, "slidingSync": { diff --git a/crates/tauri-plugin-notifications b/crates/tauri-plugin-notifications new file mode 160000 index 000000000..ea3f3d8d0 --- /dev/null +++ b/crates/tauri-plugin-notifications @@ -0,0 +1 @@ +Subproject commit ea3f3d8d05619dd2c0e3537538fb91269ecf2723 diff --git a/index.html b/index.html index 21c34e6d1..03bc47068 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,10 @@ - + Sable Client diff --git a/package.json b/package.json index 784416232..9a4d5bea0 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "slate-history": "^0.113.1", "slate-react": "^0.123.0", "tauri-plugin-splashscreen-api": "file:./crates/tauri-plugin-splashscreen", + "@choochmeque/tauri-plugin-notifications-api": "file:./crates/tauri-plugin-notifications", "ua-parser-js": "^1.0.41", "workbox-precaching": "^7.4.0" }, diff --git a/scripts/symlink-tauri-icons.js b/scripts/symlink-tauri-icons.js index 1cf0ce1e9..25674f335 100644 --- a/scripts/symlink-tauri-icons.js +++ b/scripts/symlink-tauri-icons.js @@ -17,8 +17,10 @@ const ANDROID_ICONS = [ `${dir}/ic_launcher.png`, `${dir}/ic_launcher_round.png`, `${dir}/ic_launcher_foreground.png`, + `${dir}/ic_notification.png`, ]) - .concat(['mipmap-anydpi-v26/ic_launcher.xml', 'values/ic_launcher_background.xml']); + .concat(['mipmap-anydpi-v26/ic_launcher.xml', 'values/ic_launcher_background.xml']) + .concat(['drawable/ic_notification.xml', 'drawable/notification_icon.xml']); const IOS_ICONS = [ 'AppIcon-20x20@1x.png', diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 68036fa86..619acb4c2 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4243,7 +4243,6 @@ dependencies = [ [[package]] name = "tauri-plugin-notifications" version = "0.4.3" -source = "git+https://github.com/TastelessVoid/tauri-plugin-notifications.git?branch=unified-push-support#3d55514246037665192103dc0feeeffafda00557" dependencies = [ "log", "notify-rust", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 61958f083..9de7f88a3 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -53,5 +53,5 @@ tauri-plugin-single-instance = { version = "2.4.0", features = ["deep-link"] } tauri-plugin-window-state = "2.4.1" [target.'cfg(target_os = "android")'.dependencies] -tauri-plugin-notifications = { git = "https://github.com/TastelessVoid/tauri-plugin-notifications.git", branch = "unified-push-support", features = ["unified-push"] } +tauri-plugin-notifications = { path = "../crates/tauri-plugin-notifications", features = ["unified-push"] } diff --git a/src-tauri/gen/android/app/src/main/AndroidManifest.xml b/src-tauri/gen/android/app/src/main/AndroidManifest.xml index 1124ae2cc..c650f0d20 100644 --- a/src-tauri/gen/android/app/src/main/AndroidManifest.xml +++ b/src-tauri/gen/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ diff --git a/src-tauri/gen/android/app/src/main/java/moe/sable/app/MainActivity.kt b/src-tauri/gen/android/app/src/main/java/moe/sable/app/MainActivity.kt index f0cc837bc..66132f329 100644 --- a/src-tauri/gen/android/app/src/main/java/moe/sable/app/MainActivity.kt +++ b/src-tauri/gen/android/app/src/main/java/moe/sable/app/MainActivity.kt @@ -1,12 +1,20 @@ package moe.sable.app +import android.graphics.Bitmap import android.os.Bundle import android.webkit.WebView +import android.webkit.WebViewClient import androidx.activity.enableEdgeToEdge import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat class MainActivity : TauriActivity() { + private var lastTop = 0f + private var lastBottom = 0f + private var lastLeft = 0f + private var lastRight = 0f + private var webViewRef: WebView? = null + override fun onCreate(savedInstanceState: Bundle?) { enableEdgeToEdge() super.onCreate(savedInstanceState) @@ -14,10 +22,80 @@ class MainActivity : TauriActivity() { override fun onWebViewCreate(webView: WebView) { super.onWebViewCreate(webView) + webViewRef = webView + + val originalClient = webView.webViewClient + + webView.webViewClient = object : WebViewClient() { + override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) { + originalClient.onPageStarted(view, url, favicon) + injectCssInsets(view) + } + + override fun onPageFinished(view: WebView, url: String) { + originalClient.onPageFinished(view, url) + injectCssInsets(view) + } + + override fun onPageCommitVisible(view: WebView, url: String) { + super.onPageCommitVisible(view, url) + injectCssInsets(view) + } + + override fun shouldOverrideUrlLoading( + view: WebView, + request: android.webkit.WebResourceRequest + ): Boolean = originalClient.shouldOverrideUrlLoading(view, request) + + override fun shouldInterceptRequest( + view: WebView, + request: android.webkit.WebResourceRequest + ): android.webkit.WebResourceResponse? = originalClient.shouldInterceptRequest(view, request) + + override fun onReceivedError( + view: WebView, + request: android.webkit.WebResourceRequest, + error: android.webkit.WebResourceError + ) = originalClient.onReceivedError(view, request, error) + } + ViewCompat.setOnApplyWindowInsetsListener(webView) { view, insets -> - val bars = insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime()) - view.setPadding(bars.left, bars.top, bars.right, bars.bottom) + val bars = insets.getInsets( + WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout() + ) + val ime = insets.getInsets(WindowInsetsCompat.Type.ime()) + val density = view.resources.displayMetrics.density + + lastTop = bars.top / density + lastBottom = maxOf(bars.bottom, ime.bottom) / density + lastLeft = bars.left / density + lastRight = bars.right / density + + // Don't use setPadding — it gets clobbered by Wry/Tauri internals. + // Instead, rely solely on CSS custom properties for inset handling. + injectCssInsets(view as WebView) + WindowInsetsCompat.CONSUMED } + + // Wry may reset layout after onWebViewCreate — re-request insets. + webView.post { webView.requestApplyInsets() } + // Also re-request after a short delay to handle Wry's deferred setup. + webView.postDelayed({ webView.requestApplyInsets() }, 500) + } + + private fun injectCssInsets(webView: WebView) { + webView.evaluateJavascript( + """ + (function() { + var s = document.documentElement.style; + s.setProperty('--sable-inset-top', '${lastTop}px'); + s.setProperty('--sable-inset-bottom', '${lastBottom}px'); + s.setProperty('--sable-inset-left', '${lastLeft}px'); + s.setProperty('--sable-inset-right', '${lastRight}px'); + })(); + """.trimIndent(), + null + ) } } diff --git a/src-tauri/gen/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/src-tauri/gen/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index 2b068d114..000000000 --- a/src-tauri/gen/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/drawable/ic_launcher_background.xml b/src-tauri/gen/android/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9cb..000000000 --- a/src-tauri/gen/android/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src-tauri/gen/android/app/src/main/res/drawable/ic_notification.xml b/src-tauri/gen/android/app/src/main/res/drawable/ic_notification.xml new file mode 120000 index 000000000..94a4ffc17 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/drawable/ic_notification.xml @@ -0,0 +1 @@ +../../../../../../../icons/android/drawable/ic_notification.xml \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/drawable/notification_icon.xml b/src-tauri/gen/android/app/src/main/res/drawable/notification_icon.xml new file mode 120000 index 000000000..f363fcecd --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/drawable/notification_icon.xml @@ -0,0 +1 @@ +../../../../../../../icons/android/drawable/notification_icon.xml \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 120000 index 000000000..eb916ab9d --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-anydpi-v26/ic_launcher.xml \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index 28f1aa119..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 120000 index 000000000..e4011dc87 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-hdpi/ic_launcher.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png deleted file mode 100644 index 85d0c88af..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 120000 index 000000000..2bb464f07 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-hdpi/ic_launcher_foreground.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 28f1aa119..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 120000 index 000000000..0e1d1415e --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-hdpi/ic_launcher_round.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_notification.png b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_notification.png new file mode 120000 index 000000000..38bf128b2 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-hdpi/ic_notification.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-hdpi/ic_notification.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 73e48dbfb..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 120000 index 000000000..c5c8af7d5 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-mdpi/ic_launcher.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png deleted file mode 100644 index 13dd21476..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 120000 index 000000000..1dc8bd660 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-mdpi/ic_launcher_foreground.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 73e48dbfb..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 120000 index 000000000..de6c001a7 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-mdpi/ic_launcher_round.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_notification.png b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_notification.png new file mode 120000 index 000000000..04dcb612b --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-mdpi/ic_notification.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-mdpi/ic_notification.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 1d98044f1..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 120000 index 000000000..c244d43ac --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xhdpi/ic_launcher.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png deleted file mode 100644 index a888b336b..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 120000 index 000000000..a9ba70dfa --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xhdpi/ic_launcher_foreground.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 1d98044f1..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 120000 index 000000000..9756cb1f2 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xhdpi/ic_launcher_round.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_notification.png b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_notification.png new file mode 120000 index 000000000..d4b91921d --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xhdpi/ic_notification.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xhdpi/ic_notification.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 081832466..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 120000 index 000000000..1832021dc --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxhdpi/ic_launcher.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png deleted file mode 100644 index a2a838e7b..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 120000 index 000000000..20afdb7e5 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxhdpi/ic_launcher_foreground.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 081832466..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 120000 index 000000000..f209887ca --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxhdpi/ic_launcher_round.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_notification.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_notification.png new file mode 120000 index 000000000..dea0cf035 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxhdpi/ic_notification.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxhdpi/ic_notification.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index b18bceb64..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 120000 index 000000000..2c20016b0 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxxhdpi/ic_launcher.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png deleted file mode 100644 index 3f8a57f38..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 120000 index 000000000..18a184d9f --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index b18bceb64..000000000 Binary files a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 120000 index 000000000..c7eff2834 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxxhdpi/ic_launcher_round.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_notification.png b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_notification.png new file mode 120000 index 000000000..78d475ccc --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/mipmap-xxxhdpi/ic_notification.png @@ -0,0 +1 @@ +../../../../../../../icons/android/mipmap-xxxhdpi/ic_notification.png \ No newline at end of file diff --git a/src-tauri/gen/android/app/src/main/res/values/ic_launcher_background.xml b/src-tauri/gen/android/app/src/main/res/values/ic_launcher_background.xml new file mode 120000 index 000000000..3aa4ae6f1 --- /dev/null +++ b/src-tauri/gen/android/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1 @@ +../../../../../../../icons/android/values/ic_launcher_background.xml \ No newline at end of file diff --git a/src-tauri/icons/android/drawable/ic_notification.xml b/src-tauri/icons/android/drawable/ic_notification.xml new file mode 100644 index 000000000..696a13d0c --- /dev/null +++ b/src-tauri/icons/android/drawable/ic_notification.xml @@ -0,0 +1,7 @@ + + + + diff --git a/src-tauri/icons/android/drawable/notification_icon.xml b/src-tauri/icons/android/drawable/notification_icon.xml new file mode 100644 index 000000000..afa6af354 --- /dev/null +++ b/src-tauri/icons/android/drawable/notification_icon.xml @@ -0,0 +1,7 @@ + + + + diff --git a/src-tauri/icons/android/mipmap-hdpi/ic_notification.png b/src-tauri/icons/android/mipmap-hdpi/ic_notification.png new file mode 100644 index 000000000..e2d71f7d2 Binary files /dev/null and b/src-tauri/icons/android/mipmap-hdpi/ic_notification.png differ diff --git a/src-tauri/icons/android/mipmap-mdpi/ic_notification.png b/src-tauri/icons/android/mipmap-mdpi/ic_notification.png new file mode 100644 index 000000000..255084025 Binary files /dev/null and b/src-tauri/icons/android/mipmap-mdpi/ic_notification.png differ diff --git a/src-tauri/icons/android/mipmap-xhdpi/ic_notification.png b/src-tauri/icons/android/mipmap-xhdpi/ic_notification.png new file mode 100644 index 000000000..bea0f2d25 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xhdpi/ic_notification.png differ diff --git a/src-tauri/icons/android/mipmap-xxhdpi/ic_notification.png b/src-tauri/icons/android/mipmap-xxhdpi/ic_notification.png new file mode 100644 index 000000000..8a3e2a860 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxhdpi/ic_notification.png differ diff --git a/src-tauri/icons/android/mipmap-xxxhdpi/ic_notification.png b/src-tauri/icons/android/mipmap-xxxhdpi/ic_notification.png new file mode 100644 index 000000000..334958c5d Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxxhdpi/ic_notification.png differ diff --git a/src/app/components/message/content/ImageContent.tsx b/src/app/components/message/content/ImageContent.tsx index 26486dbb0..f3ac87299 100644 --- a/src/app/components/message/content/ImageContent.tsx +++ b/src/app/components/message/content/ImageContent.tsx @@ -109,12 +109,26 @@ export const ImageContent = as<'div', ImageContentProps>( }, [rawMediaUrl, resolvedMediaUrl, url, mimeType, encInfo, mediaToken]) ); + // When the source download succeeds, reset image-element error state so the + // Retry button doesn't flash before the has had a chance to load. + useEffect(() => { + if (srcState.status === AsyncStatus.Success) { + setError(false); + } + }, [srcState.status]); + const handleLoad = () => { setLoad(true); + setError(false); }; const handleError = () => { - setLoad(false); - setError(true); + // Only show the error if the source download already succeeded — if + // it's still loading the image element may fire a transient error + // before the blob URL is ready. + if (srcState.status === AsyncStatus.Success) { + setLoad(false); + setError(true); + } }; const handleRetry = () => { @@ -225,12 +239,13 @@ export const ImageContent = as<'div', ImageContentProps>( )} {(srcState.status === AsyncStatus.Loading || srcState.status === AsyncStatus.Success) && !load && + !error && !blurred && ( )} - {(error || srcState.status === AsyncStatus.Error) && ( + {!load && (error || srcState.status === AsyncStatus.Error) && ( ( }, [mx, url, useAuthentication, mimeType, encInfo, mediaToken]) ); + // When the source download succeeds, reset video-element error state so the + // Retry button doesn't flash before the