From 9319ba48acbfbe1b3543ee401f64cf9b97f54f8b Mon Sep 17 00:00:00 2001 From: eevee Date: Mon, 6 May 2024 20:39:10 +0300 Subject: [PATCH] v2.1 --- Sources/EeveeSpotify/GeniusLyrics.x.swift | 4 +++- Sources/EeveeSpotify/HookedInstances.x.swift | 4 ++-- Sources/EeveeSpotify/Models/GeniusLyricsError.swift | 1 + control | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Sources/EeveeSpotify/GeniusLyrics.x.swift b/Sources/EeveeSpotify/GeniusLyrics.x.swift index 5ce7370..2156c31 100644 --- a/Sources/EeveeSpotify/GeniusLyrics.x.swift +++ b/Sources/EeveeSpotify/GeniusLyrics.x.swift @@ -29,7 +29,9 @@ class EncoreButtonHook: ClassHook { func getCurrentTrackLyricsData() throws -> Data { - let track = HookedInstances.currentTrack! + guard let track = HookedInstances.currentTrack else { + throw GeniusLyricsError.NoCurrentTrack + } let title = track.trackTitle() .removeMatches("\\(.*\\)") diff --git a/Sources/EeveeSpotify/HookedInstances.x.swift b/Sources/EeveeSpotify/HookedInstances.x.swift index 070a245..54355f3 100644 --- a/Sources/EeveeSpotify/HookedInstances.x.swift +++ b/Sources/EeveeSpotify/HookedInstances.x.swift @@ -5,9 +5,9 @@ class HookedInstances { static var currentTrack: SPTPlayerTrack? } -class SPTNowPlayingContentLayerViewModelHook: ClassHook { +class SPTNowPlayingModelHook: ClassHook { - static let targetName = "SPTNowPlayingContentLayerViewModel" + static let targetName = "SPTNowPlayingModel" func currentTrack() -> SPTPlayerTrack? { diff --git a/Sources/EeveeSpotify/Models/GeniusLyricsError.swift b/Sources/EeveeSpotify/Models/GeniusLyricsError.swift index f043c38..5df7e64 100644 --- a/Sources/EeveeSpotify/Models/GeniusLyricsError.swift +++ b/Sources/EeveeSpotify/Models/GeniusLyricsError.swift @@ -1,6 +1,7 @@ import Foundation enum GeniusLyricsError: Swift.Error { + case NoCurrentTrack case DecodingError case NoSuchSong } \ No newline at end of file diff --git a/control b/control index 9a59bc1..50f15f2 100644 --- a/control +++ b/control @@ -1,6 +1,6 @@ Package: com.eevee.spotify Name: EeveeSpotify -Version: 2.0 +Version: 2.1 Architecture: iphoneos-arm Description: A tweak to get Spotify Premium for free, just like Spotilife Maintainer: Eevee