Merge branch 'kickstarter-campaign'
This commit is contained in:
commit
f9c5ab7b02
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "kickstarter@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "kickstarter@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -52,6 +52,10 @@ extension AppConstants {
|
|||
VPN.isMockVPN = isMockVPN
|
||||
}
|
||||
}
|
||||
|
||||
static let isShowingKickstarter = true
|
||||
|
||||
static let kickstarterURL = URL(string: "https://www.kickstarter.com/projects/keeshux/passepartout-your-only-multi-provider-vpn-client/")!
|
||||
}
|
||||
|
||||
struct InApp {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
// swiftlint:disable identifier_name line_length nesting type_body_length type_name
|
||||
internal enum Asset {
|
||||
internal enum Assets {
|
||||
internal static let kickstarter = ImageAsset(name: "kickstarter")
|
||||
internal static let logo = ImageAsset(name: "logo")
|
||||
}
|
||||
internal enum Flags {
|
||||
|
|
|
@ -66,6 +66,16 @@ internal enum L10n {
|
|||
/// Add new provider
|
||||
internal static let caption = L10n.tr("App", "organizer.cells.add_provider.caption")
|
||||
}
|
||||
internal enum SupportKickstarter {
|
||||
/// What's coming next?
|
||||
internal static let caption = L10n.tr("App", "organizer.cells.support_kickstarter.caption")
|
||||
}
|
||||
}
|
||||
internal enum Sections {
|
||||
internal enum Kickstarter {
|
||||
/// More on further development of Passepartout.
|
||||
internal static let footer = L10n.tr("App", "organizer.sections.kickstarter.footer")
|
||||
}
|
||||
}
|
||||
}
|
||||
internal enum Provider {
|
||||
|
|
|
@ -69,3 +69,8 @@
|
|||
"purchase.cells.full_version.extra_description" = "- All providers (including future ones)\n%@";
|
||||
"purchase.cells.restore.title" = "Restore purchases";
|
||||
"purchase.cells.restore.description" = "If you bought this app or feature in the past, you can restore your purchases and this screen won't show again.";
|
||||
|
||||
///
|
||||
|
||||
"organizer.sections.kickstarter.footer" = "More on further development of Passepartout.";
|
||||
"organizer.cells.support_kickstarter.caption" = "What's coming next?";
|
||||
|
|
|
@ -47,6 +47,14 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
|||
|
||||
func reloadModel() {
|
||||
model.clear()
|
||||
|
||||
if AppConstants.Flags.isShowingKickstarter {
|
||||
model.add(.kickstarter)
|
||||
model.setHeader("Kickstarter", forSection: .kickstarter)
|
||||
model.setFooter(L10n.App.Organizer.Sections.Kickstarter.footer, forSection: .kickstarter)
|
||||
model.set([.supportKickstarter], forSection: .kickstarter)
|
||||
}
|
||||
|
||||
model.add(.vpn)
|
||||
model.add(.providers)
|
||||
model.add(.hosts)
|
||||
|
@ -107,6 +115,9 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
|||
super.viewDidLoad()
|
||||
|
||||
title = GroupConstants.App.title
|
||||
if AppConstants.Flags.isShowingKickstarter {
|
||||
navigationItem.leftBarButtonItem = UIBarButtonItem(image: Asset.Assets.kickstarter.image, style: .plain, target: self, action: #selector(openKickstarterCampaign))
|
||||
}
|
||||
navigationItem.rightBarButtonItem = editButtonItem
|
||||
Cells.destructive.register(with: tableView)
|
||||
reloadModel()
|
||||
|
@ -330,6 +341,10 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
|||
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
||||
}
|
||||
|
||||
@objc private func openKickstarterCampaign() {
|
||||
UIApplication.shared.open(AppConstants.Flags.kickstarterURL, options: [:], completionHandler: nil)
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
private func testInterfaces() {
|
||||
|
@ -386,6 +401,8 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
|||
|
||||
extension OrganizerViewController {
|
||||
enum SectionType: Int {
|
||||
case kickstarter
|
||||
|
||||
case vpn
|
||||
|
||||
case providers
|
||||
|
@ -406,6 +423,8 @@ extension OrganizerViewController {
|
|||
}
|
||||
|
||||
enum RowType: Int {
|
||||
case supportKickstarter
|
||||
|
||||
case connectionStatus
|
||||
|
||||
case profile
|
||||
|
@ -463,6 +482,12 @@ extension OrganizerViewController {
|
|||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
switch model.row(at: indexPath) {
|
||||
case .supportKickstarter:
|
||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
cell.applyAction(.current)
|
||||
cell.leftText = L10n.App.Organizer.Cells.SupportKickstarter.caption
|
||||
return cell
|
||||
|
||||
case .connectionStatus:
|
||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
cell.applyVPN(.current, with: VPN.shared.isEnabled ? VPN.shared.status : nil, error: nil)
|
||||
|
@ -555,6 +580,9 @@ extension OrganizerViewController {
|
|||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
switch model.row(at: indexPath) {
|
||||
case .supportKickstarter:
|
||||
openKickstarterCampaign()
|
||||
|
||||
case .connectionStatus:
|
||||
enterActiveProfile()
|
||||
|
||||
|
|
|
@ -663,6 +663,10 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||
}
|
||||
}
|
||||
|
||||
private func openKickstarterCampaign() {
|
||||
UIApplication.shared.open(AppConstants.Flags.kickstarterURL, options: [:], completionHandler: nil)
|
||||
}
|
||||
|
||||
// MARK: Notifications
|
||||
|
||||
@objc private func vpnDidUpdate() {
|
||||
|
@ -717,6 +721,8 @@ class ServiceViewController: UIViewController, StrongTableHost {
|
|||
|
||||
extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, ToggleTableViewCellDelegate {
|
||||
enum SectionType {
|
||||
case kickstarter
|
||||
|
||||
case vpn
|
||||
|
||||
case authentication
|
||||
|
@ -741,6 +747,8 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||
}
|
||||
|
||||
enum RowType: Int {
|
||||
case supportKickstarter
|
||||
|
||||
case useProfile
|
||||
|
||||
case vpnService
|
||||
|
@ -858,6 +866,12 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let row = model.row(at: indexPath)
|
||||
switch row {
|
||||
case .supportKickstarter:
|
||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
cell.applyAction(.current)
|
||||
cell.leftText = L10n.App.Organizer.Cells.SupportKickstarter.caption
|
||||
return cell
|
||||
|
||||
case .useProfile:
|
||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||
cell.applyAction(.current)
|
||||
|
@ -1087,6 +1101,9 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||
// true if enters subscreen
|
||||
private func handle(row: RowType, cell: UITableViewCell) -> Bool {
|
||||
switch row {
|
||||
case .supportKickstarter:
|
||||
openKickstarterCampaign()
|
||||
|
||||
case .useProfile:
|
||||
activateProfile()
|
||||
|
||||
|
@ -1196,6 +1213,13 @@ extension ServiceViewController: UITableViewDataSource, UITableViewDelegate, Tog
|
|||
let isActiveProfile = service.isActiveProfile(profile)
|
||||
let isProvider = (profile as? ProviderConnectionProfile) != nil
|
||||
|
||||
if AppConstants.Flags.isShowingKickstarter {
|
||||
model.add(.kickstarter)
|
||||
model.setHeader("Kickstarter", forSection: .kickstarter)
|
||||
model.setFooter(L10n.App.Organizer.Sections.Kickstarter.footer, forSection: .kickstarter)
|
||||
model.set([.supportKickstarter], forSection: .kickstarter)
|
||||
}
|
||||
|
||||
// sections
|
||||
model.add(.vpn)
|
||||
if isProvider {
|
||||
|
|
Loading…
Reference in New Issue