Skip to content

Commit

Permalink
添加持续响铃示例
Browse files Browse the repository at this point in the history
  • Loading branch information
Finb committed Aug 15, 2024
1 parent 77606f0 commit c18403e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 70 deletions.
3 changes: 3 additions & 0 deletions Bark/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
3 changes: 3 additions & 0 deletions Bark/tr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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";
3 changes: 3 additions & 0 deletions Bark/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -176,3 +176,6 @@ customSounds = "自定义铃声";
defaultSounds = "默认铃声";
uploadSoundNoticeFullText = "请先将铃声转换成 caf 格式,时长不超过 30 秒。";
uploadSoundNoticeHighlightText = "转换成 caf 格式";

ringtone = "持续响铃";
ringtoneNotice = "通知铃声将重复播放 30 秒,同时收到多个通知时将按顺序依次响铃。";
143 changes: 73 additions & 70 deletions Controller/HomeViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? "")
Expand Down

0 comments on commit c18403e

Please sign in to comment.