Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Addressed feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T committed Jun 19, 2023
1 parent 1e75e0f commit 71ae5ea
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 35 deletions.
3 changes: 0 additions & 3 deletions App/iOS/Delegates/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
PlaylistManager.shared.restoreSession()
}

UserDefaults.standard.set(true, forKey: "UIStateRestorationDebugLogging")
UserDefaults.standard.set(true, forKey: "UIStateRestorationDeveloperMode")

return shouldPerformAdditionalDelegateHandling
}

Expand Down
2 changes: 1 addition & 1 deletion App/iOS/Delegates/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}

func sceneDidDisconnect(_ scene: UIScene) {
print("SCENE DISCONNECTED")
log.debug("SCENE DISCONNECTED")
}

func sceneDidBecomeActive(_ scene: UIScene) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Brave/Frontend/Browser/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ class TabManager: NSObject {
tab.setScreenshot(savedTab.screenshot)

Task { @MainActor in
tab.favicon = try await FaviconFetcher.loadIcon(url: tabURL, kind: .smallIcon, persistent: tab.isPrivate)
tab.favicon = try await FaviconFetcher.loadIcon(url: tabURL, kind: .smallIcon, persistent: !tab.isPrivate)
tab.setScreenshot(savedTab.screenshot)
}

Expand Down
35 changes: 12 additions & 23 deletions Sources/Brave/States/AppState.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//
// AppState.swift
//
//
// Created by Brandon T on 2023-05-15.
//
// Copyright 2023 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

import Foundation
import UIKit
Expand All @@ -14,10 +12,7 @@ import Shared
import Growth
import Preferences
import Storage

#if DEBUG
import os
#endif
import os.log

/// Class that does startup initialization
/// Everything in this class can only be execute ONCE
Expand All @@ -30,14 +25,20 @@ public class AppState {
public let migration: Migration
public let profile: Profile
public let rewards: BraveRewards
private var didBecomeActive = false

public var state: State = .launching(options: [:], active: false) {
didSet {
switch state {
case .launching(_, let isActive):
if isActive {
if didBecomeActive {
assertionFailure("Cannot set launching state twice!")
}

if isActive && !didBecomeActive {
// We have to wait until pre 1.12 migration is done until we proceed with database
// initialization. This is because Database container may change. See bugs #3416, #3377.
didBecomeActive = true
DataController.shared.initializeOnce()
Migration.postCoreDataInitMigrations()
Migration.migrateTabStateToWebkitState(diskImageStore: diskImageStore)
Expand Down Expand Up @@ -103,18 +104,6 @@ public class AppState {
}

private static func setupConstants() {
// Application Constants must be initialized first
// #if MOZ_CHANNEL_RELEASE
// AppConstants.buildChannel = .release
// #elseif MOZ_CHANNEL_BETA
// AppConstants.buildChannel = .beta
// #elseif MOZ_CHANNEL_DEV
// AppConstants.buildChannel = .dev
// #elseif MOZ_CHANNEL_ENTERPRISE
// AppConstants.buildChannel = .enterprise
// #elseif MOZ_CHANNEL_DEBUG
// AppConstants.buildChannel = .debug
// #endif
}

private static func setupBraveCore() -> BraveCoreMain {
Expand Down
11 changes: 4 additions & 7 deletions Sources/Brave/States/BrowserState.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
//
// BrowserState.swift
//
//
// Created by Brandon T on 2023-05-15.
//
// Copyright 2023 The Brave Authors. All rights reserved.
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

import Foundation
import UIKit
Expand All @@ -13,7 +11,6 @@ public class BrowserState {

let window: UIWindow
let profile: Profile
//let browser: BrowserViewController

init(window: UIWindow, profile: Profile) {
self.window = window
Expand Down

0 comments on commit 71ae5ea

Please sign in to comment.