Add confirmation dialogs for deactivating extensions. Fixes #2632
This commit is contained in:
parent
25fddb9bbe
commit
ac4f5d658d
|
@ -41,7 +41,6 @@ final class ExtensionPointPreferencesViewController: NSViewController {
|
||||||
|
|
||||||
showDefaultView()
|
showDefaultView()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func enableExtensionPoints(_ sender: Any) {
|
@IBAction func enableExtensionPoints(_ sender: Any) {
|
||||||
|
@ -62,8 +61,24 @@ final class ExtensionPointPreferencesViewController: NSViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
let extensionPoint = activeExtensionPoints[tableView.selectedRow]
|
let extensionPoint = activeExtensionPoints[tableView.selectedRow]
|
||||||
ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint.extensionPointID)
|
|
||||||
hideController()
|
let alert = NSAlert()
|
||||||
|
alert.alertStyle = .warning
|
||||||
|
let prompt = NSLocalizedString("Deactivate", comment: "Deactivate")
|
||||||
|
alert.messageText = "\(prompt) “\(extensionPoint.title)”?"
|
||||||
|
let extensionPointTypeTitle = extensionPoint.extensionPointID.extensionPointType.title
|
||||||
|
alert.informativeText = NSLocalizedString("Are you sure you want to deactivate the \(extensionPointTypeTitle) extension “\(extensionPoint.title)”?", comment: "Deactivate text")
|
||||||
|
|
||||||
|
alert.addButton(withTitle: NSLocalizedString("Deactivate", comment: "Deactivate Extension"))
|
||||||
|
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: "Cancel Deactivate Extension"))
|
||||||
|
|
||||||
|
alert.beginSheetModal(for: view.window!) { [weak self] result in
|
||||||
|
if result == NSApplication.ModalResponse.alertFirstButtonReturn {
|
||||||
|
ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint.extensionPointID)
|
||||||
|
self?.hideController()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,25 @@ class ExtensionPointInspectorViewController: UITableViewController {
|
||||||
|
|
||||||
@IBAction func disable(_ sender: Any) {
|
@IBAction func disable(_ sender: Any) {
|
||||||
guard let extensionPoint = extensionPoint else { return }
|
guard let extensionPoint = extensionPoint else { return }
|
||||||
ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint.extensionPointID)
|
|
||||||
self.navigationController?.popViewController(animated: true)
|
let title = NSLocalizedString("Deactivate Extension", comment: "Deactivate Extension")
|
||||||
|
let extensionPointTypeTitle = extensionPoint.extensionPointID.extensionPointType.title
|
||||||
|
let message = NSLocalizedString("Are you sure you want to deactivate the \(extensionPointTypeTitle) extension “\(extensionPoint.title)”?", comment: "Deactivate text")
|
||||||
|
|
||||||
|
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||||
|
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
||||||
|
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
||||||
|
alertController.addAction(cancelAction)
|
||||||
|
|
||||||
|
let markTitle = NSLocalizedString("Deactivate", comment: "Deactivate")
|
||||||
|
let markAction = UIAlertAction(title: markTitle, style: .default) { [weak self] (action) in
|
||||||
|
ExtensionPointManager.shared.deactivateExtensionPoint(extensionPoint.extensionPointID)
|
||||||
|
self?.navigationController?.popViewController(animated: true)
|
||||||
|
}
|
||||||
|
alertController.addAction(markAction)
|
||||||
|
|
||||||
|
present(alertController, animated: true)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
<?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="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
<deployment identifier="iOS"/>
|
||||||
|
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
|
||||||
<capability name="Named colors" minToolsVersion="9.0"/>
|
<capability name="Named colors" minToolsVersion="9.0"/>
|
||||||
|
<capability name="System colors in document resources" minToolsVersion="11.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>
|
||||||
|
@ -118,10 +120,10 @@
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<state key="normal" title="Delete Account">
|
<state key="normal" title="Delete Account">
|
||||||
<color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="titleColor" systemColor="systemRedColor"/>
|
||||||
</state>
|
</state>
|
||||||
<state key="highlighted">
|
<state key="highlighted">
|
||||||
<color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="titleColor" systemColor="systemRedColor"/>
|
||||||
</state>
|
</state>
|
||||||
<userDefinedRuntimeAttributes>
|
<userDefinedRuntimeAttributes>
|
||||||
<userDefinedRuntimeAttribute type="color" keyPath="backgroundHighlightColor">
|
<userDefinedRuntimeAttribute type="color" keyPath="backgroundHighlightColor">
|
||||||
|
@ -196,7 +198,7 @@
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Notify About New Articles" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YV2-gG-lMP">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Notify About New Articles" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YV2-gG-lMP">
|
||||||
<rect key="frame" x="24" y="11.5" width="198" height="21"/>
|
<rect key="frame" x="24" y="11.5" width="197" height="21"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
|
@ -226,7 +228,7 @@
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Always Show Reader View" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bf4-3X-Rfr">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Always Show Reader View" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Bf4-3X-Rfr">
|
||||||
<rect key="frame" x="24" y="11.5" width="200" height="21"/>
|
<rect key="frame" x="24" y="11.5" width="199" height="21"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
|
@ -426,11 +428,11 @@
|
||||||
<constraint firstAttribute="height" constant="44" id="qwy-Nb-VrG"/>
|
<constraint firstAttribute="height" constant="44" id="qwy-Nb-VrG"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<state key="normal" title="Disable Extension">
|
<state key="normal" title="Deactivate Extension">
|
||||||
<color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="titleColor" systemColor="systemRedColor"/>
|
||||||
</state>
|
</state>
|
||||||
<state key="highlighted">
|
<state key="highlighted">
|
||||||
<color key="titleColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="titleColor" systemColor="systemRedColor"/>
|
||||||
</state>
|
</state>
|
||||||
<userDefinedRuntimeAttributes>
|
<userDefinedRuntimeAttributes>
|
||||||
<userDefinedRuntimeAttribute type="color" keyPath="backgroundHighlightColor">
|
<userDefinedRuntimeAttribute type="color" keyPath="backgroundHighlightColor">
|
||||||
|
@ -467,11 +469,14 @@
|
||||||
<point key="canvasLocation" x="1549" y="-591"/>
|
<point key="canvasLocation" x="1549" y="-591"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
|
<designables>
|
||||||
|
<designable name="rOV-XS-bNW"/>
|
||||||
|
</designables>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="safari" catalog="system" width="128" height="121"/>
|
<image name="safari" catalog="system" width="128" height="121"/>
|
||||||
<image name="safari.fill" catalog="system" width="128" height="121"/>
|
<image name="safari.fill" catalog="system" width="128" height="121"/>
|
||||||
<namedColor name="deleteBackgroundColor">
|
<namedColor name="deleteBackgroundColor">
|
||||||
<color red="1" green="0.23100000619888306" blue="0.18799999356269836" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color red="1" green="0.23100003600120544" blue="0.18799999356269836" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
</namedColor>
|
</namedColor>
|
||||||
<namedColor name="primaryAccentColor">
|
<namedColor name="primaryAccentColor">
|
||||||
<color red="0.031372549019607843" green="0.41568627450980394" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color red="0.031372549019607843" green="0.41568627450980394" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
@ -479,5 +484,8 @@
|
||||||
<namedColor name="secondaryAccentColor">
|
<namedColor name="secondaryAccentColor">
|
||||||
<color red="0.031372549019607843" green="0.41568627450980394" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color red="0.031372549019607843" green="0.41568627450980394" blue="0.93333333333333335" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
</namedColor>
|
</namedColor>
|
||||||
|
<systemColor name="systemRedColor">
|
||||||
|
<color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
|
</systemColor>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|
Loading…
Reference in New Issue