Commit 1f1e9901 by Dmitriy Stepanets

Renamed Analytics class to AppAnalytics. Added fade in animation to splash screen.

parent 2063a98a
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
CEF9596C2600C32E00975FAA /* AnalyticsEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF9596B2600C32E00975FAA /* AnalyticsEvent.swift */; }; CEF9596C2600C32E00975FAA /* AnalyticsEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF9596B2600C32E00975FAA /* AnalyticsEvent.swift */; };
CEF959742600C3A400975FAA /* FlurryAnalyticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959732600C3A400975FAA /* FlurryAnalyticsService.swift */; }; CEF959742600C3A400975FAA /* FlurryAnalyticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959732600C3A400975FAA /* FlurryAnalyticsService.swift */; };
CEF959902600C5A800975FAA /* MoEngageAnalyticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF9598F2600C5A800975FAA /* MoEngageAnalyticsService.swift */; }; CEF959902600C5A800975FAA /* MoEngageAnalyticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF9598F2600C5A800975FAA /* MoEngageAnalyticsService.swift */; };
CEF959932600C63500975FAA /* Analytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959922600C63500975FAA /* Analytics.swift */; }; CEF959932600C63500975FAA /* AppAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959922600C63500975FAA /* AppAnalytics.swift */; };
CEF959982600C88100975FAA /* AnalyticsParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959972600C88100975FAA /* AnalyticsParameter.swift */; }; CEF959982600C88100975FAA /* AnalyticsParameter.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959972600C88100975FAA /* AnalyticsParameter.swift */; };
CEF959A626035A2600975FAA /* DeviceLocationMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959A526035A2600975FAA /* DeviceLocationMonitor.swift */; }; CEF959A626035A2600975FAA /* DeviceLocationMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF959A526035A2600975FAA /* DeviceLocationMonitor.swift */; };
CEFB857226174F7A00C5CDD2 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEFB857126174F7A00C5CDD2 /* Storage.swift */; }; CEFB857226174F7A00C5CDD2 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEFB857126174F7A00C5CDD2 /* Storage.swift */; };
...@@ -623,7 +623,7 @@ ...@@ -623,7 +623,7 @@
CEF9596B2600C32E00975FAA /* AnalyticsEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsEvent.swift; sourceTree = "<group>"; }; CEF9596B2600C32E00975FAA /* AnalyticsEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsEvent.swift; sourceTree = "<group>"; };
CEF959732600C3A400975FAA /* FlurryAnalyticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlurryAnalyticsService.swift; sourceTree = "<group>"; }; CEF959732600C3A400975FAA /* FlurryAnalyticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlurryAnalyticsService.swift; sourceTree = "<group>"; };
CEF9598F2600C5A800975FAA /* MoEngageAnalyticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoEngageAnalyticsService.swift; sourceTree = "<group>"; }; CEF9598F2600C5A800975FAA /* MoEngageAnalyticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoEngageAnalyticsService.swift; sourceTree = "<group>"; };
CEF959922600C63500975FAA /* Analytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Analytics.swift; sourceTree = "<group>"; }; CEF959922600C63500975FAA /* AppAnalytics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAnalytics.swift; sourceTree = "<group>"; };
CEF959972600C88100975FAA /* AnalyticsParameter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsParameter.swift; sourceTree = "<group>"; }; CEF959972600C88100975FAA /* AnalyticsParameter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalyticsParameter.swift; sourceTree = "<group>"; };
CEF959A526035A2600975FAA /* DeviceLocationMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceLocationMonitor.swift; sourceTree = "<group>"; }; CEF959A526035A2600975FAA /* DeviceLocationMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeviceLocationMonitor.swift; sourceTree = "<group>"; };
CEFB857126174F7A00C5CDD2 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = "<group>"; }; CEFB857126174F7A00C5CDD2 /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = "<group>"; };
...@@ -1611,7 +1611,7 @@ ...@@ -1611,7 +1611,7 @@
CEF959682600C30500975FAA /* AnalyticsGlobal.swift */, CEF959682600C30500975FAA /* AnalyticsGlobal.swift */,
CEF9596B2600C32E00975FAA /* AnalyticsEvent.swift */, CEF9596B2600C32E00975FAA /* AnalyticsEvent.swift */,
CEF959972600C88100975FAA /* AnalyticsParameter.swift */, CEF959972600C88100975FAA /* AnalyticsParameter.swift */,
CEF959922600C63500975FAA /* Analytics.swift */, CEF959922600C63500975FAA /* AppAnalytics.swift */,
CEF959952600C84D00975FAA /* Services */, CEF959952600C84D00975FAA /* Services */,
); );
path = Analytics; path = Analytics;
...@@ -2163,7 +2163,7 @@ ...@@ -2163,7 +2163,7 @@
CEE0A1A226317A3F0044C257 /* NWSSeverityLevel.swift in Sources */, CEE0A1A226317A3F0044C257 /* NWSSeverityLevel.swift in Sources */,
CD86246525E66E8A0097F3FB /* PrecipitationCell.swift in Sources */, CD86246525E66E8A0097F3FB /* PrecipitationCell.swift in Sources */,
CD80917B2578E4A8003541A4 /* UIViewController+Alert.swift in Sources */, CD80917B2578E4A8003541A4 /* UIViewController+Alert.swift in Sources */,
CEF959932600C63500975FAA /* Analytics.swift in Sources */, CEF959932600C63500975FAA /* AppAnalytics.swift in Sources */,
CEE0A1A426317A8F0044C257 /* NWSAlertInfoParser.swift in Sources */, CEE0A1A426317A8F0044C257 /* NWSAlertInfoParser.swift in Sources */,
CEBAC1C62638236D00A89681 /* PushNotificationsManager.swift in Sources */, CEBAC1C62638236D00A89681 /* PushNotificationsManager.swift in Sources */,
CE13B821262480B3007CBD4D /* Scheduler.swift in Sources */, CE13B821262480B3007CBD4D /* Scheduler.swift in Sources */,
......
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
import Foundation import Foundation
public func analytics(log event: AnalyticsEvent, params: [AnalyticsParameter: Any]? = nil) { public func analytics(log event: AnalyticsEvent, params: [AnalyticsParameter: Any]? = nil) {
Analytics.shared.log(event: event, params: params) AppAnalytics.shared.log(event: event, params: params)
} }
// //
// Analytics.swift // AppAnalytics.swift
// 1Weather // 1Weather
// //
// Created by Demid Merzlyakov on 16.03.2021. // Created by Demid Merzlyakov on 16.03.2021.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import Foundation import Foundation
public class Analytics { public class AppAnalytics {
private let services: [AnalyticsService] private let services: [AnalyticsService]
private let log = Logger(componentName: "⬜ Analytics") private let log = Logger(componentName: "⬜ Analytics")
...@@ -15,7 +15,7 @@ public class Analytics { ...@@ -15,7 +15,7 @@ public class Analytics {
self.services = services self.services = services
} }
public static let shared = Analytics(services: [FlurryAnalyticsService(), MoEngageAnalyticsService(), AppsFlyerAnalyticsService()]) public static let shared = AppAnalytics(services: [FlurryAnalyticsService(), MoEngageAnalyticsService(), AppsFlyerAnalyticsService()])
public func log(event: AnalyticsEvent, params: [AnalyticsParameter: Any]? = nil) { public func log(event: AnalyticsEvent, params: [AnalyticsParameter: Any]? = nil) {
var loggedTo = [String]() var loggedTo = [String]()
......
...@@ -36,7 +36,11 @@ final class Logger { ...@@ -36,7 +36,11 @@ final class Logger {
guard level.rawValue >= minLogLevel.rawValue else { guard level.rawValue >= minLogLevel.rawValue else {
return return
} }
onMain {
Crashlytics.crashlytics().log(message) Crashlytics.crashlytics().log(message)
}
let prefix = "\(Logger.prefix) \(componentName) [\(logLevelString(level: level))]" let prefix = "\(Logger.prefix) \(componentName) [\(logLevelString(level: level))]"
if message.count < maxCharsPerMessage { if message.count < maxCharsPerMessage {
NSLog("\(prefix): \(message)") NSLog("\(prefix): \(message)")
......
...@@ -44,13 +44,8 @@ class AppCoordinator: Coordinator { ...@@ -44,13 +44,8 @@ class AppCoordinator: Coordinator {
tabBarController.setupTabBar() tabBarController.setupTabBar()
if Settings.shared.locationDidAdded {
window.rootViewController = tabBarController
}
else {
let animationController = SplashAnimationViewController(appCoordinator: self) let animationController = SplashAnimationViewController(appCoordinator: self)
window.rootViewController = animationController window.rootViewController = animationController
}
self.window.makeKeyAndVisible() self.window.makeKeyAndVisible()
} }
......
...@@ -13,6 +13,7 @@ import IASDKCore ...@@ -13,6 +13,7 @@ import IASDKCore
import MoEngage import MoEngage
import Flurry_iOS_SDK import Flurry_iOS_SDK
import Firebase import Firebase
import FirebaseCoreDiagnostics
import CommonCrypto import CommonCrypto
import CryptoKit import CryptoKit
import FBAudienceNetwork import FBAudienceNetwork
...@@ -148,8 +149,8 @@ class CCPAHelper { ...@@ -148,8 +149,8 @@ class CCPAHelper {
} }
// Firebase // Firebase
Firebase.Analytics.setUserProperty(canCollectData ? "true" : "false", forName: AnalyticsUserPropertyAllowAdPersonalizationSignals) Analytics.setUserProperty(canCollectData ? "true" : "false", forName: AnalyticsUserPropertyAllowAdPersonalizationSignals)
Firebase.Analytics.setAnalyticsCollectionEnabled(canCollectData) Analytics.setAnalyticsCollectionEnabled(canCollectData)
PSMLocation.sharedInstance().halted = !canCollectData PSMLocation.sharedInstance().halted = !canCollectData
......
...@@ -119,7 +119,7 @@ public class LocationManager { ...@@ -119,7 +119,7 @@ public class LocationManager {
return _selectedLocationIndex return _selectedLocationIndex
} }
set { set {
if !Settings.shared.locationDidAdded { if !Settings.shared.locationDidAdded && newValue != nil {
Settings.shared.locationDidAdded = true Settings.shared.locationDidAdded = true
} }
_selectedLocationIndex = newValue _selectedLocationIndex = newValue
...@@ -268,7 +268,6 @@ public class LocationManager { ...@@ -268,7 +268,6 @@ public class LocationManager {
guard let legacyLocations = legacyLocations else { guard let legacyLocations = legacyLocations else {
storageLoadingCompletion(locations, selectedIndex, error) storageLoadingCompletion(locations, selectedIndex, error)
fatalError("Should never happen. Either legacyLocations or migrationError must be not nil") fatalError("Should never happen. Either legacyLocations or migrationError must be not nil")
return
} }
for location: PartialLocation in legacyLocations { for location: PartialLocation in legacyLocations {
......
...@@ -48,10 +48,32 @@ class SplashAnimationViewController: UIViewController { ...@@ -48,10 +48,32 @@ class SplashAnimationViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) { override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated) super.viewDidAppear(animated)
if Settings.shared.locationDidAdded {
cityAnimation()
}
else {
noCityAnimation()
}
}
private func noCityAnimation() {
self.animationView?.play(completion: {[weak self] _ in self.animationView?.play(completion: {[weak self] _ in
DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) { DispatchQueue.global().asyncAfter(deadline: .now() + 0.5) {
self?.appCoordinator.finishAnimation() self?.appCoordinator.finishAnimation()
} }
}) })
} }
private func cityAnimation() {
self.animationView?.alpha = 0
self.animationView?.currentProgress = 1
UIView.animate(withDuration: 0.5) {
self.animationView?.alpha = 1
} completion: { _ in
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
self.appCoordinator.finishAnimation()
}
}
}
} }
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