Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed May 29, 2024
1 parent 080ff67 commit eb5adfb
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 257 deletions.
4 changes: 0 additions & 4 deletions deltachat-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@
AE8F503524753DFE007FEE0B /* GalleryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8F503424753DFE007FEE0B /* GalleryViewController.swift */; };
AE9DAF0D22C1215D004C9591 /* EditContactController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE9DAF0C22C1215D004C9591 /* EditContactController.swift */; };
AE9DAF0F22C278C6004C9591 /* ChatTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE9DAF0E22C278C6004C9591 /* ChatTitleView.swift */; };
AEA0F6A124474146009F887B /* ProfileInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEA0F6A024474146009F887B /* ProfileInfoViewController.swift */; };
AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E21FB32B5C00DCDD78 /* Constants.swift */; };
AEACE2E51FB32E1900DCDD78 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E41FB32E1900DCDD78 /* Utils.swift */; };
AEC67A1C241CE9E4007DDBE1 /* AppStateRestorer.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEC67A1B241CE9E4007DDBE1 /* AppStateRestorer.swift */; };
Expand Down Expand Up @@ -478,7 +477,6 @@
AE8F503424753DFE007FEE0B /* GalleryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GalleryViewController.swift; sourceTree = "<group>"; };
AE9DAF0C22C1215D004C9591 /* EditContactController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditContactController.swift; sourceTree = "<group>"; };
AE9DAF0E22C278C6004C9591 /* ChatTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatTitleView.swift; sourceTree = "<group>"; };
AEA0F6A024474146009F887B /* ProfileInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileInfoViewController.swift; sourceTree = "<group>"; };
AEACE2E21FB32B5C00DCDD78 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
AEACE2E41FB32E1900DCDD78 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
AEC67A1B241CE9E4007DDBE1 /* AppStateRestorer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStateRestorer.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -909,7 +907,6 @@
AEE56D752253431E007DC082 /* AccountSetupController.swift */,
30C0D49C237C4908008E2A0E /* CertificateCheckController.swift */,
AE18F293228C602A0007B1BE /* SecuritySettingsController.swift */,
AEA0F6A024474146009F887B /* ProfileInfoViewController.swift */,
);
path = AccountSetup;
sourceTree = "<group>";
Expand Down Expand Up @@ -1612,7 +1609,6 @@
AE76E5EE242BF2EA003CF461 /* WelcomeViewController.swift in Sources */,
3052C60A253F082E007D13EA /* MessageLabelDelegate.swift in Sources */,
AE0AA9562478191900D42A7F /* GridCollectionViewFlowLayout.swift in Sources */,
AEA0F6A124474146009F887B /* ProfileInfoViewController.swift in Sources */,
303492A5257546B400A523D0 /* DraftPreview.swift in Sources */,
305961D02346125100C80F33 /* NSAttributedString+Extensions.swift in Sources */,
21D6C941260623F500D0755A /* NotificationManager.swift in Sources */,
Expand Down
158 changes: 0 additions & 158 deletions deltachat-ios/Controller/AccountSetup/ProfileInfoViewController.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
private let accountCode: String?
private var backupProgressObserver: NSObjectProtocol?
var progressObserver: NSObjectProtocol?
var onProgressSuccess: VoidFunction?
private var securityScopedResource: NSURL?

private lazy var scrollView: UIScrollView = {
Expand Down Expand Up @@ -59,16 +58,6 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
self.accountCode = accountCode
super.init(nibName: nil, bundle: nil)
self.navigationItem.title = String.localized(canCancel ? "add_account" : "welcome_desktop")
onProgressSuccess = { [weak self] in
guard let self else { return }
let profileInfoController = ProfileInfoViewController(context: self.dcContext)
profileInfoController.onClose = {
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
appDelegate.reloadDcContext()
}
}
self.navigationController?.setViewControllers([profileInfoController], animated: true)
}
}

