[ADD] Hint for new users who don't have any sources

This commit is contained in:
Fabian Thies
2023-01-16 19:02:58 +01:00
committed by Joe Mattiello
parent 6aaadc79e5
commit fc974a8079
4 changed files with 90 additions and 19 deletions

View File

@@ -33,6 +33,8 @@
1F0DD84129368056007608A4 /* EnvironmentValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD84029368056007608A4 /* EnvironmentValues.swift */; }; 1F0DD84129368056007608A4 /* EnvironmentValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD84029368056007608A4 /* EnvironmentValues.swift */; };
1F0DD8432936B0F9007608A4 /* RoundedTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD8422936B0F9007608A4 /* RoundedTextField.swift */; }; 1F0DD8432936B0F9007608A4 /* RoundedTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD8422936B0F9007608A4 /* RoundedTextField.swift */; };
1F0DD8452936B3FE007608A4 /* FilledButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD8442936B3FE007608A4 /* FilledButtonStyle.swift */; }; 1F0DD8452936B3FE007608A4 /* FilledButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F0DD8442936B3FE007608A4 /* FilledButtonStyle.swift */; };
1F44634529744E570070E514 /* HintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F44634429744E570070E514 /* HintView.swift */; };
1F5DF9D82974426300DDAA47 /* AppScreenshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F5DF9D72974426300DDAA47 /* AppScreenshot.swift */; };
1F6284D5295209DA0060AAD8 /* AppAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6284D4295209DA0060AAD8 /* AppAction.swift */; }; 1F6284D5295209DA0060AAD8 /* AppAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6284D4295209DA0060AAD8 /* AppAction.swift */; };
1F6284D7295218980060AAD8 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6284D6295218980060AAD8 /* DocumentPicker.swift */; }; 1F6284D7295218980060AAD8 /* DocumentPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6284D6295218980060AAD8 /* DocumentPicker.swift */; };
1F6284D929523D340060AAD8 /* SideloadingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6284D829523D340060AAD8 /* SideloadingManager.swift */; }; 1F6284D929523D340060AAD8 /* SideloadingManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F6284D829523D340060AAD8 /* SideloadingManager.swift */; };
@@ -572,6 +574,8 @@
1F0DD84029368056007608A4 /* EnvironmentValues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentValues.swift; sourceTree = "<group>"; }; 1F0DD84029368056007608A4 /* EnvironmentValues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentValues.swift; sourceTree = "<group>"; };
1F0DD8422936B0F9007608A4 /* RoundedTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedTextField.swift; sourceTree = "<group>"; }; 1F0DD8422936B0F9007608A4 /* RoundedTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoundedTextField.swift; sourceTree = "<group>"; };
1F0DD8442936B3FE007608A4 /* FilledButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilledButtonStyle.swift; sourceTree = "<group>"; }; 1F0DD8442936B3FE007608A4 /* FilledButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilledButtonStyle.swift; sourceTree = "<group>"; };
1F44634429744E570070E514 /* HintView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HintView.swift; sourceTree = "<group>"; };
1F5DF9D72974426300DDAA47 /* AppScreenshot.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppScreenshot.swift; sourceTree = "<group>"; };
1F6284D4295209DA0060AAD8 /* AppAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAction.swift; sourceTree = "<group>"; }; 1F6284D4295209DA0060AAD8 /* AppAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppAction.swift; sourceTree = "<group>"; };
1F6284D6295218980060AAD8 /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; }; 1F6284D6295218980060AAD8 /* DocumentPicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentPicker.swift; sourceTree = "<group>"; };
1F6284D829523D340060AAD8 /* SideloadingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideloadingManager.swift; sourceTree = "<group>"; }; 1F6284D829523D340060AAD8 /* SideloadingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SideloadingManager.swift; sourceTree = "<group>"; };
@@ -1198,9 +1202,11 @@
children = ( children = (
1F6E08D9292806E0005059C0 /* AppRowView.swift */, 1F6E08D9292806E0005059C0 /* AppRowView.swift */,
1F6E08DB292807D3005059C0 /* AppIconView.swift */, 1F6E08DB292807D3005059C0 /* AppIconView.swift */,
1F6E08E529280F4B005059C0 /* RatingStars.swift */,
1FB96FBD292A20E5007E68D1 /* ObservableScrollView.swift */,
1FB96FBF292A63F2007E68D1 /* AppPillButton.swift */, 1FB96FBF292A63F2007E68D1 /* AppPillButton.swift */,
1F5DF9D72974426300DDAA47 /* AppScreenshot.swift */,
1F44634429744E570070E514 /* HintView.swift */,
1FB96FBD292A20E5007E68D1 /* ObservableScrollView.swift */,
1F6E08E529280F4B005059C0 /* RatingStars.swift */,
1F0DD8422936B0F9007608A4 /* RoundedTextField.swift */, 1F0DD8422936B0F9007608A4 /* RoundedTextField.swift */,
); );
path = "View Components"; path = "View Components";
@@ -2808,6 +2814,7 @@
BFC84A4D2421A19100853474 /* SourcesViewController.swift in Sources */, BFC84A4D2421A19100853474 /* SourcesViewController.swift in Sources */,
BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */, BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */,
D57FE84428C7DB7100216002 /* ErrorLogViewController.swift in Sources */, D57FE84428C7DB7100216002 /* ErrorLogViewController.swift in Sources */,
1F44634529744E570070E514 /* HintView.swift in Sources */,
1F6E08E429280D1E005059C0 /* PillButtonStyle.swift in Sources */, 1F6E08E429280D1E005059C0 /* PillButtonStyle.swift in Sources */,
1F6284D7295218980060AAD8 /* DocumentPicker.swift in Sources */, 1F6284D7295218980060AAD8 /* DocumentPicker.swift in Sources */,
BFBE0007250AD0E70080826E /* ViewAppIntentHandler.swift in Sources */, BFBE0007250AD0E70080826E /* ViewAppIntentHandler.swift in Sources */,
@@ -2820,6 +2827,7 @@
BF6C8FAC242935ED00125131 /* NSAttributedString+Markdown.m in Sources */, BF6C8FAC242935ED00125131 /* NSAttributedString+Markdown.m in Sources */,
BFF00D322501BDA100746320 /* BackgroundRefreshAppsOperation.swift in Sources */, BFF00D322501BDA100746320 /* BackgroundRefreshAppsOperation.swift in Sources */,
1F66F5BC2938F03700A910CA /* Modifiers.swift in Sources */, 1F66F5BC2938F03700A910CA /* Modifiers.swift in Sources */,
1F5DF9D82974426300DDAA47 /* AppScreenshot.swift in Sources */,
1F66F5BA2938CA5700A910CA /* VisualEffectView.swift in Sources */, 1F66F5BA2938CA5700A910CA /* VisualEffectView.swift in Sources */,
BF0C4EBD22A1BD8B009A2DD7 /* AppManager.swift in Sources */, BF0C4EBD22A1BD8B009A2DD7 /* AppManager.swift in Sources */,
BF2901312318F7A800D88A45 /* AppBannerView.swift in Sources */, BF2901312318F7A800D88A45 /* AppBannerView.swift in Sources */,

