rootviewcontroller, buttons and labels
|
@ -330,12 +330,11 @@ public class AlertManager:NSObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The sound
|
// The sound
|
||||||
// Start by creating the sound that will be added to the notification content
|
// depending on mute override off or on, the sound will either be added to the notification content, or will be played by code here respectively - except if delayInSecondsToUse > 0, in which case we must use the sound in the notification
|
||||||
// depending on mute override on or off, the sound will either be added to the notification content, or will be played by code here
|
|
||||||
|
|
||||||
// soundToSet is the sound that will be played,
|
// soundToSet is the sound that will be played,
|
||||||
// if soundToSet is nil ==> then default sound must be used,
|
// if soundToSet is nil ==> then default sound must be used,
|
||||||
// if soundToSet = "" , empty string ==> no sound will be played
|
// if soundToSet = "" , empty string ==> no sound needs to be played
|
||||||
// Start with default sound
|
// Start with default sound
|
||||||
var soundToSet:String?
|
var soundToSet:String?
|
||||||
|
|
||||||
|
@ -388,7 +387,7 @@ public class AlertManager:NSObject {
|
||||||
// play the sound
|
// play the sound
|
||||||
soundPlayer.playSound(soundFileName: soundToSet, withVolume: nil)
|
soundPlayer.playSound(soundFileName: soundToSet, withVolume: nil)
|
||||||
} else {
|
} else {
|
||||||
// mute should not be overriden, by adding the sound to the notification, we let iOS decide of the sound will be played or not
|
// mute should not be overriden, by adding the sound to the notification, we let iOS decide if the sound will be played or not
|
||||||
content.sound = UNNotificationSound.init(named: UNNotificationSoundName.init(soundToSet))
|
content.sound = UNNotificationSound.init(named: UNNotificationSoundName.init(soundToSet))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,17 @@
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "Trash_48x48.png",
|
"filename" : "home-white_48x48.png",
|
||||||
"scale" : "1x"
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "Trash_96x96.png",
|
"filename" : "home-white_96x96.png",
|
||||||
"scale" : "2x"
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "universal",
|
"idiom" : "universal",
|
||||||
"filename" : "Trash_144x144.png",
|
"filename" : "home-white_144x144.png",
|
||||||
"scale" : "3x"
|
"scale" : "3x"
|
||||||
}
|
}
|
||||||
],
|
],
|
After Width: | Height: | Size: 4.2 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 2.7 KiB |
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "settings-white_48x48.png",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "settings-white_96x96.png",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"filename" : "settings-white_144x144.png",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"version" : 1,
|
||||||
|
"author" : "xcode"
|
||||||
|
}
|
||||||
|
}
|
BIN
xdrip/Resources/Assets.xcassets/Settings.imageset/settings-white_144x144.png
vendored
Normal file
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 528 B |
After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 8.0 KiB |
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "first.pdf"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"images" : [
|
|
||||||
{
|
|
||||||
"idiom" : "universal",
|
|
||||||
"filename" : "second.pdf"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"info" : {
|
|
||||||
"version" : 1,
|
|
||||||
"author" : "xcode"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,7 @@
|
||||||
<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>
|
||||||
<!--First-->
|
<!--Root View Controller-->
|
||||||
<scene sceneID="hNz-n2-bh7">
|
<scene sceneID="hNz-n2-bh7">
|
||||||
<objects>
|
<objects>
|
||||||
<viewController id="9pv-A4-QxB" customClass="RootViewController" customModule="xdrip" customModuleProvider="target" sceneMemberID="viewController">
|
<viewController id="9pv-A4-QxB" customClass="RootViewController" customModule="xdrip" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
@ -18,30 +18,76 @@
|
||||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="First View" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="KQZ-1w-vlD">
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mSJ-jy-nHJ">
|
||||||
<rect key="frame" x="112.5" y="312" width="150" height="43"/>
|
<rect key="frame" x="289" y="20" width="86" height="39"/>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<fontDescription key="fontDescription" type="system" pointSize="22"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="36"/>
|
<state key="normal" title="Calibrate"/>
|
||||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
<connections>
|
||||||
|
<action selector="calibrateButtonAction:" destination="9pv-A4-QxB" eventType="touchUpInside" id="JB2-Sk-Tge"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zWo-AR-qJE">
|
||||||
|
<rect key="frame" x="172" y="20" width="107" height="39"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="22"/>
|
||||||
|
<state key="normal" title="Transmitter"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="transmitterButtonAction:" destination="9pv-A4-QxB" eventType="touchUpInside" id="iJp-CH-PZa"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fSY-nc-amN">
|
||||||
|
<rect key="frame" x="62" y="20" width="100" height="39"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="22"/>
|
||||||
|
<state key="normal" title="Presnooze"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="preSnoozeButtonAction:" destination="9pv-A4-QxB" eventType="touchUpInside" id="nuJ-Sh-3Xy"/>
|
||||||
|
</connections>
|
||||||
|
</button>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="-----" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="We3-bN-ffR">
|
||||||
|
<rect key="frame" x="43" y="252.5" width="289" height="162"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="125"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Loaded by FirstViewController" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A5M-7J-77L">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uyn-2k-K74">
|
||||||
<rect key="frame" x="90.5" y="363" width="194" height="17"/>
|
<rect key="frame" x="10" y="69" width="61.5" height="31.5"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
<fontDescription key="fontDescription" type="system" pointSize="26"/>
|
||||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
<nil key="textColor"/>
|
||||||
|
<nil key="highlightedColor"/>
|
||||||
|
</label>
|
||||||
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7Wo-wd-80o">
|
||||||
|
<rect key="frame" x="10" y="110.5" width="61.5" height="31.5"/>
|
||||||
|
<fontDescription key="fontDescription" type="system" pointSize="26"/>
|
||||||
|
<nil key="textColor"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label>
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="centerX" secondItem="KQZ-1w-vlD" secondAttribute="centerX" id="6BV-lF-sBN"/>
|
<constraint firstItem="zWo-AR-qJE" firstAttribute="leading" secondItem="fSY-nc-amN" secondAttribute="trailing" constant="10" id="25g-Is-au8"/>
|
||||||
<constraint firstItem="A5M-7J-77L" firstAttribute="top" secondItem="KQZ-1w-vlD" secondAttribute="bottom" constant="8" symbolic="YES" id="cfb-er-3JN"/>
|
<constraint firstItem="7Wo-wd-80o" firstAttribute="top" secondItem="uyn-2k-K74" secondAttribute="bottom" constant="10" id="ARe-Dm-DA6"/>
|
||||||
<constraint firstItem="A5M-7J-77L" firstAttribute="centerX" secondItem="KQZ-1w-vlD" secondAttribute="centerX" id="e1l-AV-tCB"/>
|
<constraint firstItem="PQr-Ze-W5v" firstAttribute="bottom" secondItem="We3-bN-ffR" secondAttribute="bottom" constant="203.5" id="Dh8-YX-1qs"/>
|
||||||
<constraint firstAttribute="centerY" secondItem="KQZ-1w-vlD" secondAttribute="centerY" id="exm-UA-ej4"/>
|
<constraint firstItem="fSY-nc-amN" firstAttribute="top" secondItem="PQr-Ze-W5v" secondAttribute="top" id="Gsa-fG-7Wh"/>
|
||||||
|
<constraint firstItem="We3-bN-ffR" firstAttribute="centerY" secondItem="tsR-hK-woN" secondAttribute="centerY" id="Ihy-GJ-OoS"/>
|
||||||
|
<constraint firstItem="zWo-AR-qJE" firstAttribute="top" secondItem="PQr-Ze-W5v" secondAttribute="top" id="WMb-YS-LdS"/>
|
||||||
|
<constraint firstItem="mSJ-jy-nHJ" firstAttribute="leading" secondItem="zWo-AR-qJE" secondAttribute="trailing" constant="10" id="YZw-LD-39g"/>
|
||||||
|
<constraint firstItem="mSJ-jy-nHJ" firstAttribute="top" secondItem="PQr-Ze-W5v" secondAttribute="top" id="Ydd-ev-OLz"/>
|
||||||
|
<constraint firstItem="uyn-2k-K74" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="10" id="fmo-f7-DDl"/>
|
||||||
|
<constraint firstItem="We3-bN-ffR" firstAttribute="centerX" secondItem="tsR-hK-woN" secondAttribute="centerX" id="fz5-iV-QmC"/>
|
||||||
|
<constraint firstItem="We3-bN-ffR" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="43" id="ghV-YB-SJY"/>
|
||||||
|
<constraint firstItem="uyn-2k-K74" firstAttribute="top" secondItem="fSY-nc-amN" secondAttribute="bottom" constant="10" id="pqR-9I-Dpv"/>
|
||||||
|
<constraint firstItem="7Wo-wd-80o" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" constant="10" id="rno-l9-zuR"/>
|
||||||
|
<constraint firstItem="PQr-Ze-W5v" firstAttribute="trailing" secondItem="mSJ-jy-nHJ" secondAttribute="trailing" id="sen-S3-K5r"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<viewLayoutGuide key="safeArea" id="PQr-Ze-W5v"/>
|
<viewLayoutGuide key="safeArea" id="PQr-Ze-W5v"/>
|
||||||
</view>
|
</view>
|
||||||
<tabBarItem key="tabBarItem" title="First" image="first" id="acW-dT-cKf"/>
|
<tabBarItem key="tabBarItem" image="Home" selectedImage="Home" id="acW-dT-cKf">
|
||||||
|
<color key="badgeColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
|
</tabBarItem>
|
||||||
|
<connections>
|
||||||
|
<outlet property="calibrateButtonOutlet" destination="mSJ-jy-nHJ" id="XSS-W3-gbX"/>
|
||||||
|
<outlet property="preSnoozeButtonOutlet" destination="fSY-nc-amN" id="T25-Z1-3Ad"/>
|
||||||
|
<outlet property="transmitterButtonOutlet" destination="zWo-AR-qJE" id="uuB-WI-JKe"/>
|
||||||
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
|
@ -497,11 +543,11 @@
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="0.0" y="0.0"/>
|
<point key="canvasLocation" x="0.0" y="0.0"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Second-->
|
<!--Settings Navigation Controller-->
|
||||||
<scene sceneID="jbr-kK-p6W">
|
<scene sceneID="jbr-kK-p6W">
|
||||||
<objects>
|
<objects>
|
||||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="dyf-bd-1WE" customClass="SettingsNavigationController" customModule="xdrip" customModuleProvider="target" sceneMemberID="viewController">
|
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="dyf-bd-1WE" customClass="SettingsNavigationController" customModule="xdrip" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
<tabBarItem key="tabBarItem" title="Second" image="second" id="cPa-gy-q4n"/>
|
<tabBarItem key="tabBarItem" title="" image="Settings" selectedImage="Settings" id="cPa-gy-q4n"/>
|
||||||
<toolbarItems/>
|
<toolbarItems/>
|
||||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Q1d-AD-CWJ">
|
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Q1d-AD-CWJ">
|
||||||
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
||||||
|
@ -593,7 +639,7 @@
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="first" width="30" height="30"/>
|
<image name="Home" width="48" height="48"/>
|
||||||
<image name="second" width="30" height="30"/>
|
<image name="Settings" width="48" height="48"/>
|
||||||
</resources>
|
</resources>
|
||||||
</document>
|
</document>
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Texts_Alerts {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
static let missedReadingAlertTitle: String = {
|
static let missedReadingAlertTitle: String = {
|
||||||
return NSLocalizedString("alerts_missedreadingalerttitle", tableName: filename, bundle: Bundle.main, value: "Missed Reading", comment: "When Missed reading alert happens, this is the title of the alert notification, also in alert settings list, for the name of the alert")
|
return NSLocalizedString("alerts_missedreadingalerttitle", tableName: filename, bundle: Bundle.main, value: "Missed Reading Alert", comment: "When Missed reading alert happens, this is the title of the alert notification, also in alert settings list, for the name of the alert")
|
||||||
}()
|
}()
|
||||||
|
|
||||||
static let calibrationNeededAlertTitle: String = {
|
static let calibrationNeededAlertTitle: String = {
|
||||||
|
|
|
@ -7,7 +7,24 @@ import UserNotifications
|
||||||
/// viewcontroller for the home screen
|
/// viewcontroller for the home screen
|
||||||
final class RootViewController: UIViewController, CGMTransmitterDelegate, UNUserNotificationCenterDelegate {
|
final class RootViewController: UIViewController, CGMTransmitterDelegate, UNUserNotificationCenterDelegate {
|
||||||
|
|
||||||
// MARK: - Properties
|
// MARK: - Properties - Outlets and Actions for buttons and labels in home screen
|
||||||
|
|
||||||
|
@IBOutlet weak var calibrateButtonOutlet: UIButton!
|
||||||
|
|
||||||
|
@IBAction func calibrateButtonAction(_ sender: UIButton) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBOutlet weak var transmitterButtonOutlet: UIButton!
|
||||||
|
|
||||||
|
@IBAction func transmitterButtonAction(_ sender: UIButton) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBOutlet weak var preSnoozeButtonOutlet: UIButton!
|
||||||
|
|
||||||
|
@IBAction func preSnoozeButtonAction(_ sender: UIButton) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private var test:CGMTransmitter?
|
private var test:CGMTransmitter?
|
||||||
|
|
||||||
|
@ -189,8 +206,13 @@ final class RootViewController: UIViewController, CGMTransmitterDelegate, UNUser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// send request calibration notification
|
// creates notification with bg reading
|
||||||
private func requestCalibrationNotification() {
|
// for the moment also creates calibration request if there's no calibration done yet
|
||||||
|
private func createBGReadingNotification() {
|
||||||
|
|
||||||
|
// first remove existing notification
|
||||||
|
UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [Constants.Notifications.NotificationIdentifiersForAlerts.initialCalibrationRequest])
|
||||||
|
|
||||||
// Create Notification Content
|
// Create Notification Content
|
||||||
let notificationContent = UNMutableNotificationContent()
|
let notificationContent = UNMutableNotificationContent()
|
||||||
|
|
||||||
|
@ -329,7 +351,7 @@ final class RootViewController: UIViewController, CGMTransmitterDelegate, UNUser
|
||||||
}
|
}
|
||||||
|
|
||||||
coreDataManager.saveChanges()
|
coreDataManager.saveChanges()
|
||||||
if glucoseData.count > 0 {requestCalibrationNotification()}
|
if glucoseData.count > 0 {createBGReadingNotification()}
|
||||||
if let nightScoutManager = nightScoutManager {
|
if let nightScoutManager = nightScoutManager {
|
||||||
nightScoutManager.synchronize()
|
nightScoutManager.synchronize()
|
||||||
}
|
}
|
||||||
|
|