Skip to content

Commit

Permalink
1.3.4
Browse files Browse the repository at this point in the history
- Fix download button not working on BeReal versions >= 1.19
  • Loading branch information
yandevelop committed Jan 5, 2024
1 parent 4a232cd commit 1b1feda
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
TARGET := iphone:clang:latest:14.0
INSTALL_TARGET_PROCESSES = BeReal
ARCHS = arm64
ARCHS = arm64 arm64e
FINALPACKAGE = 1
PACKAGE_VERSION = 1.3.3
PACKAGE_VERSION = 1.3.4

THEOS_PACKAGE_SCHEME = rootless
THEOS_DEVICE_IP = 192.168.102.61

export SYSROOT = $(THEOS)/sdks/iPhoneOS15.5.sdk
THEOS_PACKAGE_SCHEME = rootless

include $(THEOS)/makefiles/common.mk

Expand Down
15 changes: 11 additions & 4 deletions Tweak/Tweak.x
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "Tweak.h"


%hook DoublePhotoView
%property (nonatomic, strong) BeaButton *downloadButton;

Expand Down Expand Up @@ -49,6 +50,7 @@
%end



%hook UIAlertController
- (void)viewWillAppear:(id)arg1 {
%orig;
Expand All @@ -72,6 +74,7 @@
}
%end


%hook HomeViewController
- (void)viewDidLoad {
%orig;
Expand Down Expand Up @@ -114,6 +117,7 @@
}
%end


%hook CAFilter
-(void)setValue:(id)arg1 forKey:(id)arg2 {
// remove the blur that gets applied to the BeReals
Expand All @@ -125,6 +129,8 @@
}
%end



%hook SettingsViewController
- (void)viewDidLoad {
%orig;
Expand Down Expand Up @@ -154,7 +160,7 @@
// since BeReal 1.4 the bundleIdentifier seems to have changed. Keeping both for backwards compatibility
if ([self.bundleIdentifier isEqualToString:@"Localisation-Localisation-resources"] || [self.bundleIdentifier isEqualToString:@"com.bereal.BRAssets"]) {
if ([key isEqualToString:@"timelineCell_blurredView_button"] || [key isEqualToString:@"timelineCell_blurredView_description_myFriends"] || [key isEqualToString:@"timelineCell_blurredView_title"] || [key isEqualToString:@"timelineCell_blurredView_description_discoveryGlobal"]) {
return nil;
return @"";
}
}
return %orig;
Expand All @@ -165,7 +171,6 @@
%hook NSMutableURLRequest
-(void)setAllHTTPHeaderFields:(NSDictionary *)arg1 {
%orig;

if ([[arg1 allKeys] containsObject:@"Authorization"] && [[arg1 allKeys] containsObject:@"bereal-device-id"] && !headers) {
if ([arg1[@"Authorization"] length] > 0) {
headers = (NSDictionary *)arg1;
Expand All @@ -175,6 +180,7 @@
}
%end


%hook UIHostingView
- (void)layoutSubviews {
%orig;
Expand All @@ -201,8 +207,9 @@
%ctor {
char *mediaClass = [BeaViewResolver mediaClass];

%init(HomeViewController = objc_getClass("BeReal.HomeViewController"),
%init(
DoublePhotoView = objc_getClass(mediaClass),
SettingsViewController = objc_getClass("BeReal.SettingsViewController"),
UIHostingView = objc_getClass("_TtC7SwiftUIP33_A34643117F00277B93DEBAB70EC0697116_UIInheritedView"));
UIHostingView = objc_getClass("_TtC7SwiftUIP33_A34643117F00277B93DEBAB70EC0697116_UIInheritedView"),
HomeViewController = objc_getClass("BeReal.HomeViewController"));
}
13 changes: 11 additions & 2 deletions Utilities/BeaUtilities.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,23 @@ + (void)downloadImage:(id)sender {
// < 1.16
viewClass = @"RealComponents.DoubleMediaView";
} else {
// > 1.16
UIView *hostView = button.superview.superview.superview;
UIView *hostView;
if ([version compare:@"1.19.0" options:NSNumericSearch]) {
// > 1.16 < 1.18
hostView = button.superview.superview.superview;
}

// > 1.18.0
hostView = button.superview.superview.superview.superview;

UIView *nestedSubview = hostView.subviews.firstObject;

if (nestedSubview.alpha == 0) {
imageView = hostView.subviews[5].subviews[0].subviews[0].subviews[0];
//imageView = [self findImageViewInViewHierarchy:hostView];
} else {
imageView = nestedSubview.subviews[0].subviews[0].subviews[0];
// imageView = [self findImageViewInViewHierarchy:nestedSubview];
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
@property (nonatomic, strong) UILabel *versionLabel;
@end

#define TWEAK_VERSION @"1.3.3"
#define TWEAK_VERSION @"1.3.4"
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

// method for the caption text field
- (void)captionTextFieldDidChange:(UITextField *)textField {
self.caption = textField.text;
self.caption = (NSString *)textField.text;
}

// method for the retake text field
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: com.yan.bea
Name: Bea
Version: 1.3.3
Version: 1.3.4
Architecture: iphoneos-arm64
Description: Lightweight BeReal. enhancement tweak.
Maintainer: yan
Expand Down

0 comments on commit 1b1feda

Please sign in to comment.