replace app icon and fix bugs
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.zhushenwudi.lovelivemusicplayer.i18n
|
||||
|
||||
internal val DeStrings: Map<String, String> = mapOf(
|
||||
"open_drawer" to "Menü öffnen",
|
||||
"qr_camera_unavailable" to "Kamera nicht verfügbar. Bitte die PC-IP manuell eingeben.",
|
||||
"qr_scan_failed" to "Scan konnte nicht gestartet werden. Erneut versuchen oder die PC-IP manuell eingeben.",
|
||||
"music" to "Die Musik",
|
||||
"album" to "Das Album",
|
||||
"music_name" to "Der Liedtitel",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.zhushenwudi.lovelivemusicplayer.i18n
|
||||
|
||||
internal val EnStrings: Map<String, String> = mapOf(
|
||||
"open_drawer" to "Open menu",
|
||||
"qr_camera_unavailable" to "Camera unavailable. Please enter your PC IP manually.",
|
||||
"qr_scan_failed" to "Could not start scanning. Try again or enter your PC IP manually.",
|
||||
"music" to "Music",
|
||||
"album" to "Album",
|
||||
"music_name" to "Music name",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.zhushenwudi.lovelivemusicplayer.i18n
|
||||
|
||||
internal val JaStrings: Map<String, String> = mapOf(
|
||||
"open_drawer" to "メニューを開く",
|
||||
"qr_camera_unavailable" to "カメラを使用できません。PCのIPアドレスを手動で入力してください。",
|
||||
"qr_scan_failed" to "スキャンを開始できません。再試行するかPCのIPアドレスを手動で入力してください。",
|
||||
"music" to "曲",
|
||||
"album" to "アルバム",
|
||||
"music_name" to "曲名",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.zhushenwudi.lovelivemusicplayer.i18n
|
||||
|
||||
internal val ZhStrings: Map<String, String> = mapOf(
|
||||
"open_drawer" to "打开菜单",
|
||||
"qr_camera_unavailable" to "当前设备无法使用摄像头,请手动输入电脑 IP",
|
||||
"qr_scan_failed" to "无法启动扫码,请稍后重试或手动输入电脑 IP",
|
||||
"music" to "歌曲",
|
||||
"album" to "专辑",
|
||||
"music_name" to "歌名",
|
||||
|
||||
+34
-2
@@ -3,6 +3,10 @@ package com.zhushenwudi.lovelivemusicplayer.platform
|
||||
import kotlinx.cinterop.ExperimentalForeignApi
|
||||
import platform.Foundation.NSURL
|
||||
import platform.Foundation.NSURLComponents
|
||||
import platform.Foundation.NSNotificationCenter
|
||||
import platform.Foundation.NSOperationQueue
|
||||
import platform.darwin.NSObjectProtocol
|
||||
import com.zhushenwudi.lovelivemusicplayer.i18n.I18n
|
||||
import platform.UIKit.UIApplication
|
||||
import platform.darwin.dispatch_async
|
||||
import platform.darwin.dispatch_get_main_queue
|
||||
@@ -10,9 +14,37 @@ import kotlin.system.exitProcess
|
||||
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
actual object PlatformUi {
|
||||
private var qrObserver: NSObjectProtocol? = null
|
||||
private var qrRequestId = 0L
|
||||
|
||||
actual fun openQrScanner(onResult: (String) -> Unit) {
|
||||
// iOS 相机扫码由 Swift 承载;common UI 仍支持 IP 粘贴。
|
||||
onResult("")
|
||||
// 重复点击只打开一个扫码器;取消/失败也必须回传并清理观察者。
|
||||
if (qrObserver != null) return
|
||||
val requestId = (++qrRequestId).toString()
|
||||
val center = NSNotificationCenter.defaultCenter
|
||||
qrObserver = center.addObserverForName(
|
||||
"llmpQrScanResult",
|
||||
`object` = null,
|
||||
queue = NSOperationQueue.mainQueue,
|
||||
) { notification ->
|
||||
if (notification?.userInfo?.get("requestId") != requestId) return@addObserverForName
|
||||
val result = notification.userInfo?.get("result") as? String ?: ""
|
||||
qrObserver?.let { center.removeObserver(it) }
|
||||
qrObserver = null
|
||||
onResult(result)
|
||||
}
|
||||
WidgetDataWriter.post(
|
||||
"llmpOpenQrScanner",
|
||||
mapOf(
|
||||
"requestId" to requestId,
|
||||
"title" to I18n.t("scan_qr_prompt"),
|
||||
"cancel" to I18n.t("cancel"),
|
||||
"permission" to I18n.t("camera_permission"),
|
||||
"settings" to I18n.t("system_settings"),
|
||||
"unavailable" to I18n.t("qr_camera_unavailable"),
|
||||
"failed" to I18n.t("qr_scan_failed"),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
actual fun openWebView(url: String, title: String?) {
|
||||
|
||||
Reference in New Issue
Block a user