mirror of
https://github.com/seemoo-lab/openhaystack.git
synced 2026-02-14 17:49:54 +00:00
Showing error messages when the import fails
This commit is contained in:
@@ -125,7 +125,7 @@ struct ManageAccessoriesView: View {
|
||||
do {
|
||||
_ = try self.accessoryController.export(accessories: self.accessories)
|
||||
}catch {
|
||||
//TODO: Show alert
|
||||
self.alertType = .exportFailed
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,13 @@ struct ManageAccessoriesView: View {
|
||||
do {
|
||||
try self.accessoryController.importAccessories()
|
||||
}catch {
|
||||
//TODO: Show alert
|
||||
if let importError = error as? AccessoryController.ImportError,
|
||||
importError == .cancelled {
|
||||
//User cancelled the import. No error
|
||||
return
|
||||
}
|
||||
|
||||
self.alertType = .importFailed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +365,16 @@ struct OpenHaystackMainView: View {
|
||||
return Alert(title: Text("Downloading locations failed"),
|
||||
message: Text("We could not download any locations from Apple. Please try again later"),
|
||||
dismissButton: Alert.Button.okay())
|
||||
case .exportFailed:
|
||||
return Alert(
|
||||
title: Text("Export failed"),
|
||||
message: Text("Please check that no the folder is writable and that you have the most current version of the app"),
|
||||
dismissButton: .okay())
|
||||
case .importFailed:
|
||||
return Alert(
|
||||
title: Text("Import failed"),
|
||||
message: Text("Could not import the selected file. Please make sure it has not been modified and that you have the current version of the app."),
|
||||
dismissButton: .okay())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,6 +393,8 @@ struct OpenHaystackMainView: View {
|
||||
case activatePlugin
|
||||
case pluginInstallFailed
|
||||
case selectDepoyTarget
|
||||
case exportFailed
|
||||
case importFailed
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user