添加持续响铃示例

This commit is contained in:
Fin 2024-08-15 15:32:19 +08:00
parent 77606f0b94
commit c18403e845
4 changed files with 82 additions and 70 deletions

View File

@ -176,3 +176,6 @@ customSounds = "Custom Sounds";
defaultSounds = "Default Sounds";
uploadSoundNoticeFullText = "Please convert the sound file to caf format, and make sure it's no longer than 30 seconds.";
uploadSoundNoticeHighlightText = "convert the sound file to caf format";
ringtone = "Ringtone";
ringtoneNotice = "Ringtone for a notification";

View File

@ -176,3 +176,6 @@ customSounds = "Custom Sounds";
defaultSounds = "Default Sounds";
uploadSoundNoticeFullText = "Please convert the sound file to caf format, and make sure it's no longer than 30 seconds.";
uploadSoundNoticeHighlightText = "convert the sound file to caf format";
ringtone = "Ringtone";
ringtoneNotice = "Ringtone for a notification";

View File

@ -176,3 +176,6 @@ customSounds = "自定义铃声";
defaultSounds = "默认铃声";
uploadSoundNoticeFullText = "请先将铃声转换成 caf 格式,时长不超过 30 秒。";
uploadSoundNoticeHighlightText = "转换成 caf 格式";
ringtone = "持续响铃";
ringtoneNotice = "通知铃声将重复播放 30 秒,同时收到多个通知时将按顺序依次响铃。";

View File

@ -39,76 +39,79 @@ class HomeViewModel: ViewModel, ViewModelType {
let registerForRemoteNotifications: Driver<Void>
}
let previews: [PreviewModel] = {
[
PreviewModel(
body: NSLocalizedString("CustomedNotificationContent"),
notice: NSLocalizedString("Notice1")
),
PreviewModel(
title: NSLocalizedString("CustomedNotificationTitle"),
body: NSLocalizedString("CustomedNotificationContent"),
notice: NSLocalizedString("Notice2")
),
PreviewModel(
body: NSLocalizedString("notificationSound"),
notice: NSLocalizedString("setSounds"),
queryParameter: "sound=minuet",
moreInfo: NSLocalizedString("viewAllSounds"),
moreViewModel: SoundsViewModel()
),
PreviewModel(
body: NSLocalizedString("archiveNotificationMessageTitle"),
notice: NSLocalizedString("archiveNotificationMessage"),
queryParameter: "isArchive=1"
),
PreviewModel(
body: NSLocalizedString("notificationIcon"),
notice: NSLocalizedString("notificationIconNotice"),
queryParameter: "icon=https://day.app/assets/images/avatar.jpg",
image: UIImage(named: "icon")
),
PreviewModel(
body: NSLocalizedString("messageGroup"),
notice: NSLocalizedString("groupMessagesNotice"),
queryParameter: "group=groupName",
image: UIImage(named: "group")
),
PreviewModel(
body: NSLocalizedString("pushNotificationEncryption"),
notice: NSLocalizedString("encryptionNotice"),
queryParameter: "ciphertext=ciphertext",
moreInfo: NSLocalizedString("encryptionSettings"),
moreViewModel: CryptoSettingViewModel()
),
PreviewModel(
body: NSLocalizedString("interruptionLevel"),
notice: NSLocalizedString("interruptionLevelNotice"),
queryParameter: "level=timeSensitive"
),
PreviewModel(
body: "URL Test",
notice: NSLocalizedString("urlParameter"),
queryParameter: "url=https://www.baidu.com"
),
PreviewModel(
body: "Copy Test",
notice: NSLocalizedString("copyParameter"),
queryParameter: "copy=test",
image: UIImage(named: "copyTest")
),
PreviewModel(
body: NSLocalizedString("badge"),
notice: NSLocalizedString("badgeNotice"),
queryParameter: "badge=1"
),
PreviewModel(
body: NSLocalizedString("automaticallyCopyTitle"),
notice: NSLocalizedString("automaticallyCopy"),
queryParameter: "autoCopy=1&copy=optional"
)
]
}()
let previews: [PreviewModel] = [
PreviewModel(
body: NSLocalizedString("CustomedNotificationContent"),
notice: NSLocalizedString("Notice1")
),
PreviewModel(
title: NSLocalizedString("CustomedNotificationTitle"),
body: NSLocalizedString("CustomedNotificationContent"),
notice: NSLocalizedString("Notice2")
),
PreviewModel(
body: NSLocalizedString("notificationSound"),
notice: NSLocalizedString("setSounds"),
queryParameter: "sound=minuet",
moreInfo: NSLocalizedString("viewAllSounds"),
moreViewModel: SoundsViewModel()
),
PreviewModel(
body: NSLocalizedString("ringtone"),
notice: NSLocalizedString("ringtoneNotice"),
queryParameter: "call=1"
),
PreviewModel(
body: NSLocalizedString("archiveNotificationMessageTitle"),
notice: NSLocalizedString("archiveNotificationMessage"),
queryParameter: "isArchive=1"
),
PreviewModel(
body: NSLocalizedString("notificationIcon"),
notice: NSLocalizedString("notificationIconNotice"),
queryParameter: "icon=https://day.app/assets/images/avatar.jpg",
image: UIImage(named: "icon")
),
PreviewModel(
body: NSLocalizedString("messageGroup"),
notice: NSLocalizedString("groupMessagesNotice"),
queryParameter: "group=groupName",
image: UIImage(named: "group")
),
PreviewModel(
body: NSLocalizedString("pushNotificationEncryption"),
notice: NSLocalizedString("encryptionNotice"),
queryParameter: "ciphertext=ciphertext",
moreInfo: NSLocalizedString("encryptionSettings"),
moreViewModel: CryptoSettingViewModel()
),
PreviewModel(
body: NSLocalizedString("interruptionLevel"),
notice: NSLocalizedString("interruptionLevelNotice"),
queryParameter: "level=timeSensitive"
),
PreviewModel(
body: "URL Test",
notice: NSLocalizedString("urlParameter"),
queryParameter: "url=https://www.baidu.com"
),
PreviewModel(
body: "Copy Test",
notice: NSLocalizedString("copyParameter"),
queryParameter: "copy=test",
image: UIImage(named: "copyTest")
),
PreviewModel(
body: NSLocalizedString("badge"),
notice: NSLocalizedString("badgeNotice"),
queryParameter: "badge=1"
),
PreviewModel(
body: NSLocalizedString("automaticallyCopyTitle"),
notice: NSLocalizedString("automaticallyCopy"),
queryParameter: "autoCopy=1&copy=optional"
)
]
func transform(input: Input) -> Output {
let title = BehaviorRelay(value: URL(string: ServerManager.shared.currentServer.address)?.host ?? "")