Skip to content

Commit

Permalink
Change regional restriction message
Browse files Browse the repository at this point in the history
  • Loading branch information
dayanch96 authored Mar 11, 2024
1 parent dcde55c commit 2bd837d
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions Source/Settings.x
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
}
}

0 comments on commit 2bd837d

Please sign in to comment.