ios: review fixes for wrong QR code recognition

Follow-up to "Recognise wrong QR code type in every scanner", from an iOS
review of that commit.

- ScanProtocolServer: a rejected scan now alerts in place instead of
  dismissing, but the sheet had no way out - move its title into the nav bar
  and add a Cancel button. Fixes the preview, which needs AppTheme now that
  the themed background is applied inside the view.
- MigrateToDevice: classify the pasted link off the main thread, as the
  Kotlin paste path already does - pasted text is unbounded and classifying
  a file link parses its YAML description. Guard the result, as the sheet can
  be dismissed while classifying.
- Relay message named the Chat relay screen but not that the address is only
  kept once the relay is tested, so following it lost the pasted address to
  an "Invalid relay name!" alert. The migration message named a label that
  only exists on desktop.
- ContentView: the /r deep link showed the relay alert without the guidance
  added to the other call site; both literals were identical before.
- Document WrongQRCode.swift per apps/ios/CODE.md, and refresh the specs and
  product docs that quote the changed messages.
This commit is contained in:
Narasimha-sc committed 2026-09-02 19:06:00 +00:00
1 parent 992f7f9781
commit f48377a3fa
14 files changed
+60 -51

No files matched your search

+6 -6
View File
@@ -187,10 +187,6 @@ struct ParsedServerAddress: Decodable {
var parseError: String
}
// The kind of SimpleX QR code / link a scanned string turned out to be, as
// determined by the core (chat_check_link). Public: it crosses the
// SimpleXChat -> app module boundary. Case names and the connection payload
// label must match the Haskell ScannedLinkType wire tags.
public enum ScannedLinkType: Decodable {
case connection(linkType: SimplexLinkType)
case server
@@ -199,8 +195,6 @@ public enum ScannedLinkType: Decodable {
case verificationCode
}
// Wrapper stays internal — it never leaves the framework. A missing linkType
// key (the "not a SimpleX code" case) decodes to nil.
struct CheckedLink: Decodable {
var linkType: ScannedLinkType?
}
@@ -219,6 +213,12 @@ public func checkLink(_ s: String) -> ScannedLinkType? {
return nil
}
// nonisolated async, so callers on the main actor offload to the global executor:
// pasted text is unbounded, and classifying a file link parses its YAML description
public func checkLinkAsync(_ s: String) async -> ScannedLinkType? {
checkLink(s)
}
public func parseSanitizeUri(_ s: String, safe: Bool) -> ParsedUri? {
var c = s.cString(using: .utf8)!
if let cjson = chat_parse_uri(&c, safe ? 1 : 0) {