[ADD] WIP: Add My Apps view with support for sideloading new apps, refreshing installed apps and much more

This commit is contained in:
Fabian Thies
2022-12-21 17:45:44 +01:00
committed by Joe Mattiello
parent a0eb30f98e
commit 02e48a207f
10 changed files with 797 additions and 25 deletions

View File

@@ -26,4 +26,10 @@ extension View {
self
}
}
@ViewBuilder func tintedBackground(_ color: Color) -> some View {
self
.blurBackground(.systemUltraThinMaterial)
.background(color.opacity(0.4))
}
}

View File

@@ -0,0 +1,52 @@
//
// DocumentPicker.swift
// SideStore
//
// Created by Fabian Thies on 20.12.22.
// Copyright © 2022 SideStore. All rights reserved.
//
import UIKit
import SwiftUI
struct DocumentPicker: UIViewControllerRepresentable {
internal class Coordinator: NSObject {
var parent: DocumentPicker
init(_ parent: DocumentPicker) {
self.parent = parent
}
}
@Binding var selectedUrl: URL?
let supportedTypes: [String]
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
func makeUIViewController(context: Context) -> some UIViewController {
let documentPickerViewController = UIDocumentPickerViewController(documentTypes: supportedTypes, in: .import)
documentPickerViewController.delegate = context.coordinator
return documentPickerViewController
}
func updateUIViewController(_ uiViewController: UIViewControllerType, context: Context) {}
}
extension DocumentPicker.Coordinator: UIDocumentPickerDelegate {
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
self.parent.selectedUrl = nil
}
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
guard let firstURL = urls.first else {
return
}
self.parent.selectedUrl = firstURL
}
}