mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
53 lines
2.1 KiB
Swift
53 lines
2.1 KiB
Swift
//
|
|
// SceneDelegate.swift
|
|
// AltStore
|
|
//
|
|
// Created by Riley Testut on 7/6/20.
|
|
// Copyright © 2020 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import AltStoreCore
|
|
|
|
@available(iOS 13, *)
|
|
class SceneDelegate: UIResponder, UIWindowSceneDelegate
|
|
{
|
|
var window: UIWindow?
|
|
|
|
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
|
|
{
|
|
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
|
|
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
|
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
|
guard let _ = (scene as? UIWindowScene) else { return }
|
|
}
|
|
|
|
func sceneWillEnterForeground(_ scene: UIScene)
|
|
{
|
|
// Called as the scene transitions from the background to the foreground.
|
|
// Use this method to undo the changes made on entering the background.
|
|
|
|
// applicationWillEnterForeground is _not_ called when launching app,
|
|
// whereas sceneWillEnterForeground _is_ called when launching.
|
|
// As a result, DatabaseManager might not be started yet, so just return if it isn't
|
|
// (since all these methods are called separately during app startup).
|
|
guard DatabaseManager.shared.isStarted else { return }
|
|
|
|
AppManager.shared.update()
|
|
ServerManager.shared.startDiscovering()
|
|
|
|
PatreonAPI.shared.refreshPatreonAccount()
|
|
}
|
|
|
|
func sceneDidEnterBackground(_ scene: UIScene)
|
|
{
|
|
// Called as the scene transitions from the foreground to the background.
|
|
// Use this method to save data, release shared resources, and store enough scene-specific state information
|
|
// to restore the scene back to its current state.
|
|
|
|
guard UIApplication.shared.applicationState == .background else { return }
|
|
|
|
ServerManager.shared.stopDiscovering()
|
|
}
|
|
}
|