diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..540731e Binary files /dev/null and b/.DS_Store differ diff --git a/FlashBack.xcodeproj/project.pbxproj b/FlashBack.xcodeproj/project.pbxproj index 63bbda6..4f78119 100644 --- a/FlashBack.xcodeproj/project.pbxproj +++ b/FlashBack.xcodeproj/project.pbxproj @@ -444,6 +444,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = PRBH2T6668; FRAMEWORK_SEARCH_PATHS = ( @@ -458,6 +459,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.mpg13.FlashBack; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -467,6 +469,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = PRBH2T6668; FRAMEWORK_SEARCH_PATHS = ( @@ -481,6 +484,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.mpg13.FlashBack; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/FlashBack.xcodeproj/project.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate b/FlashBack.xcodeproj/project.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..e7da8a6 Binary files /dev/null and b/FlashBack.xcodeproj/project.xcworkspace/xcuserdata/micahgomez.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/FlashBack/.DS_Store b/FlashBack/.DS_Store new file mode 100644 index 0000000..2d85e48 Binary files /dev/null and b/FlashBack/.DS_Store differ diff --git a/FlashBack/Base.lproj/Main.storyboard b/FlashBack/Base.lproj/Main.storyboard index 9060dd4..ed58ee0 100644 --- a/FlashBack/Base.lproj/Main.storyboard +++ b/FlashBack/Base.lproj/Main.storyboard @@ -1,11 +1,9 @@ - - - - + + - + @@ -26,11 +24,42 @@ + + + + + + + + - - + + @@ -43,11 +72,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/FlashBack/ViewController.m b/FlashBack/ViewController.m index 6c61f17..300fd73 100644 --- a/FlashBack/ViewController.m +++ b/FlashBack/ViewController.m @@ -16,126 +16,111 @@ @end +BOOL trial; NSArray *_backupFolderArray; NSString *_backupDirectory; NSMutableString *selectedBackupImageURL; NSMutableString *selectedBackupURL; NSString *backupNameSelected; -int itFuckingCounts = 0; -//CFArrayRef CPBitmapCreateImagesFromData(CFDataRef cpbitmap, void*, int, void*); @implementation ViewController - -- (IBAction)secretButton:(id)sender { - - itFuckingCounts++; - - if (itFuckingCounts==13) { - - UIAlertController * secretButtonAlert= [UIAlertController - alertControllerWithTitle:@"Secret found!" - message:@"Thanks for supporting FlashBack, and congratulations on finding the secret button!" - preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* ok = [UIAlertAction - actionWithTitle:@":)" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - NSURL *myPicURL = [NSURL fileURLWithPath:@"/Library/FlashBack/.mg.png"]; - NSLog(@"%@", myPicURL); - NSData *myPicData = [NSData dataWithContentsOfURL:myPicURL]; - selectedBackupImage.image = [UIImage imageWithData:myPicData]; - - [secretButtonAlert dismissViewControllerAnimated:YES completion:nil]; - - }]; - [secretButtonAlert addAction:ok]; - - [self presentViewController:secretButtonAlert animated:YES completion:nil]; - - } -} - - - - (IBAction)createBackup:(id)sender { - UIAlertController *createBackupAlert = [UIAlertController alertControllerWithTitle:@"Enter the Backup Name" message:@"Please do not use special symbols. Use only letters and numbers, no spaces." preferredStyle:UIAlertControllerStyleAlert]; - [createBackupAlert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { - textField.placeholder = @"Backup Name"; - textField.secureTextEntry = NO; - }]; - UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - NSLog(@"Backup name is :%@", [[createBackupAlert textFields][0] text]); - NSString *newBackupName=[[createBackupAlert textFields][0] text]; + if(([_backupFolderArray count] >= 1) && (trial == YES)){ - if([[[createBackupAlert textFields][0] text] isEqual:@""]){ - NSLog(@"empty backup name!"); - } - else{ - NSLog(@"Backup name is good!"); - - NSLog(@"Running NSTask"); - - NSTask *createTask = [[NSTask alloc] init]; - [createTask setLaunchPath:@"/bin/bash"]; - [createTask setArguments:@[ @"FBCreate", newBackupName]]; - [createTask launch]; - [createTask waitUntilExit]; - - UIAlertController * finishedCreateAlert= [UIAlertController - alertControllerWithTitle:@"Backup Creation Completed" - message:@"The backup has been successfully created" - preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* ok = [UIAlertAction - actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - - _backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/Library/FlashBack/Backups/" error:nil]; - [self->selectedBackupPickerView reloadAllComponents]; - - [finishedCreateAlert dismissViewControllerAnimated:YES completion:nil]; - - }]; - [finishedCreateAlert addAction:ok]; - - [self presentViewController:finishedCreateAlert animated:YES completion:nil]; - - /*pid_t pid; - int status; - const char* args[] = {"killall", "backboardd", NULL, NULL}; - posix_spawn(&pid, "/bin/bash", NULL, NULL, (char* const*)args, NULL); - waitpid(pid, &status, WEXITED);*/ - - } + UIAlertController * noMoreBackupsAlert = [UIAlertController + alertControllerWithTitle:@"Maximum Backups Reached" + message:@"The free trial of FlashBack only allows one saved setup. Purchase the full version on PackIX for $1.50 to make more!" + preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"ok" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [noMoreBackupsAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; - }]; - [createBackupAlert addAction:confirmAction]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { - NSLog(@"Canelled"); - }]; - [createBackupAlert addAction:cancelAction]; - [self presentViewController:createBackupAlert animated:YES completion:nil]; - + [noMoreBackupsAlert addAction:ok]; + [self presentViewController:noMoreBackupsAlert animated:YES completion:nil]; + + } + else{ + + UIAlertController *createBackupAlert = [UIAlertController alertControllerWithTitle:@"Enter the Backup Name" message:@"Please do not use special symbols. Use only letters and numbers, no spaces. If you have issues with the wallpaper not being properly applied after restoring to a backup, install autowall from\n https://jb365.github.io/" preferredStyle:UIAlertControllerStyleAlert]; + [createBackupAlert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { + textField.placeholder = @"Backup Name"; + textField.secureTextEntry = NO; + }]; + UIAlertAction *confirmAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + NSLog(@"Backup name is :%@", [[createBackupAlert textFields][0] text]); + NSString *newBackupName=[[createBackupAlert textFields][0] text]; + + if([[[createBackupAlert textFields][0] text] isEqual:@""]){ + NSLog(@"empty backup name!"); + } + else{ + NSLog(@"Backup name is good!"); + + NSLog(@"Running NSTask"); + + NSTask *createTask = [[NSTask alloc] init]; + [createTask setLaunchPath:@"/bin/bash"]; + [createTask setArguments:@[ @"FBCreate", newBackupName]]; + [createTask launch]; + [createTask waitUntilExit]; + + UIAlertController * finishedCreateAlert= [UIAlertController + alertControllerWithTitle:@"Backup Creation Completed" + message:@"The backup has been successfully created" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"OK" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + + _backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/Library/FlashBack/Backups/" error:nil]; + [self->selectedBackupPickerView reloadAllComponents]; + + [finishedCreateAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; + [finishedCreateAlert addAction:ok]; + + [self presentViewController:finishedCreateAlert animated:YES completion:nil]; + + /*pid_t pid; + int status; + const char* args[] = {"killall", "backboardd", NULL, NULL}; + posix_spawn(&pid, "/bin/bash", NULL, NULL, (char* const*)args, NULL); + waitpid(pid, &status, WEXITED);*/ + + } + + + }]; + [createBackupAlert addAction:confirmAction]; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { + NSLog(@"Canelled"); + }]; + [createBackupAlert addAction:cancelAction]; + [self presentViewController:createBackupAlert animated:YES completion:nil]; + } } - - - (IBAction)restoreBackup:(id)sender { if (backupNameSelected == nil){ UIAlertController * selectBackupAlert= [UIAlertController - alertControllerWithTitle:@"Select a Backup!" - message:@"Scroll through the list then let it settle on an item to select the backup." - preferredStyle:UIAlertControllerStyleAlert]; + alertControllerWithTitle:@"Select a Backup!" + message:@"Scroll through the list then let it settle on an item to select the backup." + preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"ok" @@ -152,47 +137,47 @@ int itFuckingCounts = 0; } else{ - - UIAlertController * restoreBackupAlert= [UIAlertController - alertControllerWithTitle:@"Restore Backup" - message:@"Your device will revert to the selected backup! Please wait for your device to respring." - preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* ok = [UIAlertAction - actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - - //RUN RESTORE SCRIPT - - NSTask *restoreTask = [[NSTask alloc] init]; - [restoreTask setLaunchPath:@"/bin/bash"]; - [restoreTask setArguments:@[ @"FBRestore", backupNameSelected]]; - [restoreTask launch]; - - UIAlertController * finishedRestoreAlert= [UIAlertController - alertControllerWithTitle:@"Restoring from backup" - message:@"Your device will respring when the process is completed." - preferredStyle:UIAlertControllerStyleAlert]; - [self presentViewController:finishedRestoreAlert animated:YES completion:nil]; - - [restoreBackupAlert dismissViewControllerAnimated:YES completion:nil]; - - }]; - UIAlertAction* cancel = [UIAlertAction - actionWithTitle:@"Cancel" + + UIAlertController * restoreBackupAlert= [UIAlertController + alertControllerWithTitle:@"Restore Backup" + message:@"Your device will revert to the selected backup! Please wait for your device to respring." + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + + //RUN RESTORE SCRIPT + + NSTask *restoreTask = [[NSTask alloc] init]; + [restoreTask setLaunchPath:@"/bin/bash"]; + [restoreTask setArguments:@[ @"FBRestore", backupNameSelected]]; + [restoreTask launch]; + + UIAlertController * finishedRestoreAlert= [UIAlertController + alertControllerWithTitle:@"Restoring from backup" + message:@"Your device will respring when the process is completed." + preferredStyle:UIAlertControllerStyleAlert]; + [self presentViewController:finishedRestoreAlert animated:YES completion:nil]; + [restoreBackupAlert dismissViewControllerAnimated:YES completion:nil]; }]; - - [restoreBackupAlert addAction:cancel]; - [restoreBackupAlert addAction:ok]; - - [self presentViewController:restoreBackupAlert animated:YES completion:nil]; + UIAlertAction* cancel = [UIAlertAction + actionWithTitle:@"Cancel" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [restoreBackupAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; + + [restoreBackupAlert addAction:cancel]; + [restoreBackupAlert addAction:ok]; + + [self presentViewController:restoreBackupAlert animated:YES completion:nil]; } } @@ -220,143 +205,167 @@ int itFuckingCounts = 0; } else{ - - UIAlertController * updateBackupAlert= [UIAlertController - alertControllerWithTitle:@"Update Backup" - message:@"The selected backup will be overwritten! Please wait until the completion pop-up appears" - preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* ok = [UIAlertAction - actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - - - [updateBackupAlert dismissViewControllerAnimated:YES completion:nil]; - - NSTask *deleteTask = [[NSTask alloc] init]; - [deleteTask setLaunchPath:@"/bin/bash"]; - [deleteTask setArguments:@[ @"FBDelete", backupNameSelected]]; - [deleteTask launch]; - [deleteTask waitUntilExit]; - - NSTask *createTask = [[NSTask alloc] init]; - [createTask setLaunchPath:@"/bin/bash"]; - [createTask setArguments:@[ @"FBCreate", backupNameSelected]]; - [createTask launch]; - [createTask waitUntilExit]; - - UIAlertController * finishedUpdateAlert= [UIAlertController - alertControllerWithTitle:@"Backup Update Completed" - message:@"The backup has been successfully updated" - preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* ok = [UIAlertAction - actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - - _backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/Library/FlashBack/Backups/" error:nil]; - [self->selectedBackupPickerView reloadAllComponents]; - - [finishedUpdateAlert dismissViewControllerAnimated:YES completion:nil]; - - }]; - [finishedUpdateAlert addAction:ok]; - - [self presentViewController:finishedUpdateAlert animated:YES completion:nil]; - - - }]; - UIAlertAction* cancel = [UIAlertAction - actionWithTitle:@"Cancel" + + UIAlertController * updateBackupAlert= [UIAlertController + alertControllerWithTitle:@"Update Backup" + message:@"The selected backup will be overwritten! Please wait until the completion pop-up appears" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { + + [updateBackupAlert dismissViewControllerAnimated:YES completion:nil]; + NSTask *deleteTask = [[NSTask alloc] init]; + [deleteTask setLaunchPath:@"/bin/bash"]; + [deleteTask setArguments:@[ @"FBDelete", backupNameSelected]]; + [deleteTask launch]; + [deleteTask waitUntilExit]; + + NSTask *createTask = [[NSTask alloc] init]; + [createTask setLaunchPath:@"/bin/bash"]; + [createTask setArguments:@[ @"FBCreate", backupNameSelected]]; + [createTask launch]; + [createTask waitUntilExit]; + + UIAlertController * finishedUpdateAlert= [UIAlertController + alertControllerWithTitle:@"Backup Update Completed" + message:@"The backup has been successfully updated" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"OK" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + + _backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/Library/FlashBack/Backups/" error:nil]; + [self->selectedBackupPickerView reloadAllComponents]; + + [finishedUpdateAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; + [finishedUpdateAlert addAction:ok]; + + [self presentViewController:finishedUpdateAlert animated:YES completion:nil]; + + }]; - - [updateBackupAlert addAction:cancel]; - [updateBackupAlert addAction:ok]; - - [self presentViewController:updateBackupAlert animated:YES completion:nil]; + UIAlertAction* cancel = [UIAlertAction + actionWithTitle:@"Cancel" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [updateBackupAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; + + [updateBackupAlert addAction:cancel]; + [updateBackupAlert addAction:ok]; + + [self presentViewController:updateBackupAlert animated:YES completion:nil]; } } - - (IBAction)packageBackup:(id)sender { - if (backupNameSelected == nil){ + if (trial == NO){ - UIAlertController * selectBackupAlert= [UIAlertController - alertControllerWithTitle:@"Select a Backup!" - message:@"Scroll through the list then let it settle on an item to select the backup." - preferredStyle:UIAlertControllerStyleAlert]; + if (backupNameSelected == nil){ + + UIAlertController * selectBackupAlert= [UIAlertController + alertControllerWithTitle:@"Select a Backup!" + message:@"Scroll through the list then let it settle on an item to select the backup." + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"ok" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [selectBackupAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; + + [selectBackupAlert addAction:ok]; + + [self presentViewController:selectBackupAlert animated:YES completion:nil]; + + } + else{ + + UIAlertController * packageBackupAlert= [UIAlertController + alertControllerWithTitle:@"Package Backup" + message:@"This will package the selected backup to a DEB file." + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* ok = [UIAlertAction + actionWithTitle:@"OK" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + + UIAlertController * packageBackupWait= [UIAlertController + alertControllerWithTitle:@"Backup DEB" + message:@"The backup is being created. Please Wait. This dialogue will will be dismissed when finished. The DEB can be found in [/User/Documents/FlashBackDEBs]" + preferredStyle:UIAlertControllerStyleAlert]; + + [packageBackupAlert dismissViewControllerAnimated:YES completion:nil]; + + [self presentViewController:packageBackupWait animated:YES completion:nil]; + + + NSTask *packageTask = [[NSTask alloc] init]; + [packageTask setLaunchPath:@"/bin/bash"]; + [packageTask setArguments:@[ @"FBPackage", backupNameSelected]]; + [packageTask launch]; + [packageTask waitUntilExit]; + + + [packageBackupWait dismissViewControllerAnimated:YES completion:nil]; + + }]; + UIAlertAction* cancel = [UIAlertAction + actionWithTitle:@"Cancel" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [packageBackupAlert dismissViewControllerAnimated:YES completion:nil]; + + }]; + + [packageBackupAlert addAction:cancel]; + [packageBackupAlert addAction:ok]; + + [self presentViewController:packageBackupAlert animated:YES completion:nil]; + } + } + + else{ + + UIAlertController * noBackupDEBAlert = [UIAlertController + alertControllerWithTitle:@"Creating DEBs is only available in the full version" + message:@"The free trial of FlashBack doesn't allow backing up setups to DEBs. Purchase the full version on PackIX for $1.50 for this!" + preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) { - [selectBackupAlert dismissViewControllerAnimated:YES completion:nil]; + [noBackupDEBAlert dismissViewControllerAnimated:YES completion:nil]; }]; - [selectBackupAlert addAction:ok]; + [noBackupDEBAlert addAction:ok]; - [self presentViewController:selectBackupAlert animated:YES completion:nil]; + [self presentViewController:noBackupDEBAlert animated:YES completion:nil]; } - else{ - - UIAlertController * packageBackupAlert= [UIAlertController - alertControllerWithTitle:@"Package Backup" - message:@"This will package the selected backup to a DEB file." - preferredStyle:UIAlertControllerStyleAlert]; - - UIAlertAction* ok = [UIAlertAction - actionWithTitle:@"OK" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - - UIAlertController * packageBackupWait= [UIAlertController - alertControllerWithTitle:@"Backup DEB" - message:@"The backup is being created. Please Wait. This dialogue will will be dismissed when finished. The DEB can be found in [/User/Documents/FlashBackDEBs]" - preferredStyle:UIAlertControllerStyleAlert]; - - [packageBackupAlert dismissViewControllerAnimated:YES completion:nil]; - - [self presentViewController:packageBackupWait animated:YES completion:nil]; - - - NSTask *packageTask = [[NSTask alloc] init]; - [packageTask setLaunchPath:@"/bin/bash"]; - [packageTask setArguments:@[ @"FBPackage", backupNameSelected]]; - [packageTask launch]; - [packageTask waitUntilExit]; - - - [packageBackupWait dismissViewControllerAnimated:YES completion:nil]; - - }]; - UIAlertAction* cancel = [UIAlertAction - actionWithTitle:@"Cancel" - style:UIAlertActionStyleDefault - handler:^(UIAlertAction * action) - { - [packageBackupAlert dismissViewControllerAnimated:YES completion:nil]; - - }]; - - [packageBackupAlert addAction:cancel]; - [packageBackupAlert addAction:ok]; - - [self presentViewController:packageBackupAlert animated:YES completion:nil]; - } } - (IBAction)helpMenu:(id)sender { @@ -376,7 +385,7 @@ int itFuckingCounts = 0; UIAlertController * infoAlert= [UIAlertController alertControllerWithTitle:@"Known issues" - message:@"\nScrolling through the picker view with no backups will crash the app.\n\nSometimes, wallpapers are incorrectly applied after restoring a backup\n\nFor bug reports, please contact me via Twitter or the email available in the next pop-up dialogue." + message:@"\nFor bug reports, please contact me via Twitter or the email available in the next pop-up dialogue.\n\nCredit for the DRM goes to @kushdabush on twitter" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okay = [UIAlertAction @@ -423,8 +432,6 @@ int itFuckingCounts = 0; } - - - (IBAction)deleteBackup:(id)sender { if (backupNameSelected == nil){ @@ -467,9 +474,9 @@ int itFuckingCounts = 0; [deleteTask waitUntilExit]; UIAlertController * deleteFinishedAlert= [UIAlertController - alertControllerWithTitle:@"Backup Deleted" - message:@"The backup has been deleted successfully" - preferredStyle:UIAlertControllerStyleAlert]; + alertControllerWithTitle:@"Backup Deleted" + message:@"The backup has been deleted successfully" + preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* okey = [UIAlertAction actionWithTitle:@"ok" @@ -515,24 +522,82 @@ int itFuckingCounts = 0; [super viewDidLoad]; // Do any additional setup after loading the view. + + selectedBackupPickerView.delegate=self; selectedBackupPickerView.dataSource=self; + // MARK: List of Backups is found and added to this array //_backupFolderArray = @[@"one",@"two",@"three"]; _backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/Library/FlashBack/Backups/" error:nil]; - NSLog(@"%d", itFuckingCounts); + + // MARK: DRM From @Kushdabush, commenting out for testing + //pulled from https://github.com/DomienF/kushy-drm/blob/master/Tweak.xm + /* + + UIAlertController * failedDRMAlert= [UIAlertController + alertControllerWithTitle:@"FlashBack appears to be pirated :(" + message:@"Please support small devs and purchase software. If you're unable to, please contact me, I'm happy to work things out! If you want to test it out, check out the trial version!" + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* failedDRMOk = [UIAlertAction + actionWithTitle:@"ok" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [failedDRMAlert dismissViewControllerAnimated:YES completion:nil]; + //exit(0); + }]; + + UIAlertController * trialNoticeAlert= [UIAlertController + alertControllerWithTitle:@"Trial Notice" + message:@"Thanks for checking out FlashBack! This trial allows you to give FlashBack a test run allowing for one backup. You can use that backup as a checkpoint to revert to after making changes." + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* trialOk = [UIAlertAction + actionWithTitle:@"ok" + style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) + { + [trialNoticeAlert dismissViewControllerAnimated:YES completion:nil]; + }]; + + [failedDRMAlert addAction:failedDRMOk]; + [trialNoticeAlert addAction:trialOk]; + + if ([[NSFileManager defaultManager] fileExistsAtPath:@"/var/lib/dpkg/info/com.mpg13.flashback.list"]){ + NSLog(@"FlashBack DRM Passed"); + trial = NO; + } + else{ + if ([[NSFileManager defaultManager] fileExistsAtPath:@"/var/lib/dpkg/info/com.mpg13.flashbackfree.list"]){ + NSLog(@"FlashBack Trial Mode"); + trial = YES; + dispatch_async(dispatch_get_main_queue(), ^ { + [self presentViewController:trialNoticeAlert animated:YES completion:nil]; + }); + } + else{ + NSLog(@"DRM failed"); + dispatch_async(dispatch_get_main_queue(), ^ { + [self presentViewController:failedDRMAlert animated:YES completion:nil]; + }); + } + } + */ + + trial = NO; } + -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{ - - //NEED TO FIGURE OUT HOW TO CHECK FOR EMPTY LIST if (_backupFolderArray == nil){ - + UIAlertController * emptyArrayAlert= [UIAlertController - alertControllerWithTitle:@"Let's start by making a backup!" - message:@"Press 'Create Backup' to get started!" - preferredStyle:UIAlertControllerStyleAlert]; + alertControllerWithTitle:@"Let's start by making a backup!" + message:@"Press 'Create Backup' to get started!" + preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction* ok = [UIAlertAction actionWithTitle:@"ok" @@ -546,33 +611,24 @@ int itFuckingCounts = 0; [emptyArrayAlert addAction:ok]; [self presentViewController:emptyArrayAlert animated:YES completion:nil]; - + } else{ - backupNameSelected = [_backupFolderArray objectAtIndex:row]; - selectedBackupText.text=backupNameSelected; - - selectedBackupURL = [NSMutableString stringWithString: @"/Library/FlashBack/Backups/"]; - [selectedBackupURL appendString: backupNameSelected]; - - selectedBackupImageURL=selectedBackupURL; - - [selectedBackupImageURL appendString: @"/SBFolder/LockBackgroundThumbnail.jpg"]; - //[selectedBackupImageURL appendString: @"/SBFolder/LockBackground.cpbitmap"]; - NSLog(@"%@", selectedBackupImageURL); - NSURL *url = [NSURL fileURLWithPath:selectedBackupImageURL]; - NSData *data = [NSData dataWithContentsOfURL:url]; - - /*NSData *homeData = [NSData dataWithContentsOfFile:selectedBackupImageURL]; - CFArrayRef homeArrayRef = CPBitmapCreateImagesFromData((__bridge CFDataRef)homeData, NULL, 1, NULL); - NSArray *homeArray = (__bridge NSArray*)homeArrayRef; - UIImage *homeWallpaper = [[UIImage alloc] initWithCGImage:(__bridge CGImageRef)(homeArray[0])];*/ + backupNameSelected = [_backupFolderArray objectAtIndex:row]; + selectedBackupText.text=backupNameSelected; - selectedBackupImage.image = [UIImage imageWithData:data]; - //selectedBackupImage.image = [UIImage imageWithContentsOfCPBitmapFile:selectedBackupImageURL flags:kNilOptions]; + selectedBackupURL = [NSMutableString stringWithString: @"/Library/FlashBack/Backups/"]; + [selectedBackupURL appendString: backupNameSelected]; - - NSLog(@"%@", backupNameSelected); + selectedBackupImageURL=selectedBackupURL; + + [selectedBackupImageURL appendString: @"/SBFolder/LockBackgroundThumbnail.jpg"]; + NSLog(@"%@", selectedBackupImageURL); + NSURL *url = [NSURL fileURLWithPath:selectedBackupImageURL]; + NSData *data = [NSData dataWithContentsOfURL:url]; + selectedBackupImage.image = [UIImage imageWithData:data]; + + NSLog(@"%@", backupNameSelected); } }