mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-08 23:23:20 +00:00
fixes and improvements
This commit is contained in:
@@ -10,7 +10,7 @@ class SPTDataLoaderServiceHook: ClassHook<NSObject>, SpotifySessionDelegate {
|
||||
let shouldReplaceLyrics = LyricsGroup.isActive
|
||||
|
||||
return (shouldReplaceLyrics && url.isLyrics)
|
||||
|| (shouldPatchPremium && (url.isCustomize || url.isPremiumPlanRow || url.isPlanOverview))
|
||||
|| (shouldPatchPremium && (url.isCustomize || url.isPremiumPlanRow || url.isPremiumBadge || url.isPlanOverview))
|
||||
}
|
||||
|
||||
// orion:new
|
||||
@@ -59,6 +59,11 @@ class SPTDataLoaderServiceHook: ClassHook<NSObject>, SpotifySessionDelegate {
|
||||
return
|
||||
}
|
||||
|
||||
if url.isPremiumBadge {
|
||||
respondWithCustomData(try getPremiumPlanBadge(), task: task, session: session)
|
||||
return
|
||||
}
|
||||
|
||||
var customizeMessage = try CustomizeMessage(serializedBytes: buffer)
|
||||
modifyRemoteConfiguration(&customizeMessage.response)
|
||||
|
||||
|
||||
@@ -21,3 +21,19 @@ class NowPlayingScrollViewControllerInstanceHook: ClassHook<UIViewController> {
|
||||
return nowPlayingScrollViewController!
|
||||
}
|
||||
}
|
||||
|
||||
class NowPlayingScrollPrivateServiceImplementationHook: ClassHook<NSObject> {
|
||||
typealias Group = LyricsGroup
|
||||
static let targetName = "NowPlaying_ScrollImpl.NowPlayingScrollPrivateServiceImplementation"
|
||||
|
||||
func provideScrollViewControllerWithDependencies(_ dependencies: NSObject) -> UIViewController {
|
||||
// spotify introduced some "nova scroll" with different controllers and logic
|
||||
// hope they don't remove backward compatibility, i don't want to rewrite ts 😭🙏
|
||||
|
||||
if EeveeSpotify.hookTarget != .lastAvailableiOS14 {
|
||||
Ivars<Bool>(target).$__lazy_storage_$_isNovaScrollEnabled = false
|
||||
}
|
||||
|
||||
return orig.provideScrollViewControllerWithDependencies(dependencies)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
func modifyRemoteConfiguration(_ configuration: inout UcsResponse) {
|
||||
if UserDefaults.overwriteConfiguration {
|
||||
@@ -17,10 +18,6 @@ func modifyAttributes(_ attributes: inout [String: AccountAttribute]) {
|
||||
attributes["ads"] = AccountAttribute.with {
|
||||
$0.boolValue = false
|
||||
}
|
||||
|
||||
attributes["audio-quality"] = AccountAttribute.with {
|
||||
$0.stringValue = "1"
|
||||
}
|
||||
|
||||
attributes["can_use_superbird"] = AccountAttribute.with {
|
||||
$0.boolValue = true
|
||||
@@ -34,10 +31,6 @@ func modifyAttributes(_ attributes: inout [String: AccountAttribute]) {
|
||||
$0.stringValue = "pr:premium,tc:0"
|
||||
}
|
||||
|
||||
attributes["high-bitrate"] = AccountAttribute.with {
|
||||
$0.boolValue = true
|
||||
}
|
||||
|
||||
attributes["is-eligible-premium-unboxing"] = AccountAttribute.with {
|
||||
$0.boolValue = true
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
import Foundation
|
||||
|
||||
func getPremiumPlanBadge() throws -> Data {
|
||||
let badge = YourPremiumBadge.with {
|
||||
$0.name = "Eevee"
|
||||
$0.version = 2
|
||||
$0.colorCode = "#FFD2D7"
|
||||
}
|
||||
|
||||
return try badge.serializedData()
|
||||
}
|
||||
|
||||
func getPremiumPlanRowData(originalPremiumPlanRow: PremiumPlanRow) throws -> Data {
|
||||
var premiumPlanRow = originalPremiumPlanRow
|
||||
|
||||
@@ -14,7 +24,7 @@ func getPlanOverviewData() throws -> Data {
|
||||
let plan = SpotifyPlan.with {
|
||||
$0.notice = SpotifyPlan.Notice.with {
|
||||
$0.message = "payment_notice".localized
|
||||
$0.status = 2 // 0 - trial, 1 - prepaid, 2 - subsription
|
||||
$0.status = 2 // 0 - trial, 1 - prepaid, 2 - subsсription
|
||||
}
|
||||
$0.subscription = SpotifyPlan.SubscriptionInfo.with {
|
||||
$0.planVariant = 2
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
// swiftlint:disable all
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: YourPremiumBadge.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
struct YourPremiumBadge: Sendable {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
var name: String = String()
|
||||
|
||||
var version: Int32 = 0
|
||||
|
||||
var colorCode: String = String()
|
||||
|
||||
var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
extension YourPremiumBadge: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
static let protoMessageName: String = "YourPremiumBadge"
|
||||
static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "name"),
|
||||
2: .same(proto: "version"),
|
||||
3: .standard(proto: "color_code"),
|
||||
]
|
||||
|
||||
mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
|
||||
case 2: try { try decoder.decodeSingularInt32Field(value: &self.version) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.colorCode) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.name.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
|
||||
}
|
||||
if self.version != 0 {
|
||||
try visitor.visitSingularInt32Field(value: self.version, fieldNumber: 2)
|
||||
}
|
||||
if !self.colorCode.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.colorCode, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
static func ==(lhs: YourPremiumBadge, rhs: YourPremiumBadge) -> Bool {
|
||||
if lhs.name != rhs.name {return false}
|
||||
if lhs.version != rhs.version {return false}
|
||||
if lhs.colorCode != rhs.colorCode {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,10 @@ extension URL {
|
||||
var isPremiumPlanRow: Bool {
|
||||
self.path.contains("v1/GetPremiumPlanRow")
|
||||
}
|
||||
|
||||
var isPremiumBadge: Bool {
|
||||
self.path.contains("GetYourPremiumBadge")
|
||||
}
|
||||
|
||||
var isOpenSpotifySafariExtension: Bool {
|
||||
self.host == "eevee"
|
||||
|
||||
Reference in New Issue
Block a user