Skip to content

Commit

Permalink
new api page + ipad full support yay
Browse files Browse the repository at this point in the history
  • Loading branch information
cranci1 committed Apr 13, 2024
1 parent 023a9ac commit 8f464cc
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 36 deletions.
4 changes: 2 additions & 2 deletions AnimeGen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = AnimeGen/AnimeGen.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = 399LMK6Q2Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AnimeGen/Info.plist;
Expand Down Expand Up @@ -480,7 +480,7 @@
CODE_SIGN_ENTITLEMENTS = AnimeGen/AnimeGen.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_TEAM = 399LMK6Q2Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = AnimeGen/Info.plist;
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion AnimeGen/APIs/nekosmoe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ extension ViewController {
self.imageView.image = newImage
self.addToHistory(image: newImage)
self.animateImageChange(with: newImage)
self.tagsLabel.isHidden = true
self.tagsLabel.isHidden = !self.moetags
self.incrementCounter()
} else {
print("Failed to load image data.")
Expand Down
1 change: 1 addition & 0 deletions AnimeGen/History/HistoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct HistoryView: View {
.navigationBarTitle("History")
}
}
.navigationViewStyle(StackNavigationViewStyle())
}
}

Expand Down
1 change: 1 addition & 0 deletions AnimeGen/Settings/AboutPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct AboutPage: View {
.navigationBarHidden(true)
}
.navigationBarTitle("About", displayMode: .inline)
.navigationViewStyle(StackNavigationViewStyle())
}
}

Expand Down
84 changes: 55 additions & 29 deletions AnimeGen/Settings/ApiPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,49 +29,75 @@ struct ApiPage: View {
var body: some View {
NavigationView {
ScrollView {
VStack(spacing: 10) {
ForEach(0..<apiData.count, id: \.self) { index in
if index % 3 == 0 {
HStack(spacing: 20) {
apiItem(index: index)
if index + 1 < apiData.count {
apiItem(index: index + 1)
}
if index + 2 < apiData.count {
apiItem(index: index + 2)
}
VStack(spacing: 20) {
ForEach(Array(apiData.enumerated()), id: \.element.self) { index, data in
if index != apiData.count - 1 {
APIRow(data: data)
} else {
VStack(spacing: 10) {
APIRow(data: data)
THanksSection()
}
}
}
}
.padding(EdgeInsets(top: 10, leading: 10, bottom: 30, trailing: 10))
.padding()
}
.navigationBarHidden(true)
}
.navigationBarTitle(Text("APIs Credit"), displayMode: .inline)
.navigationBarTitle("APIs Credit", displayMode: .inline)
.navigationViewStyle(StackNavigationViewStyle())
}
}

private func apiItem(index: Int) -> some View {
let data = apiData[index]

return Button(action: {
openURL(data.url)
}) {
VStack {
Image(data.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(height: 100)
.cornerRadius(10)
struct THanksSection: View {
var body: some View {
VStack(spacing: 10) {
Text("Special Thanks")
.font(.title)
.fontWeight(.bold)
Text("Special thanks to all the developers who provided these APIs for public use. Without them, this project wouldn't exist. Thank you very much!")
.font(.caption)
.fontWeight(.semibold)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
}
.padding()
.background(Color.secondary.opacity(0.1))
.cornerRadius(10)
}
}

struct APIRow: View {
let data: ApiPage.APIInfo

var body: some View {
HStack {
Image(data.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 80, height: 80)
.cornerRadius(10)
.onTapGesture {
openURL(data.url)
}

VStack(alignment: .leading) {
Text(data.apiName)
.padding(.top, 5)
.font(.headline)
.font(.title)
.foregroundColor(.accentColor)
.padding(.vertical, 10)
.onTapGesture {
openURL(data.url)
}
}
.padding(.horizontal, 10)
Spacer()
}
.buttonStyle(PlainButtonStyle())
.background(Color.secondary.opacity(0.1))
.cornerRadius(10)
}

private func openURL(_ url: URL) {
UIApplication.shared.open(url)
}
Expand Down
8 changes: 4 additions & 4 deletions AnimeGen/Settings/SettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ struct SettingsPage: View {
}
))
}


Section(header: Text("Tags"), footer: Text("An app restart is necessary to enable or disable the changes.")) {
Toggle("Display Tags", isOn: Binding(
Expand All @@ -67,9 +66,8 @@ struct SettingsPage: View {
))
}


Section(header: Text("Content"), footer: Text("Caution: This content is on the borderline of explicit material and includes adult content. Viewer discretion is advised.")) {

Toggle("Explicit Contents", isOn: Binding(
get: { self.explicitCont },
set: { newValue in
Expand All @@ -92,14 +90,16 @@ struct SettingsPage: View {
}

}
.listStyle(GroupedListStyle())
.navigationBarTitle("Settings")
}
.navigationViewStyle(StackNavigationViewStyle())
}
}

struct SettingsPage_Preview: PreviewProvider {
static var previews: some View {
SettingsPage()
.preferredColorScheme(.dark)
.preferredColorScheme(.light)
}
}

0 comments on commit 8f464cc

Please sign in to comment.