[ADD] App report button and trusted source badge in app detail view

This commit is contained in:
Fabian Thies
2023-02-04 12:46:43 +01:00
parent df7d8871ff
commit 132b140af2
4 changed files with 63 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
//
// Source+Trusted.swift
// SideStore
//
// Created by Fabian Thies on 04.02.23.
// Copyright © 2023 SideStore. All rights reserved.
//
import AltStoreCore
extension Source {
var isOfficial: Bool {
self.identifier == Source.altStoreIdentifier
}
var isTrusted: Bool {
UserDefaults.shared.trustedSourceIDs?.contains(self.identifier) ?? false
}
}

View File

@@ -0,0 +1,19 @@
//
// StoreApp+Trusted.swift
// SideStore
//
// Created by Fabian Thies on 04.02.23.
// Copyright © 2023 SideStore. All rights reserved.
//
import AltStoreCore
extension StoreApp {
var isFromOfficialSource: Bool {
self.source?.isOfficial ?? false
}
var isFromTrustedSource: Bool {
self.source?.isTrusted ?? false
}
}

View File

@@ -88,8 +88,10 @@ struct AppDetailView: View {
var contentView: some View {
VStack(alignment: .leading) {
VStack(alignment: .leading, spacing: 32) {
if storeApp.sourceIdentifier == Source.altStoreIdentifier {
if storeApp.isFromOfficialSource {
officialAppBadge
} else if storeApp.isFromTrustedSource {
trustedAppBadge
}
if let subtitle = storeApp.subtitle {
@@ -159,6 +161,12 @@ struct AppDetailView: View {
Divider()
informationView
if !(storeApp.isFromOfficialSource || storeApp.isFromTrustedSource) {
Divider()
reportButton
}
}
.padding(.horizontal)
}
@@ -398,4 +406,12 @@ struct AppDetailView: View {
}
}
}
var reportButton: some View {
SwiftUI.Button {
} label: {
Label("Report this App", systemSymbol: .exclamationmarkBubble)
}
}
}