Last active
August 9, 2024 10:00
-
-
Save BandarHL/ddfed2eb6b7458ef6e5de0c06f4e5c93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
%config(generator=internal) | |
@interface WAInputBarRoundButton : UIButton | |
@end | |
@interface WAInputTextView : UITextView | |
@end | |
@interface WAChatBar : UIView | |
{ | |
WAInputBarRoundButton *_sendButton; | |
} | |
@property(readonly, nonatomic) WAInputTextView *textView; | |
- (void)send; | |
@end | |
@interface WAChatViewController : UIViewController | |
@property(readonly, nonatomic) WAChatBar *chatBar; | |
- (void)MultiSend; | |
@end | |
%hook WAChatViewController | |
- (WAChatBar *)chatBar { | |
WAChatBar *chat_bar = %orig; | |
WAInputBarRoundButton *sendBtn = [chat_bar valueForKey:@"_sendButton"]; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(MultiSend)]; | |
[sendBtn addGestureRecognizer:longPress]; | |
}); | |
return chat_bar; | |
} | |
%new - (void)MultiSend { | |
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"WASend" message:nil preferredStyle:UIAlertControllerStyleAlert]; | |
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { | |
[textField setPlaceholder:@"Amount of times to send"]; | |
}]; | |
UIAlertAction *send = [UIAlertAction actionWithTitle:@"Send" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { | |
NSString *lastTxT = self.chatBar.textView.text; | |
for (int i = 0; i <= alert.textFields.firstObject.text.integerValue; i++) { | |
[self.chatBar send]; | |
[self.chatBar.textView setText:lastTxT]; | |
} | |
}]; | |
[alert addAction:send]; | |
[alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; | |
[self presentViewController:alert animated:true completion:nil]; | |
} | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Azoooz