mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 16:23:32 +01:00
[ADD] Hint for new users who don't have any sources
This commit is contained in:
42
AltStore/View Components/HintView.swift
Normal file
42
AltStore/View Components/HintView.swift
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// HintView.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by Fabian Thies on 15.01.23.
|
||||
// Copyright © 2023 SideStore. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HintView<Content: View>: View {
|
||||
|
||||
var backgroundColor: Color = Color(.tertiarySystemBackground)
|
||||
|
||||
@ViewBuilder
|
||||
let content: () -> Content
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
self.content()
|
||||
}
|
||||
.padding()
|
||||
.background(self.backgroundColor)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||
}
|
||||
}
|
||||
|
||||
struct HintView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ZStack {
|
||||
Color(.secondarySystemBackground).edgesIgnoringSafeArea(.all)
|
||||
|
||||
HintView {
|
||||
Text("Hint Title")
|
||||
.bold()
|
||||
|
||||
Text("This hint view can be used to tell the user something about how SideStore works.")
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,15 +42,34 @@ struct BrowseView: View {
|
||||
.bold()
|
||||
}
|
||||
}
|
||||
|
||||
LazyVStack(spacing: 32) {
|
||||
ForEach(filteredApps, id: \.bundleIdentifier) { app in
|
||||
NavigationLink {
|
||||
AppDetailView(storeApp: app)
|
||||
|
||||
if searchText.isEmpty, filteredApps.count == 0 {
|
||||
HintView {
|
||||
Text("You don't have any apps yet.")
|
||||
.bold()
|
||||
|
||||
Text("Apps are provided by \"sources\". The specification for them is an open standard, so everyone can create their own source. To get you started, we have compiled a list of \"Trusted Sources\" which you can check out by tapping the button below.")
|
||||
.font(.callout)
|
||||
.foregroundColor(.secondary)
|
||||
|
||||
SwiftUI.Button {
|
||||
self.isShowingSourcesView = true
|
||||
} label: {
|
||||
BrowseAppPreviewView(storeApp: app)
|
||||
Label("Add Source", systemSymbol: .plus)
|
||||
}
|
||||
.buttonStyle(FilledButtonStyle())
|
||||
.padding(.top, 8)
|
||||
}
|
||||
} else {
|
||||
LazyVStack(spacing: 32) {
|
||||
ForEach(filteredApps, id: \.bundleIdentifier) { app in
|
||||
NavigationLink {
|
||||
AppDetailView(storeApp: app)
|
||||
} label: {
|
||||
BrowseAppPreviewView(storeApp: app)
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -111,7 +130,9 @@ struct BrowseView: View {
|
||||
|
||||
struct BrowseView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
BrowseView()
|
||||
NavigationView {
|
||||
BrowseView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,19 +155,19 @@ struct MyAppsView: View {
|
||||
}
|
||||
|
||||
var updatesSection: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
HintView {
|
||||
HStack(alignment: .center) {
|
||||
Text("All Apps are Up To Date")
|
||||
.bold()
|
||||
Spacer()
|
||||
|
||||
|
||||
Menu {
|
||||
SwiftUI.Button {
|
||||
self.dismissUpdatesHint(forever: false)
|
||||
} label: {
|
||||
Label("Dismiss for now", systemSymbol: .zzz)
|
||||
}
|
||||
|
||||
|
||||
SwiftUI.Button {
|
||||
self.dismissUpdatesHint(forever: true)
|
||||
} label: {
|
||||
@@ -176,15 +176,13 @@ struct MyAppsView: View {
|
||||
} label: {
|
||||
Image(systemSymbol: .xmark)
|
||||
}
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
.padding()
|
||||
.background(Color(.tertiarySystemBackground))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -428,6 +426,8 @@ extension MyAppsView {
|
||||
|
||||
struct MyAppsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MyAppsView()
|
||||
NavigationView {
|
||||
MyAppsView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user