Skip to content

Commit

Permalink
Merge pull request #459 from paulplant/ios17-updates
Browse files Browse the repository at this point in the history
iOS17 updates
  • Loading branch information
JohanDegraeve authored Sep 16, 2023
2 parents 7344250 + ca6cf29 commit 5e3bf62
Show file tree
Hide file tree
Showing 141 changed files with 92 additions and 90 deletions.
112 changes: 56 additions & 56 deletions xdrip.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions xdrip/Constants/ConstantsSounds.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ enum ConstantsSounds: String, CaseIterable {

// here using case iso properties because we want to iterate through them
// name of the sound as shown to the user, and also stored in the alerttype
case batterwakeup = "Better Wake Up/betterwakeup.mp3"
case bruteforce = "Brute Force/bruteforce.mp3"
case modernalarm2 = "Modern Alert 2/modern2.mp3"
case modernalarm = "Modern Alert/modernalarm.mp3"
case shorthigh1 = "Short High 1/shorthigh1.mp3"
case shorthigh2 = "Short High 2/shorthigh2.mp3"
case shorthigh3 = "Short High 3/shorthigh3.mp3"
case shorthigh4 = "Short High 4/shorthigh4.mp3"
case shortlow1 = "Short Low 1/shortlow1.mp3"
case shortlow2 = "Short Low 2/shortlow2.mp3"
case shortlow3 = "Short Low 3/shortlow3.mp3"
case shortlow4 = "Short Low 4/shortlow4.mp3"
case spaceship = "Space Ship/spaceship.mp3"
case batterwakeup = "Better Wake Up/betterwakeup.caf"
case bruteforce = "Brute Force/bruteforce.caf"
case modernalarm2 = "Modern Alert 2/modern2.caf"
case modernalarm = "Modern Alert/modernalarm.caf"
case shorthigh1 = "Short High 1/shorthigh1.caf"
case shorthigh2 = "Short High 2/shorthigh2.caf"
case shorthigh3 = "Short High 3/shorthigh3.caf"
case shorthigh4 = "Short High 4/shorthigh4.caf"
case shortlow1 = "Short Low 1/shortlow1.caf"
case shortlow2 = "Short Low 2/shortlow2.caf"
case shortlow3 = "Short Low 3/shortlow3.caf"
case shortlow4 = "Short Low 4/shortlow4.caf"
case spaceship = "Space Ship/spaceship.caf"
case xdripalert = "xDrip Alert/xdripalert.aif"

// copied from Spike project https://github.com/SpikeApp/Spike/tree/master/src/assets/sounds
Expand Down
2 changes: 1 addition & 1 deletion xdrip/Constants/ConstantsSuspensionPrevention.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
enum ConstantsSuspensionPrevention {

/// name of the file that has the sound to play
static let soundFileName = "1-millisecond-of-silence.mp3"//20ms-of-silence.caf"
static let soundFileName = "1-millisecond-of-silence.caf"//20ms-of-silence.caf"

/// how often to play the sound, in seconds
static let interval = 5
Expand Down
42 changes: 22 additions & 20 deletions xdrip/Managers/NightScout/NightScoutFollowManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ import AVFoundation
import AudioToolbox

/// instance of this class will do the follower functionality. Just make an instance, it will listen to the settings, do the regular download if needed - it could be deallocated when isMaster setting in Userdefaults changes, but that's not necessary to do
class NightScoutFollowManager:NSObject {
class NightScoutFollowManager: NSObject {

// MARK: - public properties

// MARK: - private properties

/// to solve problem that sometemes UserDefaults key value changes is triggered twice for just one change
private let keyValueObserverTimeKeeper:KeyValueObserverTimeKeeper = KeyValueObserverTimeKeeper()
private let keyValueObserverTimeKeeper: KeyValueObserverTimeKeeper = KeyValueObserverTimeKeeper()

/// for logging
private var log = OSLog(subsystem: ConstantsLog.subSystem, category: ConstantsLog.categoryNightScoutFollowManager)

/// when to do next download
private var nextFollowDownloadTimeStamp:Date
private var nextFollowDownloadTimeStamp: Date

/// reference to coredatamanager
private var coreDataManager:CoreDataManager
private var coreDataManager: CoreDataManager

/// reference to BgReadingsAccessor
private var bgReadingsAccessor:BgReadingsAccessor
private var bgReadingsAccessor: BgReadingsAccessor

/// delegate to pass back glucosedata
private (set) weak var nightScoutFollowerDelegate:NightScoutFollowerDelegate?
private (set) weak var nightScoutFollowerDelegate: NightScoutFollowerDelegate?

/// AVAudioPlayer to use
private var audioPlayer:AVAudioPlayer?
private var audioPlayer: AVAudioPlayer?

/// constant for key in ApplicationManager.shared.addClosureToRunWhenAppWillEnterForeground - create playsoundtimer
private let applicationManagerKeyResumePlaySoundTimer = "NightScoutFollowerManager-ResumePlaySoundTimer"
Expand All @@ -38,15 +38,15 @@ class NightScoutFollowManager:NSObject {
private let applicationManagerKeySuspendPlaySoundTimer = "NightScoutFollowerManager-SuspendPlaySoundTimer"

/// closure to call when downloadtimer needs to be invalidated, eg when changing from master to follower
private var invalidateDownLoadTimerClosure:(() -> Void)?
private var invalidateDownLoadTimerClosure: (() -> Void)?

// timer for playsound
private var playSoundTimer:RepeatingTimer?
private var playSoundTimer: RepeatingTimer?

// MARK: - initializer

/// initializer
public init(coreDataManager:CoreDataManager, nightScoutFollowerDelegate:NightScoutFollowerDelegate) {
public init(coreDataManager: CoreDataManager, nightScoutFollowerDelegate: NightScoutFollowerDelegate) {

// initialize nextFollowDownloadTimeStamp to now, which is at the moment FollowManager is instantiated
nextFollowDownloadTimeStamp = Date()
Expand All @@ -56,18 +56,20 @@ class NightScoutFollowManager:NSObject {
self.bgReadingsAccessor = BgReadingsAccessor(coreDataManager: coreDataManager)
self.nightScoutFollowerDelegate = nightScoutFollowerDelegate

// creat audioplayer
do {
// set up url to create audioplayer
let soundFileName = ConstantsSuspensionPrevention.soundFileName
if let url = Bundle.main.url(forResource: soundFileName, withExtension: "") {

try audioPlayer = AVAudioPlayer(contentsOf: url)

// set up audioplayer
if let url = Bundle.main.url(forResource: ConstantsSuspensionPrevention.soundFileName, withExtension: "") {

// create audioplayer
do {

audioPlayer = try AVAudioPlayer(contentsOf: url)

} catch let error {

trace("in init, exception while trying to create audoplayer, error = %{public}@", log: self.log, category: ConstantsLog.categoryNightScoutFollowManager, type: .error, error.localizedDescription)

}

} catch let error {
trace("in init, exception while trying to create audoplayer, error = %{public}@", log: self.log, category: ConstantsLog.categoryNightScoutFollowManager, type: .error, error.localizedDescription)
}

// call super.init
Expand Down
Binary file not shown.
Binary file removed xdrip/Resources/sounds/1-millisecond-of-silence.mp3
Binary file not shown.
Binary file modified xdrip/Resources/sounds/20ms-of-silence.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Alarm_Buzzer.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Alarm_Clock.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Alert_Tone_Busy.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Alert_Tone_Ringtone_1.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Alert_Tone_Ringtone_2.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Alien_Siren.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Ambulance.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Analog_Watch_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Big_Clock_Ticking.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Burglar_Alarm_Siren_1.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Burglar_Alarm_Siren_2.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/CSFX-2_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Ascend_Climb_Sneaky.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Ascend_Then_Descend.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Bounce_To_Ceiling.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Dreamy_Glissando_Harp.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Fail_Strings_Trumpet.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Machine_Clumsy_Loop.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Siren.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Tip_Toe_Sneaky_Walk.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Uh_Oh.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cartoon_Villain_Horns.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cell_Phone_Ring_Tone.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Chimes_Glassy.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Computer_Magic.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Cuckoo_Clock.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Dhol_Shuffleloop.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Discreet.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Early_Sunrise.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Emergency_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Emergency_Alarm_Carbon_Monoxide.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Emergency_Alarm_Siren.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Ending_Reached.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Fly.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Ghost_Hover.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Good_Morning.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Hell_Yeah_Somewhat_Calmer.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/In_A_Hurry.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Indeed.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Insistently.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Jingle_All_The_Way.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Laser_Shoot.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Machine_Charge.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Magical_Twinkle.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Marching_Heavy_Footed_Fat_Elephants.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Marimba_Descend.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Marimba_Flutter_or_Shake.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Martian_Gun.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Martian_Scanner.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Metallic.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Nightguard.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Not_Kiddin.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Open_Your_Eyes_And_See.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Orchestral_Horns.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Oringz.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Pager_Beeps.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Remembers_Me_Of_Asia.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Rise_And_Shine.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Rush.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Air_Raid_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Alarm_Loop_1.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Alarm_Loop_2.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Alarm_Loop_3.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Alarm_Loop_4.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Computer_Console_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Console_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Eerie_Alarm.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Engine_Shut_Down.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Incoming_Message_Alert.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Spaceship_Message.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Spaceship_Warm_Up.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sci-Fi_Warning.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Signature_Corporate.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Calibration_Needed.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Device_Muted.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Glucose_Dropping_Fast.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Glucose_Rising_Fast.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_High_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Low_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Missed_Readings.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Transmitter_Battery_Low.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Urgent_High_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Alert_Urgent_Low_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Calibration_Needed.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Device_Muted.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Glucose_Dropping_Fast.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Glucose_Rising_Fast.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_High_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Low_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Missed_Readings.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Transmitter_Battery_Low.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Urgent_High_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Siri_Urgent_Low_Glucose.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Soft_Marimba_Pad_Positive.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Soft_Warm_Airy_Optimistic.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Soft_Warm_Airy_Reassuring.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Store_Door_Chime.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Sunny.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Thunder_Sound_FX.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Time_Has_Come.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Tornado_Siren.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Two_Turtle_Doves.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Unpaved.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Wake_Up_Will_You.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Win_Gain.caf
Binary file not shown.
Binary file modified xdrip/Resources/sounds/Wrong_Answer.caf
Binary file not shown.
Binary file added xdrip/Resources/sounds/betterwakeup.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/betterwakeup.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/bruteforce.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/bruteforce.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/modern2.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/modern2.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/modernalarm.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/modernalarm.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shorthigh1.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shorthigh1.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shorthigh2.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shorthigh2.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shorthigh3.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shorthigh3.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shorthigh4.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shorthigh4.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shortlow1.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shortlow1.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shortlow2.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shortlow2.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shortlow3.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shortlow3.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/shortlow4.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/shortlow4.mp3
Binary file not shown.
Binary file added xdrip/Resources/sounds/spaceship.caf
Binary file not shown.
Binary file removed xdrip/Resources/sounds/spaceship.mp3
Binary file not shown.
Binary file modified xdrip/Resources/sounds/xdripalert.aif
Binary file not shown.

0 comments on commit 5e3bf62

Please sign in to comment.