Adds “Context Menu Previews” setting
Controls whether Delta previews games and save states when using context menus. Enabled by default.
This commit is contained in:
parent
a58d201b1b
commit
0d5e7e97cc
@ -20,7 +20,7 @@
|
||||
<color key="backgroundColor" systemColor="systemGroupedBackgroundColor"/>
|
||||
<color key="separatorColor" systemColor="separatorColor"/>
|
||||
<label key="tableFooterView" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Delta 0.6.0" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Str-BY-agW">
|
||||
<rect key="frame" x="0.0" y="1651" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1730.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
@ -376,10 +376,10 @@
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Haptic Touch" id="fdp-8c-oOc">
|
||||
<tableViewSection headerTitle="Haptic Touch" footerTitle="Preview games and save states when using context menus." id="fdp-8c-oOc">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" textLabel="c5i-qG-ir9" style="IBUITableViewCellStyleDefault" id="SSL-t4-QZj">
|
||||
<rect key="frame" x="0.0" y="1102" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1109.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="SSL-t4-QZj" id="hQB-Iy-bzy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
@ -397,12 +397,42 @@
|
||||
<segue destination="yXS-6u-1AN" kind="show" id="b79-OK-isV"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="SwitchCell" id="M7w-lw-FcL" customClass="SwitchTableViewCell">
|
||||
<rect key="frame" x="0.0" y="1153.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="M7w-lw-FcL" id="p8M-4q-q3o">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Context Menu Previews" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rDR-EH-JuO">
|
||||
<rect key="frame" x="8" y="11.5" width="302" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OJE-9e-9i3">
|
||||
<rect key="frame" x="318" y="6.5" width="51" height="31"/>
|
||||
<color key="onTintColor" name="Purple"/>
|
||||
<connections>
|
||||
<action selector="togglePreviewsEnabled:" destination="eHi-aO-uGS" eventType="primaryActionTriggered" id="Rdg-zi-J7B"/>
|
||||
</connections>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="rDR-EH-JuO" firstAttribute="centerY" secondItem="p8M-4q-q3o" secondAttribute="centerY" id="b7H-wJ-FmC"/>
|
||||
<constraint firstItem="OJE-9e-9i3" firstAttribute="centerY" secondItem="p8M-4q-q3o" secondAttribute="centerY" id="jy8-b4-Xrl"/>
|
||||
<constraint firstItem="OJE-9e-9i3" firstAttribute="leading" secondItem="rDR-EH-JuO" secondAttribute="trailing" constant="8" symbolic="YES" id="lD9-zp-fFz"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="OJE-9e-9i3" secondAttribute="trailing" id="u6W-7p-0sW"/>
|
||||
<constraint firstItem="rDR-EH-JuO" firstAttribute="leading" secondItem="p8M-4q-q3o" secondAttribute="leadingMargin" id="yVU-nD-jBF"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection headerTitle="Core Settings" footerTitle="Manage settings for individual emulation cores." id="1eN-id-M8c">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" textLabel="zeg-kj-CMN" detailTextLabel="CFd-fn-r0t" style="IBUITableViewCellStyleValue1" id="lxX-Hz-sXl">
|
||||
<rect key="frame" x="0.0" y="1209.5" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1289" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="lxX-Hz-sXl" id="OWw-OH-9F5">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
@ -429,7 +459,7 @@
|
||||
<tableViewSection headerTitle="Patreon" footerTitle="Receive early access to new features and more by becoming a patron." id="QvT-Yt-oP1">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Cell" textLabel="faT-qa-JP0" style="IBUITableViewCellStyleDefault" id="4it-3L-j8P">
|
||||
<rect key="frame" x="0.0" y="1329" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1408.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="4it-3L-j8P" id="7dE-36-hzp">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
@ -449,7 +479,7 @@
|
||||
<tableViewSection headerTitle="Credits" id="foh-L9-g6W">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="DetailCell" textLabel="Pum-dL-hGn" detailTextLabel="WQ6-m7-zhh" style="IBUITableViewCellStyleValue1" id="BU4-ee-DGz">
|
||||
<rect key="frame" x="0.0" y="1457" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1536.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="BU4-ee-DGz" id="fWf-gm-1sf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
@ -472,7 +502,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="DetailCell" textLabel="gWx-Xn-5Nf" detailTextLabel="09x-GX-cpy" style="IBUITableViewCellStyleValue1" id="8qc-0t-Nte">
|
||||
<rect key="frame" x="0.0" y="1501" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1580.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8qc-0t-Nte" id="jUL-fL-i0n">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
@ -495,7 +525,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="DetailCell" textLabel="zro-BX-EY9" detailTextLabel="e45-FD-ug2" style="IBUITableViewCellStyleValue1" id="Zh9-JJ-jEQ">
|
||||
<rect key="frame" x="0.0" y="1545" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1624.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Zh9-JJ-jEQ" id="VCc-oJ-ODB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
@ -518,14 +548,14 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="DetailCell" textLabel="2K3-IL-94S" style="IBUITableViewCellStyleDefault" id="j7p-ZK-mHq">
|
||||
<rect key="frame" x="0.0" y="1589" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="1668.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="j7p-ZK-mHq" id="BqT-yP-OpS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="356" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Licenses" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2K3-IL-94S">
|
||||
<rect key="frame" x="16" y="0.0" width="324" height="44"/>
|
||||
<rect key="frame" x="15" y="0.0" width="333" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@ -555,6 +585,7 @@
|
||||
<outlet property="buttonHapticFeedbackEnabledSwitch" destination="mlO-iy-zU2" id="ObD-uL-Si0"/>
|
||||
<outlet property="controllerOpacityLabel" destination="zaz-yD-CYG" id="eUW-u9-xxx"/>
|
||||
<outlet property="controllerOpacitySlider" destination="whi-If-wFf" id="6Cx-HY-xLG"/>
|
||||
<outlet property="previewsEnabledSwitch" destination="OJE-9e-9i3" id="Ndg-eN-PPs"/>
|
||||
<outlet property="syncingServiceLabel" destination="kLY-5g-v8n" id="zzx-qM-q1g"/>
|
||||
<outlet property="thumbstickHapticFeedbackEnabledSwitch" destination="s5f-Uz-GpH" id="ffp-3M-FDL"/>
|
||||
<outlet property="versionLabel" destination="Str-BY-agW" id="gU2-L0-pYt"/>
|
||||
|
||||
@ -926,14 +926,14 @@ extension GameCollectionViewController
|
||||
let actions = self.actions(for: game)
|
||||
|
||||
return UIContextMenuConfiguration(identifier: indexPath as NSIndexPath, previewProvider: { [weak self] in
|
||||
guard let self = self else { return nil }
|
||||
guard let self = self, Settings.isPreviewsEnabled else { return nil }
|
||||
|
||||
let previewViewController = self.makePreviewGameViewController(for: game)
|
||||
self._previewTransitionViewController = previewViewController
|
||||
|
||||
return previewViewController
|
||||
}) { suggestedActions in
|
||||
return UIMenu(title: "", children: actions.menuActions)
|
||||
return UIMenu(title: game.name, children: actions.menuActions)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -769,14 +769,14 @@ extension SaveStatesViewController
|
||||
guard let actions = self.actionsForSaveState(saveState) else { return nil }
|
||||
|
||||
return UIContextMenuConfiguration(identifier: indexPath as NSIndexPath, previewProvider: { [weak self] in
|
||||
guard let self = self else { return nil }
|
||||
guard let self = self, Settings.isPreviewsEnabled else { return nil }
|
||||
|
||||
let previewGameViewController = self.makePreviewGameViewController(for: saveState)
|
||||
self._previewTransitionViewController = previewGameViewController
|
||||
|
||||
return previewGameViewController
|
||||
}) { suggestedActions in
|
||||
return UIMenu(title: "", children: actions.menuActions)
|
||||
return UIMenu(title: saveState.localizedName, children: actions.menuActions)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -60,6 +60,7 @@ struct Settings
|
||||
#keyPath(UserDefaults.isButtonHapticFeedbackEnabled): true,
|
||||
#keyPath(UserDefaults.isThumbstickHapticFeedbackEnabled): true,
|
||||
#keyPath(UserDefaults.sortSaveStatesByOldestFirst): true,
|
||||
#keyPath(UserDefaults.isPreviewsEnabled): true,
|
||||
Settings.preferredCoreSettingsKey(for: .ds): DS.core.identifier] as [String : Any]
|
||||
UserDefaults.standard.register(defaults: defaults)
|
||||
}
|
||||
@ -182,6 +183,14 @@ extension Settings
|
||||
}
|
||||
}
|
||||
|
||||
static var isPreviewsEnabled: Bool {
|
||||
set { UserDefaults.standard.isPreviewsEnabled = newValue }
|
||||
get {
|
||||
let isPreviewsEnabled = UserDefaults.standard.isPreviewsEnabled
|
||||
return isPreviewsEnabled
|
||||
}
|
||||
}
|
||||
|
||||
static func preferredCore(for gameType: GameType) -> DeltaCoreProtocol?
|
||||
{
|
||||
let key = self.preferredCoreSettingsKey(for: gameType)
|
||||
@ -374,4 +383,6 @@ private extension UserDefaults
|
||||
@NSManaged var isThumbstickHapticFeedbackEnabled: Bool
|
||||
|
||||
@NSManaged var sortSaveStatesByOldestFirst: Bool
|
||||
|
||||
@NSManaged var isPreviewsEnabled: Bool
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@ class SettingsViewController: UITableViewController
|
||||
|
||||
@IBOutlet private var buttonHapticFeedbackEnabledSwitch: UISwitch!
|
||||
@IBOutlet private var thumbstickHapticFeedbackEnabledSwitch: UISwitch!
|
||||
@IBOutlet private var previewsEnabledSwitch: UISwitch!
|
||||
|
||||
@IBOutlet private var versionLabel: UILabel!
|
||||
|
||||
@ -172,6 +173,7 @@ private extension SettingsViewController
|
||||
|
||||
self.buttonHapticFeedbackEnabledSwitch.isOn = Settings.isButtonHapticFeedbackEnabled
|
||||
self.thumbstickHapticFeedbackEnabledSwitch.isOn = Settings.isThumbstickHapticFeedbackEnabled
|
||||
self.previewsEnabledSwitch.isOn = Settings.isPreviewsEnabled
|
||||
|
||||
self.tableView.reloadData()
|
||||
}
|
||||
@ -240,6 +242,11 @@ private extension SettingsViewController
|
||||
Settings.isThumbstickHapticFeedbackEnabled = sender.isOn
|
||||
}
|
||||
|
||||
@IBAction func togglePreviewsEnabled(_ sender: UISwitch)
|
||||
{
|
||||
Settings.isPreviewsEnabled = sender.isOn
|
||||
}
|
||||
|
||||
func openTwitter(username: String)
|
||||
{
|
||||
let twitterAppURL = URL(string: "twitter://user?screen_name=" + username)!
|
||||
|
||||
Loading…
Reference in New Issue
Block a user