deep clean

pull/1023/head
Ryan ZHAO 9 months ago
parent 6d4a6715fa
commit 1e1d71f788

@ -111,6 +111,7 @@ extension ProjectState {
.contains("separator:", caseSensitive: false),
.contains("separatedBy:", caseSensitive: false),
.nextLine(.contains(".put(key:", caseSensitive: false)),
.nextLine(.contains(".putNumber(", caseSensitive: false)),
.nextLine(.contains(".localized()", caseSensitive: false)),
.regex(".*static var databaseTableName: String"),
.regex("case .* = "),

@ -201,6 +201,7 @@
9473386E2BDF5F3E00B9E169 /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 9473386D2BDF5F3E00B9E169 /* InfoPlist.xcstrings */; };
94B3DC172AF8592200C88531 /* QuoteView_SwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94B3DC162AF8592200C88531 /* QuoteView_SwiftUI.swift */; };
94C5DCB02BE88170003AA8C5 /* BezierPathView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94C5DCAF2BE88170003AA8C5 /* BezierPathView.swift */; };
94FC7A8E2C759805004A8146 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94FC7A8D2C759805004A8146 /* Constants.swift */; };
A11CD70D17FA230600A2D1B1 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A11CD70C17FA230600A2D1B1 /* QuartzCore.framework */; };
A163E8AB16F3F6AA0094D68B /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A163E8AA16F3F6A90094D68B /* Security.framework */; };
A1C32D5017A06538000A904E /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1C32D4F17A06537000A904E /* AddressBookUI.framework */; };
@ -1391,6 +1392,7 @@
9473386D2BDF5F3E00B9E169 /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = "<group>"; };
94B3DC162AF8592200C88531 /* QuoteView_SwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuoteView_SwiftUI.swift; sourceTree = "<group>"; };
94C5DCAF2BE88170003AA8C5 /* BezierPathView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BezierPathView.swift; sourceTree = "<group>"; };
94FC7A8D2C759805004A8146 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
987AE169AEA3246E4C0897B1 /* Pods_GlobalDependencies_FrameworkAndExtensionDependencies_ExtendedDependencies_SessionShareExtension.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GlobalDependencies_FrameworkAndExtensionDependencies_ExtendedDependencies_SessionShareExtension.framework; sourceTree = BUILT_PRODUCTS_DIR; };
998762BFD08C2415FE71186C /* Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionUtilitiesKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionUtilitiesKit.debug.xcconfig"; path = "Target Support Files/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionUtilitiesKit/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionUtilitiesKit.debug.xcconfig"; sourceTree = "<group>"; };
9DE2662E4E5838CD8E1AF35F /* Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionShareExtension.app store release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionShareExtension.app store release.xcconfig"; path = "Target Support Files/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionShareExtension/Pods-GlobalDependencies-FrameworkAndExtensionDependencies-ExtendedDependencies-SessionShareExtension.app store release.xcconfig"; sourceTree = "<group>"; };
@ -3541,6 +3543,7 @@
children = (
C3AAFFF125AE99710089E6DD /* AppDelegate.swift */,
34D99CE3217509C1000AFB39 /* AppEnvironment.swift */,
94FC7A8D2C759805004A8146 /* Constants.swift */,
7BFD1A952747689000FB91B9 /* TurnServers */,
B8FF8E6025C10D8B004D1F22 /* Countries */,
34330A581E7875FB00DF2FB9 /* Fonts */,
@ -6502,6 +6505,7 @@
FD716E7128505E5200C96BF4 /* MessageRequestsCell.swift in Sources */,
FDF848F329413DB0007DCAE5 /* ImagePickerHandler.swift in Sources */,
B88FA7F2260C3EB10049422F /* OpenGroupSuggestionGrid.swift in Sources */,
94FC7A8E2C759805004A8146 /* Constants.swift in Sources */,
9422569F2C23F8FE00C0FDBF /* ScanQRCodeScreen.swift in Sources */,
FD71160428C95B5600B47552 /* PhotoCollectionPickerViewModel.swift in Sources */,
FD37EA1928AC5CCA003AE748 /* NotificationSoundViewModel.swift in Sources */,

