Skip to content

Commit

Permalink
chore: remove dead code and add Periphery
Browse files Browse the repository at this point in the history
  • Loading branch information
flaksp committed Feb 2, 2025
1 parent 2c38e56 commit 827fae0
Show file tree
Hide file tree
Showing 60 changed files with 164 additions and 728 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/build.yaml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/code_qualty.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@ name: Code Quality
on: pull_request

jobs:
xcodegen:
name: XcodeGen
runs-on: macos-15

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install XcodeGen
run: brew install xcodegen

- name: Generate Xcode Configs
run: xcodegen generate

- name: Upload Ichime.xcodeproj Artifact
uses: actions/upload-artifact@v4
with:
name: ichime
path: ./
retention-days: 7

swift_format:
name: swift-format
runs-on: macos-15
Expand Down Expand Up @@ -38,3 +59,24 @@ jobs:

- name: Check Code Formatting
run: swiftlint --strict

periphery:
name: Periphery
runs-on: macos-15
needs: [xcodegen]

steps:
- name: Download Repository w/ Xcode Configs Artifact
uses: actions/download-artifact@v4
with:
name: ichime
path: ./

- name: Install Periphery
run: brew install periphery

- name: ls
run: ls -la

- name: Check For Unused Code
run: periphery scan
4 changes: 4 additions & 0 deletions .periphery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
project: Ichime.xcodeproj
retain_public: true
schemes:
- Ichime_tvOS
14 changes: 7 additions & 7 deletions Ichime/Anime365/Anime365Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ class Anime365Client {
self.apiClient = apiClient
}

public func getShow(seriesId: Int) async throws -> Show {
func getShow(seriesId: Int) async throws -> Show {
let apiResponse = try await apiClient.getSeries(seriesId: seriesId)

return Show.createFromApiSeries(series: apiResponse)
}

public func getOngoings(
func getOngoings(
offset: Int,
limit: Int
) async throws -> [Show] {
Expand All @@ -37,7 +37,7 @@ class Anime365Client {
}
}

public func getTop(
func getTop(
offset: Int,
limit: Int
) async throws -> [Show] {
Expand All @@ -51,7 +51,7 @@ class Anime365Client {
}
}

public func getSeason(
func getSeason(
offset: Int,
limit: Int,
airingSeason: AiringSeason
Expand All @@ -69,7 +69,7 @@ class Anime365Client {
}
}

public func getByGenre(
func getByGenre(
offset: Int,
limit: Int,
genreIds: [Int]
Expand All @@ -90,15 +90,15 @@ class Anime365Client {
}
}

public func getShowByEpisodeId(episodeId: Int) async throws -> Show {
func getShowByEpisodeId(episodeId: Int) async throws -> Show {
let episodeResponse = try await apiClient.getEpisode(
episodeId: episodeId
)

return try await self.getShow(seriesId: episodeResponse.seriesId)
}

public func searchShows(
func searchShows(
searchQuery: String,
offset: Int,
limit: Int
Expand Down
30 changes: 0 additions & 30 deletions Ichime/AppPreferences/PlayerPreference.swift

This file was deleted.

23 changes: 0 additions & 23 deletions Ichime/Calendar/Model/ShowFromCalendar.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Anime365ApiClient
import Foundation
import ShikimoriApiClient

Expand All @@ -12,27 +11,9 @@ struct ShowFromCalendar: Hashable, Identifiable {
let translated: TranslatedTitles
}

enum BroadcastType {
case tv
case other

static func createFromApiType(apiType: String) -> Self {
switch apiType {
case "tv":
return .tv
default:
return .other
}
}
}

let id: Int
let title: Title
let posterUrl: URL?
let score: Float?
let numberOfEpisodes: Int?
let broadcastType: BroadcastType
let isOngoing: Bool
let nextEpisodeNumber: Int
let nextEpisodeReleaseDate: Date

Expand All @@ -58,10 +39,6 @@ struct ShowFromCalendar: Hashable, Identifiable {
)
),
posterUrl: URL(string: shikimoriBaseUrl.absoluteString + anime.image.original),
score: score <= 0 ? nil : Float(anime.score),
numberOfEpisodes: anime.episodes <= 0 ? nil : anime.episodes,
broadcastType: .createFromApiType(apiType: anime.kind),
isOngoing: anime.status == "ongoing",
nextEpisodeNumber: calendarEntry.next_episode,
nextEpisodeReleaseDate: isoDateFormatter.date(from: calendarEntry.next_episode_at)!
)
Expand Down
7 changes: 3 additions & 4 deletions Ichime/CommonViewComponents/CardWithExpandableText.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import SwiftUI

struct CardWithExpandableText: View {
public static let RECOMMENDED_MINIMUM_WIDTH: CGFloat = 450
public static let RECOMMENDED_SPACING: CGFloat = 40
static let RECOMMENDED_SPACING: CGFloat = 40

public let title: String
public let text: String
let title: String
let text: String

@State private var isSheetPresented = false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI

struct HeadingSectionWithBackground<Content: View>: View {
public let imageUrl: URL?
let imageUrl: URL?

@ViewBuilder let content: Content

Expand Down
1 change: 0 additions & 1 deletion Ichime/ContentView/ContentView.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ScraperAPI
import SwiftUI

private enum NavigationStyle: String {
Expand Down
7 changes: 2 additions & 5 deletions Ichime/ContentView/ContentViewWithSideBar.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import ScraperAPI
import SwiftData
import SwiftUI

struct ContentViewWithSideBar: View {
@Environment(\.modelContext) private var modelContext
@AppStorage("ContentViewWithTabView.selectedTab") private var selectedTab: Tabs = .home

@State private var route: Route?
Expand Down Expand Up @@ -101,10 +99,10 @@ struct ContentViewWithSideBar: View {
switch action {
case URLActions.show.rawValue:
print("its show \(id)")
self.route = Route(id: id, type: .show, title: nil)
self.route = Route(id: id, type: .show)
case URLActions.episode.rawValue:
print("its episode \(id)")
self.route = Route(id: id, type: .episode, title: episodeTitle)
self.route = Route(id: id, type: .episode)
default:
print("idk")
}
Expand All @@ -120,5 +118,4 @@ enum URLActions: String {
struct Route: Hashable, Identifiable {
let id: Int
let type: URLActions
let title: String?
}
6 changes: 2 additions & 4 deletions Ichime/ContentView/ContentViewWithTabBar.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import ScraperAPI
import SwiftData
import SwiftUI

struct ContentViewWithTabBar: View {
@Environment(\.modelContext) private var modelContext
@AppStorage("ContentViewWithTabView.selectedTab") private var selectedTab: Tabs = .home
@State private var route: Route?

Expand Down Expand Up @@ -103,10 +101,10 @@ struct ContentViewWithTabBar: View {
switch action {
case URLActions.show.rawValue:
print("its show \(id)")
self.route = Route(id: id, type: .show, title: nil)
self.route = Route(id: id, type: .show)
case URLActions.episode.rawValue:
print("its episode \(id)")
self.route = Route(id: id, type: .episode, title: episodeTitle)
self.route = Route(id: id, type: .episode)
default:
print("idk")
}
Expand Down
Loading

0 comments on commit 827fae0

Please sign in to comment.