Lock donation controller if no payment method

This commit is contained in:
Davide De Rosa 2019-04-09 11:16:15 +02:00
parent 4ea91f783b
commit 3309fd747f
4 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,7 @@
//
import UIKit
import StoreKit
import MessageUI
import Passepartout_Core
@ -193,6 +194,15 @@ class OrganizerViewController: UITableViewController, TableModelHost {
}
private func donateToDeveloper() {
guard SKPaymentQueue.canMakePayments() else {
let alert = Macros.alert(
L10n.Organizer.Cells.Donate.caption,
L10n.Organizer.Alerts.CannotDonate.message
)
alert.addCancelAction(L10n.Global.ok)
present(alert, animated: true, completion: nil)
return
}
perform(segue: StoryboardSegue.Organizer.donateSegueIdentifier, sender: nil)
}

View File

@ -55,6 +55,7 @@
"organizer.cells.uninstall.caption" = "Remove VPN configuration";
"organizer.alerts.exhausted_providers.message" = "You have created profiles for any available provider.";
"organizer.alerts.add_host.message" = "Open an URL to an .ovpn configuration file from Safari, Mail or another app to set up a host profile.\n\nYou can also import an .ovpn with iTunes File Sharing.";
"organizer.alerts.cannot_donate.message" = "There is no payment method configured on this device.";
"organizer.alerts.delete_vpn_profile.message" = "Do you really want to erase the VPN configuration from your device settings? This may fix some broken VPN states and will not affect your provider and host profiles.";
"wizards.host.cells.title_input.caption" = "Title";

View File

@ -55,6 +55,7 @@
"organizer.cells.uninstall.caption" = "Rimuovi configurazione VPN";
"organizer.alerts.exhausted_providers.message" = "Hai creato profili per tutti i provider disponibili.";
"organizer.alerts.add_host.message" = "Apri l'URL di un file di configurazione .ovpn da Safari, Mail o da un'altra app per configurare un host.\n\nPuoi anche importare un file .ovpn con iTunes File Sharing.";
"organizer.alerts.cannot_donate.message" = "Nessun metodo di pagamento configurato su questo dispositivo.";
"organizer.alerts.delete_vpn_profile.message" = "Vuoi veramente cancellare la configurazione VPN dalle impostazioni del tuo dispositivo? Quest'azione potrebbe risolvere alcuni stati erronei della VPN e non altererà i tuoi provider e i tuoi host.";
"wizards.host.cells.title_input.caption" = "Titolo";

View File

@ -407,6 +407,10 @@ public enum L10n {
/// Open an URL to an .ovpn configuration file from Safari, Mail or another app to set up a host profile.\n\nYou can also import an .ovpn with iTunes File Sharing.
public static let message = L10n.tr("Localizable", "organizer.alerts.add_host.message")
}
public enum CannotDonate {
/// There is no payment method configured on this device.
public static let message = L10n.tr("Localizable", "organizer.alerts.cannot_donate.message")
}
public enum DeleteVpnProfile {
/// Do you really want to erase the VPN configuration from your device settings? This may fix some broken VPN states and will not affect your provider and host profiles.
public static let message = L10n.tr("Localizable", "organizer.alerts.delete_vpn_profile.message")