Skip to content

Commit

Permalink
chore: adjust shake intensity
Browse files Browse the repository at this point in the history
  • Loading branch information
castdrian committed Nov 24, 2024
1 parent 5b2e89d commit fc4b796
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Tweak.x
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,18 @@ id gBridge = nil;

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion == UIEventSubtypeMotionShake) {
isShaking = YES;
isShaking = YES;
shakeStartTime = [[NSDate date] timeIntervalSince1970];
}
%orig;
}

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event {
if (motion == UIEventSubtypeMotionShake && isShaking) {
NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970];
NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970];
NSTimeInterval shakeDuration = currentTime - shakeStartTime;

if (shakeDuration >= 1.0 && shakeDuration <= 3.0) {
if (shakeDuration >= 0.5 && shakeDuration <= 2.0) {
dispatch_async(dispatch_get_main_queue(), ^{ showSettingsSheet(); });
}
isShaking = NO;
Expand Down

0 comments on commit fc4b796

Please sign in to comment.