Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old app delegate, rename states and introduce Resuming (a.k.a willEnterForeground) #3809

Merged
merged 9 commits into from
Jan 16, 2025
4 changes: 1 addition & 3 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,6 @@ extension Pixel {

// MARK: Lifecycle
case appDidTransitionToUnexpectedState
case appDidConsecutivelyBackground

}

Expand Down Expand Up @@ -1946,8 +1945,7 @@ extension Pixel.Event {
case .openAIChatFromAddressBar: return "m_aichat_addressbar_icon"

// MARK: Lifecycle
case .appDidTransitionToUnexpectedState: return "m_debug_app-did-transition-to-unexpected-state-2"
case .appDidConsecutivelyBackground: return "m_debug_app-did-consecutively-background-2"
case .appDidTransitionToUnexpectedState: return "m_debug_app-did-transition-to-unexpected-state-3"

}
}
Expand Down
44 changes: 20 additions & 24 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1010,13 +1010,13 @@
CB2A7EEF283D185100885F67 /* RulesCompilationMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2A7EEE283D185100885F67 /* RulesCompilationMonitor.swift */; };
CB2A7EF128410DF700885F67 /* PixelEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2A7EF028410DF700885F67 /* PixelEvent.swift */; };
CB2A7EF4285383B300885F67 /* AppLastCompiledRulesStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2A7EF3285383B300885F67 /* AppLastCompiledRulesStore.swift */; };
CB3C78892D06D3A700A7E4ED /* Active.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EFC2CFE1D48006267B8 /* Active.swift */; };
CB3C78892D06D3A700A7E4ED /* Foreground.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EFC2CFE1D48006267B8 /* Foreground.swift */; };
CB3C788A2D06D3A700A7E4ED /* Background.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0F002CFE1D54006267B8 /* Background.swift */; };
CB3C788B2D06D3A700A7E4ED /* Launched.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EFA2CFE1D3F006267B8 /* Launched.swift */; };
CB3C788B2D06D3A700A7E4ED /* Launching.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EFA2CFE1D3F006267B8 /* Launching.swift */; };
CB3C788C2D06D3A700A7E4ED /* AppStateMachine.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0F052CFE270D006267B8 /* AppStateMachine.swift */; };
CB3C788D2D06D3A700A7E4ED /* AppStateTransitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0F072CFE27D5006267B8 /* AppStateTransitions.swift */; };
CB3C788E2D06D3A700A7E4ED /* Init.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EF82CFE1D35006267B8 /* Init.swift */; };
CB3C788F2D06D3A700A7E4ED /* Inactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EFE2CFE1D4E006267B8 /* Inactive.swift */; };
CB3C788E2D06D3A700A7E4ED /* Initializing.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EF82CFE1D35006267B8 /* Initializing.swift */; };
CB3C788F2D06D3A700A7E4ED /* Suspending.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBAD0EFE2CFE1D4E006267B8 /* Suspending.swift */; };
CB48D3332B90CE9F00631D8B /* PageRefreshStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB48D3312B90CE9F00631D8B /* PageRefreshStore.swift */; };
CB4FA44E2C78AACE00A16F5A /* SpecialErrorPageUserScript.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB4FA44D2C78AACE00A16F5A /* SpecialErrorPageUserScript.swift */; };
CB5516D0286500290079B175 /* TrackerRadarIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85519124247468580010FDD0 /* TrackerRadarIntegrationTests.swift */; };
Expand Down Expand Up @@ -1044,14 +1044,13 @@
CBD4F13E279EBFAB00B20FD7 /* HomeMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF14FC227970072001D94D0 /* HomeMessageView.swift */; };
CBD4F13F279EBFAF00B20FD7 /* HomeMessageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF14FC427970AB0001D94D0 /* HomeMessageViewModel.swift */; };
CBD4F140279EBFB300B20FD7 /* SwiftUICollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB1AEFB02799AA940031AE3D /* SwiftUICollectionViewCell.swift */; };
CBD79F482D1061DA00DBB45A /* NewAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD79F472D1061D500DBB45A /* NewAppDelegate.swift */; };
CBD79F4A2D1061E200DBB45A /* OldAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD79F492D1061DF00DBB45A /* OldAppDelegate.swift */; };
CBD79F4D2D130F6500DBB45A /* Testing.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBD79F4C2D130F6300DBB45A /* Testing.swift */; };
CBDD5DDF29A6736A00832877 /* APIHeadersTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBDD5DDE29A6736A00832877 /* APIHeadersTests.swift */; };
CBDD5DE129A6741300832877 /* MockBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBDD5DE029A6741300832877 /* MockBundle.swift */; };
CBECDB6F2CD3DFBE005B8B87 /* PageRefreshMonitor in Frameworks */ = {isa = PBXBuildFile; productRef = CBECDB6E2CD3DFBE005B8B87 /* PageRefreshMonitor */; };
CBECDB7A2CD981CE005B8B87 /* AppPageRefreshMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBECDB792CD981C6005B8B87 /* AppPageRefreshMonitor.swift */; };
CBEFB9142AE0844700DEDE7B /* CriticalAlerts.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBEFB9102ADFFE7900DEDE7B /* CriticalAlerts.swift */; };
CBF259502D37ED6600AC63E4 /* Resuming.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBF2594F2D37ED6100AC63E4 /* Resuming.swift */; };
CBFCB30E2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBFCB30D2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift */; };
D60170BD2BA34CE8001911B5 /* Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = D60170BB2BA32DD6001911B5 /* Subscription.swift */; };
D6037E692C32F2E7009AAEC0 /* DuckPlayerSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6037E682C32F2E7009AAEC0 /* DuckPlayerSettings.swift */; };
Expand Down Expand Up @@ -2960,10 +2959,10 @@
CBA1DE942AF6D579007C9457 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CBAA195927BFE15600A4BD49 /* NSManagedObjectContextExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSManagedObjectContextExtension.swift; sourceTree = "<group>"; };
CBAA195B27C3982A00A4BD49 /* PrivacyFeatures.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyFeatures.swift; sourceTree = "<group>"; };
CBAD0EF82CFE1D35006267B8 /* Init.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Init.swift; sourceTree = "<group>"; };
CBAD0EFA2CFE1D3F006267B8 /* Launched.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Launched.swift; sourceTree = "<group>"; };
CBAD0EFC2CFE1D48006267B8 /* Active.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Active.swift; sourceTree = "<group>"; };
CBAD0EFE2CFE1D4E006267B8 /* Inactive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Inactive.swift; sourceTree = "<group>"; };
CBAD0EF82CFE1D35006267B8 /* Initializing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Initializing.swift; sourceTree = "<group>"; };
CBAD0EFA2CFE1D3F006267B8 /* Launching.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Launching.swift; sourceTree = "<group>"; };
CBAD0EFC2CFE1D48006267B8 /* Foreground.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Foreground.swift; sourceTree = "<group>"; };
CBAD0EFE2CFE1D4E006267B8 /* Suspending.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Suspending.swift; sourceTree = "<group>"; };
CBAD0F002CFE1D54006267B8 /* Background.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Background.swift; sourceTree = "<group>"; };
CBAD0F052CFE270D006267B8 /* AppStateMachine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStateMachine.swift; sourceTree = "<group>"; };
CBAD0F072CFE27D5006267B8 /* AppStateTransitions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStateTransitions.swift; sourceTree = "<group>"; };
Expand All @@ -2978,8 +2977,6 @@
CBC88EE42C8097B500F0F8C5 /* URLCredentialCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLCredentialCreator.swift; sourceTree = "<group>"; };
CBC8DC252AF6D4CD00BA681A /* da */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = da; path = da.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CBD4F13B279EBF4A00B20FD7 /* HomeMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeMessage.swift; sourceTree = "<group>"; };
CBD79F472D1061D500DBB45A /* NewAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewAppDelegate.swift; sourceTree = "<group>"; };
CBD79F492D1061DF00DBB45A /* OldAppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OldAppDelegate.swift; sourceTree = "<group>"; };
CBD79F4C2D130F6300DBB45A /* Testing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Testing.swift; sourceTree = "<group>"; };
CBD7AE812AF6D5B6009052FD /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/InfoPlist.strings; sourceTree = "<group>"; };
CBDD5DDE29A6736A00832877 /* APIHeadersTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = APIHeadersTests.swift; sourceTree = "<group>"; };
Expand All @@ -2993,6 +2990,7 @@
CBF14FC227970072001D94D0 /* HomeMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeMessageView.swift; sourceTree = "<group>"; };
CBF14FC427970AB0001D94D0 /* HomeMessageViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeMessageViewModel.swift; sourceTree = "<group>"; };
CBF14FC627970C8A001D94D0 /* HomeMessageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeMessageCollectionViewCell.swift; sourceTree = "<group>"; };
CBF2594F2D37ED6100AC63E4 /* Resuming.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Resuming.swift; sourceTree = "<group>"; };
CBFCB30D2B2CD47800253E9E /* ConfigurationURLDebugViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationURLDebugViewController.swift; sourceTree = "<group>"; };
D60170BB2BA32DD6001911B5 /* Subscription.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Subscription.swift; sourceTree = "<group>"; };
D6037E682C32F2E7009AAEC0 /* DuckPlayerSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DuckPlayerSettings.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5748,11 +5746,12 @@
CBAD0EF72CFE1D14006267B8 /* AppStates */ = {
isa = PBXGroup;
children = (
CBAD0EF82CFE1D35006267B8 /* Init.swift */,
CBAD0EFA2CFE1D3F006267B8 /* Launched.swift */,
CBAD0EFC2CFE1D48006267B8 /* Active.swift */,
CBAD0EFE2CFE1D4E006267B8 /* Inactive.swift */,
CBAD0EF82CFE1D35006267B8 /* Initializing.swift */,
CBAD0EFA2CFE1D3F006267B8 /* Launching.swift */,
CBAD0EFC2CFE1D48006267B8 /* Foreground.swift */,
CBAD0EFE2CFE1D4E006267B8 /* Suspending.swift */,
CBAD0F002CFE1D54006267B8 /* Background.swift */,
CBF2594F2D37ED6100AC63E4 /* Resuming.swift */,
CBD79F4C2D130F6300DBB45A /* Testing.swift */,
);
path = AppStates;
Expand Down Expand Up @@ -6678,8 +6677,6 @@
83BE9BC2215D69C1009844D9 /* AppConfigurationFetch.swift */,
CB24F70E29A3EB15006DCC58 /* AppConfigurationURLProvider.swift */,
84E341951E2F7EFB00BDBA6F /* AppDelegate.swift */,
CBD79F492D1061DF00DBB45A /* OldAppDelegate.swift */,
CBD79F472D1061D500DBB45A /* NewAppDelegate.swift */,
85DB12EC2A1FED0C000A4A72 /* AppDelegate+AppDeepLinks.swift */,
98B31291218CCB8C00E54DE1 /* AppDependencyProvider.swift */,
85BA58591F3506AE00C6E8CA /* AppSettings.swift */,
Expand Down Expand Up @@ -7878,7 +7875,6 @@
B623C1C42862CD670043013E /* WKDownloadSession.swift in Sources */,
6FD1BAE42B87A107000C475C /* AdAttributionPixelReporter.swift in Sources */,
1E8AD1D927C4FEC100ABA377 /* DownloadsListSectioningHelper.swift in Sources */,
CBD79F4A2D1061E200DBB45A /* OldAppDelegate.swift in Sources */,
D60170BD2BA34CE8001911B5 /* Subscription.swift in Sources */,
1E4DCF4827B6A35400961E25 /* DownloadsListModel.swift in Sources */,
C12726F02A5FF89900215B02 /* EmailSignupPromptViewModel.swift in Sources */,
Expand Down Expand Up @@ -7933,15 +7929,14 @@
9FEA22272C2D2BDA006B03BF /* RootDebugViewController+Onboarding.swift in Sources */,
319A37152829A55F0079FBCE /* AutofillListItemTableViewCell.swift in Sources */,
6F8496412BC3D8EE00ADA54E /* OnboardingButtonsView.swift in Sources */,
CB3C78892D06D3A700A7E4ED /* Active.swift in Sources */,
CB3C78892D06D3A700A7E4ED /* Foreground.swift in Sources */,
CB3C788A2D06D3A700A7E4ED /* Background.swift in Sources */,
CB3C788B2D06D3A700A7E4ED /* Launched.swift in Sources */,
CB3C788B2D06D3A700A7E4ED /* Launching.swift in Sources */,
CB3C788C2D06D3A700A7E4ED /* AppStateMachine.swift in Sources */,
CB3C788D2D06D3A700A7E4ED /* AppStateTransitions.swift in Sources */,
CB3C788E2D06D3A700A7E4ED /* Init.swift in Sources */,
CB3C788F2D06D3A700A7E4ED /* Inactive.swift in Sources */,
CB3C788E2D06D3A700A7E4ED /* Initializing.swift in Sources */,
CB3C788F2D06D3A700A7E4ED /* Suspending.swift in Sources */,
1EA513782866039400493C6A /* TrackerAnimationLogic.swift in Sources */,
CBD79F482D1061DA00DBB45A /* NewAppDelegate.swift in Sources */,
854A01332A558B3A00FCC628 /* UIView+Constraints.swift in Sources */,
9FB0271B2C2927D0009EA190 /* OnboardingView.swift in Sources */,
C12726EE2A5FF88C00215B02 /* EmailSignupPromptView.swift in Sources */,
Expand Down Expand Up @@ -8006,6 +8001,7 @@
1E1626072968413B0004127F /* ViewExtension.swift in Sources */,
31A42566285A0A6300049386 /* FaviconViewModel.swift in Sources */,
6F691CCA2C4979EC002E9553 /* FavoritesTooltip.swift in Sources */,
CBF259502D37ED6600AC63E4 /* Resuming.swift in Sources */,
859DB8132CE6263C001F7210 /* TextZoomStorage.swift in Sources */,
D65625952C22D382006EF297 /* TabViewController.swift in Sources */,
8C4838B5221C8F7F008A6739 /* GestureToolbarButton.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/AppDelegate+AppDeepLinks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import UIKit
import Core

extension OldAppDelegate {
extension AppDelegate {

func handleAppDeepLink(_ app: UIApplication, _ mainViewController: MainViewController?, _ url: URL) -> Bool {
guard let mainViewController else { return false }
Expand Down Expand Up @@ -51,7 +51,7 @@ extension OldAppDelegate {
mainViewController.newEmailAddress()

case .openVPN:
presentNetworkProtectionStatusSettingsModal()
mainViewController.presentNetworkProtectionStatusSettingsModal()

case .openPasswords:
var source: AutofillSettingsSource = .homeScreenWidget
Expand Down
82 changes: 21 additions & 61 deletions DuckDuckGo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,6 @@
import UIKit
import Core

enum AppBehavior: String {

case old
case new

}

protocol DDGApp {

var privacyProDataReporter: PrivacyProDataReporting? { get }

func initialize()
func refreshRemoteMessages()

}

@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {

static let ShowKeyboardOnLaunchThreshold = TimeInterval(20)
Expand All @@ -45,65 +29,50 @@ protocol DDGApp {
static let openVPNSettings = "com.duckduckgo.mobile.ios.vpn.open-settings"
}

private let appStateMachine: AppStateMachine = AppStateMachine()

var window: UIWindow?

var privacyProDataReporter: PrivacyProDataReporting? {
realDelegate.privacyProDataReporter
}

func forceOldAppDelegate() {
BoolFileMarker(name: .forceOldAppDelegate)?.mark()
}

private let appBehavior: AppBehavior = {
BoolFileMarker(name: .forceOldAppDelegate)?.isPresent == true ? .old : .new
}()

private lazy var realDelegate: UIApplicationDelegate & DDGApp = {
if appBehavior == .old {
return OldAppDelegate(with: self)
} else {
return NewAppDelegate()
}
}()

var didCallWillEnterForeground: Bool = false

override init() {
super.init()
realDelegate.initialize()
(appStateMachine.currentState as? Foreground)?.appDependencies.privacyProDataReporter // just for now, we have to get rid of this anti pattern
}

/// See: Launching.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
realDelegate.application?(application, didFinishLaunchingWithOptions: launchOptions) ?? false
let isTesting: Bool = ProcessInfo().arguments.contains("testing")
appStateMachine.handle(.didFinishLaunching(application, isTesting: isTesting))
return true
}

/// See: Foreground.swift
func applicationDidBecomeActive(_ application: UIApplication) {
didCallWillEnterForeground = false
realDelegate.applicationDidBecomeActive?(application)
appStateMachine.handle(.didBecomeActive)
}

/// See: Suspending.swift
func applicationWillResignActive(_ application: UIApplication) {
realDelegate.applicationWillResignActive?(application)
appStateMachine.handle(.willResignActive)
}

/// See: Resuming.swift
func applicationWillEnterForeground(_ application: UIApplication) {
didCallWillEnterForeground = true
realDelegate.applicationWillEnterForeground?(application)
appStateMachine.handle(.willEnterForeground)
}

/// See: Background.swift
func applicationDidEnterBackground(_ application: UIApplication) {
realDelegate.applicationDidEnterBackground?(application)
appStateMachine.handle(.didEnterBackground)
}

func application(_ application: UIApplication,
performActionFor shortcutItem: UIApplicationShortcutItem,
completionHandler: @escaping (Bool) -> Void) {
realDelegate.application?(application, performActionFor: shortcutItem, completionHandler: completionHandler)
appStateMachine.handle(.handleShortcutItem(shortcutItem))
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
realDelegate.application?(app, open: url, options: options) ?? false
appStateMachine.handle(.openURL(url))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we ok with always returning true here? I saw there's false supposed to be returned when onboarding is present (based on the Old Delegate).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw this and AFAIU the documentation correctly we can always return true, just like we do inside didFInishLaunching but we do not necessarily have to handle the opening url logic, hence the code inside Foreground state:

guard mainViewController.needsToShowOnboardingIntro() == false else {
return
}

return true
}

func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Expand All @@ -121,12 +90,12 @@ protocol DDGApp {
}

func application(_ application: UIApplication, willContinueUserActivityWithType userActivityType: String) -> Bool {
return true
true
}

/// It's public in order to allow refreshing on demand via Debug menu. Otherwise it shouldn't be called from outside.
func refreshRemoteMessages() {
realDelegate.refreshRemoteMessages()
// part of debug menu, let's not support it in the first iteration
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll need this now, won't we?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it doesn't work now, as we already use new app delegate by default, but you are correct, this should be brought back, I'll make it work in next PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it in this PR!

}

}
Expand All @@ -153,19 +122,10 @@ extension Error {
let nsError = self as NSError
if let underlyingError = nsError.userInfo["NSUnderlyingError"] as? NSError, underlyingError.code == 13 {
return true
}

if nsError.userInfo["NSSQLiteErrorDomain"] as? Int == 13 {
} else if nsError.userInfo["NSSQLiteErrorDomain"] as? Int == 13 {
return true
}

return false
}

}

private extension BoolFileMarker.Name {

static let forceOldAppDelegate = BoolFileMarker.Name(rawValue: "force-old-app-delegate")

}
Loading