Update user defaults immediately on toggle switch for iCloud sync content setting.

This commit is contained in:
Brent Simmons committed 2026-03-19 16:38:22 -07:00
1 parent 2a3fa45221
commit 3a53ebefd1
2 files changed
+13 -9

No files matched your search

@@ -56,9 +56,10 @@ final class AccountInspectorViewController: UITableViewController {
override func viewWillDisappear(_ animated: Bool) {
account?.name = nameTextField.text
account?.isActive = activeSwitch.isOn
if account?.type == .cloudKit {
UserDefaults.standard.set(syncContentSwitch.isOn, forKey: Account.iCloudSyncArticleContentForUnreadArticlesKey)
}
}
@IBAction func syncContentSwitchDidChange(_ sender: UISwitch) {
UserDefaults.standard.set(sender.isOn, forKey: Account.iCloudSyncArticleContentForUnreadArticlesKey)
}
@objc func done() {
+9 -6
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24412" 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="24506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24405"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24504"/>
<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"/>
@@ -16,7 +16,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<view key="tableFooterView" contentMode="scaleToFill" id="3V2-Cm-ezj">
<rect key="frame" x="0.0" y="312" width="414" height="44"/>
<rect key="frame" x="0.0" y="399" width="414" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dgD-uX-vcx">
@@ -173,7 +173,7 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sync Content of Unread Articles" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="syncContent-label-id">
<rect key="frame" x="20" y="15.5" width="250" height="20.5"/>
<rect key="frame" x="20" y="15.5" width="245" height="20.5"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@@ -181,11 +181,14 @@
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="syncContent-switch-id">
<rect key="frame" x="293" y="11.5" width="63" height="28"/>
<color key="onTintColor" name="primaryAccentColor"/>
<connections>
<action selector="syncContentSwitchDidChange:" destination="1m3-fZ-n7g" eventType="valueChanged" id="syncContent-action-id"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstItem="syncContent-label-id" firstAttribute="leading" secondItem="syncContent-content-id" secondAttribute="leading" constant="20" symbolic="YES" id="syncContent-leading-id"/>
<constraint firstItem="syncContent-label-id" firstAttribute="centerY" secondItem="syncContent-content-id" secondAttribute="centerY" id="syncContent-labelCenterY-id"/>
<constraint firstItem="syncContent-label-id" firstAttribute="leading" secondItem="syncContent-content-id" secondAttribute="leading" constant="20" symbolic="YES" id="syncContent-leading-id"/>
<constraint firstItem="syncContent-switch-id" firstAttribute="centerY" secondItem="syncContent-content-id" secondAttribute="centerY" id="syncContent-switchCenterY-id"/>
<constraint firstAttribute="trailing" secondItem="syncContent-switch-id" secondAttribute="trailing" constant="20" symbolic="YES" id="syncContent-trailing-id"/>
</constraints>
@@ -388,11 +391,11 @@
</barButtonItem>
</navigationItem>
<connections>
<outlet property="readerViewAlwaysEnabledSwitch" destination="fUd-JB-UMK" id="kUh-ob-Ego"/>
<outlet property="feedURLLabel" destination="rOV-XS-bNW" id="mPv-yb-H4I"/>
<outlet property="homePageLabel" destination="HUP-Cu-FGT" id="EDm-vt-2r0"/>
<outlet property="nameTextField" destination="ZdA-rl-9eP" id="GzR-uc-fpV"/>
<outlet property="newArticleNotificationsEnabledSwitch" destination="g39-wK-xUs" id="ahS-ZK-6xN"/>
<outlet property="readerViewAlwaysEnabledSwitch" destination="fUd-JB-UMK" id="kUh-ob-Ego"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="qKF-0N-vfa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>