diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 090c9f8e..a67b1764 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -208,6 +208,7 @@ BFF0B69023219C6D007A79E1 /* PatreonComponents.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF0B68F23219C6D007A79E1 /* PatreonComponents.swift */; }; BFF0B6922321A305007A79E1 /* AboutPatreonHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BFF0B6912321A305007A79E1 /* AboutPatreonHeaderView.xib */; }; BFF0B6942321CB85007A79E1 /* AuthenticationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF0B6932321CB85007A79E1 /* AuthenticationViewController.swift */; }; + BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF0B695232242D3007A79E1 /* LicensesViewController.swift */; }; BFF0B6982322CAB8007A79E1 /* InstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF0B6972322CAB8007A79E1 /* InstructionsViewController.swift */; }; BFF0B69A2322D7D0007A79E1 /* UIScreen+CompactHeight.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF0B6992322D7D0007A79E1 /* UIScreen+CompactHeight.swift */; }; DBAC68F8EC03F4A41D62EDE1 /* Pods_AltStore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1039C07E517311FC499A0B64 /* Pods_AltStore.framework */; }; @@ -486,6 +487,7 @@ BFF0B68F23219C6D007A79E1 /* PatreonComponents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatreonComponents.swift; sourceTree = ""; }; BFF0B6912321A305007A79E1 /* AboutPatreonHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AboutPatreonHeaderView.xib; sourceTree = ""; }; BFF0B6932321CB85007A79E1 /* AuthenticationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticationViewController.swift; sourceTree = ""; }; + BFF0B695232242D3007A79E1 /* LicensesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicensesViewController.swift; sourceTree = ""; }; BFF0B6972322CAB8007A79E1 /* InstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstructionsViewController.swift; sourceTree = ""; }; BFF0B6992322D7D0007A79E1 /* UIScreen+CompactHeight.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScreen+CompactHeight.swift"; sourceTree = ""; }; EA79A60285C6AF5848AA16E9 /* Pods-AltStore.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AltStore.debug.xcconfig"; path = "Target Support Files/Pods-AltStore/Pods-AltStore.debug.xcconfig"; sourceTree = ""; }; @@ -979,6 +981,7 @@ BFF0B68D23219520007A79E1 /* PatreonViewController.swift */, BFF0B68F23219C6D007A79E1 /* PatreonComponents.swift */, BFF0B6912321A305007A79E1 /* AboutPatreonHeaderView.xib */, + BFF0B695232242D3007A79E1 /* LicensesViewController.swift */, ); path = Settings; sourceTree = ""; @@ -1448,6 +1451,7 @@ BF02419622F2199300129732 /* RefreshAttemptsViewController.swift in Sources */, BF08858322DE795100DE9F1E /* MyAppsViewController.swift in Sources */, BF9ABA4F22DD41A9008935CF /* UIColor+Hex.swift in Sources */, + BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */, BFD52BD422A0800A000B7ED1 /* ServerManager.swift in Sources */, BFDB6A0822AAED73007EA6D6 /* ResignAppOperation.swift in Sources */, BF3D64A222E8031100E9056B /* MergePolicy.swift in Sources */, diff --git a/AltStore/Resources/Assets.xcassets/Riley.imageset/Contents.json b/AltStore/Resources/Assets.xcassets/Riley.imageset/Contents.json new file mode 100644 index 00000000..4461513d --- /dev/null +++ b/AltStore/Resources/Assets.xcassets/Riley.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "Riles πŸ€·β€β™‚οΈ.jpg" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/AltStore/Resources/Assets.xcassets/Riley.imageset/Riles πŸ€·β€β™‚οΈ.jpg b/AltStore/Resources/Assets.xcassets/Riley.imageset/Riles πŸ€·β€β™‚οΈ.jpg new file mode 100644 index 00000000..325b7df2 Binary files /dev/null and b/AltStore/Resources/Assets.xcassets/Riley.imageset/Riles πŸ€·β€β™‚οΈ.jpg differ diff --git a/AltStore/Settings/AboutPatreonHeaderView.xib b/AltStore/Settings/AboutPatreonHeaderView.xib index 5f2954e5..09227294 100644 --- a/AltStore/Settings/AboutPatreonHeaderView.xib +++ b/AltStore/Settings/AboutPatreonHeaderView.xib @@ -13,52 +13,110 @@ - + - - + + - - + + + + + + + + + + + + + - - - - + + + + + + + - - + + + diff --git a/AltStore/Settings/LicensesViewController.swift b/AltStore/Settings/LicensesViewController.swift new file mode 100644 index 00000000..748343c3 --- /dev/null +++ b/AltStore/Settings/LicensesViewController.swift @@ -0,0 +1,49 @@ +// +// LicensesViewController.swift +// AltStore +// +// Created by Riley Testut on 9/6/19. +// Copyright Β© 2019 Riley Testut. All rights reserved. +// + +import UIKit + +class LicensesViewController: UIViewController +{ + private var _didAppear = false + + @IBOutlet private var textView: UITextView! + + override func viewWillAppear(_ animated: Bool) + { + super.viewWillAppear(animated) + + self.view.setNeedsLayout() + self.view.layoutIfNeeded() + + // Fix incorrect initial offset on iPhone SE. + self.textView.contentOffset.y = 0 + } + + override func viewDidAppear(_ animated: Bool) + { + super.viewDidAppear(animated) + + _didAppear = true + } + + override func viewDidLayoutSubviews() + { + super.viewDidLayoutSubviews() + + self.textView.textContainerInset.left = self.view.layoutMargins.left + self.textView.textContainerInset.right = self.view.layoutMargins.right + self.textView.textContainer.lineFragmentPadding = 0 + + if !_didAppear + { + // Fix incorrect initial offset on iPhone SE. + self.textView.contentOffset.y = 0 + } + } +} diff --git a/AltStore/Settings/PatreonComponents.swift b/AltStore/Settings/PatreonComponents.swift index 2bfc60fb..af91ee5e 100644 --- a/AltStore/Settings/PatreonComponents.swift +++ b/AltStore/Settings/PatreonComponents.swift @@ -56,13 +56,34 @@ class PatronsFooterView: UICollectionReusableView class AboutPatreonHeaderView: UICollectionReusableView { @IBOutlet var supportButton: UIButton! + @IBOutlet var accountButton: UIButton! + @IBOutlet var textView: UITextView! + + @IBOutlet private var imageView: UIImageView! override func awakeFromNib() { super.awakeFromNib() - self.supportButton.clipsToBounds = true - self.supportButton.layer.cornerRadius = 16 + self.imageView.clipsToBounds = true + self.imageView.layer.cornerRadius = self.imageView.bounds.midY + + self.textView.clipsToBounds = true + self.textView.layer.cornerRadius = 20 + self.textView.textContainer.lineFragmentPadding = 0 + + for button in [self.supportButton!, self.accountButton!] + { + button.clipsToBounds = true + button.layer.cornerRadius = 16 + } + } + + override func layoutMarginsDidChange() + { + super.layoutMarginsDidChange() + + self.textView.textContainerInset = UIEdgeInsets(top: self.layoutMargins.left, left: self.layoutMargins.left, bottom: self.layoutMargins.right, right: self.layoutMargins.right) } } diff --git a/AltStore/Settings/PatreonViewController.swift b/AltStore/Settings/PatreonViewController.swift index a569dc8b..77cae53e 100644 --- a/AltStore/Settings/PatreonViewController.swift +++ b/AltStore/Settings/PatreonViewController.swift @@ -30,9 +30,6 @@ class PatreonViewController: UICollectionViewController private var patronsResult: Result<[Patron], Error>? - @IBOutlet private var signInButton: UIBarButtonItem! - @IBOutlet private var signOutButton: UIBarButtonItem! - override func viewDidLoad() { super.viewDidLoad() @@ -97,13 +94,58 @@ private extension PatreonViewController func update() { - if PatreonAPI.shared.isAuthenticated && DatabaseManager.shared.patreonAccount() != nil + self.collectionView.reloadData() + } + + func prepare(_ headerView: AboutPatreonHeaderView) + { + headerView.layoutMargins = self.view.layoutMargins + + headerView.supportButton.addTarget(self, action: #selector(PatreonViewController.openPatreonURL(_:)), for: .primaryActionTriggered) + headerView.accountButton.removeTarget(self, action: nil, for: .primaryActionTriggered) + + if let account = DatabaseManager.shared.patreonAccount(), PatreonAPI.shared.isAuthenticated { - self.navigationItem.rightBarButtonItem = self.signOutButton + headerView.accountButton.addTarget(self, action: #selector(PatreonViewController.signOut(_:)), for: .primaryActionTriggered) + + headerView.supportButton.setTitle(NSLocalizedString("View Patreon", comment: ""), for: .normal) + headerView.accountButton.setTitle(String(format: NSLocalizedString("Unlink %@", comment: ""), account.name), for: .normal) + + let text = """ + Hey , + + You’re the best. Your account was linked successfully, so you now have access to the beta versions of all of my apps. You can find them all in the Browse tab. + + Thanks for all of your support. Enjoy! + Riley + """ + + let font = UIFont.systemFont(ofSize: 16) + + let attributedText = NSMutableAttributedString(string: text, attributes: [.font: font, + .foregroundColor: UIColor.white]) + + let boldedName = NSAttributedString(string: account.firstName ?? account.name, attributes: [.font: UIFont.boldSystemFont(ofSize: font.pointSize), + .foregroundColor: UIColor.white]) + attributedText.insert(boldedName, at: 4) + + headerView.textView.attributedText = attributedText } else { - self.navigationItem.rightBarButtonItem = self.signInButton + headerView.accountButton.addTarget(self, action: #selector(PatreonViewController.authenticate(_:)), for: .primaryActionTriggered) + + headerView.supportButton.setTitle(NSLocalizedString("Become a patron", comment: ""), for: .normal) + headerView.accountButton.setTitle(NSLocalizedString("Link Patreon account", comment: ""), for: .normal) + + headerView.textView.text = """ + Hey y'all, + + If you'd like to support my work, you can donate here. In return, you'll gain access to beta versions of all of my apps and be among the first to try the latest features. + + Thanks for all your support πŸ’œ + Riley + """ } } } @@ -197,8 +239,8 @@ private extension PatreonViewController } } - let alertController = UIAlertController(title: NSLocalizedString("Are you sure you want to sign out?", comment: ""), message: NSLocalizedString("You will no longer have access to beta versions of apps once you sign out.", comment: ""), preferredStyle: .actionSheet) - alertController.addAction(UIAlertAction(title: NSLocalizedString("Sign Out", comment: ""), style: .destructive) { _ in signOut() }) + let alertController = UIAlertController(title: NSLocalizedString("Are you sure you want to unlink your Patreon account?", comment: ""), message: NSLocalizedString("You will no longer have access to beta versions of apps.", comment: ""), preferredStyle: .actionSheet) + alertController.addAction(UIAlertAction(title: NSLocalizedString("Unlink Patreon Account", comment: ""), style: .destructive) { _ in signOut() }) alertController.addAction(.cancel) self.present(alertController, animated: true, completion: nil) } @@ -213,7 +255,7 @@ extension PatreonViewController { case .about: let headerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "AboutHeader", for: indexPath) as! AboutPatreonHeaderView - headerView.supportButton.addTarget(self, action: #selector(PatreonViewController.openPatreonURL(_:)), for: .primaryActionTriggered) + self.prepare(headerView) return headerView case .patrons: @@ -255,6 +297,8 @@ extension PatreonViewController: UICollectionViewDelegateFlowLayout NSLayoutConstraint.activate([widthConstraint]) defer { NSLayoutConstraint.deactivate([widthConstraint]) } + self.prepare(self.prototypeAboutHeader) + let size = self.prototypeAboutHeader.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize) return size diff --git a/AltStore/Settings/Settings.storyboard b/AltStore/Settings/Settings.storyboard index e37d5533..90304225 100644 --- a/AltStore/Settings/Settings.storyboard +++ b/AltStore/Settings/Settings.storyboard @@ -7,6 +7,7 @@ + @@ -14,10 +15,10 @@ - + - + @@ -39,7 +40,7 @@ - + @@ -76,7 +77,7 @@ - + @@ -108,7 +109,7 @@ - + @@ -140,7 +141,7 @@ - + @@ -177,7 +178,7 @@ - + @@ -220,7 +221,7 @@ - + @@ -231,10 +232,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -257,7 +426,7 @@ - + @@ -299,9 +468,14 @@ - - + + + + + + + @@ -382,16 +556,118 @@ - + + + + + + + + + + + + + + Jay Freeman (ldid) +Copyright (C) 2007-2012 Jay Freeman (saurik) + +libimobiledevice +Β© 2007-2015 by the contributors of libimobiledevice - All rights reserved. + +Gilles Vollant (minizip) +Copyright (C) 1998-2005 Gilles Vollant + +Kishikawa Katsumi (KeychainAccess) +Copyright (c) 2014 kishikawa katsumi +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Alexander Grebenyuk (Nuke) +Copyright (c) 2015-2019 Alexander Grebenyuk +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +The OpenSSL Project (OpenSSL) +Copyright (c) 1998-2019 The OpenSSL Project. All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software must display the following acknowledgment: "This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)" +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact openssl-core@openssl.org. +5. Products derived from this software may not be called "OpenSSL" nor may "OpenSSL" appear in their names without prior written permission of the OpenSSL Project. +6. Redistributions of any form whatsoever must retain the following acknowledgment: +"This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/)" +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +This product includes cryptographic software written by Eric Young (eay@cryptsoft.com). This product includes software written by Tim Hudson (tjh@cryptsoft.com). + +Eric Young (SSLeay) +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) +All rights reserved. +This package is an SSL implementation written by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. This library is free for commercial and non-commercial use as long as the following conditions are aheared to. The following conditions apply to all code found in this distribution, be it the RC4, RSA, lhash, DES, etc., code; not just the SSL code. The SSL documentation included with this distribution is covered by the same copyright terms except that the holder is Tim Hudson (tjh@cryptsoft.com). +Copyright remains Eric Young's, and as such any Copyright notices in the code are not to be removed. If this package is used in a product, Eric Young should be given attribution as the author of the parts of the library used. This can be in the form of a textual message at program startup or in documentation (online or textual) provided with the package. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software must display the following acknowledgement: +"This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)" +The word 'cryptographic' can be left out if the rouines from the library being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from the apps directory (application code) you must include an acknowledgement: +"This product includes software written by Tim Hudson (tjh@cryptsoft.com)" THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +The licence and distribution terms for any publically available version or derivative of this code cannot be changed. i.e. this code cannot simply be copied and put under another distribution licence [including the GNU Public Licence.] + +Toni Ronkko (dirent) +Copyright (c) 1998-2019 Toni Ronkko +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Microsoft Corporation (C++ REST SDK) +Copyright (c) Microsoft Corporation +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Kutuzov Viktor (mman-win32) +Copyright (c) Kutuzov Viktor +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -431,34 +707,26 @@ - - - - - - - - - - - + - - - - - - - + + + + + + + + + - - + + diff --git a/AltStore/Settings/SettingsViewController.swift b/AltStore/Settings/SettingsViewController.swift index 27702476..dc2d4874 100644 --- a/AltStore/Settings/SettingsViewController.swift +++ b/AltStore/Settings/SettingsViewController.swift @@ -7,6 +7,7 @@ // import UIKit +import SafariServices extension SettingsViewController { @@ -16,8 +17,17 @@ extension SettingsViewController case account case patreon case backgroundRefresh + case instructions + case credits case debug } + + fileprivate enum CreditsRow: Int, CaseIterable + { + case developer + case designer + case softwareLicenses + } } class SettingsViewController: UITableViewController @@ -43,6 +53,13 @@ class SettingsViewController: UITableViewController self.update() } + + override func viewWillAppear(_ animated: Bool) + { + super.viewWillAppear(animated) + + self.update() + } } private extension SettingsViewController @@ -103,6 +120,12 @@ private extension SettingsViewController case .backgroundRefresh: settingsHeaderFooterView.secondaryLabel.text = NSLocalizedString("Automatically refresh apps in the background when connected to the same WiFi as AltServer.", comment: "") + case .instructions: + break + + case .credits: + settingsHeaderFooterView.primaryLabel.text = NSLocalizedString("CREDITS", comment: "") + case .debug: settingsHeaderFooterView.primaryLabel.text = NSLocalizedString("DEBUG", comment: "") } @@ -182,12 +205,12 @@ extension SettingsViewController case .signIn where self.activeTeam != nil: return nil case .account where self.activeTeam == nil: return nil - case .signIn, .account, .debug: + case .signIn, .account, .credits, .debug: let headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "HeaderFooterView") as! SettingsHeaderFooterView self.prepare(headerView, for: section, isHeader: true) return headerView - default: return nil + case .patreon, .backgroundRefresh, .instructions: return nil } } @@ -203,7 +226,7 @@ extension SettingsViewController self.prepare(footerView, for: section, isHeader: false) return footerView - default: return nil + case .account, .credits, .debug, .instructions: return nil } } @@ -215,11 +238,11 @@ extension SettingsViewController case .signIn where self.activeTeam != nil: return 1.0 case .account where self.activeTeam == nil: return 1.0 - case .signIn, .account, .debug: + case .signIn, .account, .credits, .debug: let height = self.preferredHeight(for: self.prototypeHeaderFooterView, in: section, isHeader: true) return height - default: return 0.0 + case .patreon, .backgroundRefresh, .instructions: return 0.0 } } @@ -235,7 +258,7 @@ extension SettingsViewController let height = self.preferredHeight(for: self.prototypeHeaderFooterView, in: section, isHeader: false) return height - default: return 0.0 + case .account, .credits, .debug, .instructions: return 0.0 } } } @@ -248,6 +271,25 @@ extension SettingsViewController switch section { case .signIn: self.signIn() + case .instructions: break + case .credits: + let row = CreditsRow.allCases[indexPath.row] + switch row + { + case .developer: + let safariViewController = SFSafariViewController(url: URL(string: "https://twitter.com/rileytestut")!) + safariViewController.preferredControlTintColor = .altRed + self.present(safariViewController, animated: true, completion: nil) + + case .designer: + let safariViewController = SFSafariViewController(url: URL(string: "https://twitter.com/1carolinemoore")!) + safariViewController.preferredControlTintColor = .altRed + self.present(safariViewController, animated: true, completion: nil) + + case .softwareLicenses: + break + } + default: break } }