@@ -6,8 +6,8 @@ class SPTDataLoaderServiceHook: ClassHook<NSObject>, SpotifySessionDelegate {
66
77 // orion:new
88 func shouldModify( _ url: URL ) -> Bool {
9- let shouldPatchPremium = PremiumPatchingGroup . isActive
10- let shouldReplaceLyrics = LyricsGroup . isActive
9+ let shouldPatchPremium = BasePremiumPatchingGroup . isActive
10+ let shouldReplaceLyrics = BaseLyricsGroup . isActive
1111
1212 return ( shouldReplaceLyrics && url. isLyrics)
1313 || ( shouldPatchPremium && ( url. isCustomize || url. isPremiumPlanRow || url. isPremiumBadge || url. isPlanOverview) )
@@ -33,61 +33,53 @@ class SPTDataLoaderServiceHook: ClassHook<NSObject>, SpotifySessionDelegate {
3333 return
3434 }
3535
36+ guard let buffer = URLSessionHelper . shared. obtainData ( for: url) else {
37+ return
38+ }
39+
3640 do {
37- if let buffer = URLSessionHelper . shared. obtainData ( for: url) {
38- if url. isLyrics {
39- respondWithCustomData (
40- try getLyricsDataForCurrentTrack (
41- originalLyrics: try ? Lyrics ( serializedBytes: buffer)
42- ) ,
43- task: task,
44- session: session
45- )
46-
47- return
48- }
49-
50- if url. isPremiumPlanRow {
51- respondWithCustomData (
52- try getPremiumPlanRowData (
53- originalPremiumPlanRow: try PremiumPlanRow ( serializedBytes: buffer)
54- ) ,
55- task: task,
56- session: session
57- )
58-
59- return
60- }
61-
62- if url. isPremiumBadge {
63- respondWithCustomData ( try getPremiumPlanBadge ( ) , task: task, session: session)
64- return
65- }
66-
41+ if url. isLyrics {
42+ respondWithCustomData (
43+ try getLyricsDataForCurrentTrack (
44+ originalLyrics: try ? Lyrics ( serializedBytes: buffer)
45+ ) ,
46+ task: task,
47+ session: session
48+ )
49+ return
50+ }
51+
52+ if url. isPremiumPlanRow {
53+ respondWithCustomData (
54+ try getPremiumPlanRowData (
55+ originalPremiumPlanRow: try PremiumPlanRow ( serializedBytes: buffer)
56+ ) ,
57+ task: task,
58+ session: session
59+ )
60+ return
61+ }
62+
63+ if url. isPremiumBadge {
64+ respondWithCustomData ( try getPremiumPlanBadge ( ) , task: task, session: session)
65+ return
66+ }
67+
68+ if url. isCustomize {
6769 var customizeMessage = try CustomizeMessage ( serializedBytes: buffer)
6870 modifyRemoteConfiguration ( & customizeMessage. response)
69-
7071 respondWithCustomData ( try customizeMessage. serializedData ( ) , task: task, session: session)
7172 return
7273 }
7374
7475 if url. isPlanOverview {
75- do {
76- orig. URLSession ( session, dataTask: task, didReceiveData: try getPlanOverviewData ( ) )
77- orig. URLSession ( session, task: task, didCompleteWithError: nil )
78- }
79- catch {
80- orig. URLSession ( session, task: task, didCompleteWithError: error)
81- }
82-
76+ respondWithCustomData ( try getPlanOverviewData ( ) , task: task, session: session)
8377 return
8478 }
8579 }
8680 catch {
8781 orig. URLSession ( session, task: task, didCompleteWithError: error)
8882 }
89-
90- orig. URLSession ( session, task: task, didCompleteWithError: error)
9183 }
9284
9385 func URLSession(
0 commit comments