-
Notifications
You must be signed in to change notification settings - Fork 3
/
Tweak.xm_old
122 lines (93 loc) · 3.4 KB
/
Tweak.xm_old
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* WaterWave Tweak file
Created for iOS 10 in mind and for novelity purposes because I was bored :P
Copyright 2017 iKilledAppl3, ToxicAppl3 Inc, and J.K. Hayslip
Based on JRMBubbleTutorial from Caroline Harrison on GitHub
URL: https://github.com/carleihar/JRMBubbleTutorial
Thanks much appreciated :)
*/
//Headers we need to import
#import <UIKit/UIKit.h>
#import <Cephei/HBPreferences.h>
#import "WaterWave.h"
#import <CoreMotion/CoreMotion.h>
#import "BAFluidView/BAFluidView.h"
#import "BAFluidView/UIColor+ColorWithHex.h"
//Bubble and Fish image path on the file system
static NSString *fishImage = @"/Library/Application Support/WaterWave/fish.png";
//static NSString *bubbleImage = @"/Library/Application Support/WaterWave/bubble.png";
//BOOL values for tweak to enable or disable certain things :P
//BOOL value to see if tweak is enabled;
static BOOL kEnabled;
//Methods to hook and modify
%hook _SBLockScreenSingleBatteryChargingView
-(void)setBatteryVisible:(BOOL)arg1 {
if (kEnabled == YES) {
NO;
}
else {
%orig;
}
}
%end
%hook SBDashBoardPowerChangeObserver
-(void)setConnectedToPower:(BOOL)arg1 {
if (kEnabled == YES) {
%orig;
bubbleSound = [[AVAudioPlayer alloc] initWithContentsOfURL:bubbleChargingSound error:nil];
bubbleSound.numberOfLoops = 0;
bubbleSound.volume = 1.0;
[bubbleSound play];
}
else {
%orig;
[bubbleSound stop];
}
}
%end
%hook SBDashBoardChargingViewController
-(void)viewDidLoad {
if (kEnabled == YES) {
%orig;
windowVC = [[UIView alloc]initWithFrame:[UIScreen mainScreen].bounds];
windowVC.backgroundColor = [UIColor clearColor];
[self.view addSubview:windowVC];
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *visualEffectView;
visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = windowVC.bounds;
[windowVC addSubview:visualEffectView];
fishImageView = [[UIImageView alloc] initWithFrame:CGRectMake(windowVC.center.x - 100, windowVC.center.y - 100, 200, 200)];
fishImageView.image = [UIImage imageWithContentsOfFile:fishImage];
[windowVC addSubview:fishImageView];
[self performSelector:@selector(goFishGo) withObject:nil];
//Water Effect for view :)
BAFluidView *fluidView = [[BAFluidView alloc] initWithFrame:windowVC.frame startElevation:@0.3];
fluidView.strokeColor = [UIColor whiteColor];
fluidView.fillColor = [UIColor colorWithHex:0x397ebe];
//[fluidView keepStationary]; //optional
[fluidView startAnimation];
[fluidView startTiltAnimation];
[windowVC addSubview:fluidView];
}
}
-(void)goFishGo {
[UIView animateWithDuration:5 animations:^{
fishImageView.frame = CGRectMake(windowVC.frame.size.width + 200, windowVC.center.y - 100, 200, 200);
} completion:^(BOOL finished) {
fishImageView.frame = CGRectMake(windowVC.frame.origin.x - 200, windowVC.center.y - 100, 200, 200);
[self performSelector:@selector(goFishGo) withObject:nil];
}];
}
%end
//Prefs new
//Using libcephei instead of the old crappy way
//ws.hbang.common is your friend
HBPreferences *preferences;
extern NSString *const HBPreferencesDidChangeNotification;
//our constructor
%ctor {
//write to a plist file to save data from user when they toggle on or off a feature
preferences = [[HBPreferences alloc] initWithIdentifier:@"com.ikilledappl3.waterwave"];
//check the bool value from the plist
[preferences registerBool:&kEnabled default:NO forKey:@"kEnabled"];
}