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
fa184468
Commit
fa184468
authored
Jun 15, 2021
by
Demid Merzlyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IOS-107: Show ATT Prompt config attribute.
parent
185adcd9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
1Weather/Configuration/LocalConfig.plist
+2
-0
1Weather/Network/ConfigManager.swift
+8
-4
No files found.
1Weather/Configuration/LocalConfig.plist
View file @
fa184468
...
...
@@ -6,6 +6,8 @@
<
string
>
[
{
&
quot
;
lat
&
quot
;
:
&
quot
;
40.7127
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-74.006
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
New
York
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
New
York
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
NY
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:1
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
41.8756
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-87.6244
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Chicago
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Illinois
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
IL
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:2
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
29.7589
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-95.3677
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Houston
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Texas
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
TX
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:3
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
34.0537
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-118.243
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Los
Angeles
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
California
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
CA
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:4
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
29.4246
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-98.4951
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
San
Antonio
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Texas
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
TX
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:5
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
39.7683
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-86.1584
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Indianapolis
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Indiana
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
IN
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:6
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
39.9527
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-75.1635
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Philadelphia
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Pennsylvania
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
PA
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:7
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
36.1673
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-115.149
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Las
Vegas
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Nevada
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
NV
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:8
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
39.9623
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-83.0007
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Columbus
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Ohio
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
OH
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:9
}
,
{
&
quot
;
lat
&
quot
;
:
&
quot
;
30.3322
&
quot
;
,&
quot
;
lon
&
quot
;
:
&
quot
;
-81.6557
&
quot
;
,&
quot
;
city
&
quot
;
:
&
quot
;
Jacksonville
&
quot
;
,&
quot
;
state
&
quot
;
:
&
quot
;
Florida
&
quot
;
,&
quot
;
stateCode
&
quot
;
:
&
quot
;
FL
&
quot
;
,&
quot
;
country
&
quot
;
:
&
quot
;
United
States
of
America
&
quot
;
,&
quot
;
countryCode
&
quot
;
:
&
quot
;
US
&
quot
;
,&
quot
;
order
&
quot
;
:10
}
]
<
/string
>
<
k
e
y
>
ios_nws_alerts_via_moengage_enabled
<
/k
e
y
>
<
tru
e
/
>
<
k
e
y
>
ios_show_att_prompt
<
/k
e
y
>
<
fa
ls
e
/
>
<
k
e
y
>
ads_config_ios
<
/k
e
y
>
<
string
>{
&
quot
;
//": "1Weather iOS built in config. Override it in the Firebase console. Note that the ads_enabled: true is needed for correct initialization after receiving a proper config.",
...
...
1Weather/Network/ConfigManager.swift
View file @
fa184468
...
...
@@ -17,12 +17,14 @@ public struct AppConfig: Codable {
public
let
adConfig
:
AdConfig
public
let
ccpaUpdateInterval
:
TimeInterval
?
public
let
nwsAlertsViaMoEngageEnabled
:
Bool
public
let
showAttPrompt
:
Bool
public
init
(
popularCities
:
[
GeoNamesPlace
]?,
adConfig
:
AdConfig
,
ccpaUpdateInterval
:
TimeInterval
?,
nwsAlertsViaMoEngageEnabled
:
Bool
)
{
public
init
(
popularCities
:
[
GeoNamesPlace
]?,
adConfig
:
AdConfig
,
ccpaUpdateInterval
:
TimeInterval
?,
nwsAlertsViaMoEngageEnabled
:
Bool
,
showAttPrompt
:
Bool
)
{
self
.
popularCities
=
popularCities
self
.
adConfig
=
adConfig
self
.
ccpaUpdateInterval
=
ccpaUpdateInterval
self
.
nwsAlertsViaMoEngageEnabled
=
nwsAlertsViaMoEngageEnabled
self
.
showAttPrompt
=
showAttPrompt
}
}
...
...
@@ -35,6 +37,7 @@ public class ConfigManager {
private
static
let
popularCitiesConfigKey
=
"search_screen_popular_cities"
private
static
let
ccpaUpdateIntervalConfigKey
=
"ccpa_update_interval_ios"
private
static
let
nwsAlertsViaMoEngageEnabledKey
=
"ios_nws_alerts_via_moengage_enabled"
private
static
let
showAttPromptKey
=
"ios_show_att_prompt"
private
let
delegates
=
MulticastDelegate
<
ConfigManagerDelegate
>
()
...
...
@@ -50,7 +53,7 @@ public class ConfigManager {
public
static
let
shared
=
ConfigManager
()
public
var
config
:
AppConfig
=
AppConfig
(
popularCities
:
nil
,
adConfig
:
AdConfig
(),
ccpaUpdateInterval
:
nil
,
nwsAlertsViaMoEngageEnabled
:
true
)
public
var
config
:
AppConfig
=
AppConfig
(
popularCities
:
nil
,
adConfig
:
AdConfig
(),
ccpaUpdateInterval
:
nil
,
nwsAlertsViaMoEngageEnabled
:
true
,
showAttPrompt
:
false
)
public
func
updateConfig
()
{
log
.
info
(
"update config"
)
...
...
@@ -122,9 +125,11 @@ public class ConfigManager {
let
nwsAlertsViaMoEngageEnabledValue
=
remoteConfig
.
configValue
(
forKey
:
ConfigManager
.
nwsAlertsViaMoEngageEnabledKey
)
let
nwsAlertsViaMoEngageEnabled
=
nwsAlertsViaMoEngageEnabledValue
.
boolValue
let
showAttPromptValue
=
remoteConfig
.
configValue
(
forKey
:
ConfigManager
.
showAttPromptKey
)
let
showAttPrompt
=
showAttPromptValue
.
boolValue
DispatchQueue
.
main
.
async
{
self
.
config
=
AppConfig
(
popularCities
:
popularCities
,
adConfig
:
adConfig
,
ccpaUpdateInterval
:
ccpaUpdateInterval
,
nwsAlertsViaMoEngageEnabled
:
nwsAlertsViaMoEngageEnabled
)
self
.
config
=
AppConfig
(
popularCities
:
popularCities
,
adConfig
:
adConfig
,
ccpaUpdateInterval
:
ccpaUpdateInterval
,
nwsAlertsViaMoEngageEnabled
:
nwsAlertsViaMoEngageEnabled
,
showAttPrompt
:
showAttPrompt
)
self
.
notifyAboutConfigUpdate
()
DispatchQueue
.
global
()
.
async
{
let
encoder
=
JSONEncoder
()
...
...
@@ -135,7 +140,6 @@ public class ConfigManager {
else
{
self
.
log
.
warning
(
"New config: failed to encode to JSON."
)
}
}
}
}
...
...
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