Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Add Support Messenger 303.0
Browse files Browse the repository at this point in the history
Add github issue template
  • Loading branch information
haoict committed Mar 12, 2021
1 parent 6da77a6 commit d8b3b9f
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 8 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -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** <!--- Change to match your platform and version -->
- Tweak version: **0.0.0** <!--- Change to the version of the tweak you're using -->
- 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!
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ Licensed under the [GPLv3 License](./LICENSE), Copyright © 2020-present Hao Ngu
<details>
<summary>Click to expand!</summary>

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
Expand Down
7 changes: 7 additions & 0 deletions Tweak.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <dlfcn.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <libhdev/HUtilities/HCommon.h>
#import "settingsview/MNASettingsViewController.h"
#import "settingsview/MNAIntroViewController.h"
Expand All @@ -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
Expand Down
104 changes: 103 additions & 1 deletion Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions control
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Binary file not shown.
2 changes: 2 additions & 0 deletions settingsview/MNACellModel.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#import <Foundation/Foundation.h>

typedef NS_ENUM(NSUInteger, CellType) {
Default,
StaticText,
Expand Down

0 comments on commit d8b3b9f

Please sign in to comment.