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 SwiftUI
|
||||||
import Bedrock
|
import Bedrock
|
||||||
|
|
||||||
// MARK: - Licenses View
|
// MARK: - App Licenses
|
||||||
|
|
||||||
struct LicensesView: View {
|
extension License {
|
||||||
|
/// All open source licenses used in SelfieCam
|
||||||
|
static let appLicenses: [License] = [
|
||||||
|
License(
|
||||||
|
name: "MijickCamera",
|
||||||
|
url: "https://github.com/Mijick/Camera",
|
||||||
|
licenseType: "Apache 2.0 License",
|
||||||
|
description: "Camera framework for SwiftUI. Created by Tomasz Kurylik at Mijick."
|
||||||
|
),
|
||||||
|
License(
|
||||||
|
name: "RevenueCat",
|
||||||
|
url: "https://github.com/RevenueCat/purchases-ios",
|
||||||
|
licenseType: "MIT License",
|
||||||
|
description: "In-app subscriptions made easy."
|
||||||
|
)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - App Licenses View
|
||||||
|
|
||||||
|
struct AppLicensesView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
LicensesView(
|
||||||
VStack(alignment: .leading, spacing: Design.Spacing.large) {
|
licenses: License.appLicenses,
|
||||||
// MijickCamera
|
backgroundColor: AppSurface.overlay,
|
||||||
licenseCard(
|
cardBackgroundColor: AppSurface.card,
|
||||||
name: "MijickCamera",
|
cardBorderColor: AppBorder.subtle,
|
||||||
url: "https://github.com/Mijick/Camera",
|
accentColor: AppAccent.primary
|
||||||
license: "Apache 2.0 License",
|
)
|
||||||
description: "Camera framework for SwiftUI. Created by Tomasz Kurylik at Mijick."
|
|
||||||
)
|
|
||||||
|
|
||||||
// RevenueCat
|
|
||||||
licenseCard(
|
|
||||||
name: "RevenueCat",
|
|
||||||
url: "https://github.com/RevenueCat/purchases-ios",
|
|
||||||
license: "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)
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -533,7 +533,7 @@ struct SettingsView: View {
|
|||||||
subtitle: String(localized: "Third-party libraries used in this app"),
|
subtitle: String(localized: "Third-party libraries used in this app"),
|
||||||
backgroundColor: .clear
|
backgroundColor: .clear
|
||||||
) {
|
) {
|
||||||
LicensesView()
|
AppLicensesView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user