diff --git a/Pods Updater/Source/Repository.swift b/Pods Updater/Source/Repository.swift index 9b8a940..08b90f1 100644 --- a/Pods Updater/Source/Repository.swift +++ b/Pods Updater/Source/Repository.swift @@ -50,10 +50,8 @@ class Repository: DataSource { if let name = components.second, let currentVersion = components.fourth { // If this version info has any of the magic operators, add info message and skip this index. - if currentVersion.first!.isDigit.not() { - if currentVersion.isUnsupportedPodVersionInfo { - hasPodWithUnsupportedFormat = true - } + if currentVersion.isUnsupportedPodVersionInfo { + hasPodWithUnsupportedFormat = true continue } diff --git a/Pods Updater/UI/Home/HomeContract.swift b/Pods Updater/UI/Home/HomeContract.swift index 52abc5d..09198d5 100644 --- a/Pods Updater/UI/Home/HomeContract.swift +++ b/Pods Updater/UI/Home/HomeContract.swift @@ -20,7 +20,7 @@ protocol _HomeView: BaseContract.View { func showProjectName(_ name: String) func setProgress(enabled: Bool) func showPodWithInvalidFormatWarning() - func showLocalPodsUpdateInformation() + func showLocalPodsUpdateInformation(resultCount: Int) func showPodCleanUpResult(_ result: PodFileCleanResult) func showPodCleanUpError(_ reason: String?) } diff --git a/Pods Updater/UI/Home/HomePresenter.swift b/Pods Updater/UI/Home/HomePresenter.swift index 9386f37..5da1121 100644 --- a/Pods Updater/UI/Home/HomePresenter.swift +++ b/Pods Updater/UI/Home/HomePresenter.swift @@ -30,17 +30,18 @@ class HomePresenter: HomeContract.Presenter { .subscribeOn(ConcurrentDispatchQueueScheduler(qos: .background)) .observeOn(MainScheduler.instance) .subscribe(onNext: { [weak self] progressResult in - self?.view?.setProgress(enabled: false) if progressResult.result == nil { self?.view?.showPodfileReadPercentage(progressResult.progress) } else { + self?.view?.setProgress(enabled: false) + let result = progressResult.result! self?.view?.showPodsInformation(with: result.pods) if result.hasPodWithUnsupportedFormat { self?.view?.showPodWithInvalidFormatWarning() } else { - self?.view?.showLocalPodsUpdateInformation() + self?.view?.showLocalPodsUpdateInformation(resultCount: result.pods.count) } } }, onError: { [weak self] error in diff --git a/Pods Updater/UI/Home/HomeViewController.swift b/Pods Updater/UI/Home/HomeViewController.swift index f2ca6a5..e90b51d 100644 --- a/Pods Updater/UI/Home/HomeViewController.swift +++ b/Pods Updater/UI/Home/HomeViewController.swift @@ -30,15 +30,6 @@ class HomeViewController: NSViewController { openPanel.canCreateDirectories = false return openPanel }() - private let infoAlert: NSAlert = { - let alert = NSAlert() - alert.messageText = "Important" - alert.informativeText = "This app searches your local pod spec repository to get pod versions. For best results, it's important that this repo is up to date. This can be achieved by running the \"pod repo update\" command." - alert.alertStyle = .informational - alert.addButton(withTitle: "Close") - alert.addButton(withTitle: "Run update command now") - return alert - }() override func viewDidLoad() { super.viewDidLoad() @@ -55,7 +46,8 @@ extension HomeViewController: HomeContract.View { func showPodWithInvalidFormatWarning() { let alert = NSAlert() alert.messageText = "Important" - alert.informativeText = "One or more Pods in your Podfile is declared with a format that is not supported by this app. The app can analyze your Podfile and show which lines should be fixed." + alert.informativeText = "One or more Pods in your Podfile is declared with a format that is not supported by this app. " + + "The app can analyze your Podfile and show which lines should be fixed." alert.alertStyle = .critical alert.addButton(withTitle: "Analyze now") alert.addButton(withTitle: "Close") @@ -92,10 +84,19 @@ extension HomeViewController: HomeContract.View { tableView.isEnabled = !enabled } - func showLocalPodsUpdateInformation() { - infoAlert.beginSheetModal(for: view.window!) { [unowned self] response in + func showLocalPodsUpdateInformation(resultCount: Int) { + let alert = NSAlert() + alert.messageText = "Search completed" + let emptyResultText = "\(resultCount == 0 ? "No results found.\n\n" : "")" + alert.informativeText = "\(emptyResultText)Note: This app searches your local pod spec repository to get pod versions. " + + "For best results, it's important that this repo is up to date. This can be achieved by running the \"pod repo update\" command." + alert.alertStyle = .informational + alert.addButton(withTitle: "Close") + alert.addButton(withTitle: "Run update command now") + + alert.beginSheetModal(for: view.window!) { [unowned self] response in if response == .alertSecondButtonReturn { - self.runComman(.updateRepo) + self.runCommand(.updateRepo) } } } @@ -119,7 +120,7 @@ extension HomeViewController: HomeContract.View { alert.beginSheetModal(for: view.window!) } - fileprivate func runComman(_ command: Command) { + fileprivate func runCommand(_ command: Command) { let vc = self.storyboard?.instantiateController(withIdentifier: .commandViewController) as! CommandViewController vc.command = command @@ -158,7 +159,7 @@ extension HomeViewController { installPodButton.title = "Install Pod(s)" installPodButton.rx.tap.asDriver() .drive(onNext: { [unowned self] _ in - self.runComman(.install(podFileUrl: self.openPanel.url!.deletingLastPathComponent())) + self.runCommand(.install(podFileUrl: self.openPanel.url!.deletingLastPathComponent())) }).disposed(by: disposeBag)