mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-30 21:26:57 +02:00
Bugfix in qr code scanner for perm links
This commit is contained in:
@@ -52,23 +52,32 @@ struct PermalinkQRCodeScanner: View {
|
||||
Alert(
|
||||
title: Text(BWIL10n.roomRecentsScanFailedTitle),
|
||||
message: Text(BWIL10n.roomRecentsScanFailedMessage),
|
||||
dismissButton: .default(Text(VectorL10n.ok)))
|
||||
dismissButton: .default(Text(VectorL10n.ok)) {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
.onChange(of: scanCompleted) { newValue in
|
||||
if newValue {
|
||||
if !BWIBuildSettings.shared.clientPermalinkBaseUrl.isEmpty && qrCode.hasPrefix(BWIBuildSettings.shared.clientPermalinkBaseUrl) {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||
if let url = URL(string: qrCode) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showInvalidCodeAlert = true
|
||||
}
|
||||
|
||||
checkQRCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func checkQRCode() {
|
||||
if !BWIBuildSettings.shared.clientPermalinkBaseUrl.isEmpty && qrCode.hasPrefix(BWIBuildSettings.shared.clientPermalinkBaseUrl) {
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
|
||||
if let url = URL(string: qrCode) {
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
showInvalidCodeAlert = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user