required init?(coder: NSCoder) {
Expand Down Expand Up @@ -149,43 +138,6 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
navigationController?.pushViewController(qrReader, animated: true)
}

private func createAccountFromQRCode(qrCode: String) {
if dcAccounts.getSelected().isConfigured() {
UserDefaults.standard.setValue(dcAccounts.getSelected().id, forKey: Constants.Keys.lastSelectedAccountKey)
_ = dcAccounts.add()
}
let accountId = dcAccounts.getSelected().id

if accountId != 0 {
dcContext = dcAccounts.get(id: accountId)
addProgressAlertListener(dcAccounts: self.dcAccounts,
progressName: eventConfigureProgress,
onSuccess: self.handleLoginSuccess)
showProgressAlert(title: String.localized("login_header"), dcContext: self.dcContext)
DispatchQueue.global().async { [weak self] in
guard let self else { return }
let success = self.dcContext.setConfigFromQR(qrCode: qrCode)
DispatchQueue.main.async {
if success {
self.dcAccounts.stopIo()
self.dcContext.configure()
} else {
self.updateProgressAlert(error: self.dcContext.lastErrorString,
completion: self.accountCode != nil ? self.cancelAccountCreation : nil)
}
}
}
}
}

private func handleLoginSuccess() {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
if !UserDefaults.standard.bool(forKey: "notifications_disabled") {
appDelegate.registerForNotifications()
}
onProgressSuccess?()
}

private func handleBackupRestoreSuccess() {
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }

Expand Down Expand Up @@ -286,59 +238,13 @@ class WelcomeViewController: UIViewController, ProgressAlertHandler {
extension WelcomeViewController: QrCodeReaderDelegate {
func handleQrCode(_ code: String) {
let lot = dcContext.checkQR(qrCode: code)
if let domain = lot.text1, lot.state == DC_QR_ACCOUNT {
let title = String.localizedStringWithFormat(
String.localized(dcAccounts.getAll().count > 1 ? "qraccount_ask_create_and_login_another" : "qraccount_ask_create_and_login"),
domain)
confirmQrAccountAlert(title: title, qrCode: code)
} else if let email = lot.text1, lot.state == DC_QR_LOGIN {
let title = String.localizedStringWithFormat(
String.localized(dcAccounts.getAll().count > 1 ? "qrlogin_ask_login_another" : "qrlogin_ask_login"),
email)
confirmQrAccountAlert(title: title, qrCode: code)
} else if lot.state == DC_QR_BACKUP {
if lot.state == DC_QR_BACKUP {
confirmSetupNewDevice(qrCode: code)
} else {
qrErrorAlert()
}
}

private func confirmQrAccountAlert(title: String, qrCode: String) {
let alert = UIAlertController(title: title, message: nil, preferredStyle: .alert)

let okAction = UIAlertAction(
title: String.localized("ok"),
style: .default,
handler: { [weak self] _ in
guard let self else { return }
self.dismissQRReader()
self.createAccountFromQRCode(qrCode: qrCode)
}
)

let qrCancelAction = UIAlertAction(
title: String.localized("cancel"),
style: .cancel,
handler: { [weak self] _ in
guard let self else { return }
self.dismissQRReader()
// if an injected accountCode exists, the WelcomeViewController was only opened to handle that
// cancelling the action should also dismiss the whole controller
if self.accountCode != nil {
self.cancelAccountCreation()
}
}
)

alert.addAction(okAction)
alert.addAction(qrCancelAction)
if qrCodeReader != nil {
qrCodeReader?.present(alert, animated: true)
} else {
self.present(alert, animated: true)
}
}

private func confirmSetupNewDevice(qrCode: String) {
triggerLocalNetworkPrivacyAlert()
let alert = UIAlertController(title: String.localized("multidevice_receiver_title"),
Expand Down

0 comments on commit eb5adfb

Please sign in to comment.