From c4ce4fdd2c3431fb66b329a0afa08bc0f164b473 Mon Sep 17 00:00:00 2001 From: Matthew Matter Date: Thu, 9 Jun 2016 16:12:48 -0400 Subject: [PATCH] First Commit Movie Box Updater 3.6.4 ( New button design (HQ) ) --- Hack.xm | 129 +++++++++++++++++++++++++++++++++++++++++ Layout/DEBIAN/control | 23 ++++++++ Layout/DEBIAN/postinst | 10 ++++ Makefile | 18 ++++++ MovieBoxUpdate.plist | 17 ++++++ Resources/refresh.png | Bin 0 -> 3101 bytes 6 files changed, 197 insertions(+) create mode 100644 Hack.xm create mode 100644 Layout/DEBIAN/control create mode 100644 Layout/DEBIAN/postinst create mode 100644 Makefile create mode 100644 MovieBoxUpdate.plist create mode 100644 Resources/refresh.png diff --git a/Hack.xm b/Hack.xm new file mode 100644 index 0000000..fe8f1fa --- /dev/null +++ b/Hack.xm @@ -0,0 +1,129 @@ +/* Imports */ +#import +#import +#include + + +/* Definitions (Macros) */ +#define Bundle_Path @"/Library/MobileSubstrate/DynamicLibraries/MovieBoxBundle.bundle" +#define Queued_Update @"Update has been queued and will commence soon." +#define AlertTitle @"Movie Box Updater" +#define AlertDownload @"Download Working" +#define AlertDismiss @"Dismiss" +#define AlertOK @"OK" + +#define UpdateCheck_URL @"http://gh0stbyte.ga/iOS/moviebox.json" +#define UpdateCheck_Local @"3.6.4" +#define UpdateCheck_Alert @"There is an update available for this tweak." + + +/* Fake interface to allow calling of the update function, along with new sharedInstance */ +@interface UpdatesManager : NSObject +/* Fool the compiler into thinking that we have the method */ +- (void)requestUpdatedDataBaseWithFileURL:(NSString*)url; +/* Create sharedInstance method */ ++ (id)sharedInstance; +@end + +/* Variables */ +static UIView *header; +static UpdatesManager *sharedInstance = nil; +NSString *updateURL; + + +%hook MenuViewController + +/* When it sets up the headerView */ +-(UIView*)headerView { + /* set the headerview to itself */ + header = %orig; + /* Give it a second to create the header before adding to it */ + [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector:@selector(setupButton) + userInfo:nil + repeats:NO]; + /* return the header variable which is itself */ + return header; +} + +%new +/* New function called 1 second after headerView called allowing time for it to be created */ +-(void)setupButton { + + // Update Available Check + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:UpdateCheck_URL]]; + [NSURLConnection sendAsynchronousRequest:request + queue:[NSOperationQueue mainQueue] + completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) { + NSDictionary *myjson = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL]; + updateURL = @"http://sbfunapi.cc/data/data_en.zip"; + NSString *current_version = [myjson objectForKey:@"current_version"]; + + if(![current_version isEqualToString:UpdateCheck_Local]) { + UIAlertView *a = [[UIAlertView alloc] initWithTitle:AlertTitle message:UpdateCheck_Alert delegate:self cancelButtonTitle:AlertOK otherButtonTitles:@"Update", nil]; + [a show]; + [a release]; + } + + }]; + + + CGFloat height = CGRectGetHeight(header.bounds); + CGFloat width = CGRectGetWidth(header.bounds); + + // Create a new button that will trigger database updates. + UIButton *updateButton = [[UIButton alloc] initWithFrame:CGRectMake((width - 63), ((height/2) +3.333333), 20.0, 20.0)]; + // When button pressed, updateDB function will be called + [updateButton addTarget:self + action:@selector(updateDB) + forControlEvents:UIControlEventTouchUpInside]; + // Set the image of the button + [updateButton setImage:[UIImage imageWithContentsOfFile:[[[NSBundle alloc] initWithPath:Bundle_Path] pathForResource:@"refresh" ofType:@"png"]] forState:UIControlStateNormal]; + // Add button to the header UIView (header) + [header addSubview:updateButton]; +} + +%new +/* Function to update the Database */ +-(void)updateDB { + /* Let the user know that the update has been queued. Good for older phones that take a while to actually show the update process, and prevent the user + from spamming the update button. */ + UIAlertView *a = [[UIAlertView alloc] initWithTitle:AlertTitle message:Queued_Update delegate:nil cancelButtonTitle:AlertOK otherButtonTitles:nil]; + [a show]; + [a release]; + /* Use the sharedInstance function (returns the current instance) to call the requestUpdateBlah function with our updateURL grabbed from the server */ + [[%c(UpdatesManager) sharedInstance] requestUpdatedDataBaseWithFileURL:updateURL]; +} + +%new +// When the user presses a button +- (void)alertView :(UIAlertView*)alertView clickedButtonAtIndex: (NSInteger)buttonIndex { + + if([[alertView buttonTitleAtIndex:buttonIndex] isEqualToString: @"Update"]) { + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://cydia.dtathemes.com/"]]; + } + +} + +%end + +%hook UpdatesManager +/* When an UpdatesManager instance is created */ +- (id)init +{ + /* we set our sharedInstance to be the current instance of the UpdatesManager */ + sharedInstance = %orig; + /* Then we return the sharedInstance which is itself */ + return sharedInstance; +} + +/* Create new sharedInstance */ +%new ++ (id)sharedInstance +{ + /* It returns the current instance of the UpdatesManger */ + return sharedInstance; +} + +%end diff --git a/Layout/DEBIAN/control b/Layout/DEBIAN/control new file mode 100644 index 0000000..23906f4 --- /dev/null +++ b/Layout/DEBIAN/control @@ -0,0 +1,23 @@ +Package: com.gh0stbyte.movieboxupdater +Name: Movie Box Updater +Depends: mobilesubstrate +Architecture: iphoneos-arm +Description: Update your Movie Box database whenever you wish with this nifty tweak made by Gh0stByte, of iOSCheaters.com + With this tweak, you can update your Movie Box database whenever you want, no need to wait 24 hours. + Complete re-work of the tweak! You can now update via a button in the menu's header. + Changelog: + v.3.6.4 + - Fully compatible with latest Movie Box (3.6.4) + - Tweaked code for optimum speed + - Minor UI changes + - Version check on startup + v.3.6.2 + - Updated to work for the latest Movie Box (3.6.2) + - Changed the way you preform updates. + - Added custom button to update the Database. + v.1.0.0 + - Initial Release +Maintainer: Gh0stByte +Author: Gh0stByte +Section: Tweaks +Version: 3.6.4 diff --git a/Layout/DEBIAN/postinst b/Layout/DEBIAN/postinst new file mode 100644 index 0000000..24607ee --- /dev/null +++ b/Layout/DEBIAN/postinst @@ -0,0 +1,10 @@ +#!/bin/sh +echo +echo '#####################################################' +echo ' Movie Box 3 Updater --- Version 3.6.4 ' +echo '#####################################################' +echo 'Made by Gh0stByte! Enjoy! See more at iOSCheaters.com' +echo '#####################################################' +echo +echo +exit 0 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..39f8c3c --- /dev/null +++ b/Makefile @@ -0,0 +1,18 @@ +ARCHS = arm64 armv7 armv7s +include $(THEOS)/makefiles/common.mk + +TWEAK_NAME = MovieBoxUpdate +MovieBoxUpdate_FILES = Hack.xm +MovieBoxUpdate_FRAMEWORKS = UIKit CoreGraphics +MovieBoxUpdate_LDFLAGS += -Wl,-segalign,4000 +TARGET_IPHONEOS_DEPLOYMENT_VERSION = 6.0 + +BUNDLE_NAME = MovieBoxBundle +MovieBoxBundle_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries/ +include $(THEOS)/makefiles/bundle.mk + +include $(THEOS_MAKE_PATH)/tweak.mk + +after-install:: + install.exec "killall -9 MovieBox3; killall -9 Preferences" +include $(THEOS_MAKE_PATH)/aggregate.mk diff --git a/MovieBoxUpdate.plist b/MovieBoxUpdate.plist new file mode 100644 index 0000000..136f33c --- /dev/null +++ b/MovieBoxUpdate.plist @@ -0,0 +1,17 @@ + + + + + Filter + + Executables + + MovieBox3 + + Bundles + + com.trendico.moviebox3 + + + + diff --git a/Resources/refresh.png b/Resources/refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..f06a3058f5bafb79ee7b11477bc0b81f16058f1f GIT binary patch literal 3101 zcmV+&4C3>NP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxH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