Refactor to use Bedrock's LicensesView with License model
This commit is contained in:
parent
44512e923c
commit
d0e541910b
@ -8,63 +8,36 @@
|
||||
import SwiftUI
|
||||
import Bedrock
|
||||
|
||||
// MARK: - Licenses View
|
||||
// MARK: - App Licenses
|
||||
|
||||
struct LicensesView: View {
|
||||
var body: some View {
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.large) {
|
||||
// MijickCamera
|
||||
licenseCard(
|
||||
extension License {
|
||||
/// All open source licenses used in SelfieCam
|
||||
static let appLicenses: [License] = [
|
||||
License(
|
||||
name: "MijickCamera",
|
||||
url: "https://github.com/Mijick/Camera",
|
||||
license: "Apache 2.0 License",
|
||||
licenseType: "Apache 2.0 License",
|
||||
description: "Camera framework for SwiftUI. Created by Tomasz Kurylik at Mijick."
|
||||
)
|
||||
|
||||
// RevenueCat
|
||||
licenseCard(
|
||||
),
|
||||
License(
|
||||
name: "RevenueCat",
|
||||
url: "https://github.com/RevenueCat/purchases-ios",
|
||||
license: "MIT License",
|
||||
licenseType: "MIT License",
|
||||
description: "In-app subscriptions made easy."
|
||||
)
|
||||
}
|
||||
.padding(Design.Spacing.large)
|
||||
}
|
||||
.background(AppSurface.overlay)
|
||||
.navigationTitle(String(localized: "Open Source Licenses"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
private func licenseCard(name: String, url: String, license: String, description: String) -> some View {
|
||||
SettingsCard(backgroundColor: AppSurface.card, borderColor: AppBorder.subtle) {
|
||||
VStack(alignment: .leading, spacing: Design.Spacing.small) {
|
||||
Text(name)
|
||||
.font(.system(size: Design.BaseFontSize.medium, weight: .bold))
|
||||
.foregroundStyle(.white)
|
||||
// MARK: - App Licenses View
|
||||
|
||||
Text(description)
|
||||
.font(.system(size: Design.BaseFontSize.caption))
|
||||
.foregroundStyle(.white.opacity(Design.Opacity.strong))
|
||||
|
||||
HStack {
|
||||
Label(license, systemImage: "doc.text")
|
||||
.font(.system(size: Design.BaseFontSize.xSmall))
|
||||
.foregroundStyle(AppAccent.primary)
|
||||
|
||||
Spacer()
|
||||
|
||||
if let linkURL = URL(string: url) {
|
||||
Link(destination: linkURL) {
|
||||
Label(String(localized: "View on GitHub"), systemImage: "arrow.up.right.square")
|
||||
.font(.system(size: Design.BaseFontSize.xSmall))
|
||||
.foregroundStyle(AppAccent.primary)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.top, Design.Spacing.xSmall)
|
||||
}
|
||||
}
|
||||
struct AppLicensesView: View {
|
||||
var body: some View {
|
||||
LicensesView(
|
||||
licenses: License.appLicenses,
|
||||
backgroundColor: AppSurface.overlay,
|
||||
cardBackgroundColor: AppSurface.card,
|
||||
cardBorderColor: AppBorder.subtle,
|
||||
accentColor: AppAccent.primary
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -533,7 +533,7 @@ struct SettingsView: View {
|
||||
subtitle: String(localized: "Third-party libraries used in this app"),
|
||||
backgroundColor: .clear
|
||||
) {
|
||||
LicensesView()
|
||||
AppLicensesView()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user