Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
1
1weather
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
1weather
Commits
d556d22e
Commit
d556d22e
authored
Jul 23, 2021
by
Dmitriy Stepanets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added widget update event
parent
3117b368
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
18 deletions
+34
-18
1Weather.xcodeproj/project.pbxproj
+0
-12
1Weather/AppDelegate.swift
+1
-1
OneWeatherAnalytics/OneWeatherAnalytics/AnalyticsEvent.swift
+1
-0
OneWeatherCore/OneWeatherCore.xcodeproj/project.pbxproj
+4
-0
OneWeatherCore/OneWeatherCore/Managers/WidgetManager.swift
+21
-4
OneWeatherWidget/Data/WeatherProvider.swift
+7
-1
No files found.
1Weather.xcodeproj/project.pbxproj
View file @
d556d22e
...
@@ -161,7 +161,6 @@
...
@@ -161,7 +161,6 @@
CDA5542825EF734200A2E08C
/* TodayCellFactory.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542725EF734200A2E08C
/* TodayCellFactory.swift */
;
};
CDA5542825EF734200A2E08C
/* TodayCellFactory.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542725EF734200A2E08C
/* TodayCellFactory.swift */
;
};
CDA5542D25EF7C9700A2E08C
/* ReusableCellProtocol.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542C25EF7C9700A2E08C
/* ReusableCellProtocol.swift */
;
};
CDA5542D25EF7C9700A2E08C
/* ReusableCellProtocol.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDA5542C25EF7C9700A2E08C
/* ReusableCellProtocol.swift */
;
};
CDAC9B8526319B0500AC1BF4
/* MapTimeControlItem.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
;
};
CDAC9B8526319B0500AC1BF4
/* MapTimeControlItem.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
;
};
CDAD462C26A95ED800690CB1
/* WidgetManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD462B26A95ED800690CB1
/* WidgetManager.swift */
;
};
CDAD97B1262042B2007FCFB1
/* MapButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD97B0262042B2007FCFB1
/* MapButton.swift */
;
};
CDAD97B1262042B2007FCFB1
/* MapButton.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD97B0262042B2007FCFB1
/* MapButton.swift */
;
};
CDAD97B426207D14007FCFB1
/* MapTimeControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
;
};
CDAD97B426207D14007FCFB1
/* MapTimeControlView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
;
};
CDC3F858269460E600AAE3BF
/* PromotionMediumWidgetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDC3F857269460E600AAE3BF
/* PromotionMediumWidgetView.swift */
;
};
CDC3F858269460E600AAE3BF
/* PromotionMediumWidgetView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CDC3F857269460E600AAE3BF
/* PromotionMediumWidgetView.swift */
;
};
...
@@ -474,7 +473,6 @@
...
@@ -474,7 +473,6 @@
CDA5542725EF734200A2E08C
/* TodayCellFactory.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TodayCellFactory.swift
;
sourceTree
=
"<group>"
;
};
CDA5542725EF734200A2E08C
/* TodayCellFactory.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TodayCellFactory.swift
;
sourceTree
=
"<group>"
;
};
CDA5542C25EF7C9700A2E08C
/* ReusableCellProtocol.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ReusableCellProtocol.swift
;
sourceTree
=
"<group>"
;
};
CDA5542C25EF7C9700A2E08C
/* ReusableCellProtocol.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ReusableCellProtocol.swift
;
sourceTree
=
"<group>"
;
};
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapTimeControlItem.swift
;
sourceTree
=
"<group>"
;
};
CDAC9B8426319B0500AC1BF4
/* MapTimeControlItem.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapTimeControlItem.swift
;
sourceTree
=
"<group>"
;
};
CDAD462B26A95ED800690CB1
/* WidgetManager.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WidgetManager.swift
;
sourceTree
=
"<group>"
;
};
CDAD97B0262042B2007FCFB1
/* MapButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapButton.swift
;
sourceTree
=
"<group>"
;
};
CDAD97B0262042B2007FCFB1
/* MapButton.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapButton.swift
;
sourceTree
=
"<group>"
;
};
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapTimeControlView.swift
;
sourceTree
=
"<group>"
;
};
CDAD97B326207D14007FCFB1
/* MapTimeControlView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MapTimeControlView.swift
;
sourceTree
=
"<group>"
;
};
CDC3F857269460E600AAE3BF
/* PromotionMediumWidgetView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PromotionMediumWidgetView.swift
;
sourceTree
=
"<group>"
;
};
CDC3F857269460E600AAE3BF
/* PromotionMediumWidgetView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PromotionMediumWidgetView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -674,7 +672,6 @@
...
@@ -674,7 +672,6 @@
CD1237DA255D5DFA00C98139
/* PG.playground */
,
CD1237DA255D5DFA00C98139
/* PG.playground */
,
87C171E725FF79CC00DA3464
/* Configuration */
,
87C171E725FF79CC00DA3464
/* Configuration */
,
CE9D181425ECB8370028D9D7
/* Common */
,
CE9D181425ECB8370028D9D7
/* Common */
,
CDAD462A26A95EB800690CB1
/* Widget */
,
CEAFF09925DFC78200DF4EBF
/* Network */
,
CEAFF09925DFC78200DF4EBF
/* Network */
,
CEAFF08125DFC66F00DF4EBF
/* Model */
,
CEAFF08125DFC66F00DF4EBF
/* Model */
,
CD647D0025ED07AF0034578B
/* ViewModels */
,
CD647D0025ED07AF0034578B
/* ViewModels */
,
...
@@ -1098,14 +1095,6 @@
...
@@ -1098,14 +1095,6 @@
path
=
Cells
;
path
=
Cells
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
CDAD462A26A95EB800690CB1
/* Widget */
=
{
isa
=
PBXGroup
;
children
=
(
CDAD462B26A95ED800690CB1
/* WidgetManager.swift */
,
);
path
=
Widget
;
sourceTree
=
"<group>"
;
};
CDAD97AF26204285007FCFB1
/* Controls */
=
{
CDAD97AF26204285007FCFB1
/* Controls */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -1888,7 +1877,6 @@
...
@@ -1888,7 +1877,6 @@
CD82300A25D6B2AF00A05501
/* AppTabBarController.swift in Sources */
,
CD82300A25D6B2AF00A05501
/* AppTabBarController.swift in Sources */
,
CDC6126225E8DAB800188DA7
/* MoonPhaseCell.swift in Sources */
,
CDC6126225E8DAB800188DA7
/* MoonPhaseCell.swift in Sources */
,
CD37D3D6260C93B3002669D6
/* MenuCellFactory.swift in Sources */
,
CD37D3D6260C93B3002669D6
/* MenuCellFactory.swift in Sources */
,
CDAD462C26A95ED800690CB1
/* WidgetManager.swift in Sources */
,
CD8B60AD263819400055CB3F
/* NWSAlertInfoBlockTableViewCell.swift in Sources */
,
CD8B60AD263819400055CB3F
/* NWSAlertInfoBlockTableViewCell.swift in Sources */
,
87D815AC2636D61D0015A6D1
/* NWSAlertViewModel.swift in Sources */
,
87D815AC2636D61D0015A6D1
/* NWSAlertViewModel.swift in Sources */
,
CD37D3FA260DF714002669D6
/* SettingsThemeCell.swift in Sources */
,
CD37D3FA260DF714002669D6
/* SettingsThemeCell.swift in Sources */
,
...
...
1Weather/AppDelegate.swift
View file @
d556d22e
...
@@ -152,7 +152,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -152,7 +152,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
LocationManager
.
shared
.
updateEverythingIfNeeded
()
LocationManager
.
shared
.
updateEverythingIfNeeded
()
if
#available(iOS 14, *)
{
if
#available(iOS 14, *)
{
WidgetManager
.
shared
.
update
()
WidgetManager
.
shared
.
refreshAnalytics
()
}
}
}
}
...
...
OneWeatherAnalytics/OneWeatherAnalytics/AnalyticsEvent.swift
View file @
d556d22e
...
@@ -97,6 +97,7 @@ public enum AnalyticsEvent: String {
...
@@ -97,6 +97,7 @@ public enum AnalyticsEvent: String {
case
ANALYTICS_WIDGET_LAUNCH_FROM
=
"LAUNCH_FROM_WIDGET"
case
ANALYTICS_WIDGET_LAUNCH_FROM
=
"LAUNCH_FROM_WIDGET"
case
ANALYTICS_WIDGET_PLACED
=
"WIDGET_PLACED"
case
ANALYTICS_WIDGET_PLACED
=
"WIDGET_PLACED"
case
ANALYTICS_WIDGET_REMOVED
=
"WIDGET_REMOVED"
case
ANALYTICS_WIDGET_REMOVED
=
"WIDGET_REMOVED"
case
ANALYTICS_WIDGET_UPDATED
=
"WIDGET_UPDATED"
/// When widget is placed to the home screen
/// When widget is placed to the home screen
case
ANALYTICS_WIDGET_TEMP_SMALL_PLACE
=
"IOS_SMALL_WIDGET_PLACED"
case
ANALYTICS_WIDGET_TEMP_SMALL_PLACE
=
"IOS_SMALL_WIDGET_PLACED"
...
...
OneWeatherCore/OneWeatherCore.xcodeproj/project.pbxproj
View file @
d556d22e
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
CD2D55E0265537DC007B70F4
/* NWSAlertInfoBlock.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD2D55DF265537DC007B70F4
/* NWSAlertInfoBlock.swift */
;
};
CD2D55E0265537DC007B70F4
/* NWSAlertInfoBlock.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD2D55DF265537DC007B70F4
/* NWSAlertInfoBlock.swift */
;
};
CD3883972657AFE00070FD6F
/* Settings.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FCD265529DE00B717DB
/* Settings.swift */
;
};
CD3883972657AFE00070FD6F
/* Settings.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD615FCD265529DE00B717DB
/* Settings.swift */
;
};
CD3883EC2657B83D0070FD6F
/* FIPSResponse.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD3883EB2657B83D0070FD6F
/* FIPSResponse.swift */
;
};
CD3883EC2657B83D0070FD6F
/* FIPSResponse.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD3883EB2657B83D0070FD6F
/* FIPSResponse.swift */
;
};
CD440A5526AAB9F200A35A27
/* WidgetManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD440A5426AAB9F200A35A27
/* WidgetManager.swift */
;
};
CD550FBA265531A100257FB5
/* RadarLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD550FB52655318D00257FB5
/* RadarLayer.swift */
;
};
CD550FBA265531A100257FB5
/* RadarLayer.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD550FB52655318D00257FB5
/* RadarLayer.swift */
;
};
CD550FBB265531A100257FB5
/* RadarLayerType.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD550FB62655318D00257FB5
/* RadarLayerType.swift */
;
};
CD550FBB265531A100257FB5
/* RadarLayerType.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD550FB62655318D00257FB5
/* RadarLayerType.swift */
;
};
CD550FBC265531A100257FB5
/* WeatherLayerType.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD550FB72655318D00257FB5
/* WeatherLayerType.swift */
;
};
CD550FBC265531A100257FB5
/* WeatherLayerType.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
CD550FB72655318D00257FB5
/* WeatherLayerType.swift */
;
};
...
@@ -120,6 +121,7 @@
...
@@ -120,6 +121,7 @@
CD2D55DC2655377F007B70F4
/* NWSSeverityLevel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NWSSeverityLevel.swift
;
sourceTree
=
"<group>"
;
};
CD2D55DC2655377F007B70F4
/* NWSSeverityLevel.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NWSSeverityLevel.swift
;
sourceTree
=
"<group>"
;
};
CD2D55DF265537DC007B70F4
/* NWSAlertInfoBlock.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NWSAlertInfoBlock.swift
;
sourceTree
=
"<group>"
;
};
CD2D55DF265537DC007B70F4
/* NWSAlertInfoBlock.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NWSAlertInfoBlock.swift
;
sourceTree
=
"<group>"
;
};
CD3883EB2657B83D0070FD6F
/* FIPSResponse.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FIPSResponse.swift
;
sourceTree
=
"<group>"
;
};
CD3883EB2657B83D0070FD6F
/* FIPSResponse.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
FIPSResponse.swift
;
sourceTree
=
"<group>"
;
};
CD440A5426AAB9F200A35A27
/* WidgetManager.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WidgetManager.swift
;
sourceTree
=
"<group>"
;
};
CD550FB52655318D00257FB5
/* RadarLayer.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RadarLayer.swift
;
sourceTree
=
"<group>"
;
};
CD550FB52655318D00257FB5
/* RadarLayer.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RadarLayer.swift
;
sourceTree
=
"<group>"
;
};
CD550FB62655318D00257FB5
/* RadarLayerType.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RadarLayerType.swift
;
sourceTree
=
"<group>"
;
};
CD550FB62655318D00257FB5
/* RadarLayerType.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RadarLayerType.swift
;
sourceTree
=
"<group>"
;
};
CD550FB72655318D00257FB5
/* WeatherLayerType.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WeatherLayerType.swift
;
sourceTree
=
"<group>"
;
};
CD550FB72655318D00257FB5
/* WeatherLayerType.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
WeatherLayerType.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -443,6 +445,7 @@
...
@@ -443,6 +445,7 @@
CDD2F8F42665117400B48322
/* NWSAlertsManager.swift */
,
CDD2F8F42665117400B48322
/* NWSAlertsManager.swift */
,
CD9FE61926662B4F002DC9CD
/* DeepLinksRouterProtocol.swift */
,
CD9FE61926662B4F002DC9CD
/* DeepLinksRouterProtocol.swift */
,
CD6C22EF26677E0200D75659
/* PushNotificationsManagerProtocol.swift */
,
CD6C22EF26677E0200D75659
/* PushNotificationsManagerProtocol.swift */
,
CD440A5426AAB9F200A35A27
/* WidgetManager.swift */
,
);
);
path
=
Managers
;
path
=
Managers
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -690,6 +693,7 @@
...
@@ -690,6 +693,7 @@
CD11AFE726651BF900EC4BA0
/* LegacyWdtLocation.swift in Sources */
,
CD11AFE726651BF900EC4BA0
/* LegacyWdtLocation.swift in Sources */
,
CD615FC82655295C00B717DB
/* CACornerMask+All.swift in Sources */
,
CD615FC82655295C00B717DB
/* CACornerMask+All.swift in Sources */
,
CEFE851E2694C477003C67D3
/* SmartTextMacro.swift in Sources */
,
CEFE851E2694C477003C67D3
/* SmartTextMacro.swift in Sources */
,
CD440A5526AAB9F200A35A27
/* WidgetManager.swift in Sources */
,
CD11AFE326651B6300EC4BA0
/* LegacyMigrationManager.swift in Sources */
,
CD11AFE326651B6300EC4BA0
/* LegacyMigrationManager.swift in Sources */
,
CD2D55DD2655377F007B70F4
/* NWSAlertExtendedInfo.swift in Sources */
,
CD2D55DD2655377F007B70F4
/* NWSAlertExtendedInfo.swift in Sources */
,
CD615FC92655295C00B717DB
/* UIDevice+Convenience.swift in Sources */
,
CD615FC92655295C00B717DB
/* UIDevice+Convenience.swift in Sources */
,
...
...
1Weather/Widget
/WidgetManager.swift
→
OneWeatherCore/OneWeatherCore/Managers
/WidgetManager.swift
View file @
d556d22e
...
@@ -93,8 +93,8 @@ private struct WidgetOptions: OptionSet {
...
@@ -93,8 +93,8 @@ private struct WidgetOptions: OptionSet {
}
}
@available(iOS 14, *)
@available(iOS 14, *)
class
WidgetManager
{
public
class
WidgetManager
{
static
let
shared
=
WidgetManager
()
public
static
let
shared
=
WidgetManager
()
private
init
()
{
private
init
()
{
//Load stored options
//Load stored options
let
storedWidgetsOptions
=
UserDefaults
.
standard
.
integer
(
forKey
:
"widgetOptions"
)
let
storedWidgetsOptions
=
UserDefaults
.
standard
.
integer
(
forKey
:
"widgetOptions"
)
...
@@ -103,7 +103,7 @@ class WidgetManager {
...
@@ -103,7 +103,7 @@ class WidgetManager {
private
let
log
=
Logger
(
componentName
:
"WidgetManager"
)
private
let
log
=
Logger
(
componentName
:
"WidgetManager"
)
private
var
widgetOptions
:
WidgetOptions
=
[]
private
var
widgetOptions
:
WidgetOptions
=
[]
func
update
()
{
public
func
refreshAnalytics
()
{
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
):
...
@@ -114,7 +114,7 @@ class WidgetManager {
...
@@ -114,7 +114,7 @@ class WidgetManager {
}
}
}
}
func
handle
(
_
deepLink
:
URL
)
{
public
func
handle
(
_
deepLink
:
URL
)
{
guard
let
option
=
WidgetOptions
.
option
(
forDeepLink
:
deepLink
)
else
{
guard
let
option
=
WidgetOptions
.
option
(
forDeepLink
:
deepLink
)
else
{
return
return
}
}
...
@@ -124,6 +124,23 @@ class WidgetManager {
...
@@ -124,6 +124,23 @@ class WidgetManager {
params
:
[
.
ANALYTICS_KEY_WIDGET_NAME
:
name
])
params
:
[
.
ANALYTICS_KEY_WIDGET_NAME
:
name
])
}
}
public
func
logUpdate
()
{
WidgetCenter
.
shared
.
getCurrentConfigurations
{[
weak
self
]
result
in
switch
result
{
case
.
success
(
let
widgetInfo
):
for
info
in
widgetInfo
{
if
let
option
=
WidgetOptions
.
option
(
forKind
:
info
.
kind
,
family
:
info
.
family
)
{
let
name
=
WidgetOptions
.
name
(
for
:
option
)
AppAnalytics
.
shared
.
log
(
event
:
.
ANALYTICS_WIDGET_UPDATED
,
params
:
[
.
ANALYTICS_KEY_WIDGET_NAME
:
name
])
}
}
case
.
failure
(
let
error
):
self
?
.
log
.
error
(
error
.
localizedDescription
)
}
}
}
private
func
sync
(
with
widgetInfo
:
[
WidgetInfo
])
{
private
func
sync
(
with
widgetInfo
:
[
WidgetInfo
])
{
var
currentOptions
:
WidgetOptions
=
[]
var
currentOptions
:
WidgetOptions
=
[]
widgetInfo
.
forEach
{
widgetInfo
.
forEach
{
...
...
OneWeatherWidget/Data/WeatherProvider.swift
View file @
d556d22e
...
@@ -13,6 +13,7 @@ import BlendHealthSource
...
@@ -13,6 +13,7 @@ import BlendHealthSource
import
BlendFIPSSource
import
BlendFIPSSource
import
DelayedSaveStorage
import
DelayedSaveStorage
import
CoreDataStorage
import
CoreDataStorage
import
OneWeatherAnalytics
class
WeatherProvider
:
TimelineProvider
{
class
WeatherProvider
:
TimelineProvider
{
typealias
Entry
=
WeatherEntry
typealias
Entry
=
WeatherEntry
...
@@ -64,9 +65,14 @@ class WeatherProvider: TimelineProvider {
...
@@ -64,9 +65,14 @@ class WeatherProvider: TimelineProvider {
func
getTimeline
(
in
context
:
Context
,
completion
:
@escaping
(
Timeline
<
WeatherEntry
>
)
->
Void
)
{
func
getTimeline
(
in
context
:
Context
,
completion
:
@escaping
(
Timeline
<
WeatherEntry
>
)
->
Void
)
{
getUpToDateLocation
{
location
in
getUpToDateLocation
{
location
in
guard
let
fetchedLocation
=
location
else
{
return
}
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
:
l
ocation
,
date
:
nextRefresh
)
let
entry
=
WeatherEntry
(
location
:
fetchedL
ocation
,
date
:
nextRefresh
)
let
timeline
=
Timeline
(
entries
:
[
entry
],
policy
:
.
atEnd
)
let
timeline
=
Timeline
(
entries
:
[
entry
],
policy
:
.
atEnd
)
WidgetManager
.
shared
.
logUpdate
()
completion
(
timeline
)
completion
(
timeline
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment