Merge pull request #32 from rileytestut/develop

Updates Delta to 1.1
This commit is contained in:
Riley Testut 2019-10-16 10:43:45 -07:00 committed by GitHub
commit 34afd64ae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 82 additions and 26 deletions

@ -1 +1 @@
Subproject commit 5fd73cc46963b506ec077dfd9f66d7e5d997acfb
Subproject commit bcedcc293badfc9e4f07f3c66f496bf828450874

View File

@ -1320,9 +1320,11 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "Delta/Supporting Files/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DDEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.rileytestut.Delta;
PROVISIONING_PROFILE = "";
@ -1343,9 +1345,11 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 15;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "Delta/Supporting Files/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -DIMPACTOR";
PRODUCT_BUNDLE_IDENTIFIER = com.rileytestut.Delta;
PROVISIONING_PROFILE = "";

View File

@ -1,9 +1,9 @@
<?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" colorMatched="YES" initialViewController="Dt0-nV-isV">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Dt0-nV-isV">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@ -160,13 +160,28 @@
</connections>
</collectionView>
<navigationItem key="navigationItem" title="Save State" id="BoG-k2-aR2">
<barButtonItem key="rightBarButtonItem" systemItem="add" id="lKg-Ks-hWN">
<connections>
<action selector="addSaveState" destination="OOk-k7-INg" id="xY2-94-EOr"/>
</connections>
</barButtonItem>
<rightBarButtonItems>
<barButtonItem systemItem="add" id="lKg-Ks-hWN">
<connections>
<action selector="addSaveState" destination="OOk-k7-INg" id="xY2-94-EOr"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" id="has-I3-HDZ">
<button key="customView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="y2a-9f-EFz">
<rect key="frame" x="288.5" y="13" width="30" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="▼"/>
<connections>
<action selector="changeSortOrder:" destination="OOk-k7-INg" eventType="primaryActionTriggered" id="qQn-uw-SN1"/>
</connections>
</button>
</barButtonItem>
</rightBarButtonItems>
</navigationItem>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" barStyle="black" prompted="NO"/>
<connections>
<outlet property="sortButton" destination="y2a-9f-EFz" id="Zbo-Q0-bVL"/>
</connections>
</collectionViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="cL5-DH-K3b" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>

View File

@ -24,7 +24,7 @@ class SaveStatesStoryboardSegue: UIStoryboardSegue
saveStatesViewController.loadViewIfNeeded()
let doneButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(SaveStatesStoryboardSegue.handleDoneButton))
saveStatesViewController.navigationItem.rightBarButtonItem = doneButton
saveStatesViewController.navigationItem.leftBarButtonItem = doneButton
guard saveStatesViewController.theme == .translucent else { return }

View File

@ -30,6 +30,7 @@ class PhotoLibraryImportOption: NSObject, ImportOption
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
imagePickerController.modalPresentationStyle = .fullScreen
imagePickerController.sourceType = .photoLibrary
imagePickerController.mediaTypes = [kUTTypeImage as String]
imagePickerController.view.backgroundColor = .white

View File

@ -120,6 +120,7 @@ class ImportController: NSObject
let documentBrowserViewController = UIDocumentBrowserViewController(forOpeningFilesWithContentTypes: Array(self.documentTypes))
documentBrowserViewController.delegate = self
documentBrowserViewController.modalPresentationStyle = .fullScreen
documentBrowserViewController.browserUserInterfaceStyle = .dark
documentBrowserViewController.allowsPickingMultipleItems = true
documentBrowserViewController.allowsDocumentCreation = false

View File

@ -33,9 +33,6 @@ class CheatTextView: UITextView
super.init(coder: aDecoder)
self.layoutManager.delegate = self
self.textContainer.widthTracksTextView = false
self.textContainer.heightTracksTextView = false
}
}

View File

@ -55,7 +55,7 @@ class SaveStatesCollectionHeaderView: UICollectionReusableView
self.textLabel.font = UIFont(descriptor: fontDescriptor, size: 0.0)
self.textLabel.textAlignment = .center
self.vibrancyView.contentView.addSubview(self.textLabel)
self.addSubview(self.textLabel)
// Auto Layout
self.textLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 20).isActive = true

View File

