mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[CHANGE] UI fixes and SwiftUI previews for easier development
This commit is contained in:
@@ -418,3 +418,16 @@ struct AppDetailView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct AppDetailView_Previews: PreviewProvider {
|
||||
|
||||
static let context = DatabaseManager.shared.viewContext
|
||||
static let app = StoreApp.makeAltStoreApp(in: context)
|
||||
|
||||
static var previews: some View {
|
||||
NavigationView {
|
||||
AppDetailView(storeApp: app)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,17 @@ extension AppScreenshotsPreview: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
//struct AppScreenshotsPreview_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// AppScreenshotsPreview()
|
||||
// }
|
||||
//}
|
||||
struct AppScreenshotsPreview_Previews: PreviewProvider {
|
||||
|
||||
static let context = DatabaseManager.shared.viewContext
|
||||
static let app = StoreApp.makeAltStoreApp(in: context)
|
||||
|
||||
static var previews: some View {
|
||||
Color.clear
|
||||
.sheet(isPresented: .constant(true)) {
|
||||
NavigationView {
|
||||
AppScreenshotsPreview(urls: app.screenshotURLs)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,3 +56,16 @@ extension Int: Identifiable {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
import AltStoreCore
|
||||
|
||||
struct AppScreenshotsScrollView_Previews: PreviewProvider {
|
||||
|
||||
static let context = DatabaseManager.shared.viewContext
|
||||
static let app = StoreApp.makeAltStoreApp(in: context)
|
||||
|
||||
static var previews: some View {
|
||||
AppScreenshotsScrollView(urls: app.screenshotURLs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,8 +42,14 @@ struct AppVersionHistoryView: View {
|
||||
}
|
||||
}
|
||||
|
||||
//struct AppVersionHistoryView_Previews: PreviewProvider {
|
||||
// static var previews: some View {
|
||||
// AppVersionHistoryView(storeApp: )
|
||||
// }
|
||||
//}
|
||||
struct AppVersionHistoryView_Previews: PreviewProvider {
|
||||
|
||||
static let context = DatabaseManager.shared.viewContext
|
||||
static let app = StoreApp.makeAltStoreApp(in: context)
|
||||
|
||||
static var previews: some View {
|
||||
NavigationView {
|
||||
AppVersionHistoryView(storeApp: app)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,6 @@ struct MyAppsView: View {
|
||||
@State var isRefreshingAllApps: Bool = false
|
||||
@State var selectedSideloadingIpaURL: URL?
|
||||
|
||||
@State var isShowingAppIDsView: Bool = false
|
||||
|
||||
var remainingAppIDs: Int {
|
||||
guard let team = DatabaseManager.shared.activeTeam() else {
|
||||
return 0
|
||||
@@ -91,7 +89,7 @@ struct MyAppsView: View {
|
||||
.bold()
|
||||
|
||||
Spacer()
|
||||
|
||||
|
||||
if !self.isRefreshingAllApps {
|
||||
SwiftUI.Button(L10n.MyAppsView.refreshAll, action: self.refreshAllApps)
|
||||
} else {
|
||||
@@ -121,12 +119,7 @@ struct MyAppsView: View {
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
SwiftUI.Button {
|
||||
self.isShowingAppIDsView = true
|
||||
} label: {
|
||||
Text(L10n.MyAppsView.viewAppIDs)
|
||||
}
|
||||
.sheet(isPresented: self.$isShowingAppIDsView) {
|
||||
ModalNavigationLink(L10n.MyAppsView.viewAppIDs) {
|
||||
NavigationView {
|
||||
AppIDsView()
|
||||
}
|
||||
@@ -140,16 +133,13 @@ struct MyAppsView: View {
|
||||
.navigationTitle(L10n.MyAppsView.myApps)
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .navigationBarLeading) {
|
||||
SwiftUI.Button {
|
||||
self.isShowingFilePicker = true
|
||||
ModalNavigationLink {
|
||||
DocumentPicker(selectedUrl: $selectedSideloadingIpaURL, supportedTypes: sideloadFileTypes)
|
||||
.ignoresSafeArea()
|
||||
} label: {
|
||||
Image(systemSymbol: .plus)
|
||||
.imageScale(.large)
|
||||
}
|
||||
.sheet(isPresented: self.$isShowingFilePicker) {
|
||||
DocumentPicker(selectedUrl: $selectedSideloadingIpaURL, supportedTypes: sideloadFileTypes)
|
||||
.ignoresSafeArea()
|
||||
}
|
||||
.onChange(of: self.selectedSideloadingIpaURL) { newValue in
|
||||
guard let url = newValue else {
|
||||
return
|
||||
@@ -208,7 +198,7 @@ struct MyAppsView: View {
|
||||
|
||||
func refreshAllApps() {
|
||||
let installedApps = InstalledApp.fetchAppsForRefreshingAll(in: DatabaseManager.shared.viewContext)
|
||||
|
||||
|
||||
self.isRefreshingAllApps = true
|
||||
self.refresh(installedApps) { result in
|
||||
self.isRefreshingAllApps = false
|
||||
@@ -254,9 +244,9 @@ extension MyAppsView {
|
||||
|
||||
NotificationManager.shared.showNotification(title: title, detailText: message)
|
||||
}
|
||||
|
||||
self.viewModel.refreshGroup = nil
|
||||
completionHandler(results)
|
||||
|
||||
self.viewModel.refreshGroup = nil
|
||||
completionHandler(results)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,6 +425,10 @@ extension MyAppsView {
|
||||
}
|
||||
|
||||
struct MyAppsView_Previews: PreviewProvider {
|
||||
|
||||
static let context = DatabaseManager.shared.viewContext
|
||||
static let app = StoreApp.makeAltStoreApp(in: context)
|
||||
|
||||
static var previews: some View {
|
||||
NavigationView {
|
||||
MyAppsView()
|
||||
|
||||
@@ -27,13 +27,11 @@ struct SettingsView: View {
|
||||
var isBackgroundRefreshEnabled: Bool = true
|
||||
|
||||
@State var isShowingConnectAppleIDView = false
|
||||
@State var isShowingAddShortcutView = false
|
||||
@State var isShowingFeedbackMailView = false
|
||||
@State var isShowingResetPairingFileConfirmation = false
|
||||
|
||||
@State var externalURLToShow: URL?
|
||||
|
||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""
|
||||
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown Version"
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
@@ -93,13 +91,8 @@ struct SettingsView: View {
|
||||
Toggle(isOn: self.$isBackgroundRefreshEnabled, label: {
|
||||
Text(L10n.SettingsView.backgroundRefresh)
|
||||
})
|
||||
|
||||
SwiftUI.Button {
|
||||
self.isShowingAddShortcutView = true
|
||||
} label: {
|
||||
Text(L10n.SettingsView.addToSiri)
|
||||
}
|
||||
.sheet(isPresented: self.$isShowingAddShortcutView) {
|
||||
|
||||
ModalNavigationLink(L10n.SettingsView.addToSiri) {
|
||||
if let shortcut = INShortcut(intent: INInteraction.refreshAllApps().intent) {
|
||||
SiriShortcutSetupView(shortcut: shortcut)
|
||||
}
|
||||
@@ -163,10 +156,7 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
if MailComposeView.canSendMail {
|
||||
SwiftUI.Button("Send Feedback") {
|
||||
self.isShowingFeedbackMailView = true
|
||||
}
|
||||
.sheet(isPresented: self.$isShowingFeedbackMailView) {
|
||||
ModalNavigationLink("Send Feedback") {
|
||||
MailComposeView(recipients: ["support@sidestore.io"],
|
||||
subject: "SideStore Beta \(appVersion) Feedback") {
|
||||
NotificationManager.shared.showNotification(title: "Thank you for your feedback!")
|
||||
|
||||
Reference in New Issue
Block a user