From 63c55b41ec1e54dd86f8d1808b07da5ecc0b4768 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Thu, 19 Mar 2020 15:02:35 -0700 Subject: [PATCH] Improves error toast view appearance --- AltStore/Components/ToastView.swift | 8 ++++---- AltStore/My Apps/MyAppsViewController.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AltStore/Components/ToastView.swift b/AltStore/Components/ToastView.swift index e99a8f91..643f75e7 100644 --- a/AltStore/Components/ToastView.swift +++ b/AltStore/Components/ToastView.swift @@ -25,14 +25,14 @@ class ToastView: RSTToastView super.init(text: text, detailText: detailedText) - self.layoutMargins = UIEdgeInsets(top: 8, left: 12, bottom: 8, right: 12) + self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 10, right: 16) self.setNeedsLayout() if let stackView = self.textLabel.superview as? UIStackView { // RSTToastView does not expose stack view containing labels, // so we access it indirectly as the labels' superview. - stackView.spacing = 4.0 + stackView.spacing = (detailedText != nil) ? 4.0 : 0.0 } } @@ -46,7 +46,7 @@ class ToastView: RSTToastView if let failure = error.localizedFailure { text = failure - detailText = error.localizedFailureReason ?? error.localizedRecoverySuggestion + detailText = error.localizedFailureReason ?? error.localizedRecoverySuggestion ?? error.localizedDescription } else if let reason = error.localizedFailureReason { @@ -71,7 +71,7 @@ class ToastView: RSTToastView super.layoutSubviews() // Rough calculation to determine height of ToastView with one-line textLabel. - let minimumHeight = self.textLabel.font.lineHeight.rounded() + 20 + let minimumHeight = self.textLabel.font.lineHeight.rounded() + 18 self.layer.cornerRadius = minimumHeight/2 } diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index 25cba553..8adba52b 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -490,7 +490,7 @@ private extension MyAppsViewController } let error = failures.first?.value as NSError? - let detailText = error?.localizedFailureReason ?? error?.localizedDescription + let detailText = error?.localizedFailure ?? error?.localizedFailureReason ?? error?.localizedDescription toastView = ToastView(text: localizedText, detailText: detailText) toastView.preferredDuration = 4.0