diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 74dd3172..63395945 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -363,7 +363,7 @@ D586D39B28EF58B0000E101F /* AltTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D586D39A28EF58B0000E101F /* AltTests.swift */; }; D58916FE28C7C55C00E39C8B /* LoggedError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D58916FD28C7C55C00E39C8B /* LoggedError.swift */; }; D593F1942717749A006E82DE /* PatchAppOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D593F1932717749A006E82DE /* PatchAppOperation.swift */; }; - D5A2193429B14F94002229FC /* PeekPopPreviewing.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5A2193329B14F94002229FC /* PeekPopPreviewing.swift */; }; + D5A2193429B14F94002229FC /* DeprecatedAPIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5A2193329B14F94002229FC /* DeprecatedAPIs.swift */; }; D5ACE84528E3B8450021CAB9 /* ClearAppCacheOperation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5ACE84428E3B8450021CAB9 /* ClearAppCacheOperation.swift */; }; D5CA0C4B280E141900469595 /* ManagedPatron.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5CA0C4A280E141900469595 /* ManagedPatron.swift */; }; D5CA0C4E280E249E00469595 /* AltStore9ToAltStore10.xcmappingmodel in Sources */ = {isa = PBXBuildFile; fileRef = D5CA0C4D280E249E00469595 /* AltStore9ToAltStore10.xcmappingmodel */; }; @@ -906,7 +906,7 @@ D586D39A28EF58B0000E101F /* AltTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AltTests.swift; sourceTree = ""; }; D58916FD28C7C55C00E39C8B /* LoggedError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggedError.swift; sourceTree = ""; }; D593F1932717749A006E82DE /* PatchAppOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PatchAppOperation.swift; sourceTree = ""; }; - D5A2193329B14F94002229FC /* PeekPopPreviewing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeekPopPreviewing.swift; sourceTree = ""; }; + D5A2193329B14F94002229FC /* DeprecatedAPIs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeprecatedAPIs.swift; sourceTree = ""; }; D5ACE84428E3B8450021CAB9 /* ClearAppCacheOperation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClearAppCacheOperation.swift; sourceTree = ""; }; D5CA0C4A280E141900469595 /* ManagedPatron.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ManagedPatron.swift; sourceTree = ""; }; D5CA0C4C280E242500469595 /* AltStore 10.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "AltStore 10.xcdatamodel"; sourceTree = ""; }; @@ -1184,7 +1184,7 @@ children = ( BF41B807233433C100C593A3 /* LoadingState.swift */, D5DAE0932804B0B80034D8D4 /* ScreenshotProcessor.swift */, - D5A2193329B14F94002229FC /* PeekPopPreviewing.swift */, + D5A2193329B14F94002229FC /* DeprecatedAPIs.swift */, ); path = Types; sourceTree = ""; @@ -2693,7 +2693,7 @@ D5F2F6A92720B7C20081CCF5 /* PatchViewController.swift in Sources */, B39F16132918D7C5002E9404 /* Consts.swift in Sources */, BF8F69C222E659F700049BA1 /* AppContentViewController.swift in Sources */, - D5A2193429B14F94002229FC /* PeekPopPreviewing.swift in Sources */, + D5A2193429B14F94002229FC /* DeprecatedAPIs.swift in Sources */, BF08858522DE7EC800DE9F1E /* UpdateCollectionViewCell.swift in Sources */, BF770E5822BC3D0F002A40FE /* RefreshGroup.swift in Sources */, 19B9B7452845E6DF0076EF69 /* SelectTeamViewController.swift in Sources */, diff --git a/AltStore/AppDelegate.swift b/AltStore/AppDelegate.swift index 73555ddc..082a1553 100644 --- a/AltStore/AppDelegate.swift +++ b/AltStore/AppDelegate.swift @@ -16,6 +16,8 @@ import AltSign import Roxas import EmotionalDamage +extension UIApplication: LegacyBackgroundFetching {} + extension AppDelegate { static let openPatreonSettingsDeepLinkNotification = Notification.Name(Bundle.Info.appbundleIdentifier + ".OpenPatreonSettingsDeepLinkNotification") @@ -244,7 +246,7 @@ extension AppDelegate private func prepareForBackgroundFetch() { // "Fetch" every hour, but then refresh only those that need to be refreshed (so we don't drain the battery). - UIApplication.shared.setMinimumBackgroundFetchInterval(1 * 60 * 60) + (UIApplication.shared as LegacyBackgroundFetching).setMinimumBackgroundFetchInterval(1 * 60 * 60) UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { (success, error) in } diff --git a/AltStore/Types/PeekPopPreviewing.swift b/AltStore/Types/DeprecatedAPIs.swift similarity index 57% rename from AltStore/Types/PeekPopPreviewing.swift rename to AltStore/Types/DeprecatedAPIs.swift index 86d741dc..6457cb66 100644 --- a/AltStore/Types/PeekPopPreviewing.swift +++ b/AltStore/Types/DeprecatedAPIs.swift @@ -1,5 +1,5 @@ // -// PeekPopPreviewing.swift +// DeprecatedAPIs.swift // AltStore // // Created by Riley Testut on 3/2/23. @@ -8,9 +8,15 @@ import UIKit -// Conforming UIViewControllers to PeekPopPreviewing allows us to call deprecated registerForPreviewing(with:sourceView:) without warnings. +// Conform types to these protocols to call deprecated APIs without warnings. + protocol PeekPopPreviewing { @discardableResult func registerForPreviewing(with delegate: UIViewControllerPreviewingDelegate, sourceView: UIView) -> UIViewControllerPreviewing } + +protocol LegacyBackgroundFetching +{ + func setMinimumBackgroundFetchInterval(_ minimumBackgroundFetchInterval: TimeInterval) +}