Skip to content

Commit

Permalink
First public release
Browse files Browse the repository at this point in the history
  • Loading branch information
Auties00 committed Oct 31, 2024
1 parent 78ea495 commit d74cd22
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 108 deletions.
25 changes: 13 additions & 12 deletions Artemis.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
F88812D42C4EB05F0084589B /* Playlist.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88812D32C4EB05F0084589B /* Playlist.swift */; };
F88812D62C4EC94B0084589B /* Schedule.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88812D52C4EC94B0084589B /* Schedule.swift */; };
F88A1EB02C469A1700DD48C3 /* RefreshTokenRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88A1EAF2C469A1700DD48C3 /* RefreshTokenRequest.swift */; };
F88A1EB92C46B96600DD48C3 /* ACarousel in Frameworks */ = {isa = PBXBuildFile; productRef = F88A1EB82C46B96600DD48C3 /* ACarousel */; };
F88A1EBB2C46BB7D00DD48C3 /* RefreshTokenResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88A1EBA2C46BB7D00DD48C3 /* RefreshTokenResponse.swift */; };
F88AC5362C51BD1F0099F004 /* AdjacentEpisodesResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88AC5352C51BD1F0099F004 /* AdjacentEpisodesResponse.swift */; };
F88B6C3A2C5BC943001A7B78 /* OfflineEpisodeSaver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88B6C392C5BC943001A7B78 /* OfflineEpisodeSaver.swift */; };
Expand All @@ -95,6 +94,7 @@
F89720B22C5EC6C0001DB75B /* ProfilesResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89720B12C5EC6C0001DB75B /* ProfilesResponse.swift */; };
F89720B42C5ECC5D001DB75B /* AccountDetailsResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89720B32C5ECC5D001DB75B /* AccountDetailsResponse.swift */; };
F89720B62C5ED203001DB75B /* ProfileSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89720B52C5ED203001DB75B /* ProfileSection.swift */; };
F89CA71B2CCDD390002C7367 /* ACarousel in Frameworks */ = {isa = PBXBuildFile; productRef = F89CA71A2CCDD390002C7367 /* ACarousel */; };
F89F2F562C69083600237611 /* EpisodeProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89F2F552C69083600237611 /* EpisodeProgressBar.swift */; };
F89F2F582C690C7A00237611 /* SelectProfileSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89F2F572C690C7A00237611 /* SelectProfileSection.swift */; };
F89F2F5A2C690F1600237611 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89F2F592C690F1600237611 /* String.swift */; };
Expand Down Expand Up @@ -235,11 +235,11 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F88A1EB92C46B96600DD48C3 /* ACarousel in Frameworks */,
F887202A2C3C4E5F001597B0 /* WelcomeSheet in Frameworks */,
F887202C2C3C4F03001597B0 /* WelcomeSheet in Frameworks */,
F803777A2C73757A00C00C0A /* SwiftUIIntrospect in Frameworks */,
F88C1CEB2C62471F0045FA75 /* AlertToast in Frameworks */,
F89CA71B2CCDD390002C7367 /* ACarousel in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -595,9 +595,9 @@
packageProductDependencies = (
F88720292C3C4E5F001597B0 /* WelcomeSheet */,
F887202B2C3C4F03001597B0 /* WelcomeSheet */,
F88A1EB82C46B96600DD48C3 /* ACarousel */,
F88C1CEA2C62471F0045FA75 /* AlertToast */,
F80377792C73757A00C00C0A /* SwiftUIIntrospect */,
F89CA71A2CCDD390002C7367 /* ACarousel */,
);
productName = Hidive;
productReference = F8871FF22C3C2937001597B0 /* Artemis.app */;
Expand Down Expand Up @@ -802,6 +802,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Apple Development";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -864,6 +865,7 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "Apple Development";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
Expand Down Expand Up @@ -893,7 +895,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 25U5GYGLQC;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -916,7 +918,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.6;
MARKETING_VERSION = 2.0;
MARKETING_VERSION = 3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.github.auties00.artemis;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -939,7 +941,7 @@
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 16;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 25U5GYGLQC;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -962,7 +964,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 13.6;
MARKETING_VERSION = 2.0;
MARKETING_VERSION = 3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.github.auties00.artemis;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1058,16 +1060,15 @@
package = F88720282C3C4E5F001597B0 /* XCRemoteSwiftPackageReference "Welcome-Sheet" */;
productName = WelcomeSheet;
};
F88A1EB82C46B96600DD48C3 /* ACarousel */ = {
isa = XCSwiftPackageProductDependency;
package = F88A1EB72C46B96600DD48C3 /* XCRemoteSwiftPackageReference "ACarousel" */;
productName = ACarousel;
};
F88C1CEA2C62471F0045FA75 /* AlertToast */ = {
isa = XCSwiftPackageProductDependency;
package = F88C1CE92C62471F0045FA75 /* XCRemoteSwiftPackageReference "AlertToast" */;
productName = AlertToast;
};
F89CA71A2CCDD390002C7367 /* ACarousel */ = {
isa = XCSwiftPackageProductDependency;
productName = ACarousel;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = F8871FEA2C3C2937001597B0 /* Project object */;
Expand Down
6 changes: 5 additions & 1 deletion Artemis/Model/Response/DashboardResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct DashboardResponse : Decodable, Equatable {
}

@Observable
class Hero : Decodable, Identifiable, Equatable {
class Hero : Decodable, Identifiable, Hashable, Equatable {
let heroId: Int
let title: String?
let description: String?
Expand All @@ -39,6 +39,10 @@ class Hero : Decodable, Identifiable, Equatable {
return heroId
}

func hash(into hasher: inout Hasher) {
hasher.combine(id)
}

static func == (lhs: Hero, rhs: Hero) -> Bool {
return lhs.id == rhs.id && lhs.link == rhs.link
}
Expand Down
127 changes: 70 additions & 57 deletions Artemis/View/Route/Home/HomeCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,73 @@
//

import SwiftUI
import ACarousel
import AlertToast

struct HeroHeaderView: View {
struct HeroCarouselView: View {
@State
private var items: [HeroItem]
private let heroes: [Hero]
init(heroes: [Hero]) {
self.heroes = heroes
var items: [HeroItem] = []
for hero in heroes {
items.append(HeroItem(hero: hero))
}
self._items = State(initialValue: items)
}

var body: some View {
TabView {
ForEach(heroes) { hero in
NetworkImage(
thumbnailEntry: hero.imageUrl,
width: .infinity,
height: 800,
cornerRadius: 0
)
.overlay(alignment: .bottom) {
if case .url(let url) = hero.titleImage {
AsyncImage(url: URL(string: url)!) { image in
image
.resizable()
.scaledToFit()
.frame(width: 300)
.padding(.bottom, 60)
} placeholder: {

}
}
ScrollView(.horizontal) {
LazyHStack {
ForEach(items) { item in
card(item.hero)
}
}
.scrollTargetLayout()
}
.scrollTargetBehavior(.viewAligned)
.scrollIndicators(.never)
.contentMargins(.leading, 16)
.contentMargins(.trailing, 40)
.frame(height: UIScreen.main.bounds.size.height / 1.9621)
.padding(.top)
}

@ViewBuilder
private func card(_ hero: Hero) -> some View {
let result = HeroCardView(hero: hero)
.containerRelativeFrame(.horizontal)
.scrollTransition { content, phase in
content
.opacity(phase.isIdentity ? 1.0 : 0.95)
.scaleEffect(phase.isIdentity ? 1.0 : 0.95)
}
if(hero == heroes.last) {
result.onAppear {
for hero in heroes {
items.append(HeroItem(hero: hero))
}
}
}else {
result
}
.tabViewStyle(.page)
.indexViewStyle(.page(backgroundDisplayMode: .always))
.frame(maxWidth: .infinity, minHeight: 800)
.padding(.bottom)
}
}

struct HeroCarouselView: View {
private let heroes: [Hero]
init(heroes: [Hero]) {
self.heroes = heroes
fileprivate struct HeroItem: Identifiable {
let id: UUID
let hero: Hero
init(hero: Hero) {
self.id = UUID()
self.hero = hero
}

var body: some View {
ACarousel(heroes) { hero in
HeroCardView(hero: hero)
}
.padding(.vertical)
.frame(maxWidth: .infinity, minHeight: 475)
func copy() -> HeroItem {
return HeroItem(hero: hero)
}
}

struct HeroCardView: View {
fileprivate struct HeroCardView: View {
@State
private var error: Bool = false

Expand All @@ -80,12 +91,12 @@ struct HeroCardView: View {
}

var body: some View {
VStack(alignment: .leading, spacing: 0) {
VStack {
VStack(alignment: .leading, spacing: 0) {
NetworkImage(
thumbnailEntry: hero.link.event.coverUrl,
width: .infinity,
height: 200
height: 175
)

Spacer()
Expand Down Expand Up @@ -130,7 +141,8 @@ struct HeroCardView: View {
.accentColor(.accentColor)
}
.padding()
.background(.background.secondary)
.background(Color(UIColor.secondarySystemGroupedBackground))
.cornerRadius(8)
.onTapGesture {
routerController.path.append(NestedPageType.series(hero.link.event, lastWatchedEpisode: hero.lastWatchedEpisode))
}
Expand All @@ -153,7 +165,6 @@ struct HeroCardView: View {
Label("Add to Watchlist", systemImage: "list.star")
}
}
.clipShape(RoundedRectangle(cornerRadius: 8))
.alert(
"Player error",
isPresented: $error,
Expand Down Expand Up @@ -215,7 +226,7 @@ struct BucketSectionView: View {
}

var body: some View {
let result = VStack(alignment: .leading, spacing: 0) {
VStack(alignment: .leading, spacing: 0) {
Text(toBucketTitle(input: bucket.name))
.font(.system(size: 20))
.fontWeight(.bold)
Expand All @@ -242,11 +253,13 @@ struct BucketSectionView: View {
}
)
.buttonStyle(.plain)
.tag(contentEntry)
}else {
NavigationLink(value: NestedPageType.series(contentEntry)) {
label
}
.buttonStyle(.plain)
.tag(contentEntry)
}
}
}
Expand All @@ -261,15 +274,9 @@ struct BucketSectionView: View {
Text("Cannot open player")
}
)
.background(Color.backgroundColor)
.background(Color(UIColor.secondarySystemGroupedBackground))
.cornerRadius(8)
.padding(.bottom)

if(UIDevice.current.userInterfaceIdiom == .pad) {
result
}else {
result.padding(.horizontal)
}
.padding()
}


Expand Down Expand Up @@ -299,7 +306,7 @@ struct BucketSectionView: View {
}
.frame(width: 250)
.padding(12)
.background(Color.backgroundColor)
.background(Color(UIColor.secondarySystemGroupedBackground))
.contextMenu {
bucketEntryContexMenu(contentEntry: contentEntry)
}
Expand All @@ -323,9 +330,7 @@ struct BucketSectionView: View {
Label("Go to Anime", systemImage: "info.circle")
}

if case .episode = contentEntry {

}else {
if(!isEpisode(contentEntry)) {
Button {
routerController.addToWatchlistItem = if case .season(let season) = contentEntry {
.series(season.series!)
Expand All @@ -338,6 +343,14 @@ struct BucketSectionView: View {
}
}

private func isEpisode(_ contentEntry: DescriptableEntry) -> Bool {
if case .episode = contentEntry {
return true
}else {
return false
}
}

private func toBucketTitle(input: String?) -> String {
guard let input = input else {
return ""
Expand Down Expand Up @@ -376,7 +389,7 @@ struct BucketSectionView: View {
}
}

private extension View {
fileprivate extension View {
func watchNow(routerController: RouterController, accountController: AccountController, animeController: AnimeController, bucketEntry: DescriptableEntry) async throws {
switch(bucketEntry) {
case .episode(let episode):
Expand Down Expand Up @@ -465,7 +478,7 @@ private extension View {
}
}

// Can't use .background.secondary or it will be stacked, making the colour wrong
private extension Color {
// Can't use .background.secondary or it will be stacked, making the color wrong
fileprivate extension Color {
static let backgroundColor: Color = Color(UIColor.secondarySystemGroupedBackground)
}
Loading

0 comments on commit d74cd22

Please sign in to comment.