Skip to content

Commit 7139cc6

Browse files
committed
added different logic to importing and exporting list of domains, new CTA added
1 parent 841de0f commit 7139cc6

15 files changed

+1165
-109
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icn_close_filled.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"preserves-vector-representation" : true
14+
}
15+
}
Binary file not shown.

FirewallUtilities.swift

+51-24
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func setupFirewallDefaultBlockLists() {
174174
var lockdownBlockedDomains = getLockdownBlockedDomains()
175175

176176
let snapchatAnalytics = LockdownGroup.init(
177-
version: 27,
177+
version: 28,
178178
internalID: "snapchatAnalytics",
179179
name: NSLocalizedString("Snapchat Trackers", comment: "The title of a list of trackers"),
180180
iconURL: "snapchat_analytics_icon",
@@ -183,7 +183,7 @@ func setupFirewallDefaultBlockLists() {
183183
ipRanges: [:])
184184

185185
let gameAds = LockdownGroup.init(
186-
version: 30,
186+
version: 31,
187187
internalID: "gameAds",
188188
name: NSLocalizedString("Game Marketing", comment: "The title of a list of trackers"),
189189
iconURL: "game_ads_icon",
@@ -193,7 +193,7 @@ func setupFirewallDefaultBlockLists() {
193193
accessLevel: "basic")
194194

195195
let clickbait = LockdownGroup.init(
196-
version: 29,
196+
version: 30,
197197
internalID: "clickbait",
198198
name: NSLocalizedString("Clickbait", comment: "The title of a list of trackers"),
199199
iconURL: "clickbait_icon",
@@ -203,7 +203,7 @@ func setupFirewallDefaultBlockLists() {
203203
accessLevel: "basic")
204204

205205
let emailOpens = LockdownGroup.init(
206-
version: 30,
206+
version: 31,
207207
internalID: "email_opens",
208208
name: NSLocalizedString("Email Trackers", comment: "The title of a list of trackers"),
209209
iconURL: "email_icon",
@@ -213,7 +213,7 @@ func setupFirewallDefaultBlockLists() {
213213
accessLevel: "basic")
214214

215215
let facebookInc = LockdownGroup.init(
216-
version: 33,
216+
version: 34,
217217
internalID: "facebook_inc",
218218
name: NSLocalizedString("Facebook & WhatsApp", comment: "The title of a list of trackers"),
219219
iconURL: "facebook_icon",
@@ -223,7 +223,7 @@ func setupFirewallDefaultBlockLists() {
223223
warning: "This list is intended to completely block Facebook-owned apps. Do not enable it if you use apps owned by Facebook like WhatsApp, Facebook Messenger, and Instagram.")
224224

225225
let facebookSDK = LockdownGroup.init(
226-
version: 28,
226+
version: 29,
227227
internalID: "facebook_sdk",
228228
name: NSLocalizedString("Facebook Trackers", comment: "The title of a list of trackers"),
229229
iconURL: "facebook_white_icon",
@@ -233,7 +233,7 @@ func setupFirewallDefaultBlockLists() {
233233
accessLevel: "basic")
234234

235235
let marketingScripts = LockdownGroup.init(
236-
version: 31,
236+
version: 32,
237237
internalID: "marketing_scripts",
238238
name: NSLocalizedString("Marketing Trackers", comment: "The title of a list of trackers"),
239239
iconURL: "marketing_icon",
@@ -243,7 +243,7 @@ func setupFirewallDefaultBlockLists() {
243243
accessLevel: "basic")
244244

245245
let marketingScriptsII = LockdownGroup.init(
246-
version: 30,
246+
version: 31,
247247
internalID: "marketing_beta_scripts",
248248
name: NSLocalizedString("Marketing Trackers II", comment: "The title of a list of trackers"),
249249
iconURL: "marketing_icon",
@@ -252,7 +252,7 @@ func setupFirewallDefaultBlockLists() {
252252
ipRanges: [:])
253253

254254
let googleShoppingAds = LockdownGroup.init(
255-
version: 35,
255+
version: 36,
256256
internalID: "google_shopping_ads",
257257
name: NSLocalizedString("Google Shopping", comment: "The title of a list of trackers"),
258258
iconURL: "google_icon",
@@ -262,7 +262,7 @@ func setupFirewallDefaultBlockLists() {
262262
warning: "This blocks background Google tracking, but also blocks the shopping results at the top of Google search results. This is on by default for maximum privacy, but if you like the Google Shopping results, you can turn blocking off.")
263263

264264
let dataTrackers = LockdownGroup.init(
265-
version: 35,
265+
version: 36,
266266
internalID: "data_trackers",
267267
name: NSLocalizedString("Data Trackers", comment: "The title of a list of trackers"),
268268
iconURL: "user_data_icon",
@@ -272,7 +272,7 @@ func setupFirewallDefaultBlockLists() {
272272
accessLevel: "basic")
273273

274274
let generalAds = LockdownGroup.init(
275-
version: 40,
275+
version: 41,
276276
internalID: "general_ads",
277277
name: NSLocalizedString("General Marketing", comment: "The title of a list of trackers"),
278278
iconURL: "ads_icon",
@@ -282,7 +282,7 @@ func setupFirewallDefaultBlockLists() {
282282
accessLevel: "basic")
283283

284284
let reporting = LockdownGroup.init(
285-
version: 29,
285+
version: 30,
286286
internalID: "reporting",
287287
name: NSLocalizedString("Reporting", comment: "The title of a list of trackers"),
288288
iconURL: "reporting_icon",
@@ -292,7 +292,7 @@ func setupFirewallDefaultBlockLists() {
292292
accessLevel: "basic")
293293

294294
let amazonTrackers = LockdownGroup.init(
295-
version: 32,
295+
version: 33,
296296
internalID: "amazon_trackers",
297297
name: NSLocalizedString("Amazon Trackers", comment: "The title of a list of trackers"),
298298
iconURL: "amazon_icon",
@@ -303,7 +303,7 @@ func setupFirewallDefaultBlockLists() {
303303
accessLevel: "basic")
304304

305305
let ifunnyTrackers = LockdownGroup.init(
306-
version: 2,
306+
version: 3,
307307
internalID: "ifunnyTrackers",
308308
name: NSLocalizedString("iFunny Trackers", comment: "The title of a list of trackers"),
309309
iconURL: "icn_vpn",
@@ -312,7 +312,7 @@ func setupFirewallDefaultBlockLists() {
312312
ipRanges: [:])
313313

314314
let advancedGaming = LockdownGroup.init(
315-
version: 2,
315+
version: 3,
316316
internalID: "advancedGaming",
317317
name: NSLocalizedString("Advanced Gaming", comment: "The title of a list of trackers"),
318318
iconURL: "icn_vpn",
@@ -321,7 +321,7 @@ func setupFirewallDefaultBlockLists() {
321321
ipRanges: [:])
322322

323323
let tiktokTrackers = LockdownGroup.init(
324-
version: 1,
324+
version: 2,
325325
internalID: "tiktokTrackers",
326326
name: NSLocalizedString("Tiktok Trackers", comment: "The title of a list of trackers"),
327327
iconURL: "icn_vpn",
@@ -330,7 +330,7 @@ func setupFirewallDefaultBlockLists() {
330330
ipRanges: [:])
331331

332332
let scams = LockdownGroup.init(
333-
version: 2,
333+
version: 3,
334334
internalID: "scams",
335335
name: NSLocalizedString("Scams", comment: "The title of a list of trackers"),
336336
iconURL: "icn_vpn",
@@ -339,7 +339,7 @@ func setupFirewallDefaultBlockLists() {
339339
ipRanges: [:])
340340

341341
let junesJourneyTrackers = LockdownGroup.init(
342-
version: 2,
342+
version: 3,
343343
internalID: "junesJourneyTrackers",
344344
name: NSLocalizedString("Junes Journey Trackers", comment: "The title of a list of trackers"),
345345
iconURL: "icn_vpn",
@@ -348,7 +348,7 @@ func setupFirewallDefaultBlockLists() {
348348
ipRanges: [:])
349349

350350
let advancedAnalytics = LockdownGroup.init(
351-
version: 1,
351+
version: 2,
352352
internalID: "advancedAnalytics",
353353
name: NSLocalizedString("Advanced Analytics", comment: "The title of a list of trackers"),
354354
iconURL: "icn_vpn",
@@ -577,27 +577,54 @@ extension UserBlockListsGroup {
577577
}
578578

579579
func exportToURL() -> URL? {
580-
let timeStamp = generateCurrentTimeStamp()
581-
let fileName = "LOCKDOWN_\(NSDate.now)"
582-
guard let encoded = try? JSONEncoder().encode(self) else { return nil }
580+
var csvString = ""
581+
582+
for domain in domains {
583+
csvString = csvString.appending("\(domain)\r\n")
584+
}
583585

584586
let documents = FileManager.default.urls(
585587
for: .documentDirectory,
586588
in: .userDomainMask
587589
).first
588590

591+
let fileName = "LOCKDOWN_\(NSDate.now)"
592+
589593
guard let path = documents?.appendingPathComponent("/\(fileName).csv") else {
590594
return nil
591595
}
592596

593597
do {
594-
try encoded.write(to: path, options: .atomicWrite)
595-
print(fileName)
598+
try csvString.write(to: path, atomically: true, encoding: .utf8)
596599
return path
597600
} catch {
598601
print(error.localizedDescription)
599602
return nil
600603
}
604+
605+
606+
607+
608+
609+
// guard let encoded = try? JSONEncoder().encode(self) else { return nil }
610+
//
611+
// let documents = FileManager.default.urls(
612+
// for: .documentDirectory,
613+
// in: .userDomainMask
614+
// ).first
615+
//
616+
// guard let path = documents?.appendingPathComponent("/\(fileName).csv") else {
617+
// return nil
618+
// }
619+
//
620+
// do {
621+
// try encoded.write(to: path, options: .atomicWrite)
622+
// print(fileName)
623+
// return path
624+
// } catch {
625+
// print(error.localizedDescription)
626+
// return nil
627+
// }
601628
}
602629

603630
static func importData(from url: URL) {

0 commit comments

Comments
 (0)