Skip to content

Commit

Permalink
added EPA conversion factor function for purple air
Browse files Browse the repository at this point in the history
  • Loading branch information
DarraghRogan committed Aug 28, 2021
1 parent fbdd498 commit a239451
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
filePath = "Miasma/DataLoaderPurpleAir.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "242"
endingLineNumber = "242"
startingLineNumber = "244"
endingLineNumber = "244"
landmarkName = "loadPurpleAirData(id:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -30,8 +30,8 @@
filePath = "Miasma/DataLoaderPurpleAir.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "234"
endingLineNumber = "234"
startingLineNumber = "236"
endingLineNumber = "236"
landmarkName = "loadPurpleAirData(id:)"
landmarkType = "7">
</BreakpointContent>
Expand All @@ -46,8 +46,8 @@
filePath = "Miasma/DataLoaderPurpleAir.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "135"
endingLineNumber = "135"
startingLineNumber = "137"
endingLineNumber = "137"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
Expand Down
9 changes: 6 additions & 3 deletions Miasma/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
defaults.set("🟢", forKey: "PreviousStateForNotification")


// this is where users should end up and allows population of the RefreshInterval feature introduced in 1.21
} else if (defaults.bool(forKey: "First Launch") == true && isKeyPresentInUserDefaults(key: "RefreshIntervalSeconds") == false ) {
// this is where users should end up, and allows population of the RefreshInterval & PurpleAir EPA conversion factor features introduced in 1.21
} else if (defaults.bool(forKey: "First Launch") == true && isKeyPresentInUserDefaults(key: "RefreshIntervalSeconds") == false ) && isKeyPresentInUserDefaults(key: "PurpleAirConversionFactorEPAInUse") == false {

defaults.set("🟢", forKey: "PreviousStateForNotification")
defaults.set(1200.0, forKey: "RefreshIntervalSeconds")

defaults.set(0, forKey: "PurpleAirConversionFactorEPAInUse")


// this is where most returning users should end up and they need an initial state for the notifications
} else if defaults.bool(forKey: "First Launch") == true {
Expand All @@ -100,6 +101,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
defaults.set(50, forKey:"FallingAQINotificationsTrigger")
defaults.set("🟢", forKey: "PreviousStateForNotification")
defaults.set(1200.0, forKey: "RefreshIntervalSeconds")
defaults.set(0, forKey: "PurpleAirConversionFactorEPAInUse")

}

// Launching automatically at startup from tutorial: https://theswiftdev.com/how-to-launch-a-macos-app-at-login/
Expand Down
Loading

0 comments on commit a239451

Please sign in to comment.