Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan Proxy-QR-codes (#2400) #2404

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,14 @@ extension InstantOnboardingViewController: MediaPickerDelegate {

// MARK: - QrCodeReaderDelegate
extension InstantOnboardingViewController: QrCodeReaderDelegate {
func handleQrCode(_ code: String) {
func handleQrCode(_ qrCode: String) {
// update with new code
let parsedQrCode = dcContext.checkQR(qrCode: code)
let parsedQrCode = dcContext.checkQR(qrCode: qrCode)
if parsedQrCode.state == DC_QR_LOGIN || parsedQrCode.state == DC_QR_ACCOUNT,
let host = parsedQrCode.text1,
let url = URL(string: "https://\(host)") {
self.providerHostURL = url
self.qrCodeData = code
self.qrCodeData = qrCode

contentView?.updateContent(with: host)
dismissQRReader()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@ class WelcomeViewController: UIViewController {

// MARK: - QrCodeReaderDelegate
extension WelcomeViewController: QrCodeReaderDelegate {
func handleQrCode(_ code: String) {
let lot = dcContext.checkQR(qrCode: code)
func handleQrCode(_ qrCode: String) {
let lot = dcContext.checkQR(qrCode: qrCode)
if lot.state == DC_QR_BACKUP || lot.state == DC_QR_BACKUP2 {
confirmSetupNewDevice(qrCode: code)
confirmSetupNewDevice(qrCode: qrCode)
} else {
qrErrorAlert()
}
Expand Down
5 changes: 2 additions & 3 deletions deltachat-ios/Controller/QrPageController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,8 @@ extension QrPageController: UIPageViewControllerDataSource, UIPageViewController

// MARK: - QRCodeDelegate
extension QrPageController: QrCodeReaderDelegate {

func handleQrCode(_ code: String) {
func handleQrCode(_ qrCode: String) {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
appDelegate.appCoordinator.coordinate(qrCode: code, from: self)
appDelegate.appCoordinator.coordinate(qrCode: qrCode, from: self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ class ProxySettingsViewController: UITableViewController {
DispatchQueue.main.async { [weak self] in
guard let self else { return }

let proxies = dcContext.getProxies()
self.proxies = proxies
self.selectedProxy = proxies.first
self.tableView.reloadData()
}
}
Expand Down
3 changes: 2 additions & 1 deletion deltachat-ios/Coordinator/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ class AppCoordinator: NSObject {
_ = dcContext.setConfigFromQR(qrCode: code)
}))
viewController.present(alert, animated: true)

case DC_QR_PROXY:
handleProxySelection(on: viewController, dcContext: dcContext, proxyURL: code)
default:
var msg = String.localizedStringWithFormat(String.localized("qrscan_contains_text"), code)
if state == DC_QR_ERROR {
Expand Down
2 changes: 1 addition & 1 deletion deltachat-ios/Helper/Protocols.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UIKit

protocol QrCodeReaderDelegate: AnyObject {
func handleQrCode(_ code: String)
func handleQrCode(_ qrCode: String)
}

protocol ContactListDelegate: AnyObject {
Expand Down
Loading