mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-14 09:13:25 +01:00
Fixes UIDocumentPickerViewController deprecation warnings
This commit is contained in:
committed by
Nythepegasus
parent
36913b425c
commit
f97548fc3a
@@ -10,6 +10,7 @@ import UIKit
|
|||||||
import MobileCoreServices
|
import MobileCoreServices
|
||||||
import Intents
|
import Intents
|
||||||
import Combine
|
import Combine
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
import AltStoreCore
|
import AltStoreCore
|
||||||
import AltSign
|
import AltSign
|
||||||
@@ -701,18 +702,9 @@ private extension MyAppsViewController
|
|||||||
|
|
||||||
@IBAction func sideloadApp(_ sender: UIBarButtonItem)
|
@IBAction func sideloadApp(_ sender: UIBarButtonItem)
|
||||||
{
|
{
|
||||||
let supportedTypes: [String]
|
let supportedTypes = UTType.types(tag: "ipa", tagClass: .filenameExtension, conformingTo: nil)
|
||||||
|
|
||||||
if let types = UTTypeCreateAllIdentifiersForTag(kUTTagClassFilenameExtension, "ipa" as CFString, nil)?.takeRetainedValue()
|
let documentPickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: supportedTypes, asCopy: true)
|
||||||
{
|
|
||||||
supportedTypes = (types as NSArray).map { $0 as! String }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
supportedTypes = ["com.apple.itunes.ipa"] // Declared by the system.
|
|
||||||
}
|
|
||||||
|
|
||||||
let documentPickerViewController = UIDocumentPickerViewController(documentTypes: supportedTypes, in: .import)
|
|
||||||
documentPickerViewController.delegate = self
|
documentPickerViewController.delegate = self
|
||||||
self.present(documentPickerViewController, animated: true, completion: nil)
|
self.present(documentPickerViewController, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
@@ -1246,8 +1238,11 @@ private extension MyAppsViewController
|
|||||||
{
|
{
|
||||||
guard let backupURL = FileManager.default.backupDirectoryURL(for: installedApp) else { return }
|
guard let backupURL = FileManager.default.backupDirectoryURL(for: installedApp) else { return }
|
||||||
|
|
||||||
let documentPicker = UIDocumentPickerViewController(url: backupURL, in: .exportToService)
|
let documentPicker = UIDocumentPickerViewController(forExporting: [backupURL], asCopy: true)
|
||||||
documentPicker.delegate = self
|
|
||||||
|
// Don't set delegate to avoid conflicting with import callbacks.
|
||||||
|
// documentPicker.delegate = self
|
||||||
|
|
||||||
self.present(documentPicker, animated: true, completion: nil)
|
self.present(documentPicker, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2050,15 +2045,8 @@ extension MyAppsViewController: UIDocumentPickerDelegate
|
|||||||
{
|
{
|
||||||
guard let fileURL = urls.first else { return }
|
guard let fileURL = urls.first else { return }
|
||||||
|
|
||||||
switch controller.documentPickerMode
|
self.sideloadApp(at: fileURL) { (result) in
|
||||||
{
|
print("Sideloaded app at \(fileURL) with result:", result)
|
||||||
case .import, .open:
|
|
||||||
self.sideloadApp(at: fileURL) { (result) in
|
|
||||||
print("Sideloaded app at \(fileURL) with result:", result)
|
|
||||||
}
|
|
||||||
|
|
||||||
case .exportToService, .moveToService: break
|
|
||||||
@unknown default: break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user