Skip to content

Commit

Permalink
Adjust icon size in UnauthorizedErrorHeaderView, refactor error handl…
Browse files Browse the repository at this point in the history
…ing and update localization strings
  • Loading branch information
iammajid committed Oct 15, 2024
1 parent f7821ec commit 0bfa725
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
16 changes: 7 additions & 9 deletions FileProviderExtensionUI/FileProviderCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ class FileProviderCoordinator: Coordinator {

func handleError(_ error: Error, for viewController: UIViewController) {
DDLogError("Error: \(error)")
if let fileProviderError = error as? FileProviderCoordinatorError {
switch fileProviderError {
case let .unauthorized(vaultName):
showUnauthorizedError(vaultName: vaultName)
return
}
}
let alertController = UIAlertController(title: LocalizedString.getValue("common.alert.error.title"), message: error.localizedDescription, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: LocalizedString.getValue("common.button.ok"), style: .default))
viewController.present(alertController, animated: true)
Expand Down Expand Up @@ -198,15 +205,6 @@ class FileProviderCoordinator: Coordinator {
guard let hostViewController = hostViewController else {
return
}

if let fileProviderError = error as? FileProviderCoordinatorError {
switch fileProviderError {
case let .unauthorized(vaultName):
showUnauthorizedError(vaultName: vaultName)
return
}
}

handleError(error, for: hostViewController)
}
}
4 changes: 2 additions & 2 deletions FileProviderExtensionUI/UnauthorizedErrorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class UnauthorizedErrorViewController: UITableViewController {

private class UnauthorizedErrorHeaderView: LargeHeaderFooterView {
init(vaultName: String) {
let config = UIImage.SymbolConfiguration(pointSize: 100)
let config = UIImage.SymbolConfiguration(pointSize: 120)
let symbolImage = UIImage(systemName: "exclamationmark.triangle.fill", withConfiguration: config)?.withTintColor(.systemYellow, renderingMode: .alwaysOriginal)

let infoText = String(format: LocalizedString.getValue("fileprovider.error.reauthentication"), vaultName)
let infoText = String(format: LocalizedString.getValue("fileprovider.error.unauthorized.text"), vaultName)

super.init(image: symbolImage, infoText: infoText)
}
Expand Down
2 changes: 1 addition & 1 deletion SharedResources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"fileProvider.error.biometricalAuthWrongPassword.message" = "The password that has been saved for %@ is wrong. Please try again and enter your password to re-enable %@.";
"fileProvider.error.defaultLock.title" = "Unlock Required";
"fileProvider.error.defaultLock.message" = "To access and show the contents of your vault, it has to be unlocked.";
"fileprovider.error.reauthentication" = "Access to your vault \"%@\" was denied. Open the main app to check your connection and re-authenticate if needed.";
"fileprovider.error.unauthorized.text" = "Access to your vault \"%@\" was denied. Open the main app to check your connection and re-authenticate if needed.";
"fileProvider.error.unlockButton" = "Unlock";
"fileProvider.clearFileFromCache.title" = "Clear File from Cache";
"fileProvider.clearFileFromCache.message" = "This only removes the local file from your device and does not delete the file in the cloud.";
Expand Down

0 comments on commit 0bfa725

Please sign in to comment.