Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yandevelop committed Apr 15, 2023
0 parents commit 735663f
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.theos/
packages/
.DS_Store
Versions/
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
TARGET := iphone:clang:latest:15.0
INSTALL_TARGET_PROCESSES = BeReal
ARCHS = arm64 arm64e
THEOS_PACKAGE_SCHEME = rootless
THEOS_DEVICE_IP = 192.168.102.61

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

include $(THEOS)/makefiles/common.mk

TWEAK_NAME = Bea

Bea_FILES = Tweak.x
Bea_CFLAGS = -fobjc-arc
Bea_FRAMEWORKS = UIKit

include $(THEOS_MAKE_PATH)/tweak.mk
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Bea
Bea adds small enhancements to the BeReal. app.

## Installation
1. Add https://havoc.app to your package manager.
2. Install Bea

## Compatibility
All iOS devices running iOS 14 or later.

## Build
- Clone this repository using `git clone https://github.com/yandevelop/Bea`
- `cd Bea`
- Run `make package`

## License
You may not copy, modify, sublicense or distribute the source code or any packages from it.

107 changes: 107 additions & 0 deletions Tweak.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#include <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

static NSString *lateBeReal;

%hook CameraViewController
// Display the close button even if not finished taking a photo
- (void)viewDidLoad {
%orig;
UIViewController *viewController = (UIViewController *)self;
for (UIView *subview in viewController.view.subviews) {
if ([subview isKindOfClass:[UIButton class]]) {
if (subview.hidden == YES) {
subview.hidden = NO;
break;
}
}
}
}

// Don't dismiss if the countdown of 2 minutes finishes
- (void)countdownFinished {
UIViewController *viewController = (UIViewController *)self;
for (UILabel *countdownLabel in viewController.view.subviews) {
if ([countdownLabel isKindOfClass:objc_getClass("_TtC14CountdownLabel14CountdownLabel")]) {
countdownLabel.text = @"Take your time.";
countdownLabel.textColor = [UIColor whiteColor];
[UIView animateWithDuration:0.4 delay:10.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
countdownLabel.alpha = 0.0;
} completion:^(BOOL finished) {
[countdownLabel removeFromSuperview];
}];
}
}
}
%end

%hook UIView
- (void)layoutSubviews {
%orig;

// Get the current View Controller
UIResponder *responder = self;
while (responder && ![responder isKindOfClass:[UIViewController class]]) {
responder = [responder nextResponder];
}
UIViewController *vc = (UIViewController *)responder;

// Remove the "Post to view" View
for (UIView *subview in self.subviews) {
if ([subview isKindOfClass:objc_getClass("_TtC6BeReal20FeedPostCellBlurView")]) {
[subview removeFromSuperview];
break;
}
}

for (UIView *view in self.subviews) {
if ([view isKindOfClass:objc_getClass("UIImageView")] && [view.superview isKindOfClass:objc_getClass("BeReal.DoublePhotoView")]) {
for (UIButton *button in view.subviews) {
if ([button isKindOfClass:[UIButton class]]) {
return;
}
}

// Adding the "Post a Late BeReal." button but only for the Feed Friends View
if (![vc isKindOfClass:objc_getClass("_TtC6BeReal25FeedFriendsViewController")] || (vc == nil)) return;
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.backgroundColor = [UIColor colorWithWhite: 1.0 alpha: 0.9];
button.layer.cornerRadius = 8;
button.layer.masksToBounds = YES;
button.tintColor = [UIColor blackColor];
NSString *title = lateBeReal ?: @"Post a Late BeReal.";
[button setTitle:title forState:UIControlStateNormal];
button.titleLabel.font = [UIFont systemFontOfSize:13.0 weight:UIFontWeightBold];
[button sizeToFit];
CGRect frame = button.frame;
frame.size.width += 20;
button.frame = CGRectMake(view.frame.size.width - frame.size.width - 10, 11.7, frame.size.width, 36);
[button addTarget:vc action:@selector(emptyViewTakeBeReal) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:button];
break;
}
}
}
%end

// Bypass screenshot detection?
%hook UIScreen
- (BOOL)isCaptured {
return NO;
}
%end

%hook NSNotificationCenter
- (void)addObserver:(id)arg0 selector:(SEL)arg1 name:(NSNotificationName)arg2 object:(id)arg3 {
if (arg2 == UIApplicationUserDidTakeScreenshotNotification) {
return;
}
%orig;
}
%end

%ctor {
NSBundle *bundle = [NSBundle bundleWithIdentifier:@"com.bereal.BRAssets"];
lateBeReal = [bundle localizedStringForKey:@"timelineCell_blurredView_button" value:@"" table:@"Localizable"];
%init(CameraViewController = objc_getClass("_TtC6BeReal20CameraViewController"));
}
1 change: 1 addition & 0 deletions bea.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ Filter = { Bundles = ( "AlexisBarreyat.BeReal" ); }; }
10 changes: 10 additions & 0 deletions control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: com.yan.bea
Name: Bea
Version: 1.0
Architecture: iphoneos-arm64
Description: Lightweight BeReal. enhancement tweak.
Maintainer: yan
Author: yan
Section: Tweaks
Depends: mobilesubstrate (>= 0.9.5000), firmware(>=14.0)
Icon: https://yandevelop.github.io/assets/icons/bea/icon.png

0 comments on commit 735663f

Please sign in to comment.