mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[ADD] Hint view in MyAppsView telling the user about where to find updates in the future if no updates are available
This commit is contained in:
@@ -29,6 +29,9 @@ struct MyAppsView: View {
|
|||||||
], predicate: NSPredicate(format: "%K == YES", #keyPath(InstalledApp.isActive)))
|
], predicate: NSPredicate(format: "%K == YES", #keyPath(InstalledApp.isActive)))
|
||||||
var activeApps: FetchedResults<InstalledApp>
|
var activeApps: FetchedResults<InstalledApp>
|
||||||
|
|
||||||
|
@AppStorage("shouldShowAppUpdateHint")
|
||||||
|
var shouldShowAppUpdateHint: Bool = true
|
||||||
|
|
||||||
@ObservedObject
|
@ObservedObject
|
||||||
var viewModel = MyAppsViewModel()
|
var viewModel = MyAppsViewModel()
|
||||||
|
|
||||||
@@ -72,7 +75,11 @@ struct MyAppsView: View {
|
|||||||
.background(Color(UIColor.secondarySystemBackground))
|
.background(Color(UIColor.secondarySystemBackground))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if updates.isEmpty {
|
||||||
|
if shouldShowAppUpdateHint {
|
||||||
updatesSection
|
updatesSection
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Text("Active")
|
Text("Active")
|
||||||
@@ -139,15 +146,36 @@ struct MyAppsView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var updatesSection: some View {
|
var updatesSection: some View {
|
||||||
Text("No Updates Available")
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
.font(.headline)
|
HStack(alignment: .center) {
|
||||||
|
Text("All Apps are Up To Date")
|
||||||
.bold()
|
.bold()
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
SwiftUI.Button {
|
||||||
|
self.dismissUpdatesHint(forever: false)
|
||||||
|
} label: {
|
||||||
|
Label("Dismiss for now", systemSymbol: .zzz)
|
||||||
|
}
|
||||||
|
|
||||||
|
SwiftUI.Button {
|
||||||
|
self.dismissUpdatesHint(forever: true)
|
||||||
|
} label: {
|
||||||
|
Label("Don't show this again", systemSymbol: .xmark)
|
||||||
|
}
|
||||||
|
} label: {
|
||||||
|
Image(systemSymbol: .xmark)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text("You will be notified once updates for your apps are available. The updates will then be shown here.")
|
||||||
|
.font(.callout)
|
||||||
|
}
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.opacity(0.8)
|
|
||||||
.padding()
|
.padding()
|
||||||
.frame(maxWidth: .infinity)
|
.background(Color(.tertiarySystemBackground))
|
||||||
.tintedBackground(.accentColor)
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 30, style: .circular))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
@@ -169,6 +197,12 @@ struct MyAppsView: View {
|
|||||||
|
|
||||||
self.refresh(installedApps) { result in }
|
self.refresh(installedApps) { result in }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func dismissUpdatesHint(forever: Bool) {
|
||||||
|
withAnimation {
|
||||||
|
self.shouldShowAppUpdateHint = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user