View 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)
}
}
}
}

View File

@@ -42,15 +42,34 @@ struct BrowseView: View {
.bold() .bold()
} }
} }
LazyVStack(spacing: 32) { if searchText.isEmpty, filteredApps.count == 0 {
ForEach(filteredApps, id: \.bundleIdentifier) { app in HintView {
NavigationLink { Text("You don't have any apps yet.")
AppDetailView(storeApp: app) .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: { } 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 { struct BrowseView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
BrowseView() NavigationView {
BrowseView()
}
} }
} }

View File

@@ -155,19 +155,19 @@ struct MyAppsView: View {
} }
var updatesSection: some View { var updatesSection: some View {
VStack(alignment: .leading, spacing: 8) { HintView {
HStack(alignment: .center) { HStack(alignment: .center) {
Text("All Apps are Up To Date") Text("All Apps are Up To Date")
.bold() .bold()
Spacer() Spacer()
Menu { Menu {
SwiftUI.Button { SwiftUI.Button {
self.dismissUpdatesHint(forever: false) self.dismissUpdatesHint(forever: false)
} label: { } label: {
Label("Dismiss for now", systemSymbol: .zzz) Label("Dismiss for now", systemSymbol: .zzz)
} }
SwiftUI.Button { SwiftUI.Button {
self.dismissUpdatesHint(forever: true) self.dismissUpdatesHint(forever: true)
} label: { } label: {
@@ -176,15 +176,13 @@ struct MyAppsView: View {
} label: { } label: {
Image(systemSymbol: .xmark) Image(systemSymbol: .xmark)
} }
.foregroundColor(.secondary)
} }
Text("You will be notified once updates for your apps are available. The updates will then be shown here.") Text("You will be notified once updates for your apps are available. The updates will then be shown here.")
.font(.callout) .font(.callout)
.foregroundColor(.secondary)
} }
.foregroundColor(.secondary)
.padding()
.background(Color(.tertiarySystemBackground))
.clipShape(RoundedRectangle(cornerRadius: 8))
} }
@ViewBuilder @ViewBuilder
@@ -428,6 +426,8 @@ extension MyAppsView {
struct MyAppsView_Previews: PreviewProvider { struct MyAppsView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
MyAppsView() NavigationView {
MyAppsView()
}
} }
} }