@ -24,7 +24,7 @@ final class CallMissedTipsModal: Modal {
private lazy var titleLabel: UILabel = {
let result: UILabel = UILabel()
result.font = .boldSystemFont(ofSize: Values.mediumFontSize)
result.text = "callsMissed"
result.text = "callsMissedCallFrom"
.put(key: "name", value: caller)
.localized()
result.themeTextColor = .textPrimary

@ -456,7 +456,7 @@ final class EditClosedGroupVC: BaseVC, UITableViewDataSource, UITableViewDelegat
if !updatedMemberIds.contains(userPublicKey) {
guard self.originalMembersAndZombieIds.removing(userPublicKey) == updatedMemberIds else {
return showError(
title: "GROUP_UPDATE_ERROR_TITLE".localized(),
title: "deleteAfterLegacyGroupsGroupUpdateErrorTitle".localized(),
message: "deleteAfterGroupPR3GroupErrorLeave".localized()
)
}

@ -329,30 +329,16 @@ public final class SearchResultsBar: UIView {
return
}
switch results.count {
case 0:
// Keyboard toolbar label when no messages match the search string
label.text = "searchMatchesNone".localized()
case 1:
// Keyboard toolbar label when exactly 1 message matches the search string
label.text = "searchMatches"
.put(key: "count", value: 1)
.put(key: "total_count", value: results.count)
.localized()
default:
// Keyboard toolbar label when more than 1 message matches the search string
//
// Embeds {{number/position of the 'currently viewed' result}} and
// the {{total number of results}}
guard let currentIndex: Int = currentIndex else { return }
label.text = {
guard results.count > 0 else {
return "searchMatchesNone".localized()
}
label.text = "searchMatches"
.put(key: "count", value: currentIndex + 1)
.put(key: "total_count", value: results.count)
return "searchMatches"
.putNumber(results.count)
.put(key: "found_count", value: (currentIndex ?? 0) + 1)
.localized()
}
}()
if let currentIndex: Int = currentIndex {
downButton.isEnabled = currentIndex > 0

@ -875,12 +875,6 @@ extension ConversationVC:
cellLocation: CGPoint,
using dependencies: Dependencies = Dependencies()
) {
guard cellViewModel.variant != .standardOutgoing || (cellViewModel.state != .failed && cellViewModel.state != .failedToSync) else {
// Show the failed message sheet
showFailedMessageSheet(for: cellViewModel, using: dependencies)
return
}
// For call info messages show the "call missed" modal
guard cellViewModel.variant != .infoCall else {
let callMissedTipsModal: CallMissedTipsModal = CallMissedTipsModal(caller: cellViewModel.authorName)
@ -1656,54 +1650,6 @@ extension ConversationVC:
// MARK: --action handling
private func showFailedMessageSheet(for cellViewModel: MessageViewModel, using dependencies: Dependencies) {
let sheet = UIAlertController(
title: (cellViewModel.state == .failedToSync ?
"MESSAGE_DELIVERY_FAILED_SYNC_TITLE".localized() :
"messageStatusFailedToSend".localized()
),
message: cellViewModel.mostRecentFailureText,
preferredStyle: .actionSheet
)
sheet.addAction(UIAlertAction(title: "cancel".localized(), style: .cancel, handler: nil))
if cellViewModel.state != .failedToSync {
sheet.addAction(UIAlertAction(title: "delete".localized(), style: .destructive, handler: { _ in
Storage.shared.writeAsync { db in
try Interaction
.filter(id: cellViewModel.id)
.deleteAll(db)
}
}))
}
sheet.addAction(UIAlertAction(
title: (cellViewModel.state == .failedToSync ?
"resync".localized() :
"resend".localized()
),
style: .default,
handler: { [weak self] _ in self?.retry(cellViewModel, using: dependencies) }
))
// HACK: Extracting this info from the error string is pretty dodgy
let prefix: String = "HTTP request failed at destination (Service node " // stringlint:disable
if let mostRecentFailureText: String = cellViewModel.mostRecentFailureText, mostRecentFailureText.hasPrefix(prefix) {
let rest = mostRecentFailureText.substring(from: prefix.count)
if let index = rest.firstIndex(of: ")") { // stringlint:disable
let snodeAddress = String(rest[rest.startIndex..<index])
sheet.addAction(UIAlertAction(title: "Copy Service Node Info", style: .default) { _ in // stringlint:disable
UIPasteboard.general.string = snodeAddress
})
}
}
Modal.setupForIPadIfNeeded(sheet, targetView: self.view)
present(sheet, animated: true, completion: nil)
}
func joinOpenGroup(name: String?, url: String) {
// Open groups can be unsafe, so always ask the user whether they want to join one
let finalName: String = (name ?? "communityUnknown".localized())

@ -837,7 +837,7 @@ final class HomeVC: BaseVC, LibSessionRespondingViewController, UITableViewDataS
let targetViewController: UIViewController = ConfirmationModal(
info: ConfirmationModal.Info(
title: "theError".localized(),
body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()),
body: .text("recoveryPasswordErrorLoad".localized()),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)

@ -104,7 +104,7 @@ struct StartConversationScreen: View {
QRCodeView(
string: getUserHexEncodedPublicKey(),
hasBackground: false,
logo: "SessionWhite40",
logo: "SessionWhite40", // stringlint:disable
themeStyle: ThemeManager.currentTheme.interfaceStyle
)
.aspectRatio(1, contentMode: .fit)

@ -19,10 +19,7 @@ enum GiphyError: Error {
extension GiphyError: LocalizedError {
public var errorDescription: String? {
switch self {
case .assertionError: return "errorUnknown".localized()
case .fetchFailure: return "errorUnknown".localized()
}
return "errorUnknown".localized()
}
}

@ -329,7 +329,7 @@ extension SendMediaNavigationController: ImagePickerGridControllerDelegate {
let modal: ConfirmationModal = ConfirmationModal(
targetView: self?.view,
info: ConfirmationModal.Info(
title: "IMAGE_PICKER_FAILED_TO_PROCESS_ATTACHMENTS".localized(),
title: "attachmentsErrorMediaSelection".localized(),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)
@ -386,7 +386,7 @@ extension SendMediaNavigationController: ImagePickerGridControllerDelegate {
let modal: ConfirmationModal = ConfirmationModal(
targetView: self.view,
info: ConfirmationModal.Info(
title: "IMAGE_PICKER_FAILED_TO_PROCESS_ATTACHMENTS".localized(),
title: "attachmentsErrorMediaSelection".localized(),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)

@ -496,7 +496,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
default: break
}
alert.addAction(UIAlertAction(title: "quit".localized(), style: .default) { _ in
alert.addAction(UIAlertAction(title: "quit".put(key: "app_name", value: Singleton.appName).localized(), style: .default) { _ in
Log.flush()
exit(0)
})
@ -942,7 +942,9 @@ private enum StartupError: Error {
return "databaseErrorGeneric".localized()
case .databaseError(StorageError.migrationNoLongerSupported):
return "databaseErrorUpdate".localized()
return "databaseErrorUpdate"
.put(key: "app_name", value: Singleton.appName)
.localized()
case .startupTimeout:
return "databaseErrorTimeout"

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -264,7 +264,7 @@ public class NotificationPresenter: NotificationsProtocol {
case .permissionDenied:
return "callsYouMissedCallPermissions"
.put(key: "name", value: senderName)
.localized()
.localizedDeformatted()
case .missed:
return "callsMissedCallFrom"
.put(key: "name", value: senderName)
@ -313,10 +313,8 @@ public class NotificationPresenter: NotificationsProtocol {
else { return }
guard !isMessageRequest else { return }
let senderName: String = Profile.displayName(db, id: reaction.authorId, threadVariant: thread.variant)
let notificationTitle = Singleton.appName
var notificationBody = "emojiReactsHoverName"
.put(key: "name", value: senderName)
let notificationTitle = Profile.displayName(db, id: reaction.authorId, threadVariant: thread.variant)
var notificationBody = "emojiReactsNotification"
.put(key: "emoji", value: reaction.emoji)
.localized()

@ -149,7 +149,7 @@ struct LandingScreen: View {
let modal: ConfirmationModal = ConfirmationModal(
info: ConfirmationModal.Info(
title: "urlOpen".localized(),
body: .text("urlOpenBrowswer".localized()),
body: .text("urlOpenBrowser".localized()),
confirmTitle: "onboardingTos".localized(),
confirmAccessibility: Accessibility(
identifier: "Terms of service button",

@ -66,7 +66,7 @@ struct PNModeScreen: View {
.foregroundColor(themeColor: .textPrimary)
Text(
"onboardingMessageNotificationExplaination"
"onboardingMessageNotificationExplanation"
.put(key: "app_name", value: Singleton.appName)
.localized()
)

@ -226,9 +226,7 @@ final class JoinOpenGroupVC: BaseVC, UIPageViewControllerDataSource, UIPageViewC
self?.isJoining = false
self?.dismiss(animated: true) { // Dismiss the loader
self?.showError(
title: "communityJoinError"
.put(key: "community_name", value: "communityUnknown".localized())
.localized(),
title: "communityJoinError".localized(),
message: error.localizedDescription,
onError: onError
)

@ -460,7 +460,7 @@ class SettingsViewModel: SessionTableViewModel, NavigationItemSource, Navigatabl
let targetViewController: UIViewController = ConfirmationModal(
info: ConfirmationModal.Info(
title: "theError".localized(),
body: .text("LOAD_RECOVERY_PASSWORD_ERROR".localized()),
body: .text("recoveryPasswordErrorLoad".localized()),
cancelTitle: "okay".localized(),
cancelStyle: .alert_text
)

@ -27,14 +27,9 @@ public extension Date {
return Date.thisWeekFormatter.string(from: self)
}
guard Calendar.current.isDate(self, equalTo: dateNow, toGranularity: .minute) else {
// Today formatter: 8:32 am
return Date.todayFormatter.string(from: self)
}
return "DATE_NOW".localized()
}
var fromattedForMessageInfo: String {
let formatter: DateFormatter = DateFormatter()
formatter.locale = Locale.current

@ -69,7 +69,7 @@ public enum Permissions {
info: ConfirmationModal.Info(
title: "permissionsRequired".localized(),
body: .text(
"permissionsMicrophoneAccessRequiredDesktop"
"permissionsMicrophoneAccessRequiredIos"
.put(key: "app_name", value: Singleton.appName)
.localized()
),

@ -342,7 +342,7 @@ public extension UIContextualAction {
info: ConfirmationModal.Info(
title: "blockDescription"
.put(key: "name", value: threadViewModel.displayName)
.localized(),
.localizedDeformatted(),
confirmTitle: "block".localized(),
confirmAccessibility: Accessibility(
identifier: "Block"

@ -197,10 +197,8 @@ public class NSENotificationPresenter: NSObject, NotificationsProtocol {
else { return }
guard !isMessageRequest else { return }
let senderName: String = Profile.displayName(db, id: reaction.authorId, threadVariant: thread.variant)
let notificationTitle = Singleton.appName
var notificationBody = "emojiReactsHoverName"
.put(key: "name", value: senderName)
let notificationTitle = Profile.displayName(db, id: reaction.authorId, threadVariant: thread.variant)
var notificationBody = "emojiReactsNotification"
.put(key: "emoji", value: reaction.emoji)
.localized()

Loading…
Cancel
Save