Skip to content

Commit 2bd837d

Browse files
authored
Change regional restriction message
1 parent dcde55c commit 2bd837d

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

Source/Settings.x

+28-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@
1313
- (id)_viewControllerForAncestor;
1414
@end
1515

16+
@interface YTISupportedMessageRendererIcons : NSObject
17+
@property (nonatomic, assign, readwrite) int iconType;
18+
@end
19+
20+
@interface YTIMessageRenderer : NSObject
21+
@property (nonatomic, strong, readwrite) YTISupportedMessageRendererIcons *icon;
22+
@end
23+
24+
@interface YTMLightweightMessageCell : UIView
25+
@end
26+
27+
@interface YTMMessageView : UIView
28+
@property (nonatomic, weak, readwrite) YTMLightweightMessageCell *delegate;
29+
@end
30+
1631
%group SettingsPage
1732
%hook YTMAvatarAccountView
1833

@@ -61,13 +76,22 @@
6176

6277
%hook YTMMessageView
6378
- (void)setMessageText:(id)arg1 {
64-
if ([arg1 containsString:@"Premium"]) {
65-
arg1 = LOC(@"REGIONAL_RESTRICTION");
66-
} %orig(arg1);
79+
if (![self.delegate isKindOfClass:%c(YTMLightweightMessageCell)]) {
80+
return %orig;
81+
}
82+
83+
YTMLightweightMessageCell *msgCell = (YTMLightweightMessageCell *)self.delegate;
84+
YTIMessageRenderer *renderer = [msgCell valueForKey:@"_renderer"];
85+
86+
if (renderer.icon.iconType != 187) {
87+
return %orig;
88+
}
89+
90+
%orig(LOC(@"REGIONAL_RESTRICTION"));
6791
}
6892
%end
6993
%end
7094

7195
%ctor {
7296
%init(SettingsPage);
73-
}
97+
}

0 commit comments

Comments
 (0)