feat: add about page

This commit is contained in:
2024-07-30 22:27:13 +01:00
parent 2e66788e7c
commit 3c199c2b31
10 changed files with 162 additions and 9 deletions

View File

@@ -17,6 +17,9 @@
F13839722C51BABD00B4814F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F13839712C51BABD00B4814F /* ContentView.swift */; };
F13839742C51BABE00B4814F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F13839732C51BABE00B4814F /* Assets.xcassets */; };
F13839772C51BABE00B4814F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F13839762C51BABE00B4814F /* Preview Assets.xcassets */; };
F167F80E2C5964AD002958B9 /* TitleBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F167F80D2C5964AD002958B9 /* TitleBar.swift */; };
F167F8102C5984CC002958B9 /* AboutPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = F167F80F2C5984CC002958B9 /* AboutPage.swift */; };
F167F8122C59908E002958B9 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F167F8112C59908E002958B9 /* Constants.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -32,6 +35,9 @@
F13839712C51BABD00B4814F /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
F13839732C51BABE00B4814F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F13839762C51BABE00B4814F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
F167F80D2C5964AD002958B9 /* TitleBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleBar.swift; sourceTree = "<group>"; };
F167F80F2C5984CC002958B9 /* AboutPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutPage.swift; sourceTree = "<group>"; };
F167F8112C59908E002958B9 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -75,6 +81,9 @@
F12B734A2C56AEB00064A230 /* LiveStatusManager.swift */,
F12B734C2C5702EC0064A230 /* LiveListenerCounter.swift */,
F12B734F2C57BDD90064A230 /* DottedBackground.swift */,
F167F80D2C5964AD002958B9 /* TitleBar.swift */,
F167F80F2C5984CC002958B9 /* AboutPage.swift */,
F167F8112C59908E002958B9 /* Constants.swift */,
);
path = InfinifiIOS;
sourceTree = "<group>";
@@ -158,9 +167,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F167F8102C5984CC002958B9 /* AboutPage.swift in Sources */,
F167F80E2C5964AD002958B9 /* TitleBar.swift in Sources */,
F12B734B2C56AEB00064A230 /* LiveStatusManager.swift in Sources */,
F12B73452C55505E0064A230 /* NeuButton.swift in Sources */,
F12B734D2C5702EC0064A230 /* LiveListenerCounter.swift in Sources */,
F167F8122C59908E002958B9 /* Constants.swift in Sources */,
F13839722C51BABD00B4814F /* ContentView.swift in Sources */,
F12B73472C55AC6B0064A230 /* PlaybackManager.swift in Sources */,
F12B73502C57BDD90064A230 /* DottedBackground.swift in Sources */,

View File

@@ -0,0 +1,75 @@
import Foundation
import SwiftUI
struct AboutPage: View {
private func openLink(string: String) {
guard let url = URL(string: string),
UIApplication.shared.canOpenURL(url)
else {
return
}
UIApplication.shared.open(url)
}
var body: some View {
VStack {
Text("about infinifi")
.font(.system(.title3, design: .monospaced))
.fontWeight(.bold)
.padding()
Spacer()
VStack(spacing: 24) {
NeuButton(action: {
openLink(string: sourceCodeURL)
}) {
Text("source code")
.font(.system(.body, design: .monospaced))
}
.frame(maxWidth: .infinity, maxHeight: 40)
NeuButton(action: {
openLink(string: xURL)
}) {
Text("my twitter")
.font(.system(.body, design: .monospaced))
}
.frame(maxWidth: .infinity, maxHeight: 40)
NeuButton(action: {
openLink(string: githubURL)
}) {
Text("my github")
.font(.system(.body, design: .monospaced))
}
.frame(maxWidth: .infinity, maxHeight: 40)
NeuButton(action: {
openLink(string: emailURL)
}) {
Text("my email")
.font(.system(.body, design: .monospaced))
}
.frame(maxWidth: .infinity, maxHeight: 40)
}
.padding()
Spacer()
HStack {
Spacer()
Image(uiImage: UIImage(named: "EepingCat")!)
.resizable()
.frame(width: 36, height: 18, alignment: .trailing)
.padding(.trailing)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(.base)
}
}
#Preview {
AboutPage()
}

View File

@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "EepingCat.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "EepingCat@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "EepingCat@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

View File

@@ -0,0 +1,13 @@
//
// Constants.swift
// InfinifiIOS
//
// Created by Kenneth on 30/07/2024.
//
import Foundation
let sourceCodeURL = "https://github.com/kennethnym/infinifi"
let xURL = "https://x.com/kennethnym"
let githubURL = "https://github.com/kennethnym"
let emailURL = "mailto:kennethnym@outlook.com"

View File

@@ -37,10 +37,7 @@ struct ContentView: View {
.ignoresSafeArea()
VStack(alignment: .center) {
Text("infinifi")
.font(.system(.title3, design: .monospaced))
.fontWeight(.bold)
.padding()
TitleBar()
Spacer()
@@ -52,6 +49,7 @@ struct ContentView: View {
.font(.system(size: 24))
.tint(.text)
}
.frame(width: 64, height: 64)
}
Spacer()

View File

@@ -37,8 +37,8 @@ struct NeuButton<Content>: View where Content: View {
Rectangle()
.fill(isPressed ? .base : .text)
.offset(
x: isPressed ? 0 : 4,
y: isPressed ? 0 : 4
x: isPressed ? 0 : 3,
y: isPressed ? 0 : 3
)
.overlay {
ZStack {
@@ -51,10 +51,9 @@ struct NeuButton<Content>: View where Content: View {
}
}
.border(.text, width: 2)
.frame(width: 64, height: 64)
.offset(
x: isPressed ? 6 : 0,
y: isPressed ? 6 : 0
x: isPressed ? 5 : 0,
y: isPressed ? 5 : 0
)
.buttonStyle(NeuButtonStyle { isPressed in
self.isPressed = isPressed

View File

@@ -0,0 +1,33 @@
import Foundation
import SwiftUI
struct TitleBar: View {
@State private var isSettingsOpen = false
var body: some View {
HStack(alignment: .center) {
Spacer()
Text("infinifi")
.font(.system(.title3, design: .monospaced))
.fontWeight(.bold)
.padding()
// offset the title down vertically by a bit to optically align with the settings button
.offset(x: 0, y: 4)
Spacer().overlay {
NeuButton(action: {
isSettingsOpen.toggle()
}) {
Image(systemName: "info.square.fill")
.font(.system(size: 16))
.tint(.text)
}
.frame(width: 32, height: 32)
}
}
.sheet(isPresented: $isSettingsOpen, content: {
AboutPage()
})
}
}