Commit 87646ff1 by Dmitry Stepanets

Merge branch 'bugfix/IOS-259-incorrect-events-order' into develop

parents 4f15e58a cdd773d7
...@@ -91,11 +91,11 @@ ...@@ -91,11 +91,11 @@
<EnvironmentVariable <EnvironmentVariable
key = "_XCWidgetDefaultView" key = "_XCWidgetDefaultView"
value = "timeline" value = "timeline"
isEnabled = "NO"> isEnabled = "YES">
</EnvironmentVariable> </EnvironmentVariable>
<EnvironmentVariable <EnvironmentVariable
key = "_XCWidgetFamily" key = "_XCWidgetFamily"
value = "medium" value = "small"
isEnabled = "YES"> isEnabled = "YES">
</EnvironmentVariable> </EnvironmentVariable>
</EnvironmentVariables> </EnvironmentVariables>
......
...@@ -14,7 +14,6 @@ import OneWeatherAnalytics ...@@ -14,7 +14,6 @@ import OneWeatherAnalytics
public class PushNotificationsManager: NSObject, PushNotificationsManagerProtocol { public class PushNotificationsManager: NSObject, PushNotificationsManagerProtocol {
// MARK: - Private // MARK: - Private
private let log = Logger(componentName: "PushNotificationsManager") private let log = Logger(componentName: "PushNotificationsManager")
private let configManager: ConfigManager private let configManager: ConfigManager
......
...@@ -111,7 +111,7 @@ public class WidgetManager { ...@@ -111,7 +111,7 @@ public class WidgetManager {
private let smartTextProvider = SmartTextProvider(prioritizedSmartTexts: SmartTextProvider.defaultSmartTexts) private let smartTextProvider = SmartTextProvider(prioritizedSmartTexts: SmartTextProvider.defaultSmartTexts)
private var widgetOptions: WidgetOptions = [] private var widgetOptions: WidgetOptions = []
public func refreshAnalytics() { public func refreshAnalytics(completion: (() -> Void)? = nil) {
WidgetCenter.shared.getCurrentConfigurations {[weak self] result in WidgetCenter.shared.getCurrentConfigurations {[weak self] result in
switch result { switch result {
case .success(let widgetInfo): case .success(let widgetInfo):
...@@ -119,6 +119,7 @@ public class WidgetManager { ...@@ -119,6 +119,7 @@ public class WidgetManager {
case .failure(let error): case .failure(let error):
self?.log.error(error.localizedDescription) self?.log.error(error.localizedDescription)
} }
completion?()
} }
} }
...@@ -156,8 +157,7 @@ public class WidgetManager { ...@@ -156,8 +157,7 @@ public class WidgetManager {
} }
} }
AppAnalytics.shared.log(event: .ANALYTICS_WIDGET_UPDATED, AppAnalytics.shared.log(event: .ANALYTICS_WIDGET_UPDATED, params: params)
params: params)
} }
} }
......
...@@ -43,6 +43,7 @@ class WeatherProvider: TimelineProvider { ...@@ -43,6 +43,7 @@ class WeatherProvider: TimelineProvider {
locationSource.getUpToDateLocation { [weak self] location in locationSource.getUpToDateLocation { [weak self] location in
guard let self = self else { return } guard let self = self else { return }
var needToLogUpdate = false var needToLogUpdate = false
if if
let fetchedLocation = location, let fetchedLocation = location,
let coordinates = fetchedLocation.coordinates let coordinates = fetchedLocation.coordinates
...@@ -55,9 +56,7 @@ class WeatherProvider: TimelineProvider { ...@@ -55,9 +56,7 @@ class WeatherProvider: TimelineProvider {
let nextRefresh = Calendar.current.date(byAdding: .minute, value: 30, to: Date())! let nextRefresh = Calendar.current.date(byAdding: .minute, value: 30, to: Date())!
let entry = WeatherEntry(location: fetchedLocation, date: nextRefresh, radarMapImage: mapImage) let entry = WeatherEntry(location: fetchedLocation, date: nextRefresh, radarMapImage: mapImage)
let timeline = Timeline(entries: [entry], policy: .atEnd) let timeline = Timeline(entries: [entry], policy: .atEnd)
if !context.isPreview { needToLogUpdate = true
WidgetManager.shared.logUpdate(forLocation: location, kind: self.widgetKind, family: context.family)
}
completion(timeline) completion(timeline)
} }
} }
...@@ -78,10 +77,11 @@ class WeatherProvider: TimelineProvider { ...@@ -78,10 +77,11 @@ class WeatherProvider: TimelineProvider {
} }
if !context.isPreview { if !context.isPreview {
WidgetManager.shared.refreshAnalytics() WidgetManager.shared.refreshAnalytics(completion: {
if needToLogUpdate { if needToLogUpdate {
WidgetManager.shared.logUpdate(forLocation: location, kind: self.widgetKind, family: context.family) WidgetManager.shared.logUpdate(forLocation: location, kind: self.widgetKind, family: context.family)
} }
})
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment