Skip to content
This repository was archived by the owner on Jun 23, 2020. It is now read-only.

Commit 4c52e23

Browse files
authored
Initialize logo db only once: CLIQZ-IOS-1657 (#473)
1 parent 1d9dfdd commit 4c52e23

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Cliqz/Services/LogoLoader.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class LogoLoader {
3939
private static let dbVersion = "1537258816173"
4040
private static let dispatchQueue = DispatchQueue(label: "com.cliqz.logoLoader", attributes: .concurrent);
4141

42-
private lazy var logoDB: JSON? = {
42+
private static var LogoDB: JSON? = {
4343
if let path = Bundle.main.path(forResource: "logo-database", ofType: "json"),
4444
let jsonData = try? Data(contentsOf: URL(fileURLWithPath: path), options: .mappedIfSafe) as Data {
4545
return JSON(jsonData)
@@ -88,7 +88,7 @@ class LogoLoader {
8888
if
8989
let domainName = self.domainName(fixedURL), //URLParser.getURLDetails(fixedURL),
9090
let hostName = URL(string: fixedURL)?.host,
91-
let db = self.logoDB?.dictionary,
91+
let db = LogoLoader.LogoDB?.dictionary,
9292
let details = db["domains"]?.dictionary
9393
{
9494
logoDetails.hostName = domainName
@@ -130,7 +130,7 @@ class LogoLoader {
130130
if logoDetails.color == nil {
131131
logoDetails.color = "000000"
132132
if
133-
let db = self.logoDB?.dictionary,
133+
let db = LogoLoader.LogoDB?.dictionary,
134134
let list = db["palette"]?.array,
135135
let asciiVal = logoDetails.hostName?.asciiValue()
136136
{

0 commit comments

Comments
 (0)