Skip to content

Commit

Permalink
potentially fix some debug lines for the json url
Browse files Browse the repository at this point in the history
  • Loading branch information
erikng committed Feb 1, 2024
1 parent bdb3180 commit 1889e2f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Nudge/Utilities/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,9 @@ struct MemoizationManager {
struct NetworkFileManager {
private func decodeNudgePreferences(from url: URL) -> NudgePreferences? {
guard let data = try? Data(contentsOf: url) else {
LogManager.error("Failed to load data from URL: \(url)", logger: prefsJSONLog)
if Globals.configProfile != Data() {
LogManager.error("Failed to load data from URL: \(url)", logger: prefsJSONLog)
}
return nil
}

Expand Down Expand Up @@ -688,17 +690,17 @@ struct NetworkFileManager {
func getNudgeJSONPreferences() -> NudgePreferences? {
let url = getJSONUrl()

LogManager.debug("JSON url: \(url)", logger: utilsLog)

if CommandLineUtilities().demoModeEnabled() || CommandLineUtilities().unitTestingEnabled() {
return nil
}

if CommandLineUtilities().bundleModeEnabled(), let bundleUrl = Globals.bundle.url(forResource: "com.github.macadmins.Nudge.tester", withExtension: "json") {
LogManager.debug("JSON url: \(bundleUrl)", logger: utilsLog)
return decodeNudgePreferences(from: bundleUrl)
}

if let jsonUrl = URL(string: url) {
LogManager.debug("JSON url: \(url)", logger: utilsLog)
return decodeNudgePreferences(from: jsonUrl)
}

Expand Down

0 comments on commit 1889e2f

Please sign in to comment.