[+] Add wvm selector for adding debug alarms
This commit is contained in:
@@ -237,7 +237,7 @@
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="oTa-Ok-U9h">
|
||||
<rect key="frame" x="20" y="109" width="374" height="174"/>
|
||||
<rect key="frame" x="20" y="109" width="374" height="266"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8o4-jF-mCC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="374" height="36"/>
|
||||
@@ -247,16 +247,8 @@
|
||||
<action selector="sendNotification:" destination="r8W-6e-Hn2" eventType="touchUpInside" id="ry0-VK-YRb"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oK7-CW-NUv">
|
||||
<rect key="frame" x="0.0" y="46" width="374" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<state key="normal" title="Add an alarm activating one minute later"/>
|
||||
<connections>
|
||||
<action selector="addAlarm:" destination="r8W-6e-Hn2" eventType="touchUpInside" id="Ctz-XA-1z2"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="VdA-Ax-Nzf">
|
||||
<rect key="frame" x="0.0" y="92" width="374" height="36"/>
|
||||
<rect key="frame" x="0.0" y="46" width="374" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<state key="normal" title="Delete All Alarms"/>
|
||||
<connections>
|
||||
@@ -264,13 +256,43 @@
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Zrg-H8-O73">
|
||||
<rect key="frame" x="0.0" y="138" width="374" height="36"/>
|
||||
<rect key="frame" x="0.0" y="92" width="374" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<state key="normal" title="Switch to Dark Mode"/>
|
||||
<connections>
|
||||
<action selector="switchViewingMode:" destination="r8W-6e-Hn2" eventType="touchUpInside" id="GFd-hP-L8n"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oK7-CW-NUv">
|
||||
<rect key="frame" x="0.0" y="138" width="374" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<state key="normal" title="Add activating alarm"/>
|
||||
<connections>
|
||||
<action selector="addAlarm:" destination="r8W-6e-Hn2" eventType="touchUpInside" id="Ctz-XA-1z2"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="↓ Add Alarm Wvm ↓" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="39b-xF-Uu5">
|
||||
<rect key="frame" x="0.0" y="184" width="374" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="cDZ-bm-jzY">
|
||||
<rect key="frame" x="0.0" y="230" width="374" height="36"/>
|
||||
<subviews>
|
||||
<stepper opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" maximumValue="100" translatesAutoresizingMaskIntoConstraints="NO" id="Em8-2h-OLJ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="94" height="36"/>
|
||||
<connections>
|
||||
<action selector="wvmStepperChange:" destination="r8W-6e-Hn2" eventType="valueChanged" id="8FF-vP-TMD"/>
|
||||
</connections>
|
||||
</stepper>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="0" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xm9-jG-GRO">
|
||||
<rect key="frame" x="114" y="0.0" width="260" height="36"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" autocorrectionType="no" spellCheckingType="no" keyboardType="numberPad" smartDashesType="no" smartInsertDeleteType="no" smartQuotesType="no"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
</stackView>
|
||||
</subviews>
|
||||
@@ -291,6 +313,8 @@
|
||||
<tabBarItem key="tabBarItem" title="Debug" image="hammer.fill" catalog="system" selectedImage="hammer.fill" id="QZ2-fJ-hLg"/>
|
||||
<connections>
|
||||
<outlet property="userModeButton" destination="Zrg-H8-O73" id="9sz-f3-9pJ"/>
|
||||
<outlet property="wvmInput" destination="xm9-jG-GRO" id="3x2-fp-i3W"/>
|
||||
<outlet property="wvmStepper" destination="Em8-2h-OLJ" id="uJ6-sU-PZQ"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="mZu-oh-Lmb" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
|
||||
@@ -13,6 +13,9 @@ class DebugViewController: UIViewController
|
||||
@IBOutlet weak var userModeButton: UIButton!
|
||||
var darkMode = false
|
||||
|
||||
@IBOutlet weak var wvmInput: UITextField!
|
||||
@IBOutlet weak var wvmStepper: UIStepper!
|
||||
|
||||
override func viewDidLoad()
|
||||
{
|
||||
super.viewDidLoad()
|
||||
@@ -36,7 +39,7 @@ class DebugViewController: UIViewController
|
||||
@IBAction func addAlarm(_ sender: Any)
|
||||
{
|
||||
let (h, m, _) = Date().getHMS()
|
||||
let alarm = Alarm(hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[1], repeats: [true, true, true, true, true, true, true], lastActivate: Date().added(.minute, -1))
|
||||
let alarm = Alarm(hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[Int(wvmStepper.value)], repeats: [true, true, true, true, true, true, true], lastActivate: Date().added(.minute, -1))
|
||||
|
||||
Alarms.fromLocal().apply { $0.list.append(alarm) }.localSave()
|
||||
Notification.scheduleNotification(alarm: alarm)
|
||||
@@ -47,6 +50,11 @@ class DebugViewController: UIViewController
|
||||
Alarms.fromLocal().apply { $0.list.removeAll() }.localSave()
|
||||
}
|
||||
|
||||
@IBAction func wvmStepperChange(_ sender: Any)
|
||||
{
|
||||
wvmInput.text = String(wvmStepper.value)
|
||||
}
|
||||
|
||||
@IBAction func switchViewingMode(_ sender: Any) {
|
||||
if !darkMode {
|
||||
view.window?.overrideUserInterfaceStyle = .dark
|
||||
|
||||
Reference in New Issue
Block a user