Reuse Credits from Convenience
This commit is contained in:
parent
fa93e664f3
commit
70783f9dda
|
@ -1,60 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="a3d-vD-Pr7">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="a3d-vD-Pr7">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="iOS"/>
|
<deployment identifier="iOS"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15509"/>
|
||||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<scenes>
|
<scenes>
|
||||||
<!--Credits View Controller-->
|
|
||||||
<scene sceneID="fCJ-0P-4HO">
|
|
||||||
<objects>
|
|
||||||
<tableViewController id="duu-Yq-oor" customClass="CreditsViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
|
|
||||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" id="f7p-SX-zRm">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
|
|
||||||
<prototypes>
|
|
||||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="SettingTableViewCell" textLabel="Cs5-Oz-lZ4" detailTextLabel="6AN-wh-sIr" style="IBUITableViewCellStyleValue1" id="jQu-e3-15s" customClass="SettingTableViewCell" customModule="Passepartout" customModuleProvider="target">
|
|
||||||
<rect key="frame" x="0.0" y="55.5" width="414" height="43.5"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="jQu-e3-15s" id="1nY-NX-ZWl">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="382.5" height="43.5"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<subviews>
|
|
||||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Cs5-Oz-lZ4">
|
|
||||||
<rect key="frame" x="20" y="12" width="33.5" height="20.5"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
||||||
<nil key="textColor"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Detail" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="6AN-wh-sIr">
|
|
||||||
<rect key="frame" x="330.5" y="12" width="44" height="20.5"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
||||||
<nil key="textColor"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
</subviews>
|
|
||||||
</tableViewCellContentView>
|
|
||||||
<connections>
|
|
||||||
<segue destination="2d7-Ad-AZr" kind="show" id="cPN-1o-GoM"/>
|
|
||||||
</connections>
|
|
||||||
</tableViewCell>
|
|
||||||
</prototypes>
|
|
||||||
<connections>
|
|
||||||
<outlet property="dataSource" destination="duu-Yq-oor" id="KEN-j6-9Eb"/>
|
|
||||||
<outlet property="delegate" destination="duu-Yq-oor" id="FR8-fY-ppd"/>
|
|
||||||
</connections>
|
|
||||||
</tableView>
|
|
||||||
</tableViewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="A5e-dW-BFv" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="-2552" y="-1544"/>
|
|
||||||
</scene>
|
|
||||||
<!--Navigation Controller-->
|
<!--Navigation Controller-->
|
||||||
<scene sceneID="bMd-7b-j9C">
|
<scene sceneID="bMd-7b-j9C">
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -117,87 +69,10 @@
|
||||||
</connections>
|
</connections>
|
||||||
</barButtonItem>
|
</barButtonItem>
|
||||||
</navigationItem>
|
</navigationItem>
|
||||||
<connections>
|
|
||||||
<segue destination="duu-Yq-oor" kind="show" identifier="CreditsSegueIdentifier" id="8oK-Gy-3Vg"/>
|
|
||||||
</connections>
|
|
||||||
</tableViewController>
|
</tableViewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="AnH-Vt-JJn" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="AnH-Vt-JJn" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="-3478" y="-2247"/>
|
<point key="canvasLocation" x="-3478" y="-2247"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Label View Controller-->
|
|
||||||
<scene sceneID="1v7-O6-Ddh">
|
|
||||||
<objects>
|
|
||||||
<viewController id="2d7-Ad-AZr" customClass="LabelViewController" customModule="Passepartout" customModuleProvider="target" sceneMemberID="viewController">
|
|
||||||
<view key="view" contentMode="scaleToFill" id="e1G-CS-7AH">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
|
||||||
<subviews>
|
|
||||||
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6iI-GI-SMq">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
|
||||||
<subviews>
|
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qme-Hw-Egq">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="78"/>
|
|
||||||
<subviews>
|
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UkA-Yl-a47">
|
|
||||||
<rect key="frame" x="23" y="30" width="368" height="18"/>
|
|
||||||
<subviews>
|
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="<label>" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KWp-cG-SuG">
|
|
||||||
<rect key="frame" x="0.0" y="0.0" width="368" height="18"/>
|
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
|
||||||
<nil key="textColor"/>
|
|
||||||
<nil key="highlightedColor"/>
|
|
||||||
</label>
|
|
||||||
</subviews>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="KWp-cG-SuG" firstAttribute="leading" secondItem="UkA-Yl-a47" secondAttribute="leading" id="Ail-Dw-eRH"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="KWp-cG-SuG" secondAttribute="bottom" id="PUx-et-0i2"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="KWp-cG-SuG" secondAttribute="trailing" id="c5g-Os-X0q"/>
|
|
||||||
<constraint firstItem="KWp-cG-SuG" firstAttribute="top" secondItem="UkA-Yl-a47" secondAttribute="top" id="i8Q-LU-n9f"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
|
||||||
</subviews>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="UkA-Yl-a47" firstAttribute="top" secondItem="Qme-Hw-Egq" secondAttribute="top" constant="30" id="1SG-jG-FaL"/>
|
|
||||||
<constraint firstItem="UkA-Yl-a47" firstAttribute="leading" secondItem="Qme-Hw-Egq" secondAttribute="leadingMargin" constant="15" id="94s-Tx-w6b"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="UkA-Yl-a47" secondAttribute="bottom" constant="30" id="fTE-5j-vZb"/>
|
|
||||||
<constraint firstAttribute="trailingMargin" secondItem="UkA-Yl-a47" secondAttribute="trailing" constant="15" id="v1z-AF-PXL"/>
|
|
||||||
</constraints>
|
|
||||||
</view>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="Qme-Hw-Egq" firstAttribute="leading" secondItem="6iI-GI-SMq" secondAttribute="leading" id="8sL-sx-VDd"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="Qme-Hw-Egq" secondAttribute="trailing" id="D6C-fc-tRa"/>
|
|
||||||
<constraint firstItem="Qme-Hw-Egq" firstAttribute="top" secondItem="6iI-GI-SMq" secondAttribute="top" id="hqt-PH-Y32"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="Qme-Hw-Egq" secondAttribute="bottom" id="pv4-CI-T9m"/>
|
|
||||||
<constraint firstItem="Qme-Hw-Egq" firstAttribute="width" secondItem="6iI-GI-SMq" secondAttribute="width" id="urL-Uu-OBn"/>
|
|
||||||
</constraints>
|
|
||||||
</scrollView>
|
|
||||||
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="piQ-gx-2Zm">
|
|
||||||
<rect key="frame" x="197" y="438" width="20" height="20"/>
|
|
||||||
</activityIndicatorView>
|
|
||||||
</subviews>
|
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
|
||||||
<constraints>
|
|
||||||
<constraint firstItem="piQ-gx-2Zm" firstAttribute="centerY" secondItem="e1G-CS-7AH" secondAttribute="centerY" id="2bL-bY-Tq7"/>
|
|
||||||
<constraint firstAttribute="bottom" secondItem="6iI-GI-SMq" secondAttribute="bottom" id="O7t-Z4-Wgz"/>
|
|
||||||
<constraint firstItem="piQ-gx-2Zm" firstAttribute="centerX" secondItem="e1G-CS-7AH" secondAttribute="centerX" id="kec-lV-4be"/>
|
|
||||||
<constraint firstItem="6iI-GI-SMq" firstAttribute="top" secondItem="e1G-CS-7AH" secondAttribute="top" id="moK-Ck-mjj"/>
|
|
||||||
<constraint firstItem="6iI-GI-SMq" firstAttribute="leading" secondItem="e1G-CS-7AH" secondAttribute="leading" id="rLL-Mv-Pet"/>
|
|
||||||
<constraint firstAttribute="trailing" secondItem="6iI-GI-SMq" secondAttribute="trailing" id="smW-RU-D8F"/>
|
|
||||||
</constraints>
|
|
||||||
<viewLayoutGuide key="safeArea" id="skL-cM-vUB"/>
|
|
||||||
</view>
|
|
||||||
<connections>
|
|
||||||
<outlet property="activity" destination="piQ-gx-2Zm" id="4MR-Wt-LPh"/>
|
|
||||||
<outlet property="label" destination="KWp-cG-SuG" id="us3-ss-xAX"/>
|
|
||||||
<outlet property="scrollView" destination="6iI-GI-SMq" id="uWc-do-1WG"/>
|
|
||||||
</connections>
|
|
||||||
</viewController>
|
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Urb-bq-a19" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
||||||
</objects>
|
|
||||||
<point key="canvasLocation" x="-1542" y="-1544"/>
|
|
||||||
</scene>
|
|
||||||
</scenes>
|
</scenes>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -12,9 +12,6 @@ import UIKit
|
||||||
|
|
||||||
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
|
// swiftlint:disable explicit_type_interface identifier_name line_length type_body_length type_name
|
||||||
internal enum StoryboardSegue {
|
internal enum StoryboardSegue {
|
||||||
internal enum About: String, SegueType {
|
|
||||||
case creditsSegueIdentifier = "CreditsSegueIdentifier"
|
|
||||||
}
|
|
||||||
internal enum Main: String, SegueType {
|
internal enum Main: String, SegueType {
|
||||||
case accountSegueIdentifier = "AccountSegueIdentifier"
|
case accountSegueIdentifier = "AccountSegueIdentifier"
|
||||||
case debugLogSegueIdentifier = "DebugLogSegueIdentifier"
|
case debugLogSegueIdentifier = "DebugLogSegueIdentifier"
|
||||||
|
|
|
@ -70,8 +70,16 @@ class AboutViewController: UITableViewController, StrongTableHost {
|
||||||
navigationController?.pushViewController(vc, animated: true)
|
navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func openCredits() {
|
private func showCredits() {
|
||||||
perform(segue: StoryboardSegue.About.creditsSegueIdentifier)
|
let vc = CreditsViewController()
|
||||||
|
vc.title = L10n.Core.Credits.title
|
||||||
|
vc.licensesHeader = L10n.Core.Credits.Sections.Licenses.header
|
||||||
|
vc.noticesHeader = L10n.Core.Credits.Sections.Notices.header
|
||||||
|
vc.translationsHeader = L10n.Core.Credits.Sections.Translations.header
|
||||||
|
vc.software = AppConstants.Credits.software
|
||||||
|
vc.translators = AppConstants.Translations.translators
|
||||||
|
vc.accentColor = Theme.current.palette.accent1
|
||||||
|
navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func inviteFriend(sender: UITableViewCell?) {
|
private func inviteFriend(sender: UITableViewCell?) {
|
||||||
|
@ -188,7 +196,7 @@ extension AboutViewController {
|
||||||
showVersion()
|
showVersion()
|
||||||
|
|
||||||
case .credits:
|
case .credits:
|
||||||
openCredits()
|
showCredits()
|
||||||
|
|
||||||
case .readme:
|
case .readme:
|
||||||
visitURL(AppConstants.URLs.iOS.readme)
|
visitURL(AppConstants.URLs.iOS.readme)
|
||||||
|
|
|
@ -27,122 +27,84 @@ import UIKit
|
||||||
import PassepartoutCore
|
import PassepartoutCore
|
||||||
import Convenience
|
import Convenience
|
||||||
|
|
||||||
class CreditsViewController: UITableViewController, StrongTableHost {
|
//class CreditsViewController: Convenience.CreditsViewController {
|
||||||
private let licenses = AppConstants.License.all
|
// override func viewDidLoad() {
|
||||||
|
// title = L10n.Core.Credits.title
|
||||||
|
// licensesHeader = L10n.Core.Credits.Sections.Licenses.header
|
||||||
|
// noticesHeader = L10n.Core.Credits.Sections.Notices.header
|
||||||
|
// translationsHeader = L10n.Core.Credits.Sections.Translations.header
|
||||||
|
// software = AppConstants.Credits.software
|
||||||
|
// translators = AppConstants.Translations.translators
|
||||||
|
// accentColor = Theme.current.palette.accent1
|
||||||
|
//
|
||||||
|
// super.viewDidLoad()
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
private let notices = AppConstants.Notice.all
|
// override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||||
|
// guard let vc = segue.destination as? LabelViewController else {
|
||||||
private let languages = AppConstants.Translations.authorByLanguage.keys.sorted {
|
// return
|
||||||
return Utils.localizedLanguage($0) < Utils.localizedLanguage($1)
|
// }
|
||||||
}
|
// guard let cell = sender as? SettingTableViewCell, let indexPath = tableView.indexPath(for: cell) else {
|
||||||
|
// return
|
||||||
// MARK: StrongTableHost
|
// }
|
||||||
|
// vc.title = cell.leftText
|
||||||
var model: StrongTableModel<SectionType, RowType> = StrongTableModel()
|
// switch model.row(at: indexPath) {
|
||||||
|
// case .license:
|
||||||
func reloadModel() {
|
// vc.license = licenses[indexPath.row]
|
||||||
model.add(.licenses)
|
//
|
||||||
model.add(.notices)
|
// case .notice:
|
||||||
model.add(.translations)
|
// vc.text = notices[indexPath.row].statement
|
||||||
|
//
|
||||||
model.setHeader(L10n.Core.Credits.Sections.Licenses.header, forSection: .licenses)
|
// default:
|
||||||
model.setHeader(L10n.Core.Credits.Sections.Notices.header, forSection: .notices)
|
// break
|
||||||
model.setHeader(L10n.Core.Credits.Sections.Translations.header, forSection: .translations)
|
// }
|
||||||
|
// }
|
||||||
model.set(.license, count: licenses.count, forSection: .licenses)
|
//}
|
||||||
model.set(.notice, count: notices.count, forSection: .notices)
|
//
|
||||||
model.set(.translation, count: languages.count, forSection: .translations)
|
//extension CreditsViewController {
|
||||||
}
|
// enum SectionType: Int {
|
||||||
|
// case licenses
|
||||||
// MARK: UIViewController
|
//
|
||||||
|
// case notices
|
||||||
override func viewDidLoad() {
|
//
|
||||||
super.viewDidLoad()
|
// case translations
|
||||||
|
// }
|
||||||
title = L10n.Core.Credits.title
|
//
|
||||||
reloadModel()
|
// enum RowType: Int {
|
||||||
}
|
// case license
|
||||||
|
//
|
||||||
override func shouldPerformSegue(withIdentifier identifier: String, sender: Any?) -> Bool {
|
// case notice
|
||||||
guard let cell = sender as? SettingTableViewCell, let indexPath = tableView.indexPath(for: cell) else {
|
//
|
||||||
return false
|
// case translation
|
||||||
}
|
// }
|
||||||
return model.row(at: indexPath) != .translation
|
//
|
||||||
}
|
// override func numberOfSections(in tableView: UITableView) -> Int {
|
||||||
|
// return model.numberOfSections
|
||||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
// }
|
||||||
guard let vc = segue.destination as? LabelViewController else {
|
//
|
||||||
return
|
// override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
||||||
}
|
// return model.header(forSection: section)
|
||||||
guard let cell = sender as? SettingTableViewCell, let indexPath = tableView.indexPath(for: cell) else {
|
// }
|
||||||
return
|
//
|
||||||
}
|
// override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
vc.title = cell.leftText
|
// return model.numberOfRows(forSection: section)
|
||||||
switch model.row(at: indexPath) {
|
// }
|
||||||
case .license:
|
//
|
||||||
vc.license = licenses[indexPath.row]
|
// override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
|
// let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
||||||
case .notice:
|
// switch model.row(at: indexPath) {
|
||||||
vc.text = notices[indexPath.row].statement
|
// case .license:
|
||||||
|
// let obj = licenses[indexPath.row]
|
||||||
default:
|
// cell.leftText = obj.name
|
||||||
break
|
// cell.rightText = obj.type
|
||||||
}
|
//
|
||||||
}
|
// case .notice:
|
||||||
}
|
// let obj = notices[indexPath.row]
|
||||||
|
// cell.leftText = obj.name
|
||||||
extension CreditsViewController {
|
// cell.rightText = nil
|
||||||
enum SectionType: Int {
|
//
|
||||||
case licenses
|
// }
|
||||||
|
// return cell
|
||||||
case notices
|
// }
|
||||||
|
//}
|
||||||
case translations
|
|
||||||
}
|
|
||||||
|
|
||||||
enum RowType: Int {
|
|
||||||
case license
|
|
||||||
|
|
||||||
case notice
|
|
||||||
|
|
||||||
case translation
|
|
||||||
}
|
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
|
||||||
return model.numberOfSections
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
|
|
||||||
return model.header(forSection: section)
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
||||||
return model.numberOfRows(forSection: section)
|
|
||||||
}
|
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
|
||||||
let cell = Cells.setting.dequeue(from: tableView, for: indexPath)
|
|
||||||
switch model.row(at: indexPath) {
|
|
||||||
case .license:
|
|
||||||
let obj = licenses[indexPath.row]
|
|
||||||
cell.leftText = obj.name
|
|
||||||
cell.rightText = obj.type
|
|
||||||
|
|
||||||
case .notice:
|
|
||||||
let obj = notices[indexPath.row]
|
|
||||||
cell.leftText = obj.name
|
|
||||||
cell.rightText = nil
|
|
||||||
|
|
||||||
case .translation:
|
|
||||||
let lang = languages[indexPath.row]
|
|
||||||
guard let author = AppConstants.Translations.authorByLanguage[lang] else {
|
|
||||||
fatalError("Author not found for language \(lang)")
|
|
||||||
}
|
|
||||||
cell.leftText = Utils.localizedLanguage(lang)
|
|
||||||
cell.rightText = author
|
|
||||||
cell.accessoryType = .none
|
|
||||||
cell.isTappable = false
|
|
||||||
}
|
|
||||||
return cell
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
//
|
|
||||||
// LabelViewController.swift
|
|
||||||
// Passepartout-iOS
|
|
||||||
//
|
|
||||||
// Created by Davide De Rosa on 9/26/18.
|
|
||||||
// Copyright (c) 2019 Davide De Rosa. All rights reserved.
|
|
||||||
//
|
|
||||||
// https://github.com/passepartoutvpn
|
|
||||||
//
|
|
||||||
// This file is part of Passepartout.
|
|
||||||
//
|
|
||||||
// Passepartout is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Passepartout is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with Passepartout. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import PassepartoutCore
|
|
||||||
|
|
||||||
class LabelViewController: UIViewController {
|
|
||||||
@IBOutlet private weak var scrollView: UIScrollView?
|
|
||||||
|
|
||||||
@IBOutlet private weak var activity: UIActivityIndicatorView?
|
|
||||||
|
|
||||||
@IBOutlet private weak var label: UILabel?
|
|
||||||
|
|
||||||
var text: String?
|
|
||||||
|
|
||||||
var license: AppConstants.License?
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
activity?.hidesWhenStopped = true
|
|
||||||
activity?.applyAccent(.current)
|
|
||||||
scrollView?.applyPrimaryBackground(.current)
|
|
||||||
label?.applyLight(.current)
|
|
||||||
|
|
||||||
if let license = license {
|
|
||||||
|
|
||||||
// try cache first
|
|
||||||
if let cachedContent = AppConstants.License.cachedContent[license.name] {
|
|
||||||
label?.text = cachedContent
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
label?.text = nil
|
|
||||||
activity?.startAnimating()
|
|
||||||
|
|
||||||
DispatchQueue(label: LabelViewController.description(), qos: .background).async { [weak self] in
|
|
||||||
let content: String
|
|
||||||
let couldFetch: Bool
|
|
||||||
do {
|
|
||||||
content = try String(contentsOf: license.url)
|
|
||||||
couldFetch = true
|
|
||||||
} catch {
|
|
||||||
content = L10n.Core.Label.License.error
|
|
||||||
couldFetch = false
|
|
||||||
}
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
self?.label?.text = content
|
|
||||||
self?.activity?.stopAnimating()
|
|
||||||
|
|
||||||
if couldFetch {
|
|
||||||
AppConstants.License.cachedContent[license.name] = content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
label?.text = text
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -112,9 +112,7 @@
|
||||||
0EF5CF292141F31F004FF1BD /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4FD7ED20D539A0002221FF /* Utils.swift */; };
|
0EF5CF292141F31F004FF1BD /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4FD7ED20D539A0002221FF /* Utils.swift */; };
|
||||||
0EFB901822764689006405E4 /* ProfileNetworkSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFB901722764689006405E4 /* ProfileNetworkSettings.swift */; };
|
0EFB901822764689006405E4 /* ProfileNetworkSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFB901722764689006405E4 /* ProfileNetworkSettings.swift */; };
|
||||||
0EFB901A2276D7F1006405E4 /* NetworkSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFB90192276D7F1006405E4 /* NetworkSettingsViewController.swift */; };
|
0EFB901A2276D7F1006405E4 /* NetworkSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFB90192276D7F1006405E4 /* NetworkSettingsViewController.swift */; };
|
||||||
0EFBFAC121AC464800887A8C /* CreditsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFBFAC021AC464800887A8C /* CreditsViewController.swift */; };
|
|
||||||
0EFD943E215BE10800529B64 /* IssueReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943D215BE10800529B64 /* IssueReporter.swift */; };
|
0EFD943E215BE10800529B64 /* IssueReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943D215BE10800529B64 /* IssueReporter.swift */; };
|
||||||
0EFD9440215BED8E00529B64 /* LabelViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EFD943F215BED8E00529B64 /* LabelViewController.swift */; };
|
|
||||||
577B90392A4798F63461B0B5 /* Pods_Passepartout_iOS_Tunnel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA4CE55A94366C45DDB1E624 /* Pods_Passepartout_iOS_Tunnel.framework */; };
|
577B90392A4798F63461B0B5 /* Pods_Passepartout_iOS_Tunnel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA4CE55A94366C45DDB1E624 /* Pods_Passepartout_iOS_Tunnel.framework */; };
|
||||||
87121F7216E808EE79925040 /* Pods_Passepartout_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D32B24AA7767AB2E7FB6E0F /* Pods_Passepartout_iOS.framework */; };
|
87121F7216E808EE79925040 /* Pods_Passepartout_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6D32B24AA7767AB2E7FB6E0F /* Pods_Passepartout_iOS.framework */; };
|
||||||
91AF81613E19B47C06EBD447 /* Pods_PassepartoutCore_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 276375A4CF0313B033CD8B5A /* Pods_PassepartoutCore_iOS.framework */; };
|
91AF81613E19B47C06EBD447 /* Pods_PassepartoutCore_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 276375A4CF0313B033CD8B5A /* Pods_PassepartoutCore_iOS.framework */; };
|
||||||
|
@ -313,9 +311,7 @@
|
||||||
0EF56BBA2185AC8500B0C8AB /* SwiftGen+Segues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Segues.swift"; sourceTree = "<group>"; };
|
0EF56BBA2185AC8500B0C8AB /* SwiftGen+Segues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "SwiftGen+Segues.swift"; sourceTree = "<group>"; };
|
||||||
0EFB901722764689006405E4 /* ProfileNetworkSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileNetworkSettings.swift; sourceTree = "<group>"; };
|
0EFB901722764689006405E4 /* ProfileNetworkSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileNetworkSettings.swift; sourceTree = "<group>"; };
|
||||||
0EFB90192276D7F1006405E4 /* NetworkSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkSettingsViewController.swift; sourceTree = "<group>"; };
|
0EFB90192276D7F1006405E4 /* NetworkSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkSettingsViewController.swift; sourceTree = "<group>"; };
|
||||||
0EFBFAC021AC464800887A8C /* CreditsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditsViewController.swift; sourceTree = "<group>"; };
|
|
||||||
0EFD943D215BE10800529B64 /* IssueReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueReporter.swift; sourceTree = "<group>"; };
|
0EFD943D215BE10800529B64 /* IssueReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssueReporter.swift; sourceTree = "<group>"; };
|
||||||
0EFD943F215BED8E00529B64 /* LabelViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelViewController.swift; sourceTree = "<group>"; };
|
|
||||||
0FD7B360EE444EF1CDBFDF1C /* Pods-PassepartoutCoreTests-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutCoreTests-iOS.debug.xcconfig"; path = "Target Support Files/Pods-PassepartoutCoreTests-iOS/Pods-PassepartoutCoreTests-iOS.debug.xcconfig"; sourceTree = "<group>"; };
|
0FD7B360EE444EF1CDBFDF1C /* Pods-PassepartoutCoreTests-iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutCoreTests-iOS.debug.xcconfig"; path = "Target Support Files/Pods-PassepartoutCoreTests-iOS/Pods-PassepartoutCoreTests-iOS.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
234D3C887F46AD64480495BB /* Pods-PassepartoutCoreTests-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutCoreTests-iOS.release.xcconfig"; path = "Target Support Files/Pods-PassepartoutCoreTests-iOS/Pods-PassepartoutCoreTests-iOS.release.xcconfig"; sourceTree = "<group>"; };
|
234D3C887F46AD64480495BB /* Pods-PassepartoutCoreTests-iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PassepartoutCoreTests-iOS.release.xcconfig"; path = "Target Support Files/Pods-PassepartoutCoreTests-iOS/Pods-PassepartoutCoreTests-iOS.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
276375A4CF0313B033CD8B5A /* Pods_PassepartoutCore_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PassepartoutCore_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
276375A4CF0313B033CD8B5A /* Pods_PassepartoutCore_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PassepartoutCore_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
@ -377,8 +373,6 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */,
|
0EE3BBB1215ED3A900F30952 /* AboutViewController.swift */,
|
||||||
0EFBFAC021AC464800887A8C /* CreditsViewController.swift */,
|
|
||||||
0EFD943F215BED8E00529B64 /* LabelViewController.swift */,
|
|
||||||
);
|
);
|
||||||
path = About;
|
path = About;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1024,7 +1018,6 @@
|
||||||
0E3419AD2350815E00419E18 /* Product.swift in Sources */,
|
0E3419AD2350815E00419E18 /* Product.swift in Sources */,
|
||||||
0E9CDB6723604AD5006733B4 /* ServerNetworkViewController.swift in Sources */,
|
0E9CDB6723604AD5006733B4 /* ServerNetworkViewController.swift in Sources */,
|
||||||
0E3262D9235EE8DA00B5E470 /* HostImporter.swift in Sources */,
|
0E3262D9235EE8DA00B5E470 /* HostImporter.swift in Sources */,
|
||||||
0EFD9440215BED8E00529B64 /* LabelViewController.swift in Sources */,
|
|
||||||
0ED31C2C20CF2D6F0027975F /* ProviderPoolViewController.swift in Sources */,
|
0ED31C2C20CF2D6F0027975F /* ProviderPoolViewController.swift in Sources */,
|
||||||
0E2B494020FCFF990094784C /* Theme+Titles.swift in Sources */,
|
0E2B494020FCFF990094784C /* Theme+Titles.swift in Sources */,
|
||||||
0E05C5D520D1645F006EE732 /* SettingTableViewCell.swift in Sources */,
|
0E05C5D520D1645F006EE732 /* SettingTableViewCell.swift in Sources */,
|
||||||
|
@ -1032,7 +1025,6 @@
|
||||||
0E89DFCE213EEDFA00741BA1 /* WizardProviderViewController.swift in Sources */,
|
0E89DFCE213EEDFA00741BA1 /* WizardProviderViewController.swift in Sources */,
|
||||||
0E1D72B2213BFFCF00BA1586 /* ProviderPresetViewController.swift in Sources */,
|
0E1D72B2213BFFCF00BA1586 /* ProviderPresetViewController.swift in Sources */,
|
||||||
0E6BE13F20CFBAB300A6DD36 /* DebugLogViewController.swift in Sources */,
|
0E6BE13F20CFBAB300A6DD36 /* DebugLogViewController.swift in Sources */,
|
||||||
0EFBFAC121AC464800887A8C /* CreditsViewController.swift in Sources */,
|
|
||||||
0EFD943E215BE10800529B64 /* IssueReporter.swift in Sources */,
|
0EFD943E215BE10800529B64 /* IssueReporter.swift in Sources */,
|
||||||
0EB60FDA2111136E00AD27F3 /* UITextView+Search.swift in Sources */,
|
0EB60FDA2111136E00AD27F3 /* UITextView+Search.swift in Sources */,
|
||||||
0E3586FE225BD34800509A4D /* ActivityTableViewCell.swift in Sources */,
|
0E3586FE225BD34800509A4D /* ActivityTableViewCell.swift in Sources */,
|
||||||
|
|
2
Podfile
2
Podfile
|
@ -14,7 +14,7 @@ def shared_pods
|
||||||
pod 'SSZipArchive'
|
pod 'SSZipArchive'
|
||||||
|
|
||||||
for spec in ['About', 'Alerts', 'Dialogs', 'InApp', 'Misc', 'Options', 'Persistence', 'Reviewer', 'Tables'] do
|
for spec in ['About', 'Alerts', 'Dialogs', 'InApp', 'Misc', 'Options', 'Persistence', 'Reviewer', 'Tables'] do
|
||||||
pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => '1cc2fea'
|
pod "Convenience/#{spec}", :git => 'https://github.com/keeshux/convenience', :commit => '57d789e'
|
||||||
#pod "Convenience/#{spec}", :path => '../../personal/convenience'
|
#pod "Convenience/#{spec}", :path => '../../personal/convenience'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
24
Podfile.lock
24
Podfile.lock
|
@ -34,15 +34,15 @@ PODS:
|
||||||
- TunnelKit/Core
|
- TunnelKit/Core
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- Convenience/About (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/About (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Alerts (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Alerts (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Dialogs (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Dialogs (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/InApp (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/InApp (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Misc (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Misc (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Options (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Options (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Persistence (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Persistence (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Reviewer (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Reviewer (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `1cc2fea`)
|
- Convenience/Tables (from `https://github.com/keeshux/convenience`, commit `732ee78`)
|
||||||
- Kvitto
|
- Kvitto
|
||||||
- MBProgressHUD
|
- MBProgressHUD
|
||||||
- SSZipArchive
|
- SSZipArchive
|
||||||
|
@ -60,7 +60,7 @@ SPEC REPOS:
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
Convenience:
|
Convenience:
|
||||||
:commit: 1cc2fea
|
:commit: 732ee78
|
||||||
:git: https://github.com/keeshux/convenience
|
:git: https://github.com/keeshux/convenience
|
||||||
TunnelKit:
|
TunnelKit:
|
||||||
:commit: 8b17a13
|
:commit: 8b17a13
|
||||||
|
@ -68,7 +68,7 @@ EXTERNAL SOURCES:
|
||||||
|
|
||||||
CHECKOUT OPTIONS:
|
CHECKOUT OPTIONS:
|
||||||
Convenience:
|
Convenience:
|
||||||
:commit: 1cc2fea
|
:commit: 732ee78
|
||||||
:git: https://github.com/keeshux/convenience
|
:git: https://github.com/keeshux/convenience
|
||||||
TunnelKit:
|
TunnelKit:
|
||||||
:commit: 8b17a13
|
:commit: 8b17a13
|
||||||
|
@ -84,6 +84,6 @@ SPEC CHECKSUMS:
|
||||||
SwiftyBeaver: 3d3e93a12d648bd400b6f2948a7ef128b5b183c7
|
SwiftyBeaver: 3d3e93a12d648bd400b6f2948a7ef128b5b183c7
|
||||||
TunnelKit: 4b70c0d8b6727b407248b4271b7613225f63204b
|
TunnelKit: 4b70c0d8b6727b407248b4271b7613225f63204b
|
||||||
|
|
||||||
PODFILE CHECKSUM: ccf21a2182dc05b22494a2d00f31ec4123ddd658
|
PODFILE CHECKSUM: 981400b93aecbb27e102c23158bec54a9637bf99
|
||||||
|
|
||||||
COCOAPODS: 1.8.4
|
COCOAPODS: 1.8.4
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit beda7086d31d8ebe531ac4f5776aa62bca6838ea
|
Subproject commit 7fa2468fc133696beab0e88103d2ce478d1977b5
|
Loading…
Reference in New Issue