mirror of
https://github.com/Finb/Bark.git
synced 2025-12-08 21:36:01 +00:00
修改本地化方法
This commit is contained in:
parent
91bc905628
commit
1e340c6578
@ -104,7 +104,6 @@
|
|||||||
066E0C8C2BB6AC9A00873838 /* AddSoundCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 066E0C8B2BB6AC9A00873838 /* AddSoundCell.swift */; };
|
066E0C8C2BB6AC9A00873838 /* AddSoundCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 066E0C8B2BB6AC9A00873838 /* AddSoundCell.swift */; };
|
||||||
0672CB06256903F700570C9D /* MessageListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0672CB05256903F700570C9D /* MessageListViewModel.swift */; };
|
0672CB06256903F700570C9D /* MessageListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0672CB05256903F700570C9D /* MessageListViewModel.swift */; };
|
||||||
06787C392A710568008ABDD7 /* GesturePassTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06787C382A710568008ABDD7 /* GesturePassTextView.swift */; };
|
06787C392A710568008ABDD7 /* GesturePassTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06787C382A710568008ABDD7 /* GesturePassTextView.swift */; };
|
||||||
06787C3B2AB82BDB008ABDD7 /* CrashReportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06787C3A2AB82BDB008ABDD7 /* CrashReportViewController.swift */; };
|
|
||||||
067AFB1C2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */; };
|
067AFB1C2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */; };
|
||||||
067AFB1D2E5D8BED00AE78E7 /* UNNotificationContent+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */; };
|
067AFB1D2E5D8BED00AE78E7 /* UNNotificationContent+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */; };
|
||||||
067B2EB525693E38008B6BE1 /* MessageSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B2EB425693E38008B6BE1 /* MessageSection.swift */; };
|
067B2EB525693E38008B6BE1 /* MessageSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B2EB425693E38008B6BE1 /* MessageSection.swift */; };
|
||||||
@ -119,6 +118,8 @@
|
|||||||
068EC15827ED99C900D5D11E /* ServerListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15727ED99C900D5D11E /* ServerListViewController.swift */; };
|
068EC15827ED99C900D5D11E /* ServerListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15727ED99C900D5D11E /* ServerListViewController.swift */; };
|
||||||
068EC15A27ED99E700D5D11E /* ServerListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15927ED99E700D5D11E /* ServerListViewModel.swift */; };
|
068EC15A27ED99E700D5D11E /* ServerListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15927ED99E700D5D11E /* ServerListViewModel.swift */; };
|
||||||
068F66B3247BD84C00DAD25A /* MessageListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068F66B2247BD84C00DAD25A /* MessageListViewController.swift */; };
|
068F66B3247BD84C00DAD25A /* MessageListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068F66B2247BD84C00DAD25A /* MessageListViewController.swift */; };
|
||||||
|
069332222E6A8E3100F9387F /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0603706A20E20A7C00F4CA05 /* String+Extension.swift */; };
|
||||||
|
069332232E6A8E3100F9387F /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0603706A20E20A7C00F4CA05 /* String+Extension.swift */; };
|
||||||
0699473D2D223094008D5E40 /* CustomTapTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0699473C2D223094008D5E40 /* CustomTapTextView.swift */; };
|
0699473D2D223094008D5E40 /* CustomTapTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0699473C2D223094008D5E40 /* CustomTapTextView.swift */; };
|
||||||
06B1158D247BA6D5006D91FB /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06B1158C247BA6D5006D91FB /* CloudKit.framework */; };
|
06B1158D247BA6D5006D91FB /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06B1158C247BA6D5006D91FB /* CloudKit.framework */; };
|
||||||
06B1158F247BB1FB006D91FB /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B1158E247BB1FB006D91FB /* Message.swift */; };
|
06B1158F247BB1FB006D91FB /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B1158E247BB1FB006D91FB /* Message.swift */; };
|
||||||
@ -199,8 +200,6 @@
|
|||||||
06F08EA529B1DDA7006AB9CA /* Algorithm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 061894C629A75BEA00E001C2 /* Algorithm.swift */; };
|
06F08EA529B1DDA7006AB9CA /* Algorithm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 061894C629A75BEA00E001C2 /* Algorithm.swift */; };
|
||||||
06F08EA729B1DDFE006AB9CA /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */; };
|
06F08EA729B1DDFE006AB9CA /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */; };
|
||||||
06F08EA829B1DE0A006AB9CA /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */; };
|
06F08EA829B1DE0A006AB9CA /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */; };
|
||||||
06F08EAC29B1DECD006AB9CA /* NSLocalizedString+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */; };
|
|
||||||
06F08EAD29B1DED6006AB9CA /* NSLocalizedString+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */; };
|
|
||||||
06F08EAF29B5D9FF006AB9CA /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAE29B5D9FF006AB9CA /* HUD.swift */; };
|
06F08EAF29B5D9FF006AB9CA /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAE29B5D9FF006AB9CA /* HUD.swift */; };
|
||||||
06F11E7727D9D5FB00F00298 /* QRScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F11E7627D9D5FB00F00298 /* QRScannerViewController.swift */; };
|
06F11E7727D9D5FB00F00298 /* QRScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F11E7627D9D5FB00F00298 /* QRScannerViewController.swift */; };
|
||||||
06FB04042C53575400F3A213 /* SharedDefines.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06FB04032C53575400F3A213 /* SharedDefines.swift */; };
|
06FB04042C53575400F3A213 /* SharedDefines.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06FB04032C53575400F3A213 /* SharedDefines.swift */; };
|
||||||
@ -351,7 +350,6 @@
|
|||||||
066E0C8B2BB6AC9A00873838 /* AddSoundCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSoundCell.swift; sourceTree = "<group>"; };
|
066E0C8B2BB6AC9A00873838 /* AddSoundCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSoundCell.swift; sourceTree = "<group>"; };
|
||||||
0672CB05256903F700570C9D /* MessageListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListViewModel.swift; sourceTree = "<group>"; };
|
0672CB05256903F700570C9D /* MessageListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListViewModel.swift; sourceTree = "<group>"; };
|
||||||
06787C382A710568008ABDD7 /* GesturePassTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePassTextView.swift; sourceTree = "<group>"; };
|
06787C382A710568008ABDD7 /* GesturePassTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePassTextView.swift; sourceTree = "<group>"; };
|
||||||
06787C3A2AB82BDB008ABDD7 /* CrashReportViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportViewController.swift; sourceTree = "<group>"; };
|
|
||||||
067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "UNNotificationContent+Extension.swift"; path = "notificationContentExtension/UNNotificationContent+Extension.swift"; sourceTree = SOURCE_ROOT; };
|
067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "UNNotificationContent+Extension.swift"; path = "notificationContentExtension/UNNotificationContent+Extension.swift"; sourceTree = SOURCE_ROOT; };
|
||||||
067B2EB425693E38008B6BE1 /* MessageSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSection.swift; sourceTree = "<group>"; };
|
067B2EB425693E38008B6BE1 /* MessageSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSection.swift; sourceTree = "<group>"; };
|
||||||
0683486A2050F1310024B6DA /* Bark.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bark.entitlements; sourceTree = "<group>"; };
|
0683486A2050F1310024B6DA /* Bark.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bark.entitlements; sourceTree = "<group>"; };
|
||||||
@ -411,7 +409,6 @@
|
|||||||
06EF49182D682B34008B91D2 /* PushToOtherIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushToOtherIntent.swift; sourceTree = "<group>"; };
|
06EF49182D682B34008B91D2 /* PushToOtherIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushToOtherIntent.swift; sourceTree = "<group>"; };
|
||||||
06F08EA329B098DD006AB9CA /* CryptoSettingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoSettingManager.swift; sourceTree = "<group>"; };
|
06F08EA329B098DD006AB9CA /* CryptoSettingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoSettingManager.swift; sourceTree = "<group>"; };
|
||||||
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+Extension.swift"; sourceTree = "<group>"; };
|
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+Extension.swift"; sourceTree = "<group>"; };
|
||||||
06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLocalizedString+Extension.swift"; sourceTree = "<group>"; };
|
|
||||||
06F08EAE29B5D9FF006AB9CA /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
|
06F08EAE29B5D9FF006AB9CA /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
|
||||||
06F11E7627D9D5FB00F00298 /* QRScannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRScannerViewController.swift; sourceTree = "<group>"; };
|
06F11E7627D9D5FB00F00298 /* QRScannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRScannerViewController.swift; sourceTree = "<group>"; };
|
||||||
06FB04032C53575400F3A213 /* SharedDefines.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedDefines.swift; sourceTree = "<group>"; };
|
06FB04032C53575400F3A213 /* SharedDefines.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedDefines.swift; sourceTree = "<group>"; };
|
||||||
@ -492,7 +489,6 @@
|
|||||||
068EC15927ED99E700D5D11E /* ServerListViewModel.swift */,
|
068EC15927ED99E700D5D11E /* ServerListViewModel.swift */,
|
||||||
06EEF332291CCFF400CA228A /* CryptoSettingController.swift */,
|
06EEF332291CCFF400CA228A /* CryptoSettingController.swift */,
|
||||||
06EEF334291CD00000CA228A /* CryptoSettingViewModel.swift */,
|
06EEF334291CD00000CA228A /* CryptoSettingViewModel.swift */,
|
||||||
06787C3A2AB82BDB008ABDD7 /* CrashReportViewController.swift */,
|
|
||||||
1E73F99D2C282822002BF649 /* SectionViewController-iPad.swift */,
|
1E73F99D2C282822002BF649 /* SectionViewController-iPad.swift */,
|
||||||
1EFB545E2C32514000B8E51B /* SectionViewModel-iPad.swift */,
|
1EFB545E2C32514000B8E51B /* SectionViewModel-iPad.swift */,
|
||||||
1EFB545C2C314A6800B8E51B /* BarkSplitViewController.swift */,
|
1EFB545C2C314A6800B8E51B /* BarkSplitViewController.swift */,
|
||||||
@ -625,7 +621,6 @@
|
|||||||
06F08EA329B098DD006AB9CA /* CryptoSettingManager.swift */,
|
06F08EA329B098DD006AB9CA /* CryptoSettingManager.swift */,
|
||||||
0653677729B727A60038BDB8 /* CryptoSettingRelay.swift */,
|
0653677729B727A60038BDB8 /* CryptoSettingRelay.swift */,
|
||||||
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */,
|
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */,
|
||||||
06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */,
|
|
||||||
06E944742C07012E00AC86AB /* RealmConfiguration.swift */,
|
06E944742C07012E00AC86AB /* RealmConfiguration.swift */,
|
||||||
0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */,
|
0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */,
|
||||||
06BCAE552CDB19260092867A /* GroupMuteSettingManager.swift */,
|
06BCAE552CDB19260092867A /* GroupMuteSettingManager.swift */,
|
||||||
@ -1232,6 +1227,7 @@
|
|||||||
067AFB1C2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift in Sources */,
|
067AFB1C2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift in Sources */,
|
||||||
0687F2AA2CCB7FA500B2A52F /* UIFont+Extension.swift in Sources */,
|
0687F2AA2CCB7FA500B2A52F /* UIFont+Extension.swift in Sources */,
|
||||||
0632CE2320EC9098003FDF46 /* NotificationViewController.swift in Sources */,
|
0632CE2320EC9098003FDF46 /* NotificationViewController.swift in Sources */,
|
||||||
|
069332222E6A8E3100F9387F /* String+Extension.swift in Sources */,
|
||||||
06BCAE572CDB19420092867A /* GroupMuteSettingManager.swift in Sources */,
|
06BCAE572CDB19420092867A /* GroupMuteSettingManager.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@ -1298,7 +1294,6 @@
|
|||||||
06E944762C07013000AC86AB /* RealmConfiguration.swift in Sources */,
|
06E944762C07013000AC86AB /* RealmConfiguration.swift in Sources */,
|
||||||
06EF49152D682A99008B91D2 /* PushResponse.swift in Sources */,
|
06EF49152D682A99008B91D2 /* PushResponse.swift in Sources */,
|
||||||
0603706720E1E31600F4CA05 /* Defines.swift in Sources */,
|
0603706720E1E31600F4CA05 /* Defines.swift in Sources */,
|
||||||
06787C3B2AB82BDB008ABDD7 /* CrashReportViewController.swift in Sources */,
|
|
||||||
064CAB9E256BE9090018155C /* PreviewCardCellViewModel.swift in Sources */,
|
064CAB9E256BE9090018155C /* PreviewCardCellViewModel.swift in Sources */,
|
||||||
065BE4552565055F002A8CA4 /* HomeViewModel.swift in Sources */,
|
065BE4552565055F002A8CA4 /* HomeViewModel.swift in Sources */,
|
||||||
062B98C3251B2762004562E7 /* BKButton.swift in Sources */,
|
062B98C3251B2762004562E7 /* BKButton.swift in Sources */,
|
||||||
@ -1333,7 +1328,6 @@
|
|||||||
06EF49172D682AC4008B91D2 /* OptionsProvider.swift in Sources */,
|
06EF49172D682AC4008B91D2 /* OptionsProvider.swift in Sources */,
|
||||||
06F08EAF29B5D9FF006AB9CA /* HUD.swift in Sources */,
|
06F08EAF29B5D9FF006AB9CA /* HUD.swift in Sources */,
|
||||||
065AE76B2987777F00323230 /* ArchiveSettingRelay.swift in Sources */,
|
065AE76B2987777F00323230 /* ArchiveSettingRelay.swift in Sources */,
|
||||||
06F08EAC29B1DECD006AB9CA /* NSLocalizedString+Extension.swift in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@ -1346,7 +1340,6 @@
|
|||||||
06E9447A2C0704E500AC86AB /* ImageDownloader.swift in Sources */,
|
06E9447A2C0704E500AC86AB /* ImageDownloader.swift in Sources */,
|
||||||
06CF784C21C7A51200A052D7 /* NotificationService.swift in Sources */,
|
06CF784C21C7A51200A052D7 /* NotificationService.swift in Sources */,
|
||||||
06FB04052C53575400F3A213 /* SharedDefines.swift in Sources */,
|
06FB04052C53575400F3A213 /* SharedDefines.swift in Sources */,
|
||||||
06F08EAD29B1DED6006AB9CA /* NSLocalizedString+Extension.swift in Sources */,
|
|
||||||
067AFB1D2E5D8BED00AE78E7 /* UNNotificationContent+Extension.swift in Sources */,
|
067AFB1D2E5D8BED00AE78E7 /* UNNotificationContent+Extension.swift in Sources */,
|
||||||
0653677629B719BC0038BDB8 /* CryptoSettingManager.swift in Sources */,
|
0653677629B719BC0038BDB8 /* CryptoSettingManager.swift in Sources */,
|
||||||
06E9446F2C06FF1E00AC86AB /* BadgeProcessor.swift in Sources */,
|
06E9446F2C06FF1E00AC86AB /* BadgeProcessor.swift in Sources */,
|
||||||
@ -1357,6 +1350,7 @@
|
|||||||
06F08EA529B1DDA7006AB9CA /* Algorithm.swift in Sources */,
|
06F08EA529B1DDA7006AB9CA /* Algorithm.swift in Sources */,
|
||||||
06E944782C0701F300AC86AB /* IconProcessor.swift in Sources */,
|
06E944782C0701F300AC86AB /* IconProcessor.swift in Sources */,
|
||||||
06BBB89125650CCF0076F63E /* ArchiveSettingManager.swift in Sources */,
|
06BBB89125650CCF0076F63E /* ArchiveSettingManager.swift in Sources */,
|
||||||
|
069332232E6A8E3100F9387F /* String+Extension.swift in Sources */,
|
||||||
06D69E412C11983E00161A35 /* CallProcessor.swift in Sources */,
|
06D69E412C11983E00161A35 /* CallProcessor.swift in Sources */,
|
||||||
06B11591247BC132006D91FB /* Message.swift in Sources */,
|
06B11591247BC132006D91FB /* Message.swift in Sources */,
|
||||||
06E9447C2C07052F00AC86AB /* ImageProcessor.swift in Sources */,
|
06E9447C2C07052F00AC86AB /* ImageProcessor.swift in Sources */,
|
||||||
|
|||||||
@ -53,10 +53,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||||||
|
|
||||||
UNUserNotificationCenter.current().delegate = self
|
UNUserNotificationCenter.current().delegate = self
|
||||||
var actions = [
|
var actions = [
|
||||||
UNNotificationAction(identifier: "copy", title: NSLocalizedString("Copy2"), options: UNNotificationActionOptions.foreground)
|
UNNotificationAction(identifier: "copy", title: "Copy2".localized, options: UNNotificationActionOptions.foreground)
|
||||||
]
|
]
|
||||||
if #available(iOSApplicationExtension 15.0, *) {
|
if #available(iOSApplicationExtension 15.0, *) {
|
||||||
actions.append(UNNotificationAction(identifier: "mute", title: NSLocalizedString("muteGroup1Hour"), options: UNNotificationActionOptions.foreground))
|
actions.append(UNNotificationAction(identifier: "mute", title: "muteGroup1Hour".localized, options: UNNotificationActionOptions.foreground))
|
||||||
}
|
}
|
||||||
UNUserNotificationCenter.current().setNotificationCategories([
|
UNUserNotificationCenter.current().setNotificationCategories([
|
||||||
// customDismissAction 会在 clear 推送时,调起APP,这时可以顺便更新下 DeviceToken,防止过期。
|
// customDismissAction 会在 clear 推送时,调起APP,这时可以顺便更新下 DeviceToken,防止过期。
|
||||||
@ -171,7 +171,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
|||||||
ServerManager.shared.addServer(server: server)
|
ServerManager.shared.addServer(server: server)
|
||||||
ServerManager.shared.setCurrentServer(serverId: server.id)
|
ServerManager.shared.setCurrentServer(serverId: server.id)
|
||||||
ServerManager.shared.syncAllServers()
|
ServerManager.shared.syncAllServers()
|
||||||
HUDSuccess(NSLocalizedString("AddedSuccessfully"))
|
HUDSuccess("AddedSuccessfully".localized)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -188,14 +188,14 @@ extension AppDelegate {
|
|||||||
let url = try? (userInfo["url"] as? String)?.asURL()
|
let url = try? (userInfo["url"] as? String)?.asURL()
|
||||||
|
|
||||||
let alertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
|
let alertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("CopyContent"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "CopyContent".localized, style: .default, handler: { _ in
|
||||||
if let copy = userInfo["copy"] as? String {
|
if let copy = userInfo["copy"] as? String {
|
||||||
UIPasteboard.general.string = copy
|
UIPasteboard.general.string = copy
|
||||||
} else {
|
} else {
|
||||||
UIPasteboard.general.string = body
|
UIPasteboard.general.string = body
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("MoreActions"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "MoreActions".localized, style: .default, handler: { _ in
|
||||||
var shareContent = ""
|
var shareContent = ""
|
||||||
if let title = title {
|
if let title = title {
|
||||||
shareContent += "\(title)\n"
|
shareContent += "\(title)\n"
|
||||||
@ -226,7 +226,7 @@ extension AppDelegate {
|
|||||||
}
|
}
|
||||||
controller?.present(activityController, animated: true, completion: nil)
|
controller?.present(activityController, animated: true, completion: nil)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
|
|
||||||
let viewController = Client.shared.currentSnackbarController
|
let viewController = Client.shared.currentSnackbarController
|
||||||
|
|
||||||
|
|||||||
@ -814,6 +814,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Copy" : {
|
"Copy" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"en" : {
|
"en" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
|
|||||||
@ -33,14 +33,14 @@ extension Date {
|
|||||||
}
|
}
|
||||||
if hour > 0 {
|
if hour > 0 {
|
||||||
if minute > 0 {
|
if minute > 0 {
|
||||||
return String(format: NSLocalizedString("timeMinHourAgo"), hour, minute)
|
return "timeMinHourAgo".localized(with: hour, minute)
|
||||||
}
|
}
|
||||||
return String(format: NSLocalizedString("timeHourAgo"), hour)
|
return "timeHourAgo".localized(with: hour)
|
||||||
}
|
}
|
||||||
if minute > 1 {
|
if minute > 1 {
|
||||||
return String(format: NSLocalizedString("timeMinAgo"), minute)
|
return "timeMinAgo".localized(with: minute)
|
||||||
}
|
}
|
||||||
return NSLocalizedString("timeJustNow")
|
return "timeJustNow".localized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
//
|
|
||||||
// NSLocalizedString+Extension.swift
|
|
||||||
// Bark
|
|
||||||
//
|
|
||||||
// Created by huangfeng on 2023/3/3.
|
|
||||||
// Copyright © 2023 Fin. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
func NSLocalizedString(_ key: String) -> String {
|
|
||||||
return NSLocalizedString(key, comment: "")
|
|
||||||
}
|
|
||||||
@ -53,3 +53,13 @@ extension String {
|
|||||||
return String(format: self, arguments)
|
return String(format: self, arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension String {
|
||||||
|
var localized: String {
|
||||||
|
return NSLocalizedString(self, comment: "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func localized(with arguments: CVarArg...) -> String {
|
||||||
|
return String(format: NSLocalizedString(self, comment: ""), arguments: arguments)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -20,9 +20,9 @@ class BarkTabBarController: StateStorageTabBarController {
|
|||||||
BarkNavigationController(rootViewController: MessageSettingsViewController(viewModel: MessageSettingsViewModel()))
|
BarkNavigationController(rootViewController: MessageSettingsViewController(viewModel: MessageSettingsViewModel()))
|
||||||
]
|
]
|
||||||
|
|
||||||
let tabBarItems = [UITabBarItem(title: NSLocalizedString("service"), image: UIImage(named: "baseline_gite_black_24pt"), tag: 0),
|
let tabBarItems = [UITabBarItem(title: "service".localized, image: UIImage(named: "baseline_gite_black_24pt"), tag: 0),
|
||||||
UITabBarItem(title: NSLocalizedString("historyMessage"), image: Icon.history, tag: 1),
|
UITabBarItem(title: "historyMessage".localized, image: Icon.history, tag: 1),
|
||||||
UITabBarItem(title: NSLocalizedString("settings"), image: UIImage(named: "baseline_manage_accounts_black_24pt"), tag: 2)]
|
UITabBarItem(title: "settings".localized, image: UIImage(named: "baseline_manage_accounts_black_24pt"), tag: 2)]
|
||||||
for (index, viewController) in self.viewControllers!.enumerated() {
|
for (index, viewController) in self.viewControllers!.enumerated() {
|
||||||
viewController.tabBarItem = tabBarItems[index]
|
viewController.tabBarItem = tabBarItems[index]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,76 +0,0 @@
|
|||||||
//
|
|
||||||
// CrashReportViewController.swift
|
|
||||||
// Bark
|
|
||||||
//
|
|
||||||
// Created by huangfeng on 2023/9/18.
|
|
||||||
// Copyright © 2023 Fin. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
|
|
||||||
class CrashReportViewController: UIViewController {
|
|
||||||
var crashLog = ""
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
self.overrideUserInterfaceStyle = .light
|
|
||||||
self.view.backgroundColor = UIColor.white
|
|
||||||
|
|
||||||
let warningIcon = UIImageView(image: UIImage(named: "warning"))
|
|
||||||
self.view.addSubview(warningIcon)
|
|
||||||
|
|
||||||
let crashedTitle = UILabel()
|
|
||||||
crashedTitle.text = NSLocalizedString("crashed")
|
|
||||||
crashedTitle.font = UIFont.preferredFont(ofSize: 30, weight: .bold)
|
|
||||||
crashedTitle.adjustsFontForContentSizeCategory = true
|
|
||||||
crashedTitle.textColor = UIColor(r255: 239, g255: 77, b255: 77)
|
|
||||||
self.view.addSubview(crashedTitle)
|
|
||||||
|
|
||||||
let contentlabel = UITextView()
|
|
||||||
contentlabel.backgroundColor = UIColor.clear
|
|
||||||
contentlabel.isEditable = false
|
|
||||||
contentlabel.dataDetectorTypes = [.link]
|
|
||||||
contentlabel.isScrollEnabled = false
|
|
||||||
contentlabel.textContainerInset = .zero
|
|
||||||
contentlabel.textContainer.lineFragmentPadding = 0
|
|
||||||
contentlabel.font = UIFont.preferredFont(ofSize: 14)
|
|
||||||
contentlabel.adjustsFontForContentSizeCategory = true
|
|
||||||
contentlabel.textColor = UIColor(r255: 51, g255: 51, b255: 51)
|
|
||||||
contentlabel.text = NSLocalizedString("crashContent")
|
|
||||||
self.view.addSubview(contentlabel)
|
|
||||||
|
|
||||||
let copyButton = UIButton()
|
|
||||||
copyButton.titleLabel?.font = UIFont.preferredFont(ofSize: 16, weight: .bold)
|
|
||||||
copyButton.titleLabel?.adjustsFontForContentSizeCategory = true
|
|
||||||
copyButton.setTitleColor(UIColor.white, for: .normal)
|
|
||||||
copyButton.setTitle(NSLocalizedString("copyCrashLog"), for: .normal)
|
|
||||||
copyButton.backgroundColor = UIColor(r255: 239, g255: 77, b255: 77)
|
|
||||||
copyButton.clipsToBounds = true
|
|
||||||
copyButton.layer.cornerRadius = 6
|
|
||||||
self.view.addSubview(copyButton)
|
|
||||||
|
|
||||||
warningIcon.snp.makeConstraints { make in
|
|
||||||
make.top.equalTo(kSafeAreaInsets.top + 60)
|
|
||||||
make.left.equalTo(15)
|
|
||||||
make.width.height.equalTo(42)
|
|
||||||
}
|
|
||||||
crashedTitle.snp.makeConstraints { make in
|
|
||||||
make.left.equalTo(warningIcon.snp.right).offset(10)
|
|
||||||
make.centerY.equalTo(warningIcon)
|
|
||||||
}
|
|
||||||
contentlabel.snp.makeConstraints { make in
|
|
||||||
make.left.equalTo(20)
|
|
||||||
make.right.equalTo(-20)
|
|
||||||
make.top.equalTo(warningIcon.snp.bottom).offset(40)
|
|
||||||
}
|
|
||||||
copyButton.snp.makeConstraints { make in
|
|
||||||
make.left.right.equalTo(contentlabel)
|
|
||||||
make.top.equalTo(contentlabel.snp.bottom).offset(40)
|
|
||||||
make.height.equalTo(44)
|
|
||||||
}
|
|
||||||
|
|
||||||
copyButton.rx.tap.subscribe { [weak self] _ in
|
|
||||||
UIPasteboard.general.string = self?.crashLog
|
|
||||||
ProgressHUD.inform(NSLocalizedString("Copy"))
|
|
||||||
}.disposed(by: rx.disposeBag)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -18,7 +18,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
let textField = BorderTextField(title: "Key")
|
let textField = BorderTextField(title: "Key")
|
||||||
textField.font = UIFont.preferredFont(ofSize: 14)
|
textField.font = UIFont.preferredFont(ofSize: 14)
|
||||||
textField.adjustsFontForContentSizeCategory = true
|
textField.adjustsFontForContentSizeCategory = true
|
||||||
textField.placeholder = String(format: NSLocalizedString("enterKey"), 16)
|
textField.placeholder = "enterKey".localized(with: 16)
|
||||||
return textField
|
return textField
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
|
|
||||||
let doneButton: BKButton = {
|
let doneButton: BKButton = {
|
||||||
let btn = BKButton()
|
let btn = BKButton()
|
||||||
btn.setTitle(NSLocalizedString("done"), for: .normal)
|
btn.setTitle("done".localized, for: .normal)
|
||||||
btn.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
|
btn.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
|
||||||
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
||||||
btn.fontSize = 14
|
btn.fontSize = 14
|
||||||
@ -40,7 +40,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
|
|
||||||
let copyButton: UIButton = {
|
let copyButton: UIButton = {
|
||||||
let btn = GradientButton()
|
let btn = GradientButton()
|
||||||
btn.setTitle(NSLocalizedString("copyExample"), for: .normal)
|
btn.setTitle("copyExample".localized, for: .normal)
|
||||||
btn.setTitleColor(UIColor.white, for: .normal)
|
btn.setTitleColor(UIColor.white, for: .normal)
|
||||||
btn.titleLabel?.font = UIFont.preferredFont(ofSize: 14, weight: .medium)
|
btn.titleLabel?.font = UIFont.preferredFont(ofSize: 14, weight: .medium)
|
||||||
btn.titleLabel?.adjustsFontForContentSizeCategory = true
|
btn.titleLabel?.adjustsFontForContentSizeCategory = true
|
||||||
@ -62,7 +62,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func makeUI() {
|
override func makeUI() {
|
||||||
self.title = NSLocalizedString("encryptionSettings")
|
self.title = "encryptionSettings".localized
|
||||||
self.navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: doneButton))
|
self.navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: doneButton))
|
||||||
|
|
||||||
self.view.addSubview(scrollView)
|
self.view.addSubview(scrollView)
|
||||||
@ -79,8 +79,8 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
return label
|
return label
|
||||||
}
|
}
|
||||||
|
|
||||||
let algorithmLabel = getTitleLabel(title: NSLocalizedString("algorithm"))
|
let algorithmLabel = getTitleLabel(title: "algorithm".localized)
|
||||||
let modeLabel = getTitleLabel(title: NSLocalizedString("mode"))
|
let modeLabel = getTitleLabel(title: "mode".localized)
|
||||||
let paddingLabel = getTitleLabel(title: "Padding")
|
let paddingLabel = getTitleLabel(title: "Padding")
|
||||||
let keyLabel = getTitleLabel(title: "Key")
|
let keyLabel = getTitleLabel(title: "Key")
|
||||||
let ivLabel = getTitleLabel(title: "Iv")
|
let ivLabel = getTitleLabel(title: "Iv")
|
||||||
@ -226,7 +226,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
output.keyLengthChanged.drive(onNext: { [weak self] keyLength in
|
output.keyLengthChanged.drive(onNext: { [weak self] keyLength in
|
||||||
self?.keyTextField.placeholder = String(format: NSLocalizedString("enterKey"), keyLength)
|
self?.keyTextField.placeholder = "enterKey".localized(with: keyLength)
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
self.modeFeild
|
self.modeFeild
|
||||||
@ -246,7 +246,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
|
|
||||||
output.copy.drive(onNext: { text in
|
output.copy.drive(onNext: { text in
|
||||||
UIPasteboard.general.string = text
|
UIPasteboard.general.string = text
|
||||||
HUDSuccess(NSLocalizedString("Copy"))
|
HUDSuccess("Copy".localized)
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +255,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if let length = ["CBC": 16, "GCM": 12][mode] {
|
if let length = ["CBC": 16, "GCM": 12][mode] {
|
||||||
self.ivTextField.placeholder = String(format: NSLocalizedString("enterIv"), length)
|
self.ivTextField.placeholder = "enterIv".localized(with: length)
|
||||||
} else {
|
} else {
|
||||||
self.ivTextField.placeholder = ""
|
self.ivTextField.placeholder = ""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
|
|||||||
let copy = Driver.combineLatest(copyScript, dependencies.deviceKey, dependencies.serverAddress)
|
let copy = Driver.combineLatest(copyScript, dependencies.deviceKey, dependencies.serverAddress)
|
||||||
.compactMap { fields, deviceKey, serverAddress -> String? in
|
.compactMap { fields, deviceKey, serverAddress -> String? in
|
||||||
guard fields.mode != "GCM" else {
|
guard fields.mode != "GCM" else {
|
||||||
showSnackbar.accept(NSLocalizedString("gcmNotSupported"))
|
showSnackbar.accept("gcmNotSupported".localized)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let key = fields.key ?? ""
|
let key = fields.key ?? ""
|
||||||
@ -105,7 +105,7 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
|
|||||||
"""
|
"""
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Documentation: \(NSLocalizedString("encryptionUrl"))
|
# Documentation: \("encryptionUrl".localized)
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -114,22 +114,22 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
|
|||||||
# push payload
|
# push payload
|
||||||
json='{"body": "test", "sound": "birdsong"}'
|
json='{"body": "test", "sound": "birdsong"}'
|
||||||
|
|
||||||
# \(String(format: NSLocalizedString("keyComment"), Int(fields.algorithm.suffix(3))! / 8))
|
# \("keyComment".localized(with: Int(fields.algorithm.suffix(3))! / 8)) )
|
||||||
key='\(key)'
|
key='\(key)'
|
||||||
# \(NSLocalizedString("ivComment"))
|
# \("ivComment".localized)
|
||||||
iv='\(iv)'
|
iv='\(iv)'
|
||||||
|
|
||||||
# \(NSLocalizedString("opensslEncodingComment"))
|
# \("opensslEncodingComment".localized)
|
||||||
key=$(printf $key | xxd -ps -c 200)
|
key=$(printf $key | xxd -ps -c 200)
|
||||||
iv=$(printf $iv | xxd -ps -c 200)
|
iv=$(printf $iv | xxd -ps -c 200)
|
||||||
|
|
||||||
# \(NSLocalizedString("base64Notice"))
|
# \("base64Notice".localized)
|
||||||
ciphertext=$(echo -n $json | openssl enc -aes-\(fields.algorithm.suffix(3))-\(fields.mode.lowercased()) -K $key \(iv.count > 0 ? "-iv $iv " : "")| base64)
|
ciphertext=$(echo -n $json | openssl enc -aes-\(fields.algorithm.suffix(3))-\(fields.mode.lowercased()) -K $key \(iv.count > 0 ? "-iv $iv " : "")| base64)
|
||||||
|
|
||||||
# \(NSLocalizedString("consoleComment")) "\((try? AESCryptoModel(cryptoFields: fields).encrypt(text: "{\"body\": \"test\", \"sound\": \"birdsong\"}")) ?? "")"
|
# \("consoleComment".localized) "\((try? AESCryptoModel(cryptoFields: fields).encrypt(text: "{\"body\": \"test\", \"sound\": \"birdsong\"}")) ?? "")"
|
||||||
echo $ciphertext
|
echo $ciphertext
|
||||||
|
|
||||||
# \(NSLocalizedString("ciphertextComment"))
|
# \("ciphertextComment".localized)
|
||||||
curl --data-urlencode "ciphertext=$ciphertext"\(iv.count == 0 ? "" : " --data-urlencode \"iv=\(iv)\"") \(serverAddress)/$deviceKey
|
curl --data-urlencode "ciphertext=$ciphertext"\(iv.count == 0 ? "" : " --data-urlencode \"iv=\(iv)\"") \(serverAddress)/$deviceKey
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ViewController.swift
|
// HomeViewController.swift
|
||||||
// Bark
|
// Bark
|
||||||
//
|
//
|
||||||
// Created by huangfeng on 2018/3/7.
|
// Created by huangfeng on 2018/3/7.
|
||||||
@ -19,7 +19,7 @@ class HomeViewController: BaseViewController<HomeViewModel> {
|
|||||||
btn.setImage(Icon.add, for: .normal)
|
btn.setImage(Icon.add, for: .normal)
|
||||||
btn.imageView?.tintColor = BKColor.grey.darken4
|
btn.imageView?.tintColor = BKColor.grey.darken4
|
||||||
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
||||||
btn.accessibilityIdentifier = NSLocalizedString("AddServer")
|
btn.accessibilityIdentifier = "AddServer".localized
|
||||||
return btn
|
return btn
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -28,12 +28,12 @@ class HomeViewController: BaseViewController<HomeViewModel> {
|
|||||||
btn.setImage(UIImage(named: "baseline_filter_drama_black_24pt"), for: .normal)
|
btn.setImage(UIImage(named: "baseline_filter_drama_black_24pt"), for: .normal)
|
||||||
btn.imageView?.tintColor = BKColor.grey.darken4
|
btn.imageView?.tintColor = BKColor.grey.darken4
|
||||||
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
||||||
btn.accessibilityIdentifier = NSLocalizedString("serverList")
|
btn.accessibilityIdentifier = "serverList".localized
|
||||||
return btn
|
return btn
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let startButton: FABButton = {
|
let startButton: FABButton = {
|
||||||
let button = FABButton(title: NSLocalizedString("RegisterDevice"))
|
let button = FABButton(title: "RegisterDevice".localized)
|
||||||
button.backgroundColor = BKColor.grey.lighten5
|
button.backgroundColor = BKColor.grey.lighten5
|
||||||
button.transition([.scale(0.75), .opacity(0)])
|
button.transition([.scale(0.75), .opacity(0)])
|
||||||
return button
|
return button
|
||||||
@ -184,7 +184,7 @@ class HomeViewController: BaseViewController<HomeViewModel> {
|
|||||||
output.copy
|
output.copy
|
||||||
.drive(onNext: { [weak self] text in
|
.drive(onNext: { [weak self] text in
|
||||||
UIPasteboard.general.string = text
|
UIPasteboard.general.string = text
|
||||||
self?.showSnackbar(text: NSLocalizedString("Copy"))
|
self?.showSnackbar(text: "Copy".localized)
|
||||||
})
|
})
|
||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -228,14 +228,14 @@ class HomeViewController: BaseViewController<HomeViewModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func alertServerError(error: String) {
|
func alertServerError(error: String) {
|
||||||
let alertController = UIAlertController(title: NSLocalizedString("ServerError"), message: error, preferredStyle: .alert)
|
let alertController = UIAlertController(title: "ServerError".localized, message: error, preferredStyle: .alert)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("faq"), style: .default, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "faq".localized, style: .default, handler: { [weak self] _ in
|
||||||
guard let url = try? NSLocalizedString("faqUrl").asURL() else {
|
guard let url = try? "faqUrl".localized.asURL() else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self?.navigationController?.present(BarkSFSafariViewController(url: url), animated: true, completion: nil)
|
self?.navigationController?.present(BarkSFSafariViewController(url: url), animated: true, completion: nil)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
self.present(alertController, animated: true, completion: nil)
|
self.present(alertController, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -42,85 +42,85 @@ class HomeViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
let previews: [PreviewModel] = [
|
let previews: [PreviewModel] = [
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("CustomedNotificationContent"),
|
body: "CustomedNotificationContent".localized,
|
||||||
notice: NSLocalizedString("Notice1")
|
notice: "Notice1".localized
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
title: NSLocalizedString("CustomedNotificationTitle"),
|
title: "CustomedNotificationTitle".localized,
|
||||||
body: NSLocalizedString("CustomedNotificationContent"),
|
body: "CustomedNotificationContent".localized,
|
||||||
notice: NSLocalizedString("Notice2")
|
notice: "Notice2".localized
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("notificationSound"),
|
body: "notificationSound".localized,
|
||||||
notice: NSLocalizedString("setSounds"),
|
notice: "setSounds".localized,
|
||||||
queryParameter: "sound=minuet",
|
queryParameter: "sound=minuet",
|
||||||
moreInfo: NSLocalizedString("viewAllSounds"),
|
moreInfo: "viewAllSounds".localized,
|
||||||
moreViewModel: SoundsViewModel()
|
moreViewModel: SoundsViewModel()
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("ringtone"),
|
body: "ringtone".localized,
|
||||||
notice: NSLocalizedString("ringtoneNotice"),
|
notice: "ringtoneNotice".localized,
|
||||||
queryParameter: "call=1"
|
queryParameter: "call=1"
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("archiveNotificationMessageTitle"),
|
body: "archiveNotificationMessageTitle".localized,
|
||||||
notice: NSLocalizedString("archiveNotificationMessage"),
|
notice: "archiveNotificationMessage".localized,
|
||||||
queryParameter: "isArchive=1"
|
queryParameter: "isArchive=1"
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("notificationIcon"),
|
body: "notificationIcon".localized,
|
||||||
notice: NSLocalizedString("notificationIconNotice"),
|
notice: "notificationIconNotice".localized,
|
||||||
queryParameter: "icon=https://day.app/assets/images/avatar.jpg",
|
queryParameter: "icon=https://day.app/assets/images/avatar.jpg",
|
||||||
image: UIImage(named: "icon")
|
image: UIImage(named: "icon")
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("messageGroup"),
|
body: "messageGroup".localized,
|
||||||
notice: NSLocalizedString("groupMessagesNotice"),
|
notice: "groupMessagesNotice".localized,
|
||||||
queryParameter: "group=groupName",
|
queryParameter: "group=groupName",
|
||||||
image: UIImage(named: "group")
|
image: UIImage(named: "group")
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("pushNotificationEncryption"),
|
body: "pushNotificationEncryption".localized,
|
||||||
notice: NSLocalizedString("encryptionNotice"),
|
notice: "encryptionNotice".localized,
|
||||||
queryParameter: "ciphertext=ciphertext",
|
queryParameter: "ciphertext=ciphertext",
|
||||||
moreInfo: NSLocalizedString("encryptionSettings"),
|
moreInfo: "encryptionSettings".localized,
|
||||||
moreViewModel: CryptoSettingViewModel()
|
moreViewModel: CryptoSettingViewModel()
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("criticalAlert"),
|
body: "criticalAlert".localized,
|
||||||
notice: NSLocalizedString("criticalAlertNotice"),
|
notice: "criticalAlertNotice".localized,
|
||||||
queryParameter: "level=critical&volume=5",
|
queryParameter: "level=critical&volume=5",
|
||||||
image: UIImage(named: "criticalAlert")
|
image: UIImage(named: "criticalAlert")
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("interruptionLevel"),
|
body: "interruptionLevel".localized,
|
||||||
notice: NSLocalizedString("interruptionLevelNotice"),
|
notice: "interruptionLevelNotice".localized,
|
||||||
queryParameter: "level=timeSensitive"
|
queryParameter: "level=timeSensitive"
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: "URL Test",
|
body: "URL Test",
|
||||||
notice: NSLocalizedString("urlParameter"),
|
notice: "urlParameter".localized,
|
||||||
queryParameter: "url=https://www.baidu.com"
|
queryParameter: "url=https://www.baidu.com"
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("imagePushNotification"),
|
body: "imagePushNotification".localized,
|
||||||
notice: NSLocalizedString("imageParameter"),
|
notice: "imageParameter".localized,
|
||||||
queryParameter: "image=https://day.app/assets/images/avatar.jpg"
|
queryParameter: "image=https://day.app/assets/images/avatar.jpg"
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: "Copy Test",
|
body: "Copy Test",
|
||||||
notice: NSLocalizedString("copyParameter"),
|
notice: "copyParameter".localized,
|
||||||
queryParameter: "copy=test",
|
queryParameter: "copy=test",
|
||||||
image: UIImage(named: "copyTest")
|
image: UIImage(named: "copyTest")
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("badge"),
|
body: "badge".localized,
|
||||||
notice: NSLocalizedString("badgeNotice"),
|
notice: "badgeNotice".localized,
|
||||||
queryParameter: "badge=1"
|
queryParameter: "badge=1"
|
||||||
),
|
),
|
||||||
PreviewModel(
|
PreviewModel(
|
||||||
body: NSLocalizedString("automaticallyCopyTitle"),
|
body: "automaticallyCopyTitle".localized,
|
||||||
notice: NSLocalizedString("automaticallyCopy"),
|
notice: "automaticallyCopy".localized,
|
||||||
queryParameter: "autoCopy=1©=optional"
|
queryParameter: "autoCopy=1©=optional"
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
@ -182,7 +182,7 @@ class HomeViewModel: ViewModel, ViewModelType {
|
|||||||
.skip(1)
|
.skip(1)
|
||||||
.compactMap { granted -> String? in
|
.compactMap { granted -> String? in
|
||||||
if !granted {
|
if !granted {
|
||||||
return NSLocalizedString("AllowNotifications")
|
return "AllowNotifications".localized
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ class HomeViewModel: ViewModel, ViewModelType {
|
|||||||
case .ok: break
|
case .ok: break
|
||||||
case .serverError(let error):
|
case .serverError(let error):
|
||||||
if serverErrorCount < 2 {
|
if serverErrorCount < 2 {
|
||||||
showSnackbar.accept("\(NSLocalizedString("ServerError")): \(error.rawString())")
|
showSnackbar.accept("\("ServerError".localized): \(error.rawString())")
|
||||||
} else {
|
} else {
|
||||||
alertServerError.accept(error.rawString())
|
alertServerError.accept(error.rawString())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,20 +33,20 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
}
|
}
|
||||||
subMenuElements.append(action)
|
subMenuElements.append(action)
|
||||||
}
|
}
|
||||||
menuElements.append(UIMenu(title: NSLocalizedString("more"), children: subMenuElements))
|
menuElements.append(UIMenu(title: "more".localized, children: subMenuElements))
|
||||||
|
|
||||||
let addNewMenu = UIMenu(
|
let addNewMenu = UIMenu(
|
||||||
title: NSLocalizedString("clearFrom"),
|
title: "clearFrom".localized,
|
||||||
children: menuElements
|
children: menuElements
|
||||||
)
|
)
|
||||||
let item = UIBarButtonItem(image: UIImage(named: "baseline_delete_outline_black_24pt"), menu: addNewMenu)
|
let item = UIBarButtonItem(image: UIImage(named: "baseline_delete_outline_black_24pt"), menu: addNewMenu)
|
||||||
item.accessibilityLabel = NSLocalizedString("clear")
|
item.accessibilityLabel = "clear".localized
|
||||||
return item
|
return item
|
||||||
} else {
|
} else {
|
||||||
let btn = BKButton()
|
let btn = BKButton()
|
||||||
btn.setImage(UIImage(named: "baseline_delete_outline_black_24pt"), for: .normal)
|
btn.setImage(UIImage(named: "baseline_delete_outline_black_24pt"), for: .normal)
|
||||||
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
||||||
btn.accessibilityLabel = NSLocalizedString("clear")
|
btn.accessibilityLabel = "clear".localized
|
||||||
return UIBarButtonItem(customView: btn)
|
return UIBarButtonItem(customView: btn)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,10 +246,10 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
output.errorAlert
|
output.errorAlert
|
||||||
.drive(onNext: { [weak self] error in
|
.drive(onNext: { [weak self] error in
|
||||||
let alertController = UIAlertController(title: "Error", message: error, preferredStyle: .alert)
|
let alertController = UIAlertController(title: "Error", message: error, preferredStyle: .alert)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Copy2"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "Copy2".localized, style: .default, handler: { _ in
|
||||||
UIPasteboard.general.string = error
|
UIPasteboard.general.string = error
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
self?.present(alertController, animated: true, completion: nil)
|
self?.present(alertController, animated: true, completion: nil)
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -264,20 +264,20 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
deleteBtn.rx.tap.subscribe(onNext: { [weak self] _ in
|
deleteBtn.rx.tap.subscribe(onNext: { [weak self] _ in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
let alertController = UIAlertController(title: nil, message: NSLocalizedString("clearFrom"), preferredStyle: .actionSheet)
|
let alertController = UIAlertController(title: nil, message: "clearFrom".localized, preferredStyle: .actionSheet)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("lastHour"), style: .default, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "lastHour".localized, style: .default, handler: { [weak self] _ in
|
||||||
self?.clearAlert(.lastHour)
|
self?.clearAlert(.lastHour)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("today"), style: .default, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "today".localized, style: .default, handler: { [weak self] _ in
|
||||||
self?.clearAlert(.today)
|
self?.clearAlert(.today)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("todayAndYesterday"), style: .default, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "todayAndYesterday".localized, style: .default, handler: { [weak self] _ in
|
||||||
self?.clearAlert(.todayAndYesterday)
|
self?.clearAlert(.todayAndYesterday)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("allTime"), style: .default, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "allTime".localized, style: .default, handler: { [weak self] _ in
|
||||||
self?.clearAlert(.allTime)
|
self?.clearAlert(.allTime)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
alertController.modalPresentationStyle = .popover
|
alertController.modalPresentationStyle = .popover
|
||||||
if #available(iOS 16.0, *) {
|
if #available(iOS 16.0, *) {
|
||||||
@ -291,11 +291,11 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func clearAlert(_ range: MessageDeleteTimeRange) {
|
func clearAlert(_ range: MessageDeleteTimeRange) {
|
||||||
let alertController = UIAlertController(title: nil, message: "\(NSLocalizedString("clearFrom"))\n\(range.string)", preferredStyle: .alert)
|
let alertController = UIAlertController(title: nil, message: "\("clearFrom".localized)\n\(range.string)", preferredStyle: .alert)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("clear"), style: .destructive, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "clear".localized, style: .destructive, handler: { [weak self] _ in
|
||||||
self?.clearRelay.accept(range)
|
self?.clearRelay.accept(range)
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
self.navigationController?.present(alertController, animated: true, completion: nil)
|
self.navigationController?.present(alertController, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
||||||
|
|
||||||
// 复制
|
// 复制
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Copy2"), style: .default, handler: { [weak self]
|
alertController.addAction(UIAlertAction(title: "Copy2".localized, style: .default, handler: { [weak self]
|
||||||
(_: UIAlertAction) in
|
(_: UIAlertAction) in
|
||||||
if #available(iOS 14.0, *) {
|
if #available(iOS 14.0, *) {
|
||||||
var items = [[String: Any]]()
|
var items = [[String: Any]]()
|
||||||
@ -315,10 +315,10 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
} else {
|
} else {
|
||||||
UIPasteboard.general.string = message.attributedText?.string ?? ""
|
UIPasteboard.general.string = message.attributedText?.string ?? ""
|
||||||
}
|
}
|
||||||
self?.showSnackbar(text: NSLocalizedString("Copy"))
|
self?.showSnackbar(text: "Copy".localized)
|
||||||
}))
|
}))
|
||||||
// 删除
|
// 删除
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("removeMessage"), style: .destructive, handler: { [weak self]
|
alertController.addAction(UIAlertAction(title: "removeMessage".localized, style: .destructive, handler: { [weak self]
|
||||||
(_: UIAlertAction) in
|
(_: UIAlertAction) in
|
||||||
guard let self, let indexPath = self.tableView.indexPath(for: sourceCell) else { return }
|
guard let self, let indexPath = self.tableView.indexPath(for: sourceCell) else { return }
|
||||||
if sourceCell is MessageTableViewCell {
|
if sourceCell is MessageTableViewCell {
|
||||||
@ -330,7 +330,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
// 取消
|
// 取消
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: { _ in }))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: { _ in }))
|
||||||
|
|
||||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
alertController.popoverPresentationController?.sourceView = sourceView.superview
|
alertController.popoverPresentationController?.sourceView = sourceView.superview
|
||||||
@ -350,7 +350,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
|
|||||||
|
|
||||||
extension MessageListViewController: UITableViewDelegate {
|
extension MessageListViewController: UITableViewDelegate {
|
||||||
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||||
let action = UIContextualAction(style: .destructive, title: NSLocalizedString("removeMessage")) { [weak self] _, _, actionPerformed in
|
let action = UIContextualAction(style: .destructive, title: "removeMessage".localized) { [weak self] _, _, actionPerformed in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
|
|
||||||
if self.tableView.cellForRow(at: indexPath) is MessageTableViewCell {
|
if self.tableView.cellForRow(at: indexPath) is MessageTableViewCell {
|
||||||
@ -361,12 +361,12 @@ extension MessageListViewController: UITableViewDelegate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 群组消息删除,弹出个确认提示
|
// 群组消息删除,弹出个确认提示
|
||||||
let alertView = UIAlertController(title: nil, message: NSLocalizedString("removeNotice"), preferredStyle: .alert)
|
let alertView = UIAlertController(title: nil, message: "removeNotice".localized, preferredStyle: .alert)
|
||||||
alertView.addAction(UIAlertAction(title: NSLocalizedString("removeMessage"), style: .destructive, handler: { _ in
|
alertView.addAction(UIAlertAction(title: "removeMessage".localized, style: .destructive, handler: { _ in
|
||||||
self.tableView.dataSource?.tableView?(self.tableView, commit: .delete, forRowAt: indexPath)
|
self.tableView.dataSource?.tableView?(self.tableView, commit: .delete, forRowAt: indexPath)
|
||||||
actionPerformed(true)
|
actionPerformed(true)
|
||||||
}))
|
}))
|
||||||
alertView.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: { _ in
|
alertView.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: { _ in
|
||||||
actionPerformed(false)
|
actionPerformed(false)
|
||||||
}))
|
}))
|
||||||
self.present(alertView, animated: true, completion: nil)
|
self.present(alertView, animated: true, completion: nil)
|
||||||
|
|||||||
@ -176,7 +176,7 @@ class MessageListViewModel: ViewModel, ViewModelType {
|
|||||||
items.append(.message(model: messages[0]))
|
items.append(.message(model: messages[0]))
|
||||||
} else if messages.count > 0 {
|
} else if messages.count > 0 {
|
||||||
// 多条消息时,折叠显示
|
// 多条消息时,折叠显示
|
||||||
items.append(.messageGroup(name: group ?? NSLocalizedString("default"), totalCount: messageResult.count, messages: messages))
|
items.append(.messageGroup(name: group ?? "default".localized, totalCount: messageResult.count, messages: messages))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return items
|
return items
|
||||||
@ -212,7 +212,7 @@ class MessageListViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
func transform(input: Input) -> Output {
|
func transform(input: Input) -> Output {
|
||||||
// 标题
|
// 标题
|
||||||
let titleRelay = BehaviorRelay<String>(value: NSLocalizedString("historyMessage"))
|
let titleRelay = BehaviorRelay<String>(value: "historyMessage".localized)
|
||||||
// 数据源
|
// 数据源
|
||||||
let messagesRelay = BehaviorRelay<[MessageSection]>(value: [])
|
let messagesRelay = BehaviorRelay<[MessageSection]>(value: [])
|
||||||
// 刷新操作
|
// 刷新操作
|
||||||
@ -232,9 +232,9 @@ class MessageListViewModel: ViewModel, ViewModelType {
|
|||||||
filterGroups
|
filterGroups
|
||||||
.subscribe(onNext: { filterGroups in
|
.subscribe(onNext: { filterGroups in
|
||||||
if filterGroups.count <= 0 {
|
if filterGroups.count <= 0 {
|
||||||
titleRelay.accept(NSLocalizedString("historyMessage"))
|
titleRelay.accept("historyMessage".localized)
|
||||||
} else {
|
} else {
|
||||||
titleRelay.accept(filterGroups.map { $0 ?? NSLocalizedString("default") }.joined(separator: " , "))
|
titleRelay.accept(filterGroups.map { $0 ?? "default".localized }.joined(separator: " , "))
|
||||||
}
|
}
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
|||||||
private var footers: [String?] = []
|
private var footers: [String?] = []
|
||||||
|
|
||||||
override func makeUI() {
|
override func makeUI() {
|
||||||
self.title = NSLocalizedString("settings")
|
self.title = "settings".localized
|
||||||
|
|
||||||
self.view.addSubview(tableView)
|
self.view.addSubview(tableView)
|
||||||
tableView.snp.makeConstraints { make in
|
tableView.snp.makeConstraints { make in
|
||||||
@ -63,8 +63,8 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
|||||||
SwiftyStoreKit.purchaseProduct(productId) { result in
|
SwiftyStoreKit.purchaseProduct(productId) { result in
|
||||||
SVProgressHUD.dismiss()
|
SVProgressHUD.dismiss()
|
||||||
if case .success = result {
|
if case .success = result {
|
||||||
let alert = UIAlertController(title: NSLocalizedString("successfulDonation"), message: NSLocalizedString("thankYouSupport"), preferredStyle: .alert)
|
let alert = UIAlertController(title: "successfulDonation".localized, message: "thankYouSupport".localized, preferredStyle: .alert)
|
||||||
alert.addAction(UIAlertAction(title: NSLocalizedString("donateOK"), style: .default, handler: nil))
|
alert.addAction(UIAlertAction(title: "donateOK".localized, style: .default, handler: nil))
|
||||||
self?.present(alert, animated: true)
|
self?.present(alert, animated: true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,11 +115,11 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("export"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "export".localized, style: .default, handler: { _ in
|
||||||
strongSelf.backupOrRestoreActionRelay.accept(.export)
|
strongSelf.backupOrRestoreActionRelay.accept(.export)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("import"), style: .default, handler: { [weak self] _ in
|
alertController.addAction(UIAlertAction(title: "import".localized, style: .default, handler: { [weak self] _ in
|
||||||
if #available(iOS 14.0, *) {
|
if #available(iOS 14.0, *) {
|
||||||
let supportedType: [UTType] = [UTType.json]
|
let supportedType: [UTType] = [UTType.json]
|
||||||
let pickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: supportedType, asCopy: false)
|
let pickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: supportedType, asCopy: false)
|
||||||
@ -127,8 +127,8 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
|||||||
self?.present(pickerViewController, animated: true, completion: nil)
|
self?.present(pickerViewController, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
if let cell = strongSelf.tableView.cellForRow(at: indexPath) {
|
if let cell = strongSelf.tableView.cellForRow(at: indexPath) {
|
||||||
alertController.popoverPresentationController?.sourceView = strongSelf.tableView
|
alertController.popoverPresentationController?.sourceView = strongSelf.tableView
|
||||||
@ -246,7 +246,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
|||||||
// 复制 deviceToken 操作
|
// 复制 deviceToken 操作
|
||||||
output.copyDeviceToken.drive { [weak self] deviceToken in
|
output.copyDeviceToken.drive { [weak self] deviceToken in
|
||||||
UIPasteboard.general.string = deviceToken
|
UIPasteboard.general.string = deviceToken
|
||||||
self?.showSnackbar(text: NSLocalizedString("Copy"))
|
self?.showSnackbar(text: "Copy".localized)
|
||||||
}.disposed(by: rx.disposeBag)
|
}.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
// 导出数据
|
// 导出数据
|
||||||
@ -292,7 +292,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
|
|||||||
), animated: true, completion: nil)
|
), animated: true, completion: nil)
|
||||||
case "restoreSubscription":
|
case "restoreSubscription":
|
||||||
SwiftyStoreKit.restorePurchases { [weak self] _ in
|
SwiftyStoreKit.restorePurchases { [weak self] _ in
|
||||||
self?.showSnackbar(text: NSLocalizedString("done"))
|
self?.showSnackbar(text: "done".localized)
|
||||||
}
|
}
|
||||||
default: break
|
default: break
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
// 历史消息
|
// 历史消息
|
||||||
var messageSettings = [MessageSettingItem]()
|
var messageSettings = [MessageSettingItem]()
|
||||||
messageSettings.append(.backup(viewModel: MutableTextCellViewModel(
|
messageSettings.append(.backup(viewModel: MutableTextCellViewModel(
|
||||||
title: "\(NSLocalizedString("export"))/\(NSLocalizedString("import"))",
|
title: "\("export".localized)/\("import".localized)",
|
||||||
text: Observable.merge([restoreSuccess, input.viewDidAppear])
|
text: Observable.merge([restoreSuccess, input.viewDidAppear])
|
||||||
.map { _ in
|
.map { _ in
|
||||||
if let realm = try? Realm() {
|
if let realm = try? Realm() {
|
||||||
@ -84,7 +84,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
.map { count in
|
.map { count in
|
||||||
"\(count) \(NSLocalizedString("items"))"
|
"\(count) \("items".localized)"
|
||||||
}
|
}
|
||||||
.asDriver(onErrorDriveWith: .empty())
|
.asDriver(onErrorDriveWith: .empty())
|
||||||
)
|
)
|
||||||
@ -94,7 +94,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
settings.append(
|
settings.append(
|
||||||
SectionModel(
|
SectionModel(
|
||||||
model: MessageSettingSection(header: NSLocalizedString("historyMessage"), footer: NSLocalizedString("archiveNote")),
|
model: MessageSettingSection(header: "historyMessage".localized, footer: "archiveNote".localized),
|
||||||
items: messageSettings
|
items: messageSettings
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -111,7 +111,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
if let deviceToken = deviceToken {
|
if let deviceToken = deviceToken {
|
||||||
return "\(deviceToken.prefix(2))****\(deviceToken.suffix(4))"
|
return "\(deviceToken.prefix(2))****\(deviceToken.suffix(4))"
|
||||||
}
|
}
|
||||||
return NSLocalizedString("unknown")
|
return "unknown".localized
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
))
|
))
|
||||||
@ -128,7 +128,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
}
|
}
|
||||||
settings.append(
|
settings.append(
|
||||||
SectionModel(
|
SectionModel(
|
||||||
model: MessageSettingSection(header: NSLocalizedString("info"), footer: NSLocalizedString("buildDesc")),
|
model: MessageSettingSection(header: "info".localized, footer: "buildDesc".localized),
|
||||||
items: infosettings
|
items: infosettings
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -136,20 +136,20 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
// 其他
|
// 其他
|
||||||
var otherSettings = [MessageSettingItem]()
|
var otherSettings = [MessageSettingItem]()
|
||||||
otherSettings.append(.detail(
|
otherSettings.append(.detail(
|
||||||
title: NSLocalizedString("faq"),
|
title: "faq".localized,
|
||||||
text: nil,
|
text: nil,
|
||||||
textColor: nil,
|
textColor: nil,
|
||||||
url: URL(string: NSLocalizedString("faqUrl"))
|
url: URL(string: "faqUrl".localized)
|
||||||
))
|
))
|
||||||
|
|
||||||
otherSettings.append(.detail(
|
otherSettings.append(.detail(
|
||||||
title: NSLocalizedString("documentation"),
|
title: "documentation".localized,
|
||||||
text: nil,
|
text: nil,
|
||||||
textColor: nil,
|
textColor: nil,
|
||||||
url: URL(string: NSLocalizedString("docUrl"))
|
url: URL(string: "docUrl".localized)
|
||||||
))
|
))
|
||||||
otherSettings.append(.detail(
|
otherSettings.append(.detail(
|
||||||
title: NSLocalizedString("sourceCode"),
|
title: "sourceCode".localized,
|
||||||
text: nil,
|
text: nil,
|
||||||
textColor: nil,
|
textColor: nil,
|
||||||
url: URL(string: "https://github.com/Finb/Bark")
|
url: URL(string: "https://github.com/Finb/Bark")
|
||||||
@ -157,19 +157,19 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
settings.append(
|
settings.append(
|
||||||
SectionModel(
|
SectionModel(
|
||||||
model: MessageSettingSection(header: NSLocalizedString("other")),
|
model: MessageSettingSection(header: "other".localized),
|
||||||
items: otherSettings
|
items: otherSettings
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 捐赠
|
// 捐赠
|
||||||
var donateSettings = [MessageSettingItem]()
|
var donateSettings = [MessageSettingItem]()
|
||||||
donateSettings.append(.donate(title: NSLocalizedString("oneTimeDonation"), productId: "bark.oneTimeDonation.18"))
|
donateSettings.append(.donate(title: "oneTimeDonation".localized, productId: "bark.oneTimeDonation.18"))
|
||||||
donateSettings.append(.donate(title: NSLocalizedString("continuousSupport"), productId: "bark.continuousSupport.18"))
|
donateSettings.append(.donate(title: "continuousSupport".localized, productId: "bark.continuousSupport.18"))
|
||||||
settings.append(
|
settings.append(
|
||||||
SectionModel(
|
SectionModel(
|
||||||
model: MessageSettingSection(
|
model: MessageSettingSection(
|
||||||
header: NSLocalizedString("donate"),
|
header: "donate".localized,
|
||||||
footer: nil
|
footer: nil
|
||||||
),
|
),
|
||||||
items: donateSettings
|
items: donateSettings
|
||||||
|
|||||||
@ -27,8 +27,8 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
|
|||||||
lazy var addressTextField: TextField = {
|
lazy var addressTextField: TextField = {
|
||||||
let textField = TextField()
|
let textField = TextField()
|
||||||
textField.keyboardType = .URL
|
textField.keyboardType = .URL
|
||||||
textField.placeholder = NSLocalizedString("ServerAddress")
|
textField.placeholder = "ServerAddress".localized
|
||||||
textField.detail = NSLocalizedString("ServerExample")
|
textField.detail = "ServerExample".localized
|
||||||
textField.transition([.scale(0.85), .opacity(0)])
|
textField.transition([.scale(0.85), .opacity(0)])
|
||||||
textField.detailLabel.transition([.scale(0.85), .opacity(0)])
|
textField.detailLabel.transition([.scale(0.85), .opacity(0)])
|
||||||
textField.textColor = BKColor.grey.darken4
|
textField.textColor = BKColor.grey.darken4
|
||||||
@ -42,7 +42,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
|
|||||||
|
|
||||||
let noticeLabel: UILabel = {
|
let noticeLabel: UILabel = {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = NSLocalizedString("DeploymentDocuments")
|
label.text = "DeploymentDocuments".localized
|
||||||
label.textColor = BKColor.blue.base
|
label.textColor = BKColor.blue.base
|
||||||
label.font = UIFont.preferredFont(ofSize: 12)
|
label.font = UIFont.preferredFont(ofSize: 12)
|
||||||
label.adjustsFontForContentSizeCategory = true
|
label.adjustsFontForContentSizeCategory = true
|
||||||
@ -63,8 +63,8 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
|
|||||||
|
|
||||||
override func makeUI() {
|
override func makeUI() {
|
||||||
self.navigationItem.largeTitleDisplayMode = .never
|
self.navigationItem.largeTitleDisplayMode = .never
|
||||||
navigationItem.title = NSLocalizedString("AddServer")
|
navigationItem.title = "AddServer".localized
|
||||||
|
|
||||||
self.view.layout(addressTextField)
|
self.view.layout(addressTextField)
|
||||||
.top(kNavigationHeight + 40).left(10).right(10)
|
.top(kNavigationHeight + 40).left(10).right(10)
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
|
|||||||
// 点击提醒按钮事件
|
// 点击提醒按钮事件
|
||||||
let noticeTap = noticeLabel.gestureRecognizers!.first!.rx
|
let noticeTap = noticeLabel.gestureRecognizers!.first!.rx
|
||||||
.event
|
.event
|
||||||
.map { _ -> () in
|
.map { _ in
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
.asDriver(onErrorJustReturn: ())
|
.asDriver(onErrorJustReturn: ())
|
||||||
@ -98,7 +98,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
|
|||||||
.asDriver(onErrorDriveWith: .empty())
|
.asDriver(onErrorDriveWith: .empty())
|
||||||
|
|
||||||
// 扫描二维码事件
|
// 扫描二维码事件
|
||||||
let scannerDidScan = self.scanButton.rx.tap.flatMapLatest {[weak self] _ -> Observable<String> in
|
let scannerDidScan = self.scanButton.rx.tap.flatMapLatest { [weak self] _ -> Observable<String> in
|
||||||
let controller = QRScannerViewController()
|
let controller = QRScannerViewController()
|
||||||
self?.navigationController?.present(controller, animated: true, completion: nil)
|
self?.navigationController?.present(controller, animated: true, completion: nil)
|
||||||
return controller.scannerDidSuccess
|
return controller.scannerDidSuccess
|
||||||
@ -116,8 +116,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
|
|||||||
output.showKeyboard.drive(onNext: { [weak self] show in
|
output.showKeyboard.drive(onNext: { [weak self] show in
|
||||||
if show {
|
if show {
|
||||||
_ = self?.addressTextField.becomeFirstResponder()
|
_ = self?.addressTextField.becomeFirstResponder()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self?.addressTextField.resignFirstResponder()
|
self?.addressTextField.resignFirstResponder()
|
||||||
}
|
}
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class NewServerViewModel: ViewModel, ViewModelType {
|
|||||||
let showSnackbar = PublishRelay<String>()
|
let showSnackbar = PublishRelay<String>()
|
||||||
|
|
||||||
let notice = input.noticeClick
|
let notice = input.noticeClick
|
||||||
.map { URL(string: NSLocalizedString("deployUrl"))! }
|
.map { URL(string: "deployUrl".localized)! }
|
||||||
.asDriver()
|
.asDriver()
|
||||||
|
|
||||||
input.viewDidAppear
|
input.viewDidAppear
|
||||||
@ -66,9 +66,8 @@ class NewServerViewModel: ViewModel, ViewModelType {
|
|||||||
return BarkApi.provider
|
return BarkApi.provider
|
||||||
.request(.ping(baseURL: url))
|
.request(.ping(baseURL: url))
|
||||||
.filterResponseError()
|
.filterResponseError()
|
||||||
}
|
} else {
|
||||||
else {
|
showSnackbar.accept("InvalidURL".localized)
|
||||||
showSnackbar.accept(NSLocalizedString("InvalidURL"))
|
|
||||||
return .empty()
|
return .empty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,9 +81,9 @@ class NewServerViewModel: ViewModel, ViewModelType {
|
|||||||
ServerManager.shared.syncAllServers()
|
ServerManager.shared.syncAllServers()
|
||||||
|
|
||||||
strongSelf.pop.accept(URL(string: strongSelf.url)?.host ?? "")
|
strongSelf.pop.accept(URL(string: strongSelf.url)?.host ?? "")
|
||||||
showSnackbar.accept(NSLocalizedString("AddedSuccessfully"))
|
showSnackbar.accept("AddedSuccessfully".localized)
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
showSnackbar.accept("\(NSLocalizedString("InvalidServer"))\(error.rawString())")
|
showSnackbar.accept("\("InvalidServer".localized)\(error.rawString())")
|
||||||
}
|
}
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
import Material
|
||||||
import RxCocoa
|
import RxCocoa
|
||||||
import RxDataSources
|
import RxDataSources
|
||||||
import RxSwift
|
import RxSwift
|
||||||
import Material
|
|
||||||
|
|
||||||
struct SectionItem {
|
struct SectionItem {
|
||||||
let image: UIImage?
|
let image: UIImage?
|
||||||
@ -29,9 +29,9 @@ class SectionViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
func initSectionItems() -> Observable<[SectionModel<String, SectionItem>]> {
|
func initSectionItems() -> Observable<[SectionModel<String, SectionItem>]> {
|
||||||
let sectionItems = [
|
let sectionItems = [
|
||||||
SectionItem(image: UIImage(named: "baseline_gite_black_24pt"), title: NSLocalizedString("service")),
|
SectionItem(image: UIImage(named: "baseline_gite_black_24pt"), title: "service".localized),
|
||||||
SectionItem(image: Icon.history, title: NSLocalizedString("historyMessage")),
|
SectionItem(image: Icon.history, title: "historyMessage".localized),
|
||||||
SectionItem(image: UIImage(named: "baseline_manage_accounts_black_24pt"), title: NSLocalizedString("settings")),
|
SectionItem(image: UIImage(named: "baseline_manage_accounts_black_24pt"), title: "settings".localized)
|
||||||
]
|
]
|
||||||
let section = [SectionModel(model: "", items: sectionItems)]
|
let section = [SectionModel(model: "", items: sectionItems)]
|
||||||
return Observable.just(section)
|
return Observable.just(section)
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
|
|||||||
closeButton.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
closeButton.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
|
||||||
closeButton.hitTestSlop = UIEdgeInsets(top: -10, left: -10, bottom: -10, right: -10)
|
closeButton.hitTestSlop = UIEdgeInsets(top: -10, left: -10, bottom: -10, right: -10)
|
||||||
closeButton.tintColor = BKColor.grey.darken4
|
closeButton.tintColor = BKColor.grey.darken4
|
||||||
closeButton.accessibilityLabel = NSLocalizedString("close")
|
closeButton.accessibilityLabel = "close".localized
|
||||||
return closeButton
|
return closeButton
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
override func makeUI() {
|
override func makeUI() {
|
||||||
self.title = NSLocalizedString("serverList")
|
self.title = "serverList".localized
|
||||||
|
|
||||||
navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: closeButton))
|
navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: closeButton))
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
|
|||||||
output.copy
|
output.copy
|
||||||
.drive(onNext: { [weak self] text in
|
.drive(onNext: { [weak self] text in
|
||||||
UIPasteboard.general.string = text
|
UIPasteboard.general.string = text
|
||||||
self?.showSnackbar(text: NSLocalizedString("Copy"))
|
self?.showSnackbar(text: "Copy".localized)
|
||||||
})
|
})
|
||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -148,50 +148,50 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let alertController = UIAlertController(title: nil, message: "\(URL(string: viewModel.server.address)?.host ?? "")", preferredStyle: .actionSheet)
|
let alertController = UIAlertController(title: nil, message: "\(URL(string: viewModel.server.address)?.host ?? "")", preferredStyle: .actionSheet)
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("copyAddressAndKey"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "copyAddressAndKey".localized, style: .default, handler: { _ in
|
||||||
relay.accept((viewModel.server, .copy))
|
relay.accept((viewModel.server, .copy))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("resetKey"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "resetKey".localized, style: .default, handler: { _ in
|
||||||
let alertController = UIAlertController(title: NSLocalizedString("resetKey"), message: NSLocalizedString("resetKeyDesc"), preferredStyle: .alert)
|
let alertController = UIAlertController(title: "resetKey".localized, message: "resetKeyDesc".localized, preferredStyle: .alert)
|
||||||
alertController.addTextField { textField in
|
alertController.addTextField { textField in
|
||||||
textField.placeholder = NSLocalizedString("resetKeyPlaceholder")
|
textField.placeholder = "resetKeyPlaceholder".localized
|
||||||
}
|
}
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("confirm"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "confirm".localized, style: .default, handler: { _ in
|
||||||
relay.accept((viewModel.server, .reset(key: alertController.textFields?.first?.text)))
|
relay.accept((viewModel.server, .reset(key: alertController.textFields?.first?.text)))
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
self.navigationController?.present(alertController, animated: true, completion: nil)
|
self.navigationController?.present(alertController, animated: true, completion: nil)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("setAsDefaultServer"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "setAsDefaultServer".localized, style: .default, handler: { _ in
|
||||||
relay.accept((viewModel.server, .select))
|
relay.accept((viewModel.server, .select))
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("setServerName"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "setServerName".localized, style: .default, handler: { _ in
|
||||||
let alertController = UIAlertController(title: NSLocalizedString("setServerName"), message: nil, preferredStyle: .alert)
|
let alertController = UIAlertController(title: "setServerName".localized, message: nil, preferredStyle: .alert)
|
||||||
alertController.addTextField { textField in
|
alertController.addTextField { textField in
|
||||||
textField.text = viewModel.server.name
|
textField.text = viewModel.server.name
|
||||||
}
|
}
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("confirm"), style: .default, handler: { _ in
|
alertController.addAction(UIAlertAction(title: "confirm".localized, style: .default, handler: { _ in
|
||||||
relay.accept((viewModel.server, .setName(name: alertController.textFields?.first?.text)))
|
relay.accept((viewModel.server, .setName(name: alertController.textFields?.first?.text)))
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
self.navigationController?.present(alertController, animated: true, completion: nil)
|
self.navigationController?.present(alertController, animated: true, completion: nil)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("deleteServer"), style: .destructive, handler: { _ in
|
|
||||||
|
|
||||||
let alertController = UIAlertController(title: nil, message: NSLocalizedString("confirmDeleteServer"), preferredStyle: .alert)
|
alertController.addAction(UIAlertAction(title: "deleteServer".localized, style: .destructive, handler: { _ in
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("confirm"), style: .destructive, handler: { _ in
|
|
||||||
|
let alertController = UIAlertController(title: nil, message: "confirmDeleteServer".localized, preferredStyle: .alert)
|
||||||
|
alertController.addAction(UIAlertAction(title: "confirm".localized, style: .destructive, handler: { _ in
|
||||||
relay.accept((viewModel.server, .delete))
|
relay.accept((viewModel.server, .delete))
|
||||||
}))
|
}))
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
self.navigationController?.present(alertController, animated: true, completion: nil)
|
self.navigationController?.present(alertController, animated: true, completion: nil)
|
||||||
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
|
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
|
||||||
|
|
||||||
if UIDevice.current.userInterfaceIdiom == .pad {
|
if UIDevice.current.userInterfaceIdiom == .pad {
|
||||||
if let cell = self.tableView.cellForRow(at: indexPath) {
|
if let cell = self.tableView.cellForRow(at: indexPath) {
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
// 删除检查错误提示
|
// 删除检查错误提示
|
||||||
deleteCheck.filter { $0 == nil }
|
deleteCheck.filter { $0 == nil }
|
||||||
.map { _ in NSLocalizedString("deleteFailed") }
|
.map { _ in "deleteFailed".localized }
|
||||||
.bind(to: showSnackbar)
|
.bind(to: showSnackbar)
|
||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
|
|||||||
}.share()
|
}.share()
|
||||||
|
|
||||||
// 弹出删除提示
|
// 弹出删除提示
|
||||||
serverDeleted.map { NSLocalizedString("deletedSuccessfully") }
|
serverDeleted.map { "deletedSuccessfully".localized }
|
||||||
.bind(to: showSnackbar)
|
.bind(to: showSnackbar)
|
||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
// 重置检查错误提示
|
// 重置检查错误提示
|
||||||
resetServer.filter { ($0.2?.count ?? 0) <= 0 }
|
resetServer.filter { ($0.2?.count ?? 0) <= 0 }
|
||||||
.map { _ in NSLocalizedString("resetFailed2") }
|
.map { _ in "resetFailed2".localized }
|
||||||
.bind(to: showSnackbar)
|
.bind(to: showSnackbar)
|
||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
|
|||||||
|
|
||||||
// 重置失败提示
|
// 重置失败提示
|
||||||
serverReseted.filter { $0 == nil }
|
serverReseted.filter { $0 == nil }
|
||||||
.map { _ in NSLocalizedString("resetFailed") }
|
.map { _ in "resetFailed".localized }
|
||||||
.bind(to: showSnackbar)
|
.bind(to: showSnackbar)
|
||||||
.disposed(by: rx.disposeBag)
|
.disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
|
|||||||
// 选择首页预览服务器
|
// 选择首页预览服务器
|
||||||
let serverSelected = input.selectServer.asObservable().map { server in
|
let serverSelected = input.selectServer.asObservable().map { server in
|
||||||
ServerManager.shared.setCurrentServer(serverId: server.id)
|
ServerManager.shared.setCurrentServer(serverId: server.id)
|
||||||
showSnackbar.accept(NSLocalizedString("setSuccessfully"))
|
showSnackbar.accept("setSuccessfully".localized)
|
||||||
return ()
|
return ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,13 +26,13 @@ class SoundsViewController: BaseViewController<SoundsViewModel> {
|
|||||||
|
|
||||||
// 上传铃声文件事件序列
|
// 上传铃声文件事件序列
|
||||||
let importSoundActionRelay = PublishRelay<URL>()
|
let importSoundActionRelay = PublishRelay<URL>()
|
||||||
// 当前正在播放的音频资源ID
|
// 当前正在播放的音频资源ID
|
||||||
var currentSoundID: SystemSoundID = 0
|
var currentSoundID: SystemSoundID = 0
|
||||||
// 当前正在播放的音频文件ULRL
|
// 当前正在播放的音频文件ULRL
|
||||||
var playingAudio: CFURL?
|
var playingAudio: CFURL?
|
||||||
|
|
||||||
override func makeUI() {
|
override func makeUI() {
|
||||||
self.title = NSLocalizedString("notificationSound")
|
self.title = "notificationSound".localized
|
||||||
|
|
||||||
self.view.addSubview(self.tableView)
|
self.view.addSubview(self.tableView)
|
||||||
self.tableView.delegate = self
|
self.tableView.delegate = self
|
||||||
@ -82,28 +82,28 @@ class SoundsViewController: BaseViewController<SoundsViewModel> {
|
|||||||
|
|
||||||
output.copyNameAction.drive(onNext: { [unowned self] name in
|
output.copyNameAction.drive(onNext: { [unowned self] name in
|
||||||
UIPasteboard.general.string = name.trimmingCharacters(in: .whitespacesAndNewlines)
|
UIPasteboard.general.string = name.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
self.navigationController?.showSnackbar(text: NSLocalizedString("Copy"))
|
self.navigationController?.showSnackbar(text: "Copy".localized)
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
output.playAction.drive(onNext: { url in
|
output.playAction.drive(onNext: { url in
|
||||||
/// 先结束正在播放的音频
|
/// 先结束正在播放的音频
|
||||||
AudioServicesDisposeSystemSoundID(self.currentSoundID)
|
AudioServicesDisposeSystemSoundID(self.currentSoundID)
|
||||||
/// 如果重复点击了当前音频,结束播放
|
/// 如果重复点击了当前音频,结束播放
|
||||||
if self.playingAudio == url{
|
if self.playingAudio == url {
|
||||||
self.playingAudio = nil
|
self.playingAudio = nil
|
||||||
self.currentSoundID = 0
|
self.currentSoundID = 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.playingAudio = url
|
self.playingAudio = url
|
||||||
AudioServicesCreateSystemSoundID(url, &self.currentSoundID)
|
AudioServicesCreateSystemSoundID(url, &self.currentSoundID)
|
||||||
AudioServicesPlaySystemSoundWithCompletion(self.currentSoundID) {
|
AudioServicesPlaySystemSoundWithCompletion(self.currentSoundID) {
|
||||||
/// 判断是否是当前播放的音频,防止逻辑错误
|
/// 判断是否是当前播放的音频,防止逻辑错误
|
||||||
if self.playingAudio == url {
|
if self.playingAudio == url {
|
||||||
AudioServicesDisposeSystemSoundID(self.currentSoundID)
|
AudioServicesDisposeSystemSoundID(self.currentSoundID)
|
||||||
self.playingAudio = nil
|
self.playingAudio = nil
|
||||||
self.currentSoundID = 0
|
self.currentSoundID = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).disposed(by: rx.disposeBag)
|
}).disposed(by: rx.disposeBag)
|
||||||
|
|
||||||
output.pickerFile.drive(onNext: { [unowned self] _ in
|
output.pickerFile.drive(onNext: { [unowned self] _ in
|
||||||
@ -121,7 +121,7 @@ extension SoundsViewController: UITableViewDelegate {
|
|||||||
guard section == 0 else {
|
guard section == 0 else {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return NSLocalizedString("uploadSoundNoticeFullText").count <= 30 ? 50 : 60
|
return "uploadSoundNoticeFullText".localized.count <= 30 ? 50 : 60
|
||||||
}
|
}
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
||||||
@ -130,7 +130,7 @@ extension SoundsViewController: UITableViewDelegate {
|
|||||||
let view = UIView()
|
let view = UIView()
|
||||||
|
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = NSLocalizedString(sectionTitle)
|
label.text = sectionTitle.localized
|
||||||
label.fontSize = 14
|
label.fontSize = 14
|
||||||
label.textColor = BKColor.grey.darken3
|
label.textColor = BKColor.grey.darken3
|
||||||
view.addSubview(label)
|
view.addSubview(label)
|
||||||
@ -147,9 +147,9 @@ extension SoundsViewController: UITableViewDelegate {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
let view = UIView()
|
let view = UIView()
|
||||||
|
|
||||||
let fullText = NSLocalizedString("uploadSoundNoticeFullText")
|
let fullText = "uploadSoundNoticeFullText".localized
|
||||||
let highlightText = NSLocalizedString("uploadSoundNoticeHighlightText")
|
let highlightText = "uploadSoundNoticeHighlightText".localized
|
||||||
let attrStr = NSMutableAttributedString(
|
let attrStr = NSMutableAttributedString(
|
||||||
string: fullText,
|
string: fullText,
|
||||||
attributes: [
|
attributes: [
|
||||||
|
|||||||
@ -62,7 +62,7 @@ struct AESCryptoModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
guard algorithm.keyLength == key.count else {
|
guard algorithm.keyLength == key.count else {
|
||||||
throw String(format: NSLocalizedString("enterKey"), algorithm.keyLength)
|
throw String(format: "enterKey".localized, algorithm.keyLength)
|
||||||
}
|
}
|
||||||
|
|
||||||
var iv = ""
|
var iv = ""
|
||||||
@ -74,9 +74,8 @@ struct AESCryptoModel {
|
|||||||
|
|
||||||
if let ivField = cryptoFields.iv, ivField.count == expectIVLength {
|
if let ivField = cryptoFields.iv, ivField.count == expectIVLength {
|
||||||
iv = ivField
|
iv = ivField
|
||||||
}
|
} else {
|
||||||
else {
|
throw String(format: "enterIv".localized, expectIVLength)
|
||||||
throw String(format: NSLocalizedString("enterIv"), expectIVLength)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +102,6 @@ struct AESCryptoModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decrypt(ciphertext: String) throws -> String {
|
func decrypt(ciphertext: String) throws -> String {
|
||||||
return String(data: Data(try aes.decrypt(Array(base64: ciphertext))), encoding: .utf8) ?? ""
|
return try String(data: Data(aes.decrypt(Array(base64: ciphertext))), encoding: .utf8) ?? ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,23 +32,23 @@ enum MessageDeleteTimeRange {
|
|||||||
var string: String {
|
var string: String {
|
||||||
switch self {
|
switch self {
|
||||||
case .lastHour:
|
case .lastHour:
|
||||||
return NSLocalizedString("lastHour")
|
return "lastHour".localized
|
||||||
case .today:
|
case .today:
|
||||||
return NSLocalizedString("today")
|
return "today".localized
|
||||||
case .todayAndYesterday:
|
case .todayAndYesterday:
|
||||||
return NSLocalizedString("todayAndYesterday")
|
return "todayAndYesterday".localized
|
||||||
case .lastMonth:
|
case .lastMonth:
|
||||||
return NSLocalizedString("lastMonth")
|
return "lastMonth".localized
|
||||||
case .allTime:
|
case .allTime:
|
||||||
return NSLocalizedString("allTime")
|
return "allTime".localized
|
||||||
case .beforeOneHour:
|
case .beforeOneHour:
|
||||||
return NSLocalizedString("beforeAnHour")
|
return "beforeAnHour".localized
|
||||||
case .beforeToday:
|
case .beforeToday:
|
||||||
return NSLocalizedString("beforeToday")
|
return "beforeToday".localized
|
||||||
case .beforeYesterday:
|
case .beforeYesterday:
|
||||||
return NSLocalizedString("beforeYesterday")
|
return "beforeYesterday".localized
|
||||||
case .beforeOneMonth:
|
case .beforeOneMonth:
|
||||||
return NSLocalizedString("beforeAMonth")
|
return "beforeAMonth".localized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ extension MessageListCellItem: IdentifiableType {
|
|||||||
case .message(let model):
|
case .message(let model):
|
||||||
return "list_\(model.id)_\(model.createDate?.timeInterval ?? 0)"
|
return "list_\(model.id)_\(model.createDate?.timeInterval ?? 0)"
|
||||||
case .messageGroup(_, _, let messages):
|
case .messageGroup(_, _, let messages):
|
||||||
return "group_\(messages.first?.group ?? NSLocalizedString("default"))_\(messages.first?.createDate?.timeInterval ?? 0)"
|
return "group_\(messages.first?.group ?? "default".localized)_\(messages.first?.createDate?.timeInterval ?? 0)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import UIKit
|
|||||||
class AddSoundCell: UITableViewCell {
|
class AddSoundCell: UITableViewCell {
|
||||||
let button: UIButton = {
|
let button: UIButton = {
|
||||||
let button = UIButton(type: .system)
|
let button = UIButton(type: .system)
|
||||||
button.setTitle(NSLocalizedString("uploadSound"), for: .normal)
|
button.setTitle("uploadSound".localized, for: .normal)
|
||||||
button.setImage(UIImage(named: "music_note-music_note_symbol"), for: .normal)
|
button.setImage(UIImage(named: "music_note-music_note_symbol"), for: .normal)
|
||||||
button.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
|
button.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
|
||||||
button.tintColor = BKColor.lightBlue.darken3
|
button.tintColor = BKColor.lightBlue.darken3
|
||||||
@ -31,8 +31,8 @@ class AddSoundCell: UITableViewCell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(*, unavailable)
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class ArchiveSettingCell: BaseTableViewCell<ArchiveSettingCellViewModel> {
|
|||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
self.selectionStyle = .none
|
self.selectionStyle = .none
|
||||||
self.backgroundColor = BKColor.background.secondary
|
self.backgroundColor = BKColor.background.secondary
|
||||||
self.textLabel?.text = NSLocalizedString("defaultArchiveSettings")
|
self.textLabel?.text = "defaultArchiveSettings".localized
|
||||||
|
|
||||||
contentView.addSubview(switchButton)
|
contentView.addSubview(switchButton)
|
||||||
switchButton.snp.makeConstraints { make in
|
switchButton.snp.makeConstraints { make in
|
||||||
|
|||||||
@ -25,7 +25,7 @@ class MessageGroupMoreView: UIView {
|
|||||||
|
|
||||||
var count: Int = 0 {
|
var count: Int = 0 {
|
||||||
didSet {
|
didSet {
|
||||||
moreLabel.text = NSLocalizedString("viewAllMessages").format(count)
|
moreLabel.text = "viewAllMessages".localized(with: count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,7 +205,7 @@ extension MessageItemView {
|
|||||||
.contentMode(.scaleAspectFit)
|
.contentMode(.scaleAspectFit)
|
||||||
]
|
]
|
||||||
if #available(iOS 14.0, *) {
|
if #available(iOS 14.0, *) {
|
||||||
options.append(.rightNavItemTitle(NSLocalizedString("save"), onTap: { [weak self] _ in
|
options.append(.rightNavItemTitle("save".localized, onTap: { [weak self] _ in
|
||||||
// 保存 image 到相册
|
// 保存 image 到相册
|
||||||
self?.saveImageToAlbum(image)
|
self?.saveImageToAlbum(image)
|
||||||
}))
|
}))
|
||||||
@ -248,7 +248,7 @@ extension MessageItemView {
|
|||||||
PHPhotoLibrary.requestAuthorization(for: .addOnly) { status in
|
PHPhotoLibrary.requestAuthorization(for: .addOnly) { status in
|
||||||
guard status == .authorized || status == .limited else {
|
guard status == .authorized || status == .limited else {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
SVProgressHUD.showInfo(withStatus: NSLocalizedString("noPermission"))
|
SVProgressHUD.showInfo(withStatus: "noPermission".localized)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -257,7 +257,7 @@ extension MessageItemView {
|
|||||||
}) { success, error in
|
}) { success, error in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
if success {
|
if success {
|
||||||
SVProgressHUD.showSuccess(withStatus: NSLocalizedString("saveSuccess"))
|
SVProgressHUD.showSuccess(withStatus: "saveSuccess".localized)
|
||||||
} else {
|
} else {
|
||||||
SVProgressHUD.showError(withStatus: error?.localizedDescription)
|
SVProgressHUD.showError(withStatus: error?.localizedDescription)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class MessageGroupTableViewCell: UITableViewCell {
|
|||||||
if let newValue, !newValue.isEmpty {
|
if let newValue, !newValue.isEmpty {
|
||||||
groupHeader.groupName = newValue
|
groupHeader.groupName = newValue
|
||||||
} else {
|
} else {
|
||||||
groupHeader.groupName = NSLocalizedString("default")
|
groupHeader.groupName = "default".localized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
|
|||||||
@ -86,7 +86,7 @@ private class ShowLessView: UIView {
|
|||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.font = UIFont.preferredFont(ofSize: 12)
|
label.font = UIFont.preferredFont(ofSize: 12)
|
||||||
label.textColor = BKColor.grey.darken3
|
label.textColor = BKColor.grey.darken3
|
||||||
label.text = NSLocalizedString("showLess")
|
label.text = "showLess".localized
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ private class ClearView: UIView {
|
|||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.font = UIFont.preferredFont(ofSize: 12)
|
label.font = UIFont.preferredFont(ofSize: 12)
|
||||||
label.textColor = BKColor.grey.darken3
|
label.textColor = BKColor.grey.darken3
|
||||||
label.text = NSLocalizedString("clear")
|
label.text = "clear".localized
|
||||||
label.alpha = 0
|
label.alpha = 0
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
|||||||
@ -20,12 +20,12 @@ class MessageSettingFooter: UITextView, UITextViewDelegate {
|
|||||||
// build号
|
// build号
|
||||||
let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
|
||||||
|
|
||||||
let attr = NSMutableAttributedString(string: "\(NSLocalizedString("version")) \(appVersion) (\(buildVersion))\n", attributes: [.font: UIFont.preferredFont(ofSize: 12), .foregroundColor: BKColor.grey.darken1])
|
let attr = NSMutableAttributedString(string: "\("version".localized) \(appVersion) (\(buildVersion))\n", attributes: [.font: UIFont.preferredFont(ofSize: 12), .foregroundColor: BKColor.grey.darken1])
|
||||||
attr.append(NSAttributedString(string: NSLocalizedString("privacyPolicy"), attributes: [.link: "privacyPolicy"]))
|
attr.append(NSAttributedString(string: "privacyPolicy".localized, attributes: [.link: "privacyPolicy"]))
|
||||||
attr.append(NSAttributedString(string: " · "))
|
attr.append(NSAttributedString(string: " · "))
|
||||||
attr.append(NSAttributedString(string: NSLocalizedString("userAgreement"), attributes: [.link: "userAgreement"]))
|
attr.append(NSAttributedString(string: "userAgreement".localized, attributes: [.link: "userAgreement"]))
|
||||||
attr.append(NSAttributedString(string: " · "))
|
attr.append(NSAttributedString(string: " · "))
|
||||||
attr.append(NSAttributedString(string: NSLocalizedString("restoreSubscription"), attributes: [.link: "restoreSubscription"]))
|
attr.append(NSAttributedString(string: "restoreSubscription".localized, attributes: [.link: "restoreSubscription"]))
|
||||||
|
|
||||||
let style = NSMutableParagraphStyle()
|
let style = NSMutableParagraphStyle()
|
||||||
style.lineSpacing = 6
|
style.lineSpacing = 6
|
||||||
|
|||||||
@ -12,13 +12,13 @@ import UIKit
|
|||||||
class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
|
class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
|
||||||
let previewButton: IconButton = {
|
let previewButton: IconButton = {
|
||||||
let button = IconButton(image: Icon.cm.skipForward, tintColor: BKColor.grey.base)
|
let button = IconButton(image: Icon.cm.skipForward, tintColor: BKColor.grey.base)
|
||||||
button.accessibilityLabel = NSLocalizedString("demo")
|
button.accessibilityLabel = "demo".localized
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let copyButton: IconButton = {
|
let copyButton: IconButton = {
|
||||||
let button = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base)
|
let button = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base)
|
||||||
button.accessibilityLabel = NSLocalizedString("copy")
|
button.accessibilityLabel = "copy".localized
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import UIKit
|
|||||||
class SoundCell: BaseTableViewCell<SoundCellViewModel> {
|
class SoundCell: BaseTableViewCell<SoundCellViewModel> {
|
||||||
let copyButton: IconButton = {
|
let copyButton: IconButton = {
|
||||||
let button = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base)
|
let button = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base)
|
||||||
button.accessibilityLabel = NSLocalizedString("copy")
|
button.accessibilityLabel = "copy".localized
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@ -14,18 +14,18 @@ class iCloudStatusCell: UITableViewCell {
|
|||||||
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
|
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
|
||||||
self.selectionStyle = .none
|
self.selectionStyle = .none
|
||||||
self.backgroundColor = BKColor.background.secondary
|
self.backgroundColor = BKColor.background.secondary
|
||||||
self.textLabel?.text = NSLocalizedString("iCloudSatatus")
|
self.textLabel?.text = "iCloudStatus".localized
|
||||||
self.detailTextLabel?.text = ""
|
self.detailTextLabel?.text = ""
|
||||||
self.detailTextLabel?.textColor = BKColor.grey.darken2
|
self.detailTextLabel?.textColor = BKColor.grey.darken2
|
||||||
CKContainer.default().accountStatus { status, _ in
|
CKContainer.default().accountStatus { status, _ in
|
||||||
dispatch_sync_safely_main_queue {
|
dispatch_sync_safely_main_queue {
|
||||||
switch status {
|
switch status {
|
||||||
case .available:
|
case .available:
|
||||||
self.detailTextLabel?.text = NSLocalizedString("available")
|
self.detailTextLabel?.text = "available".localized
|
||||||
case .noAccount, .restricted, .temporarilyUnavailable:
|
case .noAccount, .restricted, .temporarilyUnavailable:
|
||||||
self.detailTextLabel?.text = NSLocalizedString("restricted")
|
self.detailTextLabel?.text = "restricted".localized
|
||||||
case .couldNotDetermine:
|
case .couldNotDetermine:
|
||||||
self.detailTextLabel?.text = NSLocalizedString("unknown")
|
self.detailTextLabel?.text = "unknown".localized
|
||||||
@unknown default:
|
@unknown default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|||||||
UIPasteboard.general.string = content
|
UIPasteboard.general.string = content
|
||||||
}
|
}
|
||||||
|
|
||||||
showTips(text: NSLocalizedString("Copy", comment: ""))
|
showTips(text: "Copy".localized)
|
||||||
completion(.doNotDismiss)
|
completion(.doNotDismiss)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|||||||
// 静音一小时
|
// 静音一小时
|
||||||
GroupMuteSettingManager().settings[groupName] = Date() + 60 * 60
|
GroupMuteSettingManager().settings[groupName] = Date() + 60 * 60
|
||||||
|
|
||||||
showTips(text: String(format: NSLocalizedString("groupMuted", comment: ""), groupName.isEmpty ? "default" : groupName))
|
showTips(text: String(format: "groupMuted".localized, groupName.isEmpty ? "default".localized : groupName))
|
||||||
completion(.doNotDismiss)
|
completion(.doNotDismiss)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user