@@ -2,30 +2,65 @@ import Foundation
22import UIKit
33
44func modifyRemoteConfiguration( _ configuration: inout UcsResponse ) {
5+ modifyAttributes ( & configuration. attributes. accountAttributes)
6+
57 if UserDefaults . overwriteConfiguration {
68 configuration. resolve. configuration = try ! BundleHelper . shared. resolveConfiguration ( )
79 }
8-
9- modifyAttributes ( & configuration. attributes . accountAttributes )
10- modifyAssignedValues ( & configuration . assignedValues )
10+ else {
11+ modifyAssignedValues ( & configuration. assignedValues )
12+ }
1113}
1214
13- private let propertyToRemoveNames = [
14- " enable_common_capping " ,
15- " enable_pns_common_capping " ,
16- " enable_pick_and_shuffle_common_capping " ,
17- " enable_pick_and_shuffle_dynamic_cap " ,
18- " pick_and_shuffle_timecap " , // capping
19- " should_nova_scroll_use_scrollsita " // 😡😡😡
20- // spotify, stop changing the scroll logic
15+ private let propertyReplacements = [
16+ // capping
17+ EeveePropertyReplacement ( name: " enable_common_capping " , modification: . remove) ,
18+ EeveePropertyReplacement ( name: " enable_pns_common_capping " , modification: . remove) ,
19+ EeveePropertyReplacement ( name: " enable_pick_and_shuffle_common_capping " , modification: . remove) ,
20+ EeveePropertyReplacement ( name: " enable_pick_and_shuffle_dynamic_cap " , modification: . remove) ,
21+ EeveePropertyReplacement ( name: " pick_and_shuffle_timecap " , modification: . remove) ,
22+ EeveePropertyReplacement ( scope: " ios-feature-queue " , modification: . remove) ,
23+
24+ // also capping idk
25+ EeveePropertyReplacement ( name: " enable_free_on_demand_experiment " , modification: . remove) ,
26+ EeveePropertyReplacement ( name: " enable_free_on_demand_context_menu_experiment " , modification: . remove) ,
27+ EeveePropertyReplacement ( name: " enable_mft_plus_queue " , modification: . remove) ,
28+ EeveePropertyReplacement ( name: " enable_mft_plus_extended_queue " , modification: . remove) ,
29+ EeveePropertyReplacement ( name: " enable_playback_timeout_service " , modification: . setBool( false ) ) ,
30+ EeveePropertyReplacement ( name: " enable_playback_timeout_error_ui " , modification: . setBool( false ) ) ,
31+ EeveePropertyReplacement ( name: " playback_timeout_action " , modification: . setEnum( " Nothing " ) ) ,
32+ EeveePropertyReplacement ( name: " is_remove_from_queue_enabled_for_mft_plus " , modification: . remove) ,
33+ EeveePropertyReplacement ( name: " is_reordering_for_mft_plus_allowed " , modification: . remove) ,
34+
35+ // 😡😡😡 spotify, stop changing the scroll logic
36+ EeveePropertyReplacement ( name: " should_nova_scroll_use_scrollsita " , modification: . remove)
2137]
2238
23- func modifyAssignedValues( _ values: inout [ AssignedValue ] ) {
24- values. removeAll ( where: { propertyToRemoveNames. contains ( $0. propertyID. name) } )
25- values. removeAll ( where: { $0. propertyID. scope == " ios-feature-queue " } )
39+ private func modifyAssignedValues( _ values: inout [ AssignedValue ] ) {
40+ for replacement in propertyReplacements {
41+ let matchingIndices = values. indices. filter ( { index in
42+ let value = values [ index]
43+ let nameMatches = replacement. name. map { value. propertyID. name == $0 } ?? true
44+ let scopeMatches = replacement. scope. map { value. propertyID. scope == $0 } ?? true
45+ return nameMatches && scopeMatches
46+ } )
47+
48+ for index in matchingIndices. sorted ( by: > ) {
49+ switch replacement. modification {
50+ case . remove:
51+ values. remove ( at: index)
52+
53+ case . setBool( let newValue) :
54+ values [ index] . boolValue = BoolValue . with { $0. value = newValue }
55+
56+ case . setEnum( let newValue) :
57+ values [ index] . enumValue = EnumValue . with { $0. value = newValue }
58+ }
59+ }
60+ }
2661}
2762
28- func modifyAttributes( _ attributes: inout [ String : AccountAttribute ] ) {
63+ private func modifyAttributes( _ attributes: inout [ String : AccountAttribute ] ) {
2964 let oneYearFromNow = Calendar . current. date ( byAdding: . year, value: 1 , to: Date ( ) ) !
3065
3166 let formatter = ISO8601DateFormatter ( )
0 commit comments