SelfieCam/SelfieCam/Features/Settings/LicensesView.swift

71 lines
2.4 KiB
Swift

//
// LicensesView.swift
// SelfieCam
//
// Created by Matt Bruce on 1/4/26.
//
import SwiftUI
import Bedrock
// MARK: - Licenses View
struct LicensesView: View {
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: Design.Spacing.large) {
// MijickCamera
licenseCard(
name: "MijickCamera",
url: "https://github.com/Mijick/Camera",
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(Color.Surface.overlay)
.navigationTitle(String(localized: "Open Source Licenses"))
.navigationBarTitleDisplayMode(.inline)
}
private func licenseCard(name: String, url: String, license: String, description: String) -> some View {
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(Color.Accent.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(Color.Accent.primary)
}
}
}
.padding(.top, Design.Spacing.xSmall)
}
.padding(Design.Spacing.medium)
.background(Color.Surface.primary, in: RoundedRectangle(cornerRadius: Design.CornerRadius.medium))
}
}