mirror of
				https://github.com/Gh0stByte/Movie-Box-Updater
				synced 2025-11-03 18:56:19 +00:00 
			
		
		
		
	First Commit
Movie Box Updater 3.6.4 ( New button design (HQ) )
This commit is contained in:
		
							
								
								
									
										129
									
								
								Hack.xm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								Hack.xm
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,129 @@
 | 
			
		||||
/* Imports */
 | 
			
		||||
#import <CoreData/CoreData.h>
 | 
			
		||||
#import <UIKit/UIKit.h>
 | 
			
		||||
#include <substrate.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* 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
 | 
			
		||||
							
								
								
									
										23
									
								
								Layout/DEBIAN/control
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Layout/DEBIAN/control
									
									
									
									
									
										Normal file
									
								
							@ -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 <gh0stbyte01@gmail.com>
 | 
			
		||||
Author: Gh0stByte <gh0stbyte01@gmail.com>
 | 
			
		||||
Section: Tweaks
 | 
			
		||||
Version: 3.6.4
 | 
			
		||||
							
								
								
									
										10
									
								
								Layout/DEBIAN/postinst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Layout/DEBIAN/postinst
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
			
		||||
							
								
								
									
										18
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@ -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
 | 
			
		||||
							
								
								
									
										17
									
								
								MovieBoxUpdate.plist
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								MovieBoxUpdate.plist
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | 
			
		||||
<plist version="1.0">
 | 
			
		||||
<dict>
 | 
			
		||||
  <key>Filter</key>
 | 
			
		||||
  <dict>
 | 
			
		||||
    <key>Executables</key>
 | 
			
		||||
    <array>
 | 
			
		||||
      <string>MovieBox3</string>
 | 
			
		||||
    </array>
 | 
			
		||||
    <key>Bundles</key>
 | 
			
		||||
    <array>
 | 
			
		||||
    	<string>com.trendico.moviebox3</string>
 | 
			
		||||
    </array>
 | 
			
		||||
  </dict>
 | 
			
		||||
</dict>
 | 
			
		||||
</plist>
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								Resources/refresh.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Resources/refresh.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 3.0 KiB  | 
		Reference in New Issue
	
	Block a user