@ -54,7 +54,7 @@ class SaveStatesViewController: UICollectionViewController
didSet {
if self.isViewLoaded
{
self.updateTheme()
self.update()
}
}
}
@ -70,6 +70,8 @@ class SaveStatesViewController: UICollectionViewController
private var emulatorCoreSaveState: SaveStateProtocol?
@IBOutlet private var sortButton: UIButton!
required init?(coder aDecoder: NSCoder)
{
self.dataSource = RSTFetchedResultsCollectionViewPrefetchingDataSource<SaveState, UIImage>(fetchedResultsController: NSFetchedResultsController())
@ -106,7 +108,7 @@ extension SaveStatesViewController
case .loading:
self.title = NSLocalizedString("Load State", comment: "")
self.placeholderView.detailTextLabel.text = NSLocalizedString("You can create a new save state by pressing the Save State option in the pause menu.", comment: "")
self.navigationItem.rightBarButtonItem = nil
self.navigationItem.rightBarButtonItems?.removeFirst()
}
// Manually update prototype cell properties
@ -123,7 +125,7 @@ extension SaveStatesViewController
self.navigationController?.navigationBar.barStyle = .blackTranslucent
self.navigationController?.toolbar.barStyle = .blackTranslucent
self.updateTheme()
self.update()
}
override func viewWillDisappear(_ animated: Bool)
@ -195,12 +197,12 @@ private extension SaveStatesViewController
let fetchRequest: NSFetchRequest<SaveState> = SaveState.fetchRequest()
fetchRequest.returnsObjectsAsFaults = false
fetchRequest.predicate = NSPredicate(format: "%K == %@", #keyPath(SaveState.game), self.game)
fetchRequest.sortDescriptors = [NSSortDescriptor(key: #keyPath(SaveState.type), ascending: true), NSSortDescriptor(key: #keyPath(SaveState.creationDate), ascending: true)]
fetchRequest.sortDescriptors = [NSSortDescriptor(key: #keyPath(SaveState.type), ascending: true), NSSortDescriptor(key: #keyPath(SaveState.creationDate), ascending: Settings.sortSaveStatesByOldestFirst)]
self.dataSource.fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: DatabaseManager.shared.viewContext, sectionNameKeyPath: #keyPath(SaveState.type), cacheName: nil)
}
func updateTheme()
func update()
{
switch self.theme
{
@ -220,6 +222,8 @@ private extension SaveStatesViewController
self.placeholderView.textLabel.textColor = UIColor.white
self.placeholderView.detailTextLabel.textColor = UIColor.white
}
self.sortButton.transform = CGAffineTransform.identity.rotated(by: Settings.sortSaveStatesByOldestFirst ? 0 : .pi)
}
//MARK: - Configure Views -
@ -267,12 +271,16 @@ private extension SaveStatesViewController
}
headerView.textLabel.text = title
headerView.textLabel.textColor = UIColor.white
switch self.theme
{
case .opaque: headerView.isTextLabelVibrancyEnabled = false
case .translucent: headerView.isTextLabelVibrancyEnabled = true
case .opaque:
headerView.textLabel.textColor = UIColor.lightGray
headerView.isTextLabelVibrancyEnabled = false
case .translucent:
headerView.textLabel.textColor = UIColor.white
headerView.isTextLabelVibrancyEnabled = true
}
}
@ -429,6 +437,25 @@ private extension SaveStatesViewController
}
}
@IBAction func changeSortOrder(_ sender: UIButton)
{
Settings.sortSaveStatesByOldestFirst.toggle()
UIView.transition(with: self.collectionView, duration: 0.4, options: .transitionCrossDissolve, animations: {
self.updateDataSource()
}, completion: nil)
UIView.animate(withDuration: 0.4) {
self.update()
}
let toastView = RSTToastView()
toastView.textLabel.text = Settings.sortSaveStatesByOldestFirst ? NSLocalizedString("Oldest First", comment: "") : NSLocalizedString("Newest First", comment: "")
toastView.presentationEdge = .top
toastView.tintColor = UIColor.deltaPurple
toastView.show(in: self.view, duration: 2.0)
}
//MARK: - Convenience Methods -
func correctedSectionForSectionIndex(_ section: Int) -> Section

View File

@ -54,7 +54,8 @@ struct Settings
let defaults = [#keyPath(UserDefaults.translucentControllerSkinOpacity): 0.7,
#keyPath(UserDefaults.gameShortcutsMode): GameShortcutsMode.recent.rawValue,
#keyPath(UserDefaults.isButtonHapticFeedbackEnabled): true,
#keyPath(UserDefaults.isThumbstickHapticFeedbackEnabled): true] as [String : Any]
#keyPath(UserDefaults.isThumbstickHapticFeedbackEnabled): true,
#keyPath(UserDefaults.sortSaveStatesByOldestFirst): true] as [String : Any]
UserDefaults.standard.register(defaults: defaults)
}
}
@ -168,6 +169,14 @@ extension Settings
}
}
static var sortSaveStatesByOldestFirst: Bool {
set { UserDefaults.standard.sortSaveStatesByOldestFirst = newValue }
get {
let sortByOldestFirst = UserDefaults.standard.sortSaveStatesByOldestFirst
return sortByOldestFirst
}
}
static func preferredControllerSkin(for system: System, traits: DeltaCore.ControllerSkin.Traits) -> ControllerSkin?
{
guard let userDefaultsKey = self.preferredControllerSkinKey(for: system, traits: traits) else { return nil }
@ -270,4 +279,6 @@ private extension UserDefaults
@NSManaged var isButtonHapticFeedbackEnabled: Bool
@NSManaged var isThumbstickHapticFeedbackEnabled: Bool
@NSManaged var sortSaveStatesByOldestFirst: Bool
}

View File

@ -128,7 +128,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -161,7 +161,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>14</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
@ -222,6 +222,8 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
@ -369,7 +371,5 @@
</dict>
</dict>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict>
</plist>