diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..bfe51fd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +--- +name: Bug report +about: Report a bug +title: '' +labels: bug +assignees: '' + +--- + +### Environment +- Platform+version: **iOS 14** +- Tweak version: **0.0.0** +- Do you have jailbreak detection bypass tweaks (FlyJB, HideJB, kernbypass, ...): **Yes/No** +- If yes, are you sure that it does not block this tweak: **Yes/No** + +### Bug Report + +Note: Providing steps to reproduce, screenshot or screen recording are always helpful! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/Makefile b/Makefile index db92b80..f5eaf87 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ARCHS = arm64 arm64e -TARGET = iphone:clang:12.4:10.0 +TARGET = iphone:clang:14.4:12.0 INSTALL_TARGET_PROCESSES = LightSpeedApp Messenger Preferences diff --git a/README.md b/README.md index f64f39f..8084627 100644 --- a/README.md +++ b/README.md @@ -57,14 +57,14 @@ Licensed under the [GPLv3 License](./LICENSE), Copyright © 2020-present Hao Ngu
Click to expand! - Add your device IP in `~/.bash_profile` or in project's `Makefile` for faster deployment + Add your device IP in `~/.bash_profile` or `~/.zprofile` or in project's `Makefile` for faster deployment ```base - THEOS_DEVICE_IP = 192.168.1.21 + THEOS_DEVICE_IP = 192.168.1.12 ``` Add SSH key for target deploy device so you don't have to enter ssh root password every time ```bash - cat ~/.ssh/id_rsa.pub | ssh -p 22 root@192.168.1.21 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" + cat ~/.ssh/id_rsa.pub | ssh -p 22 root@192.168.1.12 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys" ``` Build the final package diff --git a/Tweak.h b/Tweak.h index aec18d0..0438d36 100644 --- a/Tweak.h +++ b/Tweak.h @@ -1,5 +1,6 @@ #include #import +#import #import #import "settingsview/MNASettingsViewController.h" #import "settingsview/MNAIntroViewController.h" @@ -16,6 +17,12 @@ - (void)initEyeButton; // new method @end +@interface MDSSplitViewController : UIViewController +@property (nonatomic, retain) UIView *sideSwitch; // new property +@property (nonatomic, retain) UIImageView *imageView; // new property +- (void)initEyeButton; // new method +@end + @interface MBUIStoryViewerAuthorOverlayModel : UIView @property(readonly, copy, nonatomic) NSString *authorId; @end diff --git a/Tweak.xm b/Tweak.xm index 907fd8f..b162292 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -154,6 +154,106 @@ static void reloadPrefs() { } %end + %hook MDSSplitViewController + %property (nonatomic, retain) UIView *sideSwitch; + %property (nonatomic, retain) UIImageView *imageView; + + - (void)viewDidAppear:(BOOL)arg1 { + %orig; + if (!hasCompletedIntroduction) { + [self presentViewController:[MNAIntroViewController new] animated:YES completion:nil]; + } + } + + - (void)viewDidLoad { + %orig; + if (showTheEyeButton) { + [self initEyeButton]; + } + } + + %new + - (void)initEyeButton { + self.sideSwitch = [[UIView alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 50, self.view.frame.size.height / 2 - 60, 50, 50)]; + self.sideSwitch.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.3]; + self.sideSwitch.layer.cornerRadius = 10; + self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 30, 30)]; + self.imageView.contentMode = UIViewContentModeScaleAspectFit; + self.imageView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", @PREF_BUNDLE_PATH, disablereadreceipt ? @"no-see.png" : @"see.png"]]; + self.imageView.alpha = 0.8; + [self.sideSwitch addSubview:self.imageView]; + + UITapGestureRecognizer *sideSwitchTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSideSwitchTap:)]; + [self.sideSwitch addGestureRecognizer:sideSwitchTap]; + [self.view addSubview:self.sideSwitch]; + + UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)]; + [panRecognizer setMinimumNumberOfTouches:1]; + [panRecognizer setMaximumNumberOfTouches:1]; + [self.sideSwitch addGestureRecognizer:panRecognizer]; + } + + %new + - (void)handleSideSwitchTap:(UITapGestureRecognizer *)recognizer { + [settings setObject:[NSNumber numberWithBool:!disablereadreceipt] forKey:@"disablereadreceipt"]; + BOOL success = [settings writeToFile:plistPath atomically:YES]; + + if (!success) { + [HCommon showAlertMessage:@"Can't write file" withTitle:@"Error" viewController:nil]; + } else { + self.imageView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", @PREF_BUNDLE_PATH, !disablereadreceipt ? @"no-see.png" : @"see.png"]]; + notify_post(PREF_CHANGED_NOTIF); + } + } + + %new + - (void)move:(UIPanGestureRecognizer*)sender { + // Thanks for this post: https://stackoverflow.com/questions/6672677/how-to-use-uipangesturerecognizer-to-move-object-iphone-ipad + [self.view bringSubviewToFront:sender.view]; + CGPoint translatedPoint = [sender translationInView:sender.view.superview]; + + if (sender.state == UIGestureRecognizerStateBegan) { + // firstX = sender.view.center.x; + // firstY = sender.view.center.y; + } + + translatedPoint = CGPointMake(sender.view.center.x+translatedPoint.x, sender.view.center.y+translatedPoint.y); + + [sender.view setCenter:translatedPoint]; + [sender setTranslation:CGPointZero inView:sender.view]; + + if (sender.state == UIGestureRecognizerStateEnded) { + CGFloat velocityX = (0.2*[sender velocityInView:self.view].x); + CGFloat velocityY = (0.2*[sender velocityInView:self.view].y); + + CGFloat finalX = translatedPoint.x + velocityX; + CGFloat finalY = translatedPoint.y + velocityY; + + if (finalX < self.view.frame.size.width / 2) { + finalX = 0 + sender.view.frame.size.width / 2; + } else { + finalX = self.view.frame.size.width - sender.view.frame.size.width / 2; + } + + if (finalY < 50) { // to avoid status bar + finalY = 50; + } else if (finalY > self.view.frame.size.height - 75) { // avoid bottom tab + finalY = self.view.frame.size.height - 75; + } + + CGFloat animationDuration = (ABS(velocityX)*.0002)+.2; + + [UIView beginAnimations:nil context:NULL]; + [UIView setAnimationDuration:animationDuration]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseOut]; + [UIView setAnimationDelegate:self]; + [UIView setAnimationDidStopSelector:@selector(animationDidFinish)]; + [[sender view] setCenter:CGPointMake(finalX, finalY)]; + [UIView commitAnimations]; + } + } + %end + %hook MSGListBinder %property (nonatomic, assign) BOOL didAddMNACellHeaderView; @@ -184,7 +284,9 @@ static void reloadPrefs() { - (void)handleMNACellTap:(UITapGestureRecognizer *)recognizer { MNASettingsViewController *settingsVC = [[MNASettingsViewController alloc] init]; UINavigationController *navVC = [[UINavigationController alloc] initWithRootViewController:settingsVC]; - navVC.modalPresentationStyle = UIModalPresentationFullScreen; + if (![HCommon isNotch]) { + navVC.modalPresentationStyle = UIModalPresentationFullScreen; + } [[%c(LSAppDelegate) sharedInstance] presentViewController:navVC animated:true completion:nil]; } %end diff --git a/control b/control index 786b769..4863cef 100644 --- a/control +++ b/control @@ -1,11 +1,12 @@ Package: com.haoict.messengernoads Name: Messenger No Ads -Depends: mobilesubstrate, com.haoict.libhdev (>= 4.5.0), firmware (>= 10) -Version: 3.9.1 +Depends: mobilesubstrate, com.haoict.libhdev (>= 4.8.0), firmware (>= 12) +Version: 3.10.0 Architecture: iphoneos-arm Description: The best tweak for Messenger app. The best tweak for Messenger app. Change log: https://github.com/haoict/messenger-no-ads/releases + . Features: - Hide Ads on Messenger app - Disable Read Receipt @@ -15,7 +16,7 @@ Description: The best tweak for Messenger app. - Hide Search Bar, Stories row, People tab - Hide Suggested Contact in Search - Extend Story Video Upload Length (from default is 20 seconds to 10 minutes) - - Support iOS 10 - iOS 14 + - Support iOS 12 - iOS 14 - Support latest Messenger version (If it doesn't work, you should update the app to latest version >= 300.0) . I work very hard to make good, free and open source tweaks for everyone diff --git a/release/com.haoict.messengernoads_3.10.0_iphoneos-arm.deb b/release/com.haoict.messengernoads_3.10.0_iphoneos-arm.deb new file mode 100644 index 0000000..002f226 Binary files /dev/null and b/release/com.haoict.messengernoads_3.10.0_iphoneos-arm.deb differ diff --git a/settingsview/MNACellModel.h b/settingsview/MNACellModel.h index 75c878c..df83d13 100644 --- a/settingsview/MNACellModel.h +++ b/settingsview/MNACellModel.h @@ -1,3 +1,5 @@ +#import + typedef NS_ENUM(NSUInteger, CellType) { Default, StaticText,