Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DefaultBrowser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
C5A333771BDAF6EA000767B2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5A333761BDAF6EA000767B2 /* AppDelegate.swift */; };
C5A333791BDAF6EA000767B2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C5A333781BDAF6EA000767B2 /* Assets.xcassets */; };
C5A3337C1BDAF6EA000767B2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C5A3337A1BDAF6EA000767B2 /* MainMenu.xib */; };
C5AF631129327A380087D317 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5AF631029327A380087D317 /* AboutView.swift */; };
C5AF62D4292EF8E00087D317 /* Intents.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5AF62D3292EF8E00087D317 /* Intents.swift */; };
C5AF62D6292EF92F0087D317 /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = C5AF62D5292EF92F0087D317 /* Intents.intentdefinition */; };
C5AF630F293273C00087D317 /* Bundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5AF630E293273C00087D317 /* Bundle.swift */; };
Expand Down Expand Up @@ -41,6 +42,7 @@
C5A3337D1BDAF6EA000767B2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C5AEAF5D29292C0A00F57C2F /* test.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = test.html; sourceTree = "<group>"; };
C5AEAF5E29292C2900F57C2F /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
C5AF631029327A380087D317 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
C5AF62D3292EF8E00087D317 /* Intents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Intents.swift; sourceTree = "<group>"; };
C5AF62D5292EF92F0087D317 /* Intents.intentdefinition */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; path = Intents.intentdefinition; sourceTree = "<group>"; };
C5AF630E293273C00087D317 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -86,6 +88,7 @@
children = (
C5BDAECF2DCAC8E900D18EB3 /* ImageTransforms.swift */,
C5A333761BDAF6EA000767B2 /* AppDelegate.swift */,
C5AF631029327A380087D317 /* AboutView.swift */,
C58951F31BEAD8BA0093EE2E /* SystemUtilities.swift */,
C5E39DC11BE83B48004E722B /* Defaults.swift */,
C5AF62D3292EF8E00087D317 /* Intents.swift */,
Expand Down Expand Up @@ -179,6 +182,7 @@
buildActionMask = 2147483647;
files = (
C58951F41BEAD8BA0093EE2E /* SystemUtilities.swift in Sources */,
C5AF631129327A380087D317 /* AboutView.swift in Sources */,
C5AF630F293273C00087D317 /* Bundle.swift in Sources */,
C5BDAED02DCAC8EE00D18EB3 /* ImageTransforms.swift in Sources */,
C5AF62D4292EF8E00087D317 /* Intents.swift in Sources */,
Expand Down
50 changes: 50 additions & 0 deletions DefaultBrowser/AboutView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// About.swift
// Default Browser
//
// Created by Cameron Little on 2022-11-26.
// Copyright © 2022 Cameron Little. All rights reserved.
//

import SwiftUI

let shortVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "<unknown>"
let buildNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "<unknown>"

@available(macOS 10.15, *)
extension Text {
func withSmallFontStyle() -> some View {
self
.font(.system(size: NSFont.smallSystemFontSize))
.multilineTextAlignment(.center)
}
}

@available(macOS 10.15, *)
struct AboutView: View {
var body: some View {
VStack(spacing: 20) {
Image("AppIcon")
.resizable()
.scaledToFill()
.frame(width: 32, height: 100)
Text("DefaultBrowser will automatically open links using the last browser you've used. You can disable this temporarily by clicking the menu icon and choosing a browser.")
VStack(spacing: 8) {
Text("Version \(shortVersion) (\(buildNumber))")
Text("Built by [Cameron Little](https://camlittle.com)")
Text("[GitHub project](https://github.com/apexskier/DefaultBrowser)")
}
.font(.system(size: NSFont.smallSystemFontSize))
.multilineTextAlignment(.center)
}
.frame(maxWidth: 340)
.padding(.all)
}
}

@available(macOS 10.15.0, *)
struct AboutView_Previews: PreviewProvider {
static var previews: some View {
AboutView()
}
}