Commit 9432979a by Dmitry Stepanets

Merge commit '27623f2a' into release/5.4.1

parents 46752414 27623f2a
......@@ -271,6 +271,7 @@
CEC8FBB5263976400001A6BF /* OnboardingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC8FBB4263976400001A6BF /* OnboardingViewModel.swift */; };
CED4D66B26ED6A5E00ECF479 /* SubscriptionOverviewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED4D66A26ED6A5E00ECF479 /* SubscriptionOverviewCoordinator.swift */; };
CEE1150626D987C5008FE415 /* WidgetLocationSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE1150526D987C5008FE415 /* WidgetLocationSource.swift */; };
CEE798FC270D83F800218318 /* ColoredNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE798FB270D83F800218318 /* ColoredNavigationController.swift */; };
CEE8869526C30F680000161B /* OneWeatherUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CD5909CF26A59AAA00448579 /* OneWeatherUI.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
CEEB3547266F5D9900E16F90 /* BannerAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */; };
CEEB3549266F5DA900E16F90 /* MRECAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */; };
......@@ -630,6 +631,7 @@
CEC8FBB4263976400001A6BF /* OnboardingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewModel.swift; sourceTree = "<group>"; };
CED4D66A26ED6A5E00ECF479 /* SubscriptionOverviewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionOverviewCoordinator.swift; sourceTree = "<group>"; };
CEE1150526D987C5008FE415 /* WidgetLocationSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetLocationSource.swift; sourceTree = "<group>"; };
CEE798FB270D83F800218318 /* ColoredNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColoredNavigationController.swift; sourceTree = "<group>"; };
CEEB3546266F5D9900E16F90 /* BannerAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerAdCell.swift; sourceTree = "<group>"; };
CEEB3548266F5DA900E16F90 /* MRECAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MRECAdCell.swift; sourceTree = "<group>"; };
CEEF40FF265E47FF00425D8F /* BlendFIPSSource.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BlendFIPSSource.framework; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -1093,6 +1095,7 @@
CE578FE025FB415E00E8B85D /* Locations */,
CD37D3ED260DF4B8002669D6 /* Settings */,
CD82300925D6B2AF00A05501 /* AppTabBarController.swift */,
CEE798FB270D83F800218318 /* ColoredNavigationController.swift */,
);
path = "View controllers";
sourceTree = "<group>";
......@@ -2344,6 +2347,7 @@
CD50555F26983C14006776AB /* CubicCurveAlgorithm.swift in Sources */,
CDC3F858269460E600AAE3BF /* PromotionMediumWidgetView.swift in Sources */,
CD7D318B268F36AF000D01FA /* UIApplication+Version.swift in Sources */,
CEE798FC270D83F800218318 /* ColoredNavigationController.swift in Sources */,
CD86246125E662BC0097F3FB /* SunUvLineView.swift in Sources */,
CD32CE0B260C744A00235081 /* MenuCoordinator.swift in Sources */,
CD55E0BB2615EE2400CC4DC7 /* PollutantView.swift in Sources */,
......
......@@ -11,7 +11,7 @@ import OneWeatherCore
class ForecastCoordinator: Coordinator {
//Private
private let forecastViewModel = ForecastViewModel(locationManager: LocationManager.shared)
private let navigationController = UINavigationController(nibName: nil, bundle: nil)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private var tabBarController:UITabBarController?
private var forecastViewController: ForecastViewController?
......
......@@ -24,7 +24,7 @@ class NWSAlertCoordinator: Coordinator {
func start() {
let viewModel = NWSAlertViewModel(alert: alert, alertsManager: alertManager)
let viewController = NWSAlertViewController(coordinator: self, viewModel: viewModel)
let navigationController = UINavigationController(rootViewController: viewController)
let navigationController = ColoredNavigationController(rootViewController: viewController)
self.parentViewController.present(navigationController, animated: true)
}
......
......@@ -9,7 +9,7 @@ import UIKit
class RadarCoordinator: Coordinator {
//Private
private let navigationController = UINavigationController(nibName: nil, bundle: nil)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private let tabBarController:UITabBarController
//Public
......
......@@ -10,7 +10,7 @@ import UIKit
class SettingsCoordinator: Coordinator {
//Private
private let settingsViewModel = SettingsViewModel()
private let navVC = UINavigationController()
private let navVC = ColoredNavigationController()
private var parentViewController:UIViewController?
//Public
......
......@@ -14,7 +14,7 @@ protocol TodayCoordinatorDelegate: AnyObject {
class TodayCoordinator: Coordinator {
// MARK: - Private
private let navigationController = UINavigationController(nibName: nil, bundle: nil)
private let navigationController = ColoredNavigationController(nibName: nil, bundle: nil)
private var tabBarController:UITabBarController?
var todayViewController: TodayViewController?
......
//
// ColoredNavigationController.swift
// 1Weather
//
// Created by Demid Merzlyakov on 06.10.2021.
//
import UIKit
class ColoredNavigationController: UINavigationController {
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
required init?(coder: NSCoder) {
super.init(coder: coder)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
override init(nibName: String?, bundle: Bundle?) {
super.init(nibName: nibName, bundle: bundle)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
override init(navigationBarClass: AnyClass?, toolbarClass: AnyClass?) {
super.init(navigationBarClass: navigationBarClass, toolbarClass: toolbarClass)
self.view.backgroundColor = ThemeManager.currentTheme.baseBackgroundColor
}
convenience init() {
self.init(nibName: nil, bundle: nil)
}
}
......@@ -17,7 +17,7 @@ class TodayForecastCell: UITableViewCell {
private let forecastDescriptionLabel = UILabel()
private let smartTextLabel = UILabel()
private let forecastImageView = UIImageView()
private let smartTextProvider = SmartTextProvider()
private let smartTextProvider = SmartTextProvider(prioritizedSmartTexts: SmartTextProvider.defaultSmartTexts)
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
......
......@@ -96,28 +96,28 @@ public enum AnalyticsEvent: String {
case ANALYTICS_WIDGET_PROMO_LEARN_CTA = "WIDGET_PROMO_LEARN_CTA"
case ANALYTICS_WIDGET_LAUNCH_FROM = "LAUNCH_FROM_WIDGET"
///Widget actions
// MARK: Widget actions
case ANALYTICS_WIDGET_PLACED = "WIDGET_PLACED"
case ANALYTICS_WIDGET_REMOVED = "WIDGET_REMOVED"
case ANALYTICS_WIDGET_UPDATED = "WIDGET_UPDATED"
case ANALYTICS_WIDGET_CARD_CLICK = "WIDGET_CARD_CLICK"
case ANALYTICS_WIDGET_ADD_SUCCESSFUL = "WIDGET_ADD_SUCCESSFUL"
/// When widget is placed to the home screen
// MARK: When widget is placed to the home screen
case ANALYTICS_WIDGET_TEMP_SMALL_PLACE = "IOS_SMALL_WIDGET_PLACED"
case ANALYTICS_WIDGET_TEMP_PLACE = "IOS_TEMP_FORECAST_WIDGET_PLACED"
case ANALYTICS_WIDGET_PRECIP_PLACE = "IOS_PRECIP_FORECAST_WIDGET_PLACED"
case ANALYTICS_WIDGET_WIND_PLACE = "IOS_WIND_FORECAST_WIDGET_PLACED"
case ANALYTICS_WIDGET_RADAR_PLACE = "IOS_RADAR_WIDGET_PLACED"
/// When widget has been removed from home screen
// MARK: When widget has been removed from home screen
case ANALYTICS_WIDGET_TEMP_SMALL_REMOVE = "IOS_SMALL_WIDGET_REMOVED"
case ANALYTICS_WIDGET_TEMP_REMOVE = "IOS_TEMP_FORECAST_WIDGET_REMOVED"
case ANALYTICS_WIDGET_PRECIP_REMOVE = "IOS_PRECIP_FORECAST_WIDGET_REMOVED"
case ANALYTICS_WIDGET_WIND_REMOVE = "IOS_WIND_FORECAST_WIDGET_REMOVED"
case ANALYTICS_WIDGET_RADAR_REMOVE = "IOS_RADAR_WIDGET_REMOVED"
///Shorts
// MARK: Shorts
case ANALYTICS_SHORTS_SECTION_VIEW = "SHORTS_SECTION_VIEW"
case ANALYTICS_SHORTS_CARD_VIEW = "SHORTS_CARD_VIEW"
case ANALYTICS_SHORTS_CARD_CLICK = "SHORTS_CARD_CLICK"
......@@ -128,7 +128,7 @@ public enum AnalyticsEvent: String {
case ANALYTICS_SHORTS_EXIT_SHORTS_VIEW = "EXIT_SHORTS_VIEW"
case ANALYTICS_SHORTS_NUDGE_VIEW = "NUDGE_VIEW"
///Onboarding
// MARK: Onboarding
case ANALYTICS_ONBOARDING_FORECAST_SEEN = "ONBOARDING_FORECAST_SEEN"
case ANALYTICS_ONBOARDING_ALERT_SEEN = "ONBOARDING_ALERT_SEEN"
case ANALYTICS_ONBOARDING_RADAR_SEEN = "ONBOARDING_RADAR_SEEN"
......@@ -136,7 +136,7 @@ public enum AnalyticsEvent: String {
case ANALYTICS_ONBOARDING_SKIP = "ONBOARDING_SKIP"
case ANALYTICS_ONBOARDING_SWIPE = "ONBOARDING_SWIPE"
///Premium
// MARK: Premium
case ANALYTICS_SUBSCRIPTION_PREMIUM_CARD_CLICK = "PREMIUM_CARD_CLICK"
case ANALYTICS_SUBSCRIPTION_VIEW_PREMIUM_SCREEN = "VIEW_PREMIUM_SCREEN"
case ANALYTICS_SUBSCRIPTION_SUBSCRIBE_YEARLY_CLICK = "SUBSCRIBE_YEARLY_CLICK"
......@@ -148,6 +148,19 @@ public enum AnalyticsEvent: String {
case ANALYTICS_SUBSCRIPTION_VIEW_PREMIUM_SUCCESS = "VIEW_PREMIUM_SUCCESS"
case ANALYTICS_SUBSCRIPTION_PREMIUM_HAMBURGER_CLICK = "PREMIUM_HAMBURGER_CLICK"
// MARK: Minutely
case ANALYTICS_MINUTELY_PRECIP_TODAY_SEEN = "MINUTELY_PRECIP_TODAY_SEEN"
case ANALYTICS_MINUTELY_PRECIP_TODAY_TAP = "MINUTELY_PRECIP_TODAY_TAP"
/// When the user taps on the title of the minutely precipitation graph
case ANALYTICS_MINUTELY_PRECIP_TODAY_TITLE = "MINUTELY_PRECIP_TODAY_TITLE"
case ANALYTICS_MINUTELY_TEMP_TODAY_SEEN = "MINUTELY_TEMP_TODAY_SEEN"
case ANALYTICS_MINUTELY_TEMP_TODAY_TAP = "MINUTELY_TEMP_TODAY_TAP"
case ANALYTICS_VIEW_FORECAST_MINUTELY = "VIEW_FORECAST_MINUTELY"
case ANALYTICS_FORECAST_MINUTELY_TEMPERATURE = "FORECAST_MINUTELY_TEMPERATURE"
case ANALYTICS_FORECAST_MINUTELY_PRECIP = "FORECAST_MINUTELY_PRECIP"
case ANALYTICS_FORECAST_MINUTELY_GRAPH = "FORECAST_MINUTELY_GRAPH"
/// FTUE Funnel: User has saved his first city after installing the app.
case ANALYTICS_USER_QUALIFIED = "USER_QUALIFIED"
/// FTUE Funnel: User comes back to the app between the 3rd day after being qualified and 6th day.
......
......@@ -71,11 +71,15 @@ public struct UserDefaultsBasicValue<T> {
set {
userDefaults.setValue(newValue, forKey: key)
Settings.shared.delegate.invoke { (delegate) in
delegate.settingsDidChange()
}
if #available(iOS 14, *) {
WidgetCenter.shared.reloadAllTimelines()
DispatchQueue.main.async {
Settings.shared.delegate.invoke { (delegate) in
delegate.settingsDidChange()
}
if #available(iOS 14, *) {
WidgetCenter.shared.reloadAllTimelines()
}
}
}
}
......
......@@ -108,7 +108,7 @@ public class WidgetManager {
self.widgetOptions = WidgetOptions(rawValue: storedWidgetsOptions)
}
private let log = Logger(componentName: "WidgetManager")
private let smartTextProvider = SmartTextProvider()
private let smartTextProvider = SmartTextProvider(prioritizedSmartTexts: SmartTextProvider.defaultSmartTexts)
private var widgetOptions: WidgetOptions = []
public func refreshAnalytics() {
......
......@@ -8,7 +8,7 @@
import Foundation
public class SmartTextProvider {
private var prioritizedSmartTexts: [SmartText] = [
public static let defaultSmartTexts: [SmartText] = [
OngoingPrecipitationSmartText(),
ApproachingPrecipitationSmartText(),
WindSmartText(minAllowedWindSpeed: WindSpeed(value: 75, unit: .kilometersPerHour)),
......@@ -17,8 +17,10 @@ public class SmartTextProvider {
DefaultSmartText()]
public init() {
private let prioritizedSmartTexts: [SmartText]
public init(prioritizedSmartTexts: [SmartText]) {
self.prioritizedSmartTexts = prioritizedSmartTexts
}
public func smartText(for location: Location) -> String {
......
......@@ -42,15 +42,12 @@ public class Settings {
@UserDefaultsBasicValue(key: "app_theme", userDefaults: UserDefaults.appDefaults)
private var _appTheme = AppTheme.system.rawValue
public var appTheme:AppTheme {
public var appTheme: AppTheme {
get {
return AppTheme(rawValue: _appTheme) ?? .system
}
set {
_appTheme = newValue.rawValue
Settings.shared.delegate.invoke { (delegate) in
delegate.settingsDidChange()
}
}
}
......
......@@ -121,7 +121,7 @@ struct ForecastWidgetViewModel: WidgetViewModel {
self.showLastTimeUpdated = false
lastTimeUpdatedText = ""
}
let smartTextProvider = SmartTextProvider()
let smartTextProvider = SmartTextProvider(prioritizedSmartTexts: SmartTextProvider.defaultSmartTexts)
self.smartText = smartTextProvider.smartText(for: location)
self.hourlyWeather = convertToWidgetHourly(modelHourly: location.hourly)
......
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