Commit 6b0b0b24 authored by Jose Blaya's avatar Jose Blaya
Browse files

- Replacing AlertControllers by PopupDialog

- Fix minor UI issue in tile cells
parent e4e6dbb5
This diff is collapsed.
......@@ -136,9 +136,9 @@ class AccountViewController: AutolayoutViewController {
return
}
let alert = Macros.alert(L10n.Account.Update.Email.Require.Password.title,
L10n.Account.Update.Email.Require.Password.message)
let alert = Macros.alertController(L10n.Account.Update.Email.Require.Password.title,
L10n.Account.Update.Email.Require.Password.message)
alert.addCancelAction(L10n.Global.cancel)
let action = UIAlertAction(title: L10n.Account.Update.Email.Require.Password.button,
style: .default) { [weak self] (alertAction) in
......@@ -165,7 +165,7 @@ class AccountViewController: AutolayoutViewController {
weakSelf.textEmail.text = ""
let alert = Macros.alert(L10n.Global.error, L10n.Account.Error.unauthorized)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
self?.present(alert, animated: true, completion: nil)
return
......@@ -173,7 +173,7 @@ class AccountViewController: AutolayoutViewController {
log.debug("Account: Email successfully modified")
let alert = Macros.alert(nil, L10n.Account.Save.success)
alert.addCancelAction(L10n.Global.ok)
alert.addDefaultAction(L10n.Global.ok)
weakSelf.present(alert, animated: true, completion: nil)
weakSelf.textEmail.text = email
weakSelf.textEmail.endEditing(true)
......@@ -218,14 +218,14 @@ class AccountViewController: AutolayoutViewController {
log.error("IAP: Failed to restore payment receipt (error: \(error?.localizedDescription ?? ""))")
let alert = Macros.alert(L10n.Global.error, error?.localizedDescription)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
}
private func handleReceiptSubmissionWithError(_ error: Error?) {
if let error = error {
let alert = Macros.alert(L10n.Global.error, error.localizedDescription)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
return
}
......@@ -236,7 +236,7 @@ class AccountViewController: AutolayoutViewController {
L10n.Renewal.Success.title,
L10n.Renewal.Success.message
)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
redisplayAccount()
......@@ -247,7 +247,7 @@ class AccountViewController: AutolayoutViewController {
L10n.Account.Restore.Failure.title,
L10n.Account.Restore.Failure.message
)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
}
......
......@@ -54,7 +54,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
L10n.Notifications.Disabled.title,
L10n.Notifications.Disabled.message
)
alert.addDefaultAction(L10n.Notifications.Disabled.settings) {
alert.addActionWithTitle(L10n.Notifications.Disabled.settings) {
application.openURL(URL(string: UIApplicationOpenSettingsURLString)!)
}
alert.addCancelAction(L10n.Global.ok)
......
......@@ -54,20 +54,15 @@ class CustomDNSSettingsViewController: AutolayoutViewController {
let alertController = Macros.alert(L10n.Settings.Dns.Alert.Clear.title,
L10n.Settings.Dns.Alert.Clear.message)
let saveAction = UIAlertAction(title: L10n.Global.ok, style: UIAlertActionStyle.default, handler: { alert -> Void in
alertController.addActionWithTitle(L10n.Global.ok) {
if let firstKey = DNSList.shared.firstKey() {
DNSList.shared.removeServer(name: DNSList.CUSTOM_DNS_KEY)
self.delegate?.updateSetting(Setting.vpnDns,
withValue: firstKey)
}
self.navigationController?.popToRootViewController(animated: true)
})
let cancelAction = UIAlertAction(title: L10n.Global.cancel, style: UIAlertActionStyle.default,
handler: nil)
alertController.addAction(saveAction)
alertController.addAction(cancelAction)
}
alertController.addCancelAction(L10n.Global.cancel)
self.present(alertController,
animated: true,
......@@ -128,7 +123,7 @@ class CustomDNSSettingsViewController: AutolayoutViewController {
(textPrimaryDNS.text != nil && textPrimaryDNS.text!.isEmpty)) {
let alert = Macros.alert(L10n.Settings.Dns.Custom.dns,
L10n.Settings.Dns.Validation.Primary.mandatory)
alert.addCancelAction(L10n.Global.ok)
alert.addDefaultAction(L10n.Global.ok)
self.present(alert,
animated: true,
completion: nil)
......@@ -139,7 +134,7 @@ class CustomDNSSettingsViewController: AutolayoutViewController {
!isValidAddress(primaryDNS) {
let alert = Macros.alert(L10n.Settings.Dns.Custom.dns,
L10n.Settings.Dns.Validation.Primary.invalid)
alert.addCancelAction(L10n.Global.ok)
alert.addDefaultAction(L10n.Global.ok)
self.present(alert,
animated: true,
completion: nil)
......@@ -151,7 +146,7 @@ class CustomDNSSettingsViewController: AutolayoutViewController {
!isValidAddress(secondaryDNS) {
let alert = Macros.alert(L10n.Settings.Dns.Custom.dns,
L10n.Settings.Dns.Validation.Secondary.invalid)
alert.addCancelAction(L10n.Global.ok)
alert.addDefaultAction(L10n.Global.ok)
self.present(alert,
animated: true,
completion: nil)
......
......@@ -158,7 +158,8 @@ class DashboardViewController: AutolayoutViewController {
L10n.Settings.ContentBlocker.title,
L10n.Dashboard.ContentBlocker.Intro.message
)
alert.addCancelAction(L10n.Global.ok)
alert.addActionWithTitle(L10n.Global.ok) {
}
present(alert, animated: true, completion: nil)
return
}
......
......@@ -174,7 +174,7 @@ class MenuViewController: AutolayoutViewController {
L10n.Global.error,
errorMessage
)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
}
......@@ -186,7 +186,7 @@ class MenuViewController: AutolayoutViewController {
L10n.Menu.Renewal.Message.trial
)
alert.addCancelAction(L10n.Global.cancel)
alert.addDefaultAction(L10n.Menu.Renewal.purchase) {
alert.addActionWithTitle(L10n.Menu.Renewal.purchase) {
self.dismiss(animated: true) {
self.delegate?.menu(didDetectTrialUpgrade: self)
}
......@@ -203,7 +203,7 @@ class MenuViewController: AutolayoutViewController {
L10n.Menu.Renewal.Message.website
)
alert.addCancelAction(L10n.Global.cancel)
alert.addDefaultAction(L10n.Menu.Renewal.renew) {
alert.addActionWithTitle(L10n.Menu.Renewal.renew) {
UIApplication.shared.openURL(AppConstants.Web.homeURL)
}
present(alert, animated: true, completion: nil)
......@@ -246,7 +246,7 @@ class MenuViewController: AutolayoutViewController {
log.error("IAP: Purchase failed (error: \(error)")
let alert = Macros.alert(L10n.Global.error, error.localizedDescription)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
}
......@@ -257,7 +257,7 @@ class MenuViewController: AutolayoutViewController {
L10n.Renewal.Success.title,
L10n.Renewal.Success.message
)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
}
......@@ -272,7 +272,7 @@ class MenuViewController: AutolayoutViewController {
L10n.Global.error,
L10n.Renewal.Failure.message
)
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
present(alert, animated: true, completion: nil)
}
......@@ -282,7 +282,7 @@ class MenuViewController: AutolayoutViewController {
L10n.Menu.Logout.message
)
sheet.addCancelAction(L10n.Global.cancel)
sheet.addDestructiveAction(L10n.Menu.Logout.confirm) {
sheet.addDestructiveActionWithTitle(L10n.Menu.Logout.confirm) {
self.dismiss(animated: true) {
log.debug("Account: Logging out...")
AppPreferences.shared.clean()
......
......@@ -49,7 +49,7 @@ class RegionsViewController: AutolayoutViewController {
NotificationCenter.default.addObserver(self, selector: #selector(viewHasRotated), name: .UIDeviceOrientationDidChange, object: nil)
setupSearchBarController()
stylePopupDialog()
Macros.stylePopupDialog()
tableView.emptyDataSetSource = self
tableView.emptyDataSetDelegate = self
......@@ -65,28 +65,6 @@ class RegionsViewController: AutolayoutViewController {
navigationItem.rightBarButtonItem?.accessibilityLabel = L10n.Region.Accessibility.filter
}
private func stylePopupDialog() {
let dialogAppearance = PopupDialogDefaultView.appearance()
dialogAppearance.backgroundColor = Theme.current.palette.appearance == .dark ? UIColor.piaGrey6 : .white
dialogAppearance.messageFont = TextStyle.textStyle12.font!
dialogAppearance.messageColor = Theme.current.palette.appearance == .dark ? .white : TextStyle.textStyle12.color
let containerAppearance = PopupDialogContainerView.appearance()
containerAppearance.cornerRadius = 0
containerAppearance.shadowEnabled = false
let overlayAppearance = PopupDialogOverlayView.appearance()
overlayAppearance.color = .black
overlayAppearance.blurEnabled = false
overlayAppearance.liveBlurEnabled = false
overlayAppearance.opacity = 0.5
let buttonAppearance = DefaultButton.appearance()
buttonAppearance.titleFont = TextStyle.textStyle21.font!
buttonAppearance.titleColor = TextStyle.textStyle21.color
buttonAppearance.buttonColor = Theme.current.palette.appearance == .dark ? UIColor.piaGrey6 : .white
buttonAppearance.separatorColor = Theme.current.palette.appearance == .dark ? UIColor.piaGrey10 : UIColor.piaGrey1
}
private func setupSearchBarController() {
searchController.searchResultsUpdater = self
......
......@@ -320,11 +320,8 @@ class SettingsViewController: AutolayoutViewController {
defer {
let alert = Macros.alert(title, message)
alert.addCancelAction(L10n.Global.ok)
alert.addDefaultAction(L10n.Global.ok)
self.present(alert, animated: true, completion: nil)
// UIActivityViewController *vc = [[UIActivityViewController alloc] initWithActivityItems:@[log] applicationActivities:nil];
// [self presentViewController:vc animated:YES completion:NULL];
}
guard let log = log else {
......@@ -348,7 +345,7 @@ class SettingsViewController: AutolayoutViewController {
L10n.Settings.Reset.Defaults.Confirm.title,
L10n.Settings.Reset.Defaults.Confirm.message
)
alert.addDestructiveAction(L10n.Settings.Reset.Defaults.Confirm.button) {
alert.addDestructiveActionWithTitle(L10n.Settings.Reset.Defaults.Confirm.button) {
self.doReset()
}
alert.addCancelAction(L10n.Global.cancel)
......@@ -423,15 +420,15 @@ class SettingsViewController: AutolayoutViewController {
)
// reconnect -> reconnect VPN and close
alert.addDefaultAction(L10n.Settings.Commit.Buttons.reconnect) {
alert.addActionWithTitle(L10n.Settings.Commit.Buttons.reconnect) {
self.commitPreferences()
completionHandlerAfterVPNAction(true)
}
// cancel -> revert changes and close
alert.addAction(UIAlertAction(title: L10n.Global.cancel, style: .cancel) { (action) in
alert.addCancelActionWithTitle(L10n.Global.cancel) {
completionHandler()
})
}
present(alert, animated: true, completion: nil)
return
}
......@@ -446,14 +443,15 @@ class SettingsViewController: AutolayoutViewController {
)
// reconnect -> reconnect VPN and close
alert.addDefaultAction(L10n.Settings.Commit.Buttons.reconnect) {
alert.addActionWithTitle(L10n.Settings.Commit.Buttons.reconnect) {
completionHandlerAfterVPNAction(true)
}
// later -> close
alert.addAction(UIAlertAction(title: L10n.Settings.Commit.Buttons.later, style: .cancel) { (action) in
alert.addCancelActionWithTitle(L10n.Settings.Commit.Buttons.later) {
completionHandler()
})
}
present(alert, animated: true, completion: nil)
return
}
......@@ -498,7 +496,7 @@ class SettingsViewController: AutolayoutViewController {
}
let alert = Macros.alert(nil, addresses.joined(separator: ","))
alert.addCancelAction(L10n.Global.close)
alert.addDefaultAction(L10n.Global.close)
self.present(alert, animated: true, completion: nil)
}
}
......@@ -1195,15 +1193,10 @@ extension SettingsViewController: OptionsViewControllerDelegate {
if !isFound && option == DNSList.CUSTOM_DNS_KEY {
let alertController = Macros.alert(L10n.Settings.Dns.Custom.dns,
L10n.Settings.Dns.Alert.Create.message)
let saveAction = UIAlertAction(title: L10n.Global.ok, style: UIAlertActionStyle.default, handler: { alert -> Void in
alertController.addActionWithTitle(L10n.Global.ok) {
self.perform(segue: StoryboardSegue.Main.customDNSSegueIdentifier)
})
let cancelAction = UIAlertAction(title: L10n.Global.cancel, style: UIAlertActionStyle.default,
handler: nil)
alertController.addAction(saveAction)
alertController.addAction(cancelAction)
}
alertController.addCancelAction(L10n.Global.cancel)
self.present(alertController,
animated: true,
completion: nil)
......
......@@ -23,14 +23,14 @@
<rect key="frame" x="0.0" y="0.0" width="365" height="89"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jwP-tn-mQv">
<rect key="frame" x="25" y="25" width="142.5" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jwP-tn-mQv">
<rect key="frame" x="25" y="25" width="142.5" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="xR4-ef-XuZ">
<rect key="frame" x="25" y="43" width="142.5" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="xR4-ef-XuZ">
<rect key="frame" x="25" y="64" width="142.5" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......@@ -38,14 +38,14 @@
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ip-triangle" translatesAutoresizingMaskIntoConstraints="NO" id="tN8-Zr-Ghy">
<rect key="frame" x="177.5" y="34.5" width="10" height="20"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ltV-Wi-R5o">
<rect key="frame" x="212.5" y="25" width="42" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ltV-Wi-R5o">
<rect key="frame" x="212.5" y="25" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="Eay-Yz-Xzw">
<rect key="frame" x="212.5" y="43" width="42" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="Eay-Yz-Xzw">
<rect key="frame" x="212.5" y="64" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......
......@@ -20,12 +20,15 @@ class IPTileCollectionViewCell: UICollectionViewCell, TileableCell {
@IBOutlet weak var tileLeftConstraint: NSLayoutConstraint!
@IBOutlet weak var tileRightConstraint: NSLayoutConstraint!
private var currentTileStatus: TileStatus?
func setupCellForStatus(_ status: TileStatus) {
Theme.current.applySolidLightBackground(self)
Theme.current.applySolidLightBackground(self.contentView)
self.accessoryImageRight.image = Theme.current.dragDropImage()
tile.status = status
UIView.animate(withDuration: AppConfiguration.Animations.duration, animations: {
let animationDuration = currentTileStatus != nil ? AppConfiguration.Animations.duration : 0
UIView.animate(withDuration: animationDuration, animations: {
switch status {
case .normal:
self.tileLeftConstraint.constant = 0
......@@ -36,6 +39,7 @@ class IPTileCollectionViewCell: UICollectionViewCell, TileableCell {
self.setupVisibilityButton()
}
self.layoutIfNeeded()
self.currentTileStatus = status
})
}
......
......@@ -21,8 +21,8 @@
<rect key="frame" x="0.0" y="0.0" width="365" height="89"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4bj-c2-OSN">
<rect key="frame" x="25" y="15" width="42" height="20.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4bj-c2-OSN">
<rect key="frame" x="25" y="15" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......
......@@ -19,13 +19,16 @@ class QuickConnectTileCollectionViewCell: UICollectionViewCell, TileableCell {
@IBOutlet private weak var accessoryButtonLeft: UIButton!
@IBOutlet weak var tileLeftConstraint: NSLayoutConstraint!
@IBOutlet weak var tileRightConstraint: NSLayoutConstraint!
private var currentTileStatus: TileStatus?
func setupCellForStatus(_ status: TileStatus) {
Theme.current.applySolidLightBackground(self)
Theme.current.applySolidLightBackground(self.contentView)
self.accessoryImageRight.image = Theme.current.dragDropImage()
tile.status = status
UIView.animate(withDuration: AppConfiguration.Animations.duration, animations: {
let animationDuration = currentTileStatus != nil ? AppConfiguration.Animations.duration : 0
UIView.animate(withDuration: animationDuration, animations: {
switch status {
case .normal:
self.tileLeftConstraint.constant = 0
......@@ -36,6 +39,7 @@ class QuickConnectTileCollectionViewCell: UICollectionViewCell, TileableCell {
self.setupVisibilityButton()
}
self.layoutIfNeeded()
self.currentTileStatus = status
})
}
......
......@@ -28,14 +28,14 @@
<constraint firstAttribute="width" secondItem="Dez-a8-UVo" secondAttribute="height" multiplier="403:202" id="smP-Nh-qbj"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lOm-Af-4Gm">
<rect key="frame" x="25" y="15" width="42" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lOm-Af-4Gm">
<rect key="frame" x="25" y="15" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3Z-eW-74s">
<rect key="frame" x="25" y="40" width="42" height="20.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h3Z-eW-74s">
<rect key="frame" x="25" y="19" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......
......@@ -17,9 +17,10 @@ class RegionTileCollectionViewCell: UICollectionViewCell, TileableCell {
@IBOutlet private weak var tile: Entity!
@IBOutlet private weak var accessoryImageRight: UIImageView!
@IBOutlet private weak var accessoryButtonLeft: UIButton!
@IBOutlet weak var tileLeftConstraint: NSLayoutConstraint!
private var currentTileStatus: TileStatus?
func hasDetailView() -> Bool {
return tile.hasDetailView()
}
......@@ -32,7 +33,8 @@ class RegionTileCollectionViewCell: UICollectionViewCell, TileableCell {
Theme.current.applySolidLightBackground(self)
Theme.current.applySolidLightBackground(self.contentView)
tile.status = status
UIView.animate(withDuration: AppConfiguration.Animations.duration, animations: {
let animationDuration = currentTileStatus != nil ? AppConfiguration.Animations.duration : 0
UIView.animate(withDuration: animationDuration, animations: {
switch status {
case .normal:
self.accessoryImageRight.image = Asset.Piax.Tiles.openTileDetails.image
......@@ -43,6 +45,7 @@ class RegionTileCollectionViewCell: UICollectionViewCell, TileableCell {
self.setupVisibilityButton()
}
self.layoutIfNeeded()
self.currentTileStatus = status
})
}
......
......@@ -21,14 +21,14 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="89"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cIz-i0-fhA">
<rect key="frame" x="25" y="25" width="325" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cIz-i0-fhA">
<rect key="frame" x="25" y="25" width="325" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kcM-dW-3t2">
<rect key="frame" x="25" y="43" width="325" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kcM-dW-3t2">
<rect key="frame" x="25" y="64" width="325" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......
......@@ -20,12 +20,15 @@ class SubscriptionTileCollectionViewCell: UICollectionViewCell, TileableCell {
@IBOutlet weak var tileLeftConstraint: NSLayoutConstraint!
@IBOutlet weak var tileRightConstraint: NSLayoutConstraint!
private var currentTileStatus: TileStatus?
func setupCellForStatus(_ status: TileStatus) {
Theme.current.applySolidLightBackground(self)
Theme.current.applySolidLightBackground(self.contentView)
self.accessoryImageRight.image = Theme.current.dragDropImage()
tile.status = status
UIView.animate(withDuration: AppConfiguration.Animations.duration, animations: {
let animationDuration = currentTileStatus != nil ? AppConfiguration.Animations.duration : 0
UIView.animate(withDuration: animationDuration, animations: {
switch status {
case .normal:
self.tileLeftConstraint.constant = 0
......@@ -36,6 +39,7 @@ class SubscriptionTileCollectionViewCell: UICollectionViewCell, TileableCell {
self.setupVisibilityButton()
}
self.layoutIfNeeded()
self.currentTileStatus = status
})
}
......
......@@ -24,29 +24,29 @@
<rect key="frame" x="0.0" y="0.0" width="561" height="286"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="3hN-bp-xD7">
<rect key="frame" x="25" y="15" width="511" height="40.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="3hN-bp-xD7">
<rect key="frame" x="25" y="15" width="511" height="40"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="zjp-da-E8E">
<rect key="frame" x="25" y="55.5" width="511" height="215.5"/>
<rect key="frame" x="25" y="55" width="511" height="216"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TzI-28-dRz">
<rect key="frame" x="0.0" y="0.0" width="255.5" height="215.5"/>
<rect key="frame" x="0.0" y="0.0" width="255.5" height="216"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="top" translatesAutoresizingMaskIntoConstraints="NO" id="fQh-jM-Clw">
<rect key="frame" x="0.0" y="0.0" width="255.5" height="215.5"/>
<rect key="frame" x="0.0" y="0.0" width="255.5" height="216"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Bg-0g-wy1">
<rect key="frame" x="0.0" y="0.0" width="42" height="108"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Bg-0g-wy1">
<rect key="frame" x="0.0" y="0.0" width="50" height="108"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jve-MQ-JeE">
<rect key="frame" x="0.0" y="108" width="42" height="107.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jve-MQ-JeE">
<rect key="frame" x="0.0" y="108" width="50" height="108"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
......@@ -63,19 +63,19 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GR6-xe-koy">
<rect key="frame" x="255.5" y="0.0" width="255.5" height="215.5"/>
<rect key="frame" x="255.5" y="0.0" width="255.5" height="216"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="top" translatesAutoresizingMaskIntoConstraints="NO" id="IjI-6a-Lgg">
<rect key="frame" x="0.0" y="0.0" width="255.5" height="215.5"/>