|
@@ -9,7 +9,7 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
|
|
|
|
|
|
private var selectedIndex: Int = 0
|
|
private var selectedIndex: Int = 0
|
|
|
|
|
|
- private lazy var qrCodeHint: String = {
|
|
|
|
|
|
+ private func getQrCodeHint() -> String {
|
|
var qrCodeHint = ""
|
|
var qrCodeHint = ""
|
|
if dcContext.isConfigured() {
|
|
if dcContext.isConfigured() {
|
|
// we cannot use dc_contact_get_displayname() as this would result in "Me" instead of the real name
|
|
// we cannot use dc_contact_get_displayname() as this would result in "Me" instead of the real name
|
|
@@ -19,7 +19,7 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
|
|
if name.isEmpty {
|
|
if name.isEmpty {
|
|
nameAndAddress = addr
|
|
nameAndAddress = addr
|
|
} else {
|
|
} else {
|
|
- nameAndAddress = name + " (" + addr + ")"
|
|
|
|
|
|
+ nameAndAddress = "\(name) (\(addr))"
|
|
}
|
|
}
|
|
qrCodeHint = String.localizedStringWithFormat(
|
|
qrCodeHint = String.localizedStringWithFormat(
|
|
String.localized("qrshow_join_contact_hint"),
|
|
String.localized("qrshow_join_contact_hint"),
|
|
@@ -27,7 +27,7 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
|
|
)
|
|
)
|
|
}
|
|
}
|
|
return qrCodeHint
|
|
return qrCodeHint
|
|
- }()
|
|
|
|
|
|
+ }
|
|
|
|
|
|
private lazy var qrSegmentControl: UISegmentedControl = {
|
|
private lazy var qrSegmentControl: UISegmentedControl = {
|
|
let control = UISegmentedControl(
|
|
let control = UISegmentedControl(
|
|
@@ -55,7 +55,7 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
|
|
delegate = self
|
|
delegate = self
|
|
navigationItem.titleView = qrSegmentControl
|
|
navigationItem.titleView = qrSegmentControl
|
|
|
|
|
|
- let qrController = QrViewController(dcContext: dcContext, qrCodeHint: qrCodeHint)
|
|
|
|
|
|
+ let qrController = QrViewController(dcContext: dcContext, qrCodeHint: getQrCodeHint())
|
|
setViewControllers(
|
|
setViewControllers(
|
|
[qrController],
|
|
[qrController],
|
|
direction: .forward,
|
|
direction: .forward,
|
|
@@ -85,7 +85,7 @@ class QrPageController: UIPageViewController, ProgressAlertHandler {
|
|
// MARK: - actions
|
|
// MARK: - actions
|
|
@objc private func qrSegmentControlChanged(_ sender: UISegmentedControl) {
|
|
@objc private func qrSegmentControlChanged(_ sender: UISegmentedControl) {
|
|
if sender.selectedSegmentIndex == 0 {
|
|
if sender.selectedSegmentIndex == 0 {
|
|
- let qrController = QrViewController(dcContext: dcContext, qrCodeHint: qrCodeHint)
|
|
|
|
|
|
+ let qrController = QrViewController(dcContext: dcContext, qrCodeHint: getQrCodeHint())
|
|
setViewControllers([qrController], direction: .reverse, animated: true, completion: nil)
|
|
setViewControllers([qrController], direction: .reverse, animated: true, completion: nil)
|
|
} else {
|
|
} else {
|
|
let qrCodeReaderController = makeQRReader()
|
|
let qrCodeReaderController = makeQRReader()
|
|
@@ -121,7 +121,7 @@ extension QrPageController: UIPageViewControllerDataSource, UIPageViewController
|
|
if viewController is QrViewController {
|
|
if viewController is QrViewController {
|
|
return nil
|
|
return nil
|
|
}
|
|
}
|
|
- return QrViewController(dcContext: dcContext, qrCodeHint: qrCodeHint)
|
|
|
|
|
|
+ return QrViewController(dcContext: dcContext, qrCodeHint: getQrCodeHint())
|
|
}
|
|
}
|
|
|
|
|
|
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
|
|
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {
|