Made alarmTone editable, but localRead() nil error.
This commit is contained in:
@@ -62,6 +62,15 @@ class AddAlarmViewController: EndEditingOnReturn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Sets alarm tone
|
||||||
|
if let toneName = alarmCell.toneLabel.text {
|
||||||
|
for index in 0...ringtones.count-1 {
|
||||||
|
if toneName == ringtones[index].name {
|
||||||
|
ringtonePicker.selectRow(index, inComponent: 0, animated: true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class AlarmTableCell: UITableViewCell
|
|||||||
@IBOutlet weak var repeatText: UILabel!
|
@IBOutlet weak var repeatText: UILabel!
|
||||||
@IBOutlet weak var goingOffText: UILabel!
|
@IBOutlet weak var goingOffText: UILabel!
|
||||||
@IBOutlet weak var wvmText: UILabel!
|
@IBOutlet weak var wvmText: UILabel!
|
||||||
|
@IBOutlet weak var toneLabel: UILabel!
|
||||||
|
|
||||||
var alarm: Alarm!
|
var alarm: Alarm!
|
||||||
|
|
||||||
@@ -90,6 +90,7 @@ class AlarmTableCell: UITableViewCell
|
|||||||
descriptionText.text = "- " + alarm.text
|
descriptionText.text = "- " + alarm.text
|
||||||
enable.isOn = alarm.enabled
|
enable.isOn = alarm.enabled
|
||||||
wvmText.text = alarm.wakeMethod.name
|
wvmText.text = alarm.wakeMethod.name
|
||||||
|
toneLabel.text = alarm.toneName
|
||||||
|
|
||||||
// Display Hour, Minute, and AM or PM
|
// Display Hour, Minute, and AM or PM
|
||||||
ampm.text = alarm.hour < 12 || alarm.hour == 24 ? "AM" : "PM"
|
ampm.text = alarm.hour < 12 || alarm.hour == 24 ? "AM" : "PM"
|
||||||
|
|||||||
@@ -83,6 +83,13 @@
|
|||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
|
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mQf-S4-pMF">
|
||||||
|
<rect key="frame" x="225" y="19" width="0.0" height="0.0"/>
|
||||||
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstItem="dWq-jh-9Ue" firstAttribute="baseline" secondItem="4hj-fb-FF3" secondAttribute="baseline" id="4H2-o6-GfV"/>
|
<constraint firstItem="dWq-jh-9Ue" firstAttribute="baseline" secondItem="4hj-fb-FF3" secondAttribute="baseline" id="4H2-o6-GfV"/>
|
||||||
@@ -109,6 +116,7 @@
|
|||||||
<outlet property="goingOffText" destination="EPJ-eL-Kek" id="QNo-WD-AyS"/>
|
<outlet property="goingOffText" destination="EPJ-eL-Kek" id="QNo-WD-AyS"/>
|
||||||
<outlet property="repeatText" destination="YhV-X3-y1v" id="Alj-Ko-6y6"/>
|
<outlet property="repeatText" destination="YhV-X3-y1v" id="Alj-Ko-6y6"/>
|
||||||
<outlet property="time" destination="mjO-SX-f31" id="OQC-eJ-Qjc"/>
|
<outlet property="time" destination="mjO-SX-f31" id="OQC-eJ-Qjc"/>
|
||||||
|
<outlet property="toneLabel" destination="mQf-S4-pMF" id="gw1-8p-j1O"/>
|
||||||
<outlet property="wvmText" destination="Kaa-5k-xfL" id="gsX-DJ-xmb"/>
|
<outlet property="wvmText" destination="Kaa-5k-xfL" id="gsX-DJ-xmb"/>
|
||||||
<segue destination="Mki-dC-5Kc" kind="show" identifier="edit-alarm" id="WYD-ju-WX0"/>
|
<segue destination="Mki-dC-5Kc" kind="show" identifier="edit-alarm" id="WYD-ju-WX0"/>
|
||||||
</connections>
|
</connections>
|
||||||
@@ -942,7 +950,7 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="374" height="170"/>
|
<rect key="frame" x="0.0" y="0.0" width="374" height="170"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person.crop.circle.badge.checkmark" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="yVW-fL-SIQ">
|
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="person.crop.circle.badge.checkmark" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="yVW-fL-SIQ">
|
||||||
<rect key="frame" x="130.5" y="0.0" width="111.5" height="109.5"/>
|
<rect key="frame" x="132" y="0.0" width="110" height="109.5"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="110" id="So8-k5-nLS"/>
|
<constraint firstAttribute="width" constant="110" id="So8-k5-nLS"/>
|
||||||
<constraint firstAttribute="height" constant="110" id="inA-vb-CrL"/>
|
<constraint firstAttribute="height" constant="110" id="inA-vb-CrL"/>
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class Alarm: Codable, Equatable
|
|||||||
var wakeMethod: WVM
|
var wakeMethod: WVM
|
||||||
var alarmTone: SystemSoundID
|
var alarmTone: SystemSoundID
|
||||||
var notificationID: String
|
var notificationID: String
|
||||||
|
var toneName: String
|
||||||
|
|
||||||
/// What days does it repeat (Sun, Mon, Tue, Wed, Thu, Fri, Sat)
|
/// What days does it repeat (Sun, Mon, Tue, Wed, Thu, Fri, Sat)
|
||||||
var repeats: [Bool]
|
var repeats: [Bool]
|
||||||
@@ -96,7 +97,8 @@ class Alarm: Codable, Equatable
|
|||||||
hour: Int, minute: Int, text: String, wakeMethod: WVM,
|
hour: Int, minute: Int, text: String, wakeMethod: WVM,
|
||||||
repeats: [Bool] = [false, true, true, true, true, true, false],
|
repeats: [Bool] = [false, true, true, true, true, true, false],
|
||||||
lastActivate: Date = Date(),
|
lastActivate: Date = Date(),
|
||||||
alarmTone: SystemSoundID = ringtones[0].tone
|
alarmTone: SystemSoundID = ringtones[0].tone,
|
||||||
|
toneName: String = ""
|
||||||
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -109,6 +111,7 @@ class Alarm: Codable, Equatable
|
|||||||
self.lastActivate = lastActivate
|
self.lastActivate = lastActivate
|
||||||
self.alarmTone = alarmTone
|
self.alarmTone = alarmTone
|
||||||
self.notificationID = "notification.id.\(Int.random(in: 1...Int.max))"
|
self.notificationID = "notification.id.\(Int.random(in: 1...Int.max))"
|
||||||
|
self.toneName = toneName
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Does it automatically disable after activating once
|
/// Does it automatically disable after activating once
|
||||||
|
|||||||
Reference in New Issue
Block a user