[WIP] AppIDs view in My Apps section

This commit is contained in:
Fabian Thies
2023-01-13 12:02:06 +01:00
committed by Joe Mattiello
parent f17d00c0bc
commit a6ca73f8fc
3 changed files with 78 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
1F07F5672955D16A00F7BE95 /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 1F07F5662955D16A00F7BE95 /* SFSafeSymbols */; };
1F07F5692955D3EC00F7BE95 /* SFSafeSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = 1F07F5682955D3EC00F7BE95 /* SFSafeSymbols */; };
1F07F56B2955F11500F7BE95 /* AppScreenshotsPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F07F56A2955F11500F7BE95 /* AppScreenshotsPreview.swift */; };
1F07F56F2955FB2000F7BE95 /* AppIDsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F07F56E2955FB2000F7BE95 /* AppIDsView.swift */; };
1F0DD81C2932D2FF007608A4 /* AppScreenshotsScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD81B2932D2FF007608A4 /* AppScreenshotsScrollView.swift */; };
1F0DD81F2932D84C007608A4 /* ExpandableText in Frameworks */ = {isa = PBXBuildFile; productRef = 1F0DD81E2932D84C007608A4 /* ExpandableText */; };
1F0DD8212933B749007608A4 /* AppPermissionsGrid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD8202933B749007608A4 /* AppPermissionsGrid.swift */; };
@@ -559,6 +560,7 @@
1920B04E2924AC8300744F60 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
19B9B7442845E6DF0076EF69 /* SelectTeamViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTeamViewController.swift; sourceTree = "<group>"; };
1F07F56A2955F11500F7BE95 /* AppScreenshotsPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppScreenshotsPreview.swift; sourceTree = "<group>"; };
1F07F56E2955FB2000F7BE95 /* AppIDsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppIDsView.swift; sourceTree = "<group>"; };
1F0DD81B2932D2FF007608A4 /* AppScreenshotsScrollView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppScreenshotsScrollView.swift; sourceTree = "<group>"; };
1F0DD8202933B749007608A4 /* AppPermissionsGrid.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppPermissionsGrid.swift; sourceTree = "<group>"; };
1F0DD83E29367F6C007608A4 /* ConnectAppleIDView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectAppleIDView.swift; sourceTree = "<group>"; };
@@ -1154,6 +1156,7 @@
1FAFC5BD2927E10D00B8D837 /* MyAppsView.swift */,
1FA1C8C9294906890083119D /* MyAppsViewModel.swift */,
1F6284D4295209DA0060AAD8 /* AppAction.swift */,
1F07F56E2955FB2000F7BE95 /* AppIDsView.swift */,
);
path = "My Apps";
sourceTree = "<group>";
@@ -2792,6 +2795,7 @@
1F6284D7295218980060AAD8 /* DocumentPicker.swift in Sources */,
BFBE0007250AD0E70080826E /* ViewAppIntentHandler.swift in Sources */,
1F0DD83F29367F6C007608A4 /* ConnectAppleIDView.swift in Sources */,
1F07F56F2955FB2000F7BE95 /* AppIDsView.swift in Sources */,
BFDB6A0822AAED73007EA6D6 /* ResignAppOperation.swift in Sources */,
D593F1942717749A006E82DE /* PatchAppOperation.swift in Sources */,
BF770E5122BB1CF6002A40FE /* InstallAppOperation.swift in Sources */,

View File

@@ -0,0 +1,58 @@
//
// AppIDsView.swift
// SideStore
//
// Created by Fabian Thies on 23.12.22.
// Copyright © 2022 SideStore. All rights reserved.
//
import SwiftUI
import AltStoreCore
struct AppIDsView: View {
@Environment(\.dismiss) var dismiss
@SwiftUI.FetchRequest(sortDescriptors: [
NSSortDescriptor(keyPath: \AppID.name, ascending: true),
NSSortDescriptor(keyPath: \AppID.bundleIdentifier, ascending: true),
NSSortDescriptor(keyPath: \AppID.expirationDate, ascending: true)
], predicate: NSPredicate(format: "%K == %@", #keyPath(AppID.team), DatabaseManager.shared.activeTeam() ?? Team()))
var appIDs: FetchedResults<AppID>
var body: some View {
ScrollView {
LazyVStack(alignment: .leading) {
Text("Each app and app extension installed with SideStore must register an App ID with Apple.\n\nApp IDs for paid developer accounts never expire, and there is no limit to how many you can create.")
.foregroundColor(.secondary)
ForEach(appIDs, id: \.identifier) { appId in
VStack {
Text(appId.name)
Text(appId.identifier)
.font(.callout)
.foregroundColor(.secondary)
}
.padding()
.tintedBackground(.accentColor)
.clipShape(RoundedRectangle(cornerRadius: 30, style: .circular))
}
}
.padding()
}
.navigationTitle("App IDs")
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
SwiftUI.Button("Done", action: self.dismiss)
}
}
}
}
struct AppIDsView_Previews: PreviewProvider {
static var previews: some View {
AppIDsView()
}
}

View File

@@ -39,6 +39,8 @@ struct MyAppsView: View {
@State var isShowingFilePicker: Bool = false
@State var selectedSideloadingIpaURL: URL?
@State var isShowingAppIDsView: Bool = false
var remainingAppIDs: Int {
guard let team = DatabaseManager.shared.activeTeam() else {
return 0
@@ -77,7 +79,7 @@ struct MyAppsView: View {
if updates.isEmpty {
if shouldShowAppUpdateHint {
updatesSection
updatesSection
}
}
@@ -108,14 +110,21 @@ struct MyAppsView: View {
}
VStack {
Text("\(remainingAppIDs) App IDs Remaining")
.foregroundColor(.secondary)
if DatabaseManager.shared.activeTeam()?.type == .free {
Text("\(remainingAppIDs) App IDs Remaining")
.foregroundColor(.secondary)
}
SwiftUI.Button {
self.isShowingAppIDsView = true
} label: {
Text("View App IDs")
}
.sheet(isPresented: self.$isShowingAppIDsView) {
NavigationView {
AppIDsView()
}
}
}
}
.padding(.horizontal)
@@ -149,7 +158,7 @@ struct MyAppsView: View {
VStack(alignment: .leading, spacing: 8) {
HStack(alignment: .center) {
Text("All Apps are Up To Date")
.bold()
.bold()
Spacer()
Menu {
@@ -172,8 +181,8 @@ struct MyAppsView: View {
Text("You will be notified once updates for your apps are available. The updates will then be shown here.")
.font(.callout)
}
.foregroundColor(.secondary)
.padding()
.foregroundColor(.secondary)
.padding()
.background(Color(.tertiarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 8))
}