Add button to test app termination

Might help reproducing #19
This commit is contained in:
Davide De Rosa 2019-03-06 17:44:27 +01:00
parent e4ef4a9dbc
commit 9441a31fd1
2 changed files with 25 additions and 0 deletions

View File

@ -52,6 +52,11 @@ class OrganizerViewController: UITableViewController, TableModelHost {
model.setFooter(L10n.Organizer.Sections.Hosts.footer, for: .hosts)
model.set([.openAbout], in: .about)
model.set([.uninstall], in: .destruction)
if AppConstants.Flags.isBeta {
model.add(.test)
model.setHeader("Beta", for: .test)
model.set([.testTermination], in: .test)
}
return model
}()
@ -235,6 +240,10 @@ class OrganizerViewController: UITableViewController, TableModelHost {
private func subscribeSubreddit() {
UIApplication.shared.open(AppConstants.URLs.subreddit, options: [:], completionHandler: nil)
}
private func testTermination() {
exit(0)
}
}
// MARK: -
@ -248,6 +257,8 @@ extension OrganizerViewController {
case about
case destruction
case test
}
enum RowType: Int {
@ -260,6 +271,8 @@ extension OrganizerViewController {
case openAbout
case uninstall
case testTermination
}
private var selectedIndexPath: IndexPath? {
@ -326,6 +339,11 @@ extension OrganizerViewController {
let cell = Cells.destructive.dequeue(from: tableView, for: indexPath)
cell.caption = L10n.Organizer.Cells.Uninstall.caption
return cell
case .testTermination:
let cell = Cells.destructive.dequeue(from: tableView, for: indexPath)
cell.caption = "Terminate app"
return cell
}
}
@ -346,6 +364,9 @@ extension OrganizerViewController {
case .uninstall:
confirmVpnProfileDeletion()
case .testTermination:
testTermination()
}
tableView.deselectRow(at: indexPath, animated: true)
}

View File

@ -28,6 +28,10 @@ import TunnelKit
import SwiftyBeaver
class AppConstants {
class Flags {
static let isBeta = true
}
class Domain {
static let name = "passepartoutvpn.app"
}