Add follow on Twitch
This commit is contained in:
parent
ccaf94d606
commit
da6f49dd18
|
@ -639,6 +639,10 @@ internal enum L10n {
|
||||||
/// Make a donation
|
/// Make a donation
|
||||||
internal static let caption = L10n.tr("Core", "organizer.cells.donate.caption")
|
internal static let caption = L10n.tr("Core", "organizer.cells.donate.caption")
|
||||||
}
|
}
|
||||||
|
internal enum FollowTwitch {
|
||||||
|
/// Watch Passepartout on Twitch
|
||||||
|
internal static let caption = L10n.tr("Core", "organizer.cells.follow_twitch.caption")
|
||||||
|
}
|
||||||
internal enum GithubSponsors {
|
internal enum GithubSponsors {
|
||||||
/// Support me on GitHub
|
/// Support me on GitHub
|
||||||
internal static let caption = L10n.tr("Core", "organizer.cells.github_sponsors.caption")
|
internal static let caption = L10n.tr("Core", "organizer.cells.github_sponsors.caption")
|
||||||
|
@ -697,6 +701,12 @@ internal enum L10n {
|
||||||
/// Support
|
/// Support
|
||||||
internal static let header = L10n.tr("Core", "organizer.sections.support.header")
|
internal static let header = L10n.tr("Core", "organizer.sections.support.header")
|
||||||
}
|
}
|
||||||
|
internal enum Twitch {
|
||||||
|
/// Come watch me make Passepartout live on Twitch, join the chat to interact and contribute!
|
||||||
|
internal static let footer = L10n.tr("Core", "organizer.sections.twitch.footer")
|
||||||
|
/// Twitch
|
||||||
|
internal static let header = L10n.tr("Core", "organizer.sections.twitch.header")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal enum ParsedFile {
|
internal enum ParsedFile {
|
||||||
|
|
|
@ -52,6 +52,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
||||||
|
|
||||||
func reloadModel() {
|
func reloadModel() {
|
||||||
model.clear()
|
model.clear()
|
||||||
|
model.add(.twitch)
|
||||||
model.add(.vpn)
|
model.add(.vpn)
|
||||||
model.add(.providers)
|
model.add(.providers)
|
||||||
model.add(.hosts)
|
model.add(.hosts)
|
||||||
|
@ -66,9 +67,11 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
||||||
}
|
}
|
||||||
model.add(.about)
|
model.add(.about)
|
||||||
model.add(.destruction)
|
model.add(.destruction)
|
||||||
|
model.setHeader(L10n.Core.Organizer.Sections.Twitch.header, forSection: .twitch)
|
||||||
model.setHeader(L10n.App.Service.Sections.Vpn.header, forSection: .vpn)
|
model.setHeader(L10n.App.Service.Sections.Vpn.header, forSection: .vpn)
|
||||||
model.setHeader(L10n.Core.Organizer.Sections.Providers.header, forSection: .providers)
|
model.setHeader(L10n.Core.Organizer.Sections.Providers.header, forSection: .providers)
|
||||||
model.setHeader(L10n.Core.Organizer.Sections.Hosts.header, forSection: .hosts)
|
model.setHeader(L10n.Core.Organizer.Sections.Hosts.header, forSection: .hosts)
|
||||||
|
model.setFooter(L10n.Core.Organizer.Sections.Twitch.footer, forSection: .twitch)
|
||||||
model.setFooter(L10n.Core.Organizer.Sections.Providers.footer, forSection: .providers)
|
model.setFooter(L10n.Core.Organizer.Sections.Providers.footer, forSection: .providers)
|
||||||
model.setFooter(L10n.Core.Organizer.Sections.Hosts.footer, forSection: .hosts)
|
model.setFooter(L10n.Core.Organizer.Sections.Hosts.footer, forSection: .hosts)
|
||||||
if #available(iOS 12, *) {
|
if #available(iOS 12, *) {
|
||||||
|
@ -77,6 +80,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
||||||
model.set([.siriShortcuts], forSection: .siri)
|
model.set([.siriShortcuts], forSection: .siri)
|
||||||
}
|
}
|
||||||
model.setHeader(L10n.Core.Organizer.Sections.Support.header, forSection: .support)
|
model.setHeader(L10n.Core.Organizer.Sections.Support.header, forSection: .support)
|
||||||
|
model.set([.followTwitch], forSection: .twitch)
|
||||||
model.set([.connectionStatus], forSection: .vpn)
|
model.set([.connectionStatus], forSection: .vpn)
|
||||||
model.set([.donate, .githubSponsors, .joinCommunity], forSection: .support)
|
model.set([.donate, .githubSponsors, .joinCommunity], forSection: .support)
|
||||||
|
|
||||||
|
@ -135,7 +139,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
||||||
|
|
||||||
if !didShowSubreddit && !TransientStore.didHandleSubreddit {
|
if !didShowSubreddit && !TransientStore.didHandleSubreddit {
|
||||||
didShowSubreddit = true
|
didShowSubreddit = true
|
||||||
|
|
||||||
let alert = UIAlertController.asAlert(L10n.Core.Reddit.title, L10n.Core.Reddit.message)
|
let alert = UIAlertController.asAlert(L10n.Core.Reddit.title, L10n.Core.Reddit.message)
|
||||||
alert.addPreferredAction(L10n.Core.Reddit.Buttons.subscribe) {
|
alert.addPreferredAction(L10n.Core.Reddit.Buttons.subscribe) {
|
||||||
TransientStore.didHandleSubreddit = true
|
TransientStore.didHandleSubreddit = true
|
||||||
|
@ -183,6 +187,10 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Actions
|
// MARK: Actions
|
||||||
|
|
||||||
|
private func followOnTwitch() {
|
||||||
|
UIApplication.shared.open(AppConstants.URLs.twitch, options: [:], completionHandler: nil)
|
||||||
|
}
|
||||||
|
|
||||||
private func enterProfile(_ profile: ConnectionProfile) {
|
private func enterProfile(_ profile: ConnectionProfile) {
|
||||||
perform(segue: StoryboardSegue.Organizer.selectProfileSegueIdentifier, sender: profile)
|
perform(segue: StoryboardSegue.Organizer.selectProfileSegueIdentifier, sender: profile)
|
||||||
|
@ -421,6 +429,8 @@ class OrganizerViewController: UITableViewController, StrongTableHost {
|
||||||
|
|
||||||
extension OrganizerViewController {
|
extension OrganizerViewController {
|
||||||
enum SectionType: Int {
|
enum SectionType: Int {
|
||||||
|
case twitch
|
||||||
|
|
||||||
case vpn
|
case vpn
|
||||||
|
|
||||||
case providers
|
case providers
|
||||||
|
@ -441,6 +451,8 @@ extension OrganizerViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum RowType: Int {
|
enum RowType: Int {
|
||||||
|
case followTwitch
|
||||||
|
|
||||||
case connectionStatus
|
case connectionStatus
|
||||||
|
|
||||||
case profile
|
case profile
|
||||||
|
@ -500,6 +512,12 @@ extension OrganizerViewController {
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
switch model.row(at: indexPath) {
|
switch model.row(at: indexPath) {
|
||||||
|
case .followTwitch:
|
||||||
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
|
cell.applyAction(.current)
|
||||||
|
cell.leftText = L10n.Core.Organizer.Cells.FollowTwitch.caption
|
||||||
|
return cell
|
||||||
|
|
||||||
case .connectionStatus:
|
case .connectionStatus:
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
cell.applyVPN(.current, with: VPN.shared.isEnabled ? VPN.shared.status : nil, error: nil)
|
cell.applyVPN(.current, with: VPN.shared.isEnabled ? VPN.shared.status : nil, error: nil)
|
||||||
|
@ -598,6 +616,9 @@ extension OrganizerViewController {
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||||
switch model.row(at: indexPath) {
|
switch model.row(at: indexPath) {
|
||||||
|
case .followTwitch:
|
||||||
|
followOnTwitch()
|
||||||
|
|
||||||
case .connectionStatus:
|
case .connectionStatus:
|
||||||
enterActiveProfile()
|
enterActiveProfile()
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c8f49a585843b5963a89ebd0fcc10e56f2086574
|
Subproject commit 63b96cb3a33ba940bc5c109e4de3ed239f2f964b
|
Loading…
Reference in New Issue