From 14b3dfa11cf0cee609ac50f3f0ca1dd025c31bfc Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 24 Jul 2019 12:51:23 -0700 Subject: [PATCH] [AltStore] Updates ToastView appearance --- AltStore/App Detail/AppViewController.swift | 2 +- AltStore/Browse/BrowseViewController.swift | 8 +++----- AltStore/Components/ToastView.swift | 2 +- AltStore/My Apps/MyAppsViewController.swift | 6 ++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/AltStore/App Detail/AppViewController.swift b/AltStore/App Detail/AppViewController.swift index 6f8467e1..eaeb11b4 100644 --- a/AltStore/App Detail/AppViewController.swift +++ b/AltStore/App Detail/AppViewController.swift @@ -361,7 +361,7 @@ extension AppViewController { DispatchQueue.main.async { let toastView = ToastView(text: error.localizedDescription, detailText: nil) - toastView.show(in: self.navigationController!.view, duration: 2) + toastView.show(in: self.navigationController?.view ?? self.view, duration: 2) } } diff --git a/AltStore/Browse/BrowseViewController.swift b/AltStore/Browse/BrowseViewController.swift index 1323db8f..74393fbe 100644 --- a/AltStore/Browse/BrowseViewController.swift +++ b/AltStore/Browse/BrowseViewController.swift @@ -108,8 +108,7 @@ private extension BrowseViewController catch { DispatchQueue.main.async { - let toastView = RSTToastView(text: NSLocalizedString("Failed to Fetch Apps", comment: ""), detailText: error.localizedDescription) - toastView.tintColor = .altGreen + let toastView = ToastView(text: error.localizedDescription, detailText: nil) toastView.show(in: self.navigationController?.view ?? self.view, duration: 2.0) } } @@ -150,9 +149,8 @@ private extension BrowseViewController { case .failure(OperationError.cancelled): break // Ignore case .failure(let error): - let toastView = RSTToastView(text: "Failed to install \(app.name)", detailText: error.localizedDescription) - toastView.tintColor = .altGreen - toastView.show(in: self.navigationController!.view, duration: 2) + let toastView = ToastView(text: error.localizedDescription, detailText: nil) + toastView.show(in: self.navigationController?.view ?? self.view, duration: 2) case .success: print("Installed app:", app.identifier) } diff --git a/AltStore/Components/ToastView.swift b/AltStore/Components/ToastView.swift index 1e9f07c0..c609a421 100644 --- a/AltStore/Components/ToastView.swift +++ b/AltStore/Components/ToastView.swift @@ -25,6 +25,6 @@ class ToastView: RSTToastView { super.layoutSubviews() - self.layer.cornerRadius = self.bounds.midY + self.layer.cornerRadius = 16 } } diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index 6da2618f..12448a88 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -244,7 +244,6 @@ private extension MyAppsViewController { case .failure(let error): let toastView = ToastView(text: error.localizedDescription, detailText: nil) - toastView.tintColor = .refreshRed toastView.setNeedsLayout() toastView.show(in: self.navigationController?.view ?? self.view, duration: 2.0) @@ -424,9 +423,8 @@ private extension MyAppsViewController self.collectionView.reloadItems(at: [indexPath]) case .failure(let error): - let toastView = RSTToastView(text: "Failed to update \(app.name)", detailText: error.localizedDescription) - toastView.tintColor = .altGreen - toastView.show(in: self.navigationController!.view, duration: 2) + let toastView = ToastView(text: error.localizedDescription, detailText: nil) + toastView.show(in: self.navigationController?.view ?? self.view, duration: 2) self.collectionView.reloadItems(at: [indexPath])