mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-21 00:22:12 +00:00
idk tf is this MainActor
Some checks are pending
Build and Release IPA / Build IPA (push) Waiting to run
Some checks are pending
Build and Release IPA / Build IPA (push) Waiting to run
This commit is contained in:
parent
0b3df78cdd
commit
4f6b7fbb13
1 changed files with 11 additions and 11 deletions
|
|
@ -146,22 +146,22 @@ struct ModuleAdditionSettingsView: View {
|
||||||
errorMessage = nil
|
errorMessage = nil
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
do {
|
guard let url = URL(string: moduleUrl) else {
|
||||||
guard let url = URL(string: moduleUrl) else {
|
await MainActor.run {
|
||||||
DispatchQueue.main.async {
|
self.errorMessage = "Invalid URL"
|
||||||
self.errorMessage = "Invalid URL"
|
self.isLoading = false
|
||||||
self.isLoading = false
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
do {
|
||||||
let (data, _) = try await URLSession.custom.data(from: url)
|
let (data, _) = try await URLSession.custom.data(from: url)
|
||||||
let metadata = try JSONDecoder().decode(ModuleMetadata.self, from: data)
|
let metadata = try JSONDecoder().decode(ModuleMetadata.self, from: data)
|
||||||
DispatchQueue.main.async {
|
await MainActor.run {
|
||||||
self.moduleMetadata = metadata
|
self.moduleMetadata = metadata
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
DispatchQueue.main.async {
|
await MainActor.run {
|
||||||
self.errorMessage = "Failed to fetch module: \(error.localizedDescription)"
|
self.errorMessage = "Failed to fetch module: \(error.localizedDescription)"
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
}
|
}
|
||||||
|
|
@ -174,13 +174,13 @@ struct ModuleAdditionSettingsView: View {
|
||||||
Task {
|
Task {
|
||||||
do {
|
do {
|
||||||
let _ = try await moduleManager.addModule(metadataUrl: moduleUrl)
|
let _ = try await moduleManager.addModule(metadataUrl: moduleUrl)
|
||||||
DispatchQueue.main.async {
|
await MainActor.run {
|
||||||
isLoading = false
|
isLoading = false
|
||||||
DropManager.shared.showDrop(title: "Module Added", subtitle: "click it to select it", duration: 2.0, icon: UIImage(systemName:"gear.badge.checkmark"))
|
DropManager.shared.showDrop(title: "Module Added", subtitle: "click it to select it", duration: 2.0, icon: UIImage(systemName:"gear.badge.checkmark"))
|
||||||
self.presentationMode.wrappedValue.dismiss()
|
self.presentationMode.wrappedValue.dismiss()
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
DispatchQueue.main.async {
|
await MainActor.run {
|
||||||
isLoading = false
|
isLoading = false
|
||||||
if (error as NSError).domain == "Module already exists" {
|
if (error as NSError).domain == "Module already exists" {
|
||||||
errorMessage = "Module already exists"
|
errorMessage = "Module already exists"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue