Skip to content

Instantly share code, notes, and snippets.

@BandarHL
Last active December 22, 2021 19:07
Show Gist options
  • Save BandarHL/ddfed2eb6b7458ef6e5de0c06f4e5c93 to your computer and use it in GitHub Desktop.
Save BandarHL/ddfed2eb6b7458ef6e5de0c06f4e5c93 to your computer and use it in GitHub Desktop.
#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
@Azoooooz-ss
Copy link

WhatsApp Bomber

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment