From 2bd837dc1e0e5ffeff61830f576d1ac612722e14 Mon Sep 17 00:00:00 2001 From: Dan <38832025+dayanch96@users.noreply.github.com> Date: Mon, 11 Mar 2024 19:59:26 +0300 Subject: [PATCH] Change regional restriction message --- Source/Settings.x | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/Source/Settings.x b/Source/Settings.x index 7759fea1..75cfe7fa 100644 --- a/Source/Settings.x +++ b/Source/Settings.x @@ -13,6 +13,21 @@ - (id)_viewControllerForAncestor; @end +@interface YTISupportedMessageRendererIcons : NSObject +@property (nonatomic, assign, readwrite) int iconType; +@end + +@interface YTIMessageRenderer : NSObject +@property (nonatomic, strong, readwrite) YTISupportedMessageRendererIcons *icon; +@end + +@interface YTMLightweightMessageCell : UIView +@end + +@interface YTMMessageView : UIView +@property (nonatomic, weak, readwrite) YTMLightweightMessageCell *delegate; +@end + %group SettingsPage %hook YTMAvatarAccountView @@ -61,13 +76,22 @@ %hook YTMMessageView - (void)setMessageText:(id)arg1 { - if ([arg1 containsString:@"Premium"]) { - arg1 = LOC(@"REGIONAL_RESTRICTION"); - } %orig(arg1); + if (![self.delegate isKindOfClass:%c(YTMLightweightMessageCell)]) { + return %orig; + } + + YTMLightweightMessageCell *msgCell = (YTMLightweightMessageCell *)self.delegate; + YTIMessageRenderer *renderer = [msgCell valueForKey:@"_renderer"]; + + if (renderer.icon.iconType != 187) { + return %orig; + } + + %orig(LOC(@"REGIONAL_RESTRICTION")); } %end %end %ctor { %init(SettingsPage); -} \ No newline at end of file +}