diff --git a/Passepartout-iOS/Global/SwiftGen+Strings.swift b/Passepartout-iOS/Global/SwiftGen+Strings.swift index 051fead4..90967015 100644 --- a/Passepartout-iOS/Global/SwiftGen+Strings.swift +++ b/Passepartout-iOS/Global/SwiftGen+Strings.swift @@ -639,6 +639,10 @@ internal enum L10n { /// Make a donation 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 { /// Support me on GitHub internal static let caption = L10n.tr("Core", "organizer.cells.github_sponsors.caption") @@ -697,6 +701,12 @@ internal enum L10n { /// Support 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 { diff --git a/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift b/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift index 40dd79a1..0d241a7e 100644 --- a/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift +++ b/Passepartout-iOS/Scenes/Organizer/OrganizerViewController.swift @@ -52,6 +52,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost { func reloadModel() { model.clear() + model.add(.twitch) model.add(.vpn) model.add(.providers) model.add(.hosts) @@ -66,9 +67,11 @@ class OrganizerViewController: UITableViewController, StrongTableHost { } model.add(.about) 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.Core.Organizer.Sections.Providers.header, forSection: .providers) 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.Hosts.footer, forSection: .hosts) if #available(iOS 12, *) { @@ -77,6 +80,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost { model.set([.siriShortcuts], forSection: .siri) } model.setHeader(L10n.Core.Organizer.Sections.Support.header, forSection: .support) + model.set([.followTwitch], forSection: .twitch) model.set([.connectionStatus], forSection: .vpn) model.set([.donate, .githubSponsors, .joinCommunity], forSection: .support) @@ -135,7 +139,7 @@ class OrganizerViewController: UITableViewController, StrongTableHost { if !didShowSubreddit && !TransientStore.didHandleSubreddit { didShowSubreddit = true - + let alert = UIAlertController.asAlert(L10n.Core.Reddit.title, L10n.Core.Reddit.message) alert.addPreferredAction(L10n.Core.Reddit.Buttons.subscribe) { TransientStore.didHandleSubreddit = true @@ -183,6 +187,10 @@ class OrganizerViewController: UITableViewController, StrongTableHost { } // MARK: Actions + + private func followOnTwitch() { + UIApplication.shared.open(AppConstants.URLs.twitch, options: [:], completionHandler: nil) + } private func enterProfile(_ profile: ConnectionProfile) { perform(segue: StoryboardSegue.Organizer.selectProfileSegueIdentifier, sender: profile) @@ -421,6 +429,8 @@ class OrganizerViewController: UITableViewController, StrongTableHost { extension OrganizerViewController { enum SectionType: Int { + case twitch + case vpn case providers @@ -441,6 +451,8 @@ extension OrganizerViewController { } enum RowType: Int { + case followTwitch + case connectionStatus case profile @@ -500,6 +512,12 @@ extension OrganizerViewController { override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 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: let cell = Cells.setting.dequeue(from: tableView, for: indexPath) 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) { switch model.row(at: indexPath) { + case .followTwitch: + followOnTwitch() + case .connectionStatus: enterActiveProfile() diff --git a/Submodules/Core b/Submodules/Core index c8f49a58..63b96cb3 160000 --- a/Submodules/Core +++ b/Submodules/Core @@ -1 +1 @@ -Subproject commit c8f49a585843b5963a89ebd0fcc10e56f2086574 +Subproject commit 63b96cb3a33ba940bc5c109e4de3ed239f2f964b