diff --git a/MiniScanner/Extensions/String+Extensions.swift b/MiniScanner/Extensions/String+Extensions.swift index 0cabe0d8a0decc285c4f9e866e9f9fbb7169d0bc..ba09149955598c6f513414c6123cbf336c1c671a 100644 --- a/MiniScanner/Extensions/String+Extensions.swift +++ b/MiniScanner/Extensions/String+Extensions.swift @@ -16,7 +16,7 @@ extension String { } static func getDocumentName() -> String { - return "Scan".localized + " " + date() + ".pdf" + return .scan.localized + " " + date() + ".pdf" } static func date(_ date: Date = Date()) -> String { diff --git a/MiniScanner/Extensions/URL+Extensions.swift b/MiniScanner/Extensions/URL+Extensions.swift index c3b5145533c7c4d5b85c904a9aa5ba132f7d2563..f2c25982e0695162c9f789fba28f39e4d8b75813 100644 --- a/MiniScanner/Extensions/URL+Extensions.swift +++ b/MiniScanner/Extensions/URL+Extensions.swift @@ -37,11 +37,11 @@ extension URL { if let attributes = attributes, let fileDate = attributes[FileAttributeKey.creationDate] as? Date { if Calendar.current.isDateInToday(fileDate) { - stringDate = "Today".localized + stringDate = .today.localized } else if Calendar.current.isDateInYesterday(fileDate) { - stringDate = "Yesterday".localized + stringDate = .yesterday.localized } else if Date().isSameWeekAsDate(fileDate) { - stringDate = "This week".localized + stringDate = .thisWeek.localized } else { stringDate = getDateInCurrentLocaleWithHour(fileDate) } diff --git a/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift b/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift index cd2a56c863ce944afd0af0846c79bac68810aa91..c8364cc7727673415e7edb03b2fd1d054a66b303 100644 --- a/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift +++ b/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift @@ -95,11 +95,11 @@ final class DocumentPreviewViewController: UIViewController { let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) - let cameraAction = UIAlertAction(title: "Camera".localized, style: .default, handler: { action in + let cameraAction = UIAlertAction(title: .camera.localized, style: .default, handler: { action in self.openCamera() }) - let galleryAction = UIAlertAction(title: "Gallery".localized, style: .default, handler: { action in + let galleryAction = UIAlertAction(title: .gallery.localized, style: .default, handler: { action in self.openGallery() }) @@ -111,7 +111,7 @@ final class DocumentPreviewViewController: UIViewController { galleryAction.setValue(UIImage(systemName: "photo"), forKey: "image") galleryAction.setValue(CATextLayerAlignmentMode.left, forKey: "titleTextAlignment") - alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil)) + alertController.addAction(UIAlertAction(title: .cancel.localized, style: .cancel, handler: nil)) alertController.popoverPresentationController?.barButtonItem = sender present(alertController, animated: true) } @@ -137,11 +137,11 @@ final class DocumentPreviewViewController: UIViewController { } @IBAction func deleteTapped(_ sender: UIBarButtonItem) { - let alertController = UIAlertController(title: "Delete".localized, - message: "Are you sure?".localized, preferredStyle: .actionSheet) + let alertController = UIAlertController(title: .delete.localized, + message: .areYouSure.localized, preferredStyle: .actionSheet) if pdfView.document?.pageCount == 1 { - let currentPageAction = UIAlertAction(title: "Delete document".localized, style: .default, handler: { action in + let currentPageAction = UIAlertAction(title: .deleteDocument.localized, style: .default, handler: { action in guard let documentURL = self.file?.fileURL, let pdfView = self.pdfView else { return } if pdfView.document?.pageCount == 1 { try? FileManager.default.removeItem(at: documentURL) @@ -156,7 +156,7 @@ final class DocumentPreviewViewController: UIViewController { alertController.addAction(currentPageAction) } else { - let currentPageAction = UIAlertAction(title: "Current page".localized, style: .default, handler: { action in + let currentPageAction = UIAlertAction(title: .currentPage.localized, style: .default, handler: { action in guard let documentURL = self.file?.fileURL, let pdfView = self.pdfView else { return } if pdfView.document?.pageCount == 1 { try? FileManager.default.removeItem(at: documentURL) @@ -173,7 +173,7 @@ final class DocumentPreviewViewController: UIViewController { } }) - let entireDocumentAction = UIAlertAction(title: "Entire document".localized, style: .default, handler: { action in + let entireDocumentAction = UIAlertAction(title: .entireDocument.localized, style: .default, handler: { action in guard let documentURL = self.file?.fileURL else { return } try? FileManager.default.removeItem(at: documentURL) self.navigationController?.popViewController(animated: true) @@ -183,7 +183,7 @@ final class DocumentPreviewViewController: UIViewController { alertController.addAction(entireDocumentAction) } - alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil)) + alertController.addAction(UIAlertAction(title: .cancel.localized, style: .cancel, handler: nil)) alertController.popoverPresentationController?.barButtonItem = sender present(alertController, animated: true) } diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift b/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift index 7c26b8bb18f4cd95f441dbd312866ba0f26dcc1b..f13386de1b97c8e5f8489c33487113ccdece050b 100644 --- a/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift +++ b/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift @@ -44,8 +44,8 @@ final class KNAlertViewController: BMViewController { private var message: String = "" - private var confirmButtonTitle: String = "Yes" - private var destructiveButtonTitle: String = "No" + private var confirmButtonTitle: String = .yes + private var destructiveButtonTitle: String = .no var shouldDismissAndLogin: Bool = false diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/ShareSheet/ShareSheetViewController.swift b/MiniScanner/Modules/Documents/Customs/CustomViews/ShareSheet/ShareSheetViewController.swift index 4b48ecc4cb7b386f7241a6fb3d0519a0787f1899..6c3827d4c540438bb7dfcab00812b04b5d70dd42 100644 --- a/MiniScanner/Modules/Documents/Customs/CustomViews/ShareSheet/ShareSheetViewController.swift +++ b/MiniScanner/Modules/Documents/Customs/CustomViews/ShareSheet/ShareSheetViewController.swift @@ -50,18 +50,18 @@ class ShareSheetViewController: UIViewController { private func setupUI() { pagesCountLabel.set(text: "", color: .mainText, font: .regular(16)) - whatsappLabel.set(localized: "Whatsapp", color: .mainText, font: .regular(12)) - telegramLabel.set(localized: "Telegram", color: .mainText, font: .regular(12)) - airdropLabel.set(localized: "Gmail", color: .mainText, font: .regular(12)) - printLabel.set(localized: "Print", color: .mainText, font: .regular(12)) - moreLabel.set(localized: "More", color: .mainText, font: .regular(12)) + whatsappLabel.set(localized: .whatsapp, color: .mainText, font: .regular(12)) + telegramLabel.set(localized: .telegram, color: .mainText, font: .regular(12)) + airdropLabel.set(localized: .gmail, color: .mainText, font: .regular(12)) + printLabel.set(localized: .print, color: .mainText, font: .regular(12)) + moreLabel.set(localized: .more, color: .mainText, font: .regular(12)) whatsappLabel.textAlignment = .center telegramLabel.textAlignment = .center airdropLabel.textAlignment = .center printLabel.textAlignment = .center moreLabel.textAlignment = .center - fileNameTextField.placeholder = "File name" + fileNameTextField.placeholder = .fileName.localized backgroundView.layer.cornerRadius = 30 backgroundView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] pdfImage.layer.cornerRadius = 10 diff --git a/MiniScanner/Modules/Documents/DocumentsTableViewController.swift b/MiniScanner/Modules/Documents/DocumentsTableViewController.swift index b828d037360f48dad1b86527f4112535c2f18594..9fd95237a9177fc9e86050a3ea53d9dc4296a749 100644 --- a/MiniScanner/Modules/Documents/DocumentsTableViewController.swift +++ b/MiniScanner/Modules/Documents/DocumentsTableViewController.swift @@ -255,7 +255,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, // Trash action let trash = UIContextualAction(style: .destructive, - title: "Delete".localized) { [weak self] (_, _, completionHandler) in + title: .delete.localized) { [weak self] (_, _, completionHandler) in self?.deleteFile(at: indexPath) completionHandler(true) } @@ -264,7 +264,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, // Rename action let rename = UIContextualAction(style: .normal, - title: "Rename".localized) { [weak self] (_, _, completionHandler) in + title: .rename.localized) { [weak self] (_, _, completionHandler) in self?.renameFile(at: indexPath) completionHandler(true) } @@ -272,7 +272,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, rename.image = UIImage(systemName: "square.and.pencil")?.tint(with: .white) let move = UIContextualAction(style: .normal, - title: "Move".localized) { [weak self] (_, _, completionHandler) in + title: .move.localized) { [weak self] (_, _, completionHandler) in if let viewModel = self?.isSearching == true ? self?.searchedViewModel[indexPath.row] : self?.viewModels[indexPath.row] { self?.moveto(file: viewModel) } @@ -318,7 +318,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, private func renameFile(at indexPath: IndexPath) { let viewModel = isSearching ? searchedViewModel[indexPath.row] : viewModels[indexPath.row] - renameAlertController = UIAlertController(title: "Rename document".localized, message: nil, preferredStyle: .alert) + renameAlertController = UIAlertController(title: .renameDocument.localized, message: nil, preferredStyle: .alert) renameAlertController!.addTextField { [weak self] textField in guard let self = self else { return } @@ -329,7 +329,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, textField.addTarget(self, action: #selector(self.textFieldDidChange(_:)), for: .editingChanged) } - let continueAction = UIAlertAction(title: "Rename".localized, + let continueAction = UIAlertAction(title: .rename.localized, style: .default) { [weak self] _ in guard let self = self else { return } guard let textFields = self.renameAlertController?.textFields else { return } @@ -345,7 +345,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, } renameAlertController!.addAction(continueAction) - renameAlertController!.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil)) + renameAlertController!.addAction(UIAlertAction(title: .cancel.localized, style: .cancel, handler: nil)) renameAlertController?.actions.first?.isEnabled = false present(renameAlertController!, animated: true) } @@ -363,9 +363,9 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, if UserDefaults.standard.askOnSwipeDelete { let alertController = UIAlertController(title: Bundle.appName, - message: "Are you sure you want to delete this document?".localized, preferredStyle: .alert) + message: .deleteDocumentMsg.localized, preferredStyle: .alert) - let okAction = UIAlertAction(title: "Yes, delete!".localized, style: .destructive, handler: { [weak self] action in + let okAction = UIAlertAction(title: .yesDelete.localized, style: .destructive, handler: { [weak self] action in guard let self = self else { return } self.delete(file: viewModel.fileURL, at: indexPath) @@ -373,7 +373,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate, alertController.addAction(okAction) - alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil)) + alertController.addAction(UIAlertAction(title: .cancel.localized, style: .cancel, handler: nil)) alertController.popoverPresentationController?.sourceView = tableView.cellForRow(at: indexPath) present(alertController, animated: true) } else { @@ -483,7 +483,7 @@ extension DocumentsTableViewController: ScannerViewControllerDelegate { extension DocumentsTableViewController: AllFolderTableViewCellDelegate { func addFolderTapped() { - alert(confirm: "Add Folder", destructive: "Cancel", message: "Add Folder?"){ folderName in + alert(confirm: .addFolder, destructive: .cancel, message: .addFolderMessage){ folderName in let newFolder = AppConfigurator.Folder(name: folderName, savedName: folderName.replacingOccurrences(of: " ", with: "_"), isSelected: false) var currentFolders = AppConfigurator().getFolders() currentFolders.append(newFolder) @@ -595,7 +595,7 @@ extension DocumentsTableViewController: DataScannerViewControllerDelegate { let alertController = UIAlertController(title: Bundle.appName, message: text.transcript, preferredStyle: .alert) - alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil)) + alertController.addAction(UIAlertAction(title: .cancel.localized, style: .cancel, handler: nil)) self.dismiss(animated: true) { self.present(alertController, animated: true) } diff --git a/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Scan/ScannerViewController.swift b/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Scan/ScannerViewController.swift index adab235d7e0888b1a3e69e2822fed950c78bba9f..1f837cae4fbbcc6d5e14f622ad8396b51f273518 100644 --- a/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Scan/ScannerViewController.swift +++ b/MiniScanner/Supporting Files/Frameworks/CustomWeScan/Scan/ScannerViewController.swift @@ -533,16 +533,16 @@ extension ScannerViewController: CustomTabBarViewDelegate { self.navigationController?.popViewController(animated: false) } else { let alertController = UIAlertController(title: "Alert", - message: "You have captured some images, do you want to discard them?".localized, preferredStyle: .alert) + message: .discardScannerMsg.localized, preferredStyle: .alert) - let okAction = UIAlertAction(title: "Discard".localized, style: .destructive, handler: { [weak self] action in + let okAction = UIAlertAction(title: .discard.localized, style: .destructive, handler: { [weak self] action in guard let self = self else { return } self.navigationController?.popViewController(animated: false) }) alertController.addAction(okAction) - alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil)) + alertController.addAction(UIAlertAction(title: .cancel.localized, style: .cancel, handler: nil)) present(alertController, animated: true) } }