mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-08 23:23:20 +00:00
better cache cleaning (Library/Caches/), updated dumped configuration, updates some localizations, fixed downloading server-sided alert
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import Foundation
|
||||
|
||||
enum LyricsSource : Int, CustomStringConvertible {
|
||||
enum LyricsSource: Int, CaseIterable, CustomStringConvertible {
|
||||
case genius
|
||||
case lrclib
|
||||
case musixmatch
|
||||
case petit
|
||||
|
||||
var description : String {
|
||||
var description: String {
|
||||
switch self {
|
||||
case .genius: "Genius"
|
||||
case .lrclib: "LRCLIB"
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import Foundation
|
||||
|
||||
class OfflineHelper {
|
||||
static private let applicationSupportPath = FileManager.default.urls(
|
||||
static private let applicationSupportDirectory = FileManager.default.urls(
|
||||
for: .applicationSupportDirectory, in: .userDomainMask
|
||||
)
|
||||
.first!
|
||||
|
||||
static private let cachesDirectory = FileManager.default.urls(
|
||||
for: .cachesDirectory, in: .userDomainMask
|
||||
).first!
|
||||
|
||||
//
|
||||
|
||||
static private let persistentCachePath = applicationSupportPath
|
||||
static private let persistentCachePath = applicationSupportDirectory
|
||||
.appendingPathComponent("PersistentCache")
|
||||
|
||||
static private let remoteConfigPath = applicationSupportPath
|
||||
static private let remoteConfigPath = applicationSupportDirectory
|
||||
.appendingPathComponent("remote-config")
|
||||
|
||||
//
|
||||
@@ -24,10 +28,18 @@ class OfflineHelper {
|
||||
try FileManager.default.removeItem(at: self.remoteConfigPath)
|
||||
}
|
||||
|
||||
static private func resetCaches() throws {
|
||||
try FileManager.default.removeItem(at: self.cachesDirectory)
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
static func resetData() {
|
||||
static func resetData(clearCaches: Bool = false) {
|
||||
try? resetPersistentCache()
|
||||
try? resetRemoteConfig()
|
||||
|
||||
if clearCaches {
|
||||
try? resetCaches()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,35 +24,18 @@ private func showOfflineModePopUp() {
|
||||
)
|
||||
}
|
||||
|
||||
class FTPDownloadActionHook: ClassHook<NSObject> {
|
||||
typealias Group = PremiumPatching
|
||||
static let targetName = "ListUXPlatform_FreeTierPlaylistImpl.FTPDownloadAction"
|
||||
|
||||
func execute(_ idk: Any) {
|
||||
showOfflineModePopUp()
|
||||
}
|
||||
}
|
||||
|
||||
class UIButtonHook: ClassHook<UIButton> {
|
||||
class ContentOffliningUIHelperImplementationHook: ClassHook<NSObject> {
|
||||
typealias Group = PremiumPatching
|
||||
static let targetName = "Offline_ContentOffliningUIImpl.ContentOffliningUIHelperImplementation"
|
||||
|
||||
func setHighlighted(_ highlighted: Bool) {
|
||||
|
||||
if highlighted {
|
||||
|
||||
if let identifier = target.accessibilityIdentifier, identifier.contains("DownloadButton"),
|
||||
let viewController = WindowHelper.shared.viewController(for: target) {
|
||||
|
||||
if !(NSStringFromClass(type(of: viewController)) ~= "Podcast|CreativeWorkPlatform") {
|
||||
|
||||
target.removeTarget(nil, action: nil, for: .allEvents)
|
||||
showOfflineModePopUp()
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
orig.setHighlighted(highlighted)
|
||||
func downloadToggledWithCurrentAvailability(
|
||||
_ availability: Int,
|
||||
addAction: NSObject,
|
||||
removeAction: NSObject,
|
||||
pageIdentifier: String,
|
||||
pageURI: URL
|
||||
) -> String {
|
||||
showOfflineModePopUp()
|
||||
return pageIdentifier
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ struct EeveeSettingsView: View {
|
||||
let navigationController: UINavigationController
|
||||
|
||||
@State var latestVersion = ""
|
||||
@State var hasShownCommonIssuesTip = UserDefaults.hasShownCommonIssuesTip
|
||||
|
||||
@State private var hasShownCommonIssuesTip = UserDefaults.hasShownCommonIssuesTip
|
||||
@State private var isClearingData = false
|
||||
|
||||
private func pushSettingsController(with view: any View, title: String) {
|
||||
let viewController = EeveeSettingsViewController(
|
||||
@@ -74,16 +76,29 @@ struct EeveeSettingsView: View {
|
||||
|
||||
Section(footer: Text("reset_data_description".localized)) {
|
||||
Button {
|
||||
OfflineHelper.resetData()
|
||||
exitApplication()
|
||||
isClearingData = true
|
||||
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
OfflineHelper.resetData(clearCaches: true)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
exitApplication()
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
Text("reset_data".localized)
|
||||
if isClearingData {
|
||||
ProgressView()
|
||||
}
|
||||
else {
|
||||
Text("reset_data".localized)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.listStyle(GroupedListStyle())
|
||||
|
||||
.animation(.default, value: isClearingData)
|
||||
.animation(.default, value: latestVersion)
|
||||
.animation(.default, value: hasShownCommonIssuesTip)
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import SwiftUI
|
||||
|
||||
extension EeveeLyricsSettingsView {
|
||||
|
||||
func lyricsSourceFooter() -> some View {
|
||||
var text = "lyrics_source_description".localized
|
||||
|
||||
if Locale.isInRegion("JP", orHasLanguage: "ja") {
|
||||
text.append("\n\n")
|
||||
text.append("petitlyrics_description".localized)
|
||||
}
|
||||
text.append("\n\n")
|
||||
text.append("petitlyrics_description".localized)
|
||||
|
||||
text.append("\n\n")
|
||||
text.append("lyrics_additional_info".localized)
|
||||
@@ -22,18 +19,13 @@ extension EeveeLyricsSettingsView {
|
||||
"lyrics_source".localized,
|
||||
selection: $lyricsSource
|
||||
) {
|
||||
Text("Genius").tag(LyricsSource.genius)
|
||||
Text("LRCLIB").tag(LyricsSource.lrclib)
|
||||
Text("Musixmatch").tag(LyricsSource.musixmatch)
|
||||
if Locale.isInRegion("JP", orHasLanguage: "ja") {
|
||||
Text("PetitLyrics").tag(LyricsSource.petit)
|
||||
ForEach(LyricsSource.allCases, id: \.self) { lyricsSource in
|
||||
Text(lyricsSource.description).tag(lyricsSource)
|
||||
}
|
||||
}
|
||||
|
||||
if lyricsSource == .musixmatch {
|
||||
|
||||
VStack(alignment: .leading, spacing: 5) {
|
||||
|
||||
Text("musixmatch_user_token".localized)
|
||||
|
||||
TextField("user_token_placeholder".localized, text: $musixmatchToken)
|
||||
|
||||
@@ -21,12 +21,12 @@ ok = "OK";
|
||||
// Patching
|
||||
|
||||
do_not_patch_premium = "Do Not Patch Premium";
|
||||
patching_description = "The tweak intercepts requests to load user data, deserializes it, and modifies the parameters in real-time.
|
||||
patching_description = "EeveeSpotify intercepts requests to load user data, deserializes it, and modifies the parameters in real-time.
|
||||
|
||||
If you have an active Premium subscription, you can turn on Do Not Patch Premium. The tweak won't patch the data or restrict the use of Premium server-sided features. App restart is required after changing.";
|
||||
|
||||
overwrite_configuration = "Overwrite Configuration";
|
||||
overwrite_configuration_description = "Replace remote configuration with the dumped Premium one. It might fix some issues, such as appearing ads, but it's not guaranteed.";
|
||||
overwrite_configuration_description = "Replace remote configuration with the dumped Premium one. This configuration defines most UI/UX parameters and may be helpful, although it could cause issues.";
|
||||
|
||||
// Lyrics
|
||||
|
||||
@@ -38,7 +38,7 @@ Genius: Offers the best quality lyrics, provides the most songs, and updates lyr
|
||||
LRCLIB: The most open service, offering time-synced lyrics. However, it lacks lyrics for many songs.
|
||||
|
||||
Musixmatch: The service Spotify uses. Provides time-synced lyrics for many songs, but you'll need a user token to use this source.";
|
||||
lyrics_additional_info = "If the tweak is unable to find a song or process the lyrics, you'll see a \"Couldn't load the lyrics for this song\" message. The lyrics might be wrong for some songs when using Genius due to how the tweak searches songs. I've made it work in most cases.";
|
||||
lyrics_additional_info = "If EeveeSpotify is unable to find a song or process the lyrics, you'll see a \"Couldn't load the lyrics for this song\" message. The lyrics might be wrong for some songs when using Genius due to how the tweak searches songs. I've made it work in most cases.";
|
||||
petitlyrics_description = "PetitLyrics: Offers plenty of time-synced Japanese and some international lyrics.";
|
||||
|
||||
musixmatch_user_token = "Musixmatch User Token";
|
||||
|
||||
Binary file not shown.
@@ -21,12 +21,12 @@ ok = "OK";
|
||||
// Patching
|
||||
|
||||
do_not_patch_premium = "Не патчить Premium";
|
||||
patching_description = "Твик перехватывает запросы на получение данных о пользователе, обрабатывает их и заменяет параметры в реальном времени.
|
||||
patching_description = "EeveeSpotify перехватывает запросы на получение данных о пользователе, обрабатывает их и заменяет параметры в реальном времени.
|
||||
|
||||
Если у вас есть Premium, вы можете включить Не патчить Premium. Твик не будет изменять данные и ограничивать использование серверных функций. Требуется перезапуск для применения.";
|
||||
|
||||
overwrite_configuration = "Заменять конфигурацию";
|
||||
overwrite_configuration_description = "Заменять удаленную конфигурацию на сдампленную конфигурацию Premium. Может исправить некоторые проблемы, например, появление рекламы, но это не точно.";
|
||||
overwrite_configuration_description = "Заменять удаленную конфигурацию на сдампленную конфигурацию Premium. Она определяет многие UI/UX параметры и может быть полезной, хотя может вызвать проблемы.";
|
||||
|
||||
// Lyrics
|
||||
|
||||
@@ -38,7 +38,7 @@ Genius: Предлагает наибольшее количество текс
|
||||
LRCLIB: Самый открытый источник, поддерживает синхронизацию с музыкой, однако не имеет текстов для множества песен.
|
||||
|
||||
Musixmatch: Источник, который использует Spotify. Предоставляет синхронизированные тексты для множества песен, но для его использования требуется токен.";
|
||||
lyrics_additional_info = "Если твику не удается найти песню или обработать текст, вы увидите сообщение \"Не удалось загрузить текст песни\". Иногда текст может быть неправильный при использовании Genius ввиду особенностей того, как твик ищет песни, но в большинстве случаев это работает правильно.";
|
||||
lyrics_additional_info = "Если EeveeSpotify не удается найти песню или обработать текст, вы увидите сообщение \"Не удалось загрузить текст песни\". Иногда текст может быть неправильный при использовании Genius ввиду особенностей того, как твик ищет песни, но в большинстве случаев это работает правильно.";
|
||||
petitlyrics_description = "PetitLyrics: Предоставляет множество синхронизированных с музыкой японских и некоторое количество международных текстов.";
|
||||
|
||||
musixmatch_user_token = "Токен Musixmatch";
|
||||
|
||||
Reference in New Issue
Block a user