Merge branch 'master' of https://github.com/MPG13/FlashBack
This commit is contained in:
commit
3a0f9ed6d7
4 changed files with 304 additions and 291 deletions
|
@ -7,7 +7,7 @@
|
||||||
<key>FlashBack.xcscheme_^#shared#^_</key>
|
<key>FlashBack.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>1</integer>
|
<integer>0</integer>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
Binary file not shown.
|
@ -26,286 +26,299 @@ NSString *backupNameSelected;
|
||||||
@implementation ViewController
|
@implementation ViewController
|
||||||
|
|
||||||
- (void)createBackup:(id)sender {
|
- (void)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];
|
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) {
|
[createBackupAlert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
|
||||||
textField.placeholder = @"Backup Name";
|
textField.placeholder = @"Backup Name";
|
||||||
textField.secureTextEntry = NO;
|
textField.secureTextEntry = NO;
|
||||||
}];
|
}];
|
||||||
UIAlertAction *confirmAction = [UIAlertAction okActionWithHandler:^(UIAlertAction * _Nonnull action) {
|
UIAlertAction *confirmAction = [UIAlertAction okActionWithHandler:^(UIAlertAction * _Nonnull action) {
|
||||||
NSLog(@"Backup name is :%@", [[createBackupAlert textFields][0] text]);
|
NSLog(@"Backup name is :%@", [[createBackupAlert textFields][0] text]);
|
||||||
NSString *newBackupName=[[createBackupAlert textFields][0] text];
|
NSString *newBackupName=[[createBackupAlert textFields][0] text];
|
||||||
|
|
||||||
if([[[createBackupAlert textFields][0] text] isEqual:@""]){
|
if([[[createBackupAlert textFields][0] text] isEqual:@""]){
|
||||||
NSLog(@"Empty backup name!");
|
NSLog(@"Empty backup name!");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
NSLog(@"Backup name is good!");
|
NSLog(@"Backup name is good!");
|
||||||
|
|
||||||
NSLog(@"Running NSTask");
|
NSLog(@"Running NSTask");
|
||||||
|
|
||||||
NSTask *createTask = [[NSTask alloc] init];
|
NSTask *createTask = [[NSTask alloc] init];
|
||||||
[createTask setLaunchPath:@"/bin/bash"];
|
[createTask setLaunchPath:@"/bin/bash"];
|
||||||
[createTask setArguments:@[ @"FBCreate", newBackupName, stringTweaksEnabled, stringIconsEnabled, stringWallpaperEnabled]];
|
[createTask setArguments:@[ @"FBCreate", newBackupName, stringTweaksEnabled, stringIconsEnabled, stringWallpaperEnabled]];
|
||||||
[createTask launch];
|
[createTask launch];
|
||||||
[createTask waitUntilExit];
|
[createTask waitUntilExit];
|
||||||
|
|
||||||
UIAlertController * finishedCreateAlert= [UIAlertController
|
UIAlertController * finishedCreateAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Backup Creation Completed"
|
alertControllerWithTitle:@"Backup Creation Completed"
|
||||||
message:@"The backup has been successfully created!"
|
message:@"The backup has been successfully created!"
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
_backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/FlashBack/Backups/" error:nil];
|
_backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/FlashBack/Backups/" error:nil];
|
||||||
[self->selectedBackupPickerView reloadAllComponents];
|
[self->selectedBackupPickerView reloadAllComponents];
|
||||||
|
|
||||||
[finishedCreateAlert dismissViewControllerAnimated:YES completion:nil];
|
[finishedCreateAlert dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
}];
|
}];
|
||||||
[finishedCreateAlert addAction:ok];
|
[finishedCreateAlert addAction:ok];
|
||||||
|
|
||||||
[self presentViewController:finishedCreateAlert animated:YES completion:nil];
|
[self presentViewController:finishedCreateAlert animated:YES completion:nil];
|
||||||
|
|
||||||
/*pid_t pid;
|
/*pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
const char* args[] = {"killall", "backboardd", NULL, NULL};
|
const char* args[] = {"killall", "backboardd", NULL, NULL};
|
||||||
posix_spawn(&pid, "/bin/bash", NULL, NULL, (char* const*)args, NULL);
|
posix_spawn(&pid, "/bin/bash", NULL, NULL, (char* const*)args, NULL);
|
||||||
waitpid(pid, &status, WEXITED);*/
|
waitpid(pid, &status, WEXITED);*/
|
||||||
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
[createBackupAlert addAction:confirmAction];
|
[createBackupAlert addAction:confirmAction];
|
||||||
[createBackupAlert addAction:[UIAlertAction cancelAction]];
|
[createBackupAlert addAction:[UIAlertAction cancelAction]];
|
||||||
[self presentViewController:createBackupAlert animated:YES completion:nil];
|
[self presentViewController:createBackupAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)restoreBackup:(id)sender {
|
- (IBAction)restoreBackup:(id)sender {
|
||||||
|
|
||||||
if (backupNameSelected == nil){
|
if (backupNameSelected == nil){
|
||||||
|
|
||||||
UIAlertController * selectBackupAlert= [UIAlertController
|
UIAlertController * selectBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Select a Backup!"
|
alertControllerWithTitle:@"Select a Backup!"
|
||||||
message:@"Scroll through the list then let it settle on an item to select the backup."
|
message:@"Scroll through the list then let it settle on an item to select the backup."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
[selectBackupAlert addAction:[UIAlertAction okAction]];
|
[selectBackupAlert addAction:[UIAlertAction okAction]];
|
||||||
|
|
||||||
[self presentViewController:selectBackupAlert animated:YES completion:nil];
|
[self presentViewController:selectBackupAlert animated:YES completion:nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
UIAlertController * restoreBackupAlert= [UIAlertController
|
UIAlertController * restoreBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Restore Backup"
|
alertControllerWithTitle:@"Restore Backup"
|
||||||
message:@"Your device will revert to the selected backup! Please wait for your device to respring."
|
message:@"Your device will revert to the selected backup! Please wait for your device to respring."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
//RUN RESTORE SCRIPT
|
//RUN RESTORE SCRIPT
|
||||||
|
|
||||||
NSTask *restoreTask = [[NSTask alloc] init];
|
NSTask *restoreTask = [[NSTask alloc] init];
|
||||||
[restoreTask setLaunchPath:@"/bin/bash"];
|
[restoreTask setLaunchPath:@"/bin/bash"];
|
||||||
[restoreTask setArguments:@[ @"FBRestore", backupNameSelected, stringTweaksEnabled, stringIconsEnabled, stringWallpaperEnabled]];
|
[restoreTask setArguments:@[ @"FBRestore", backupNameSelected, stringTweaksEnabled, stringIconsEnabled, stringWallpaperEnabled]];
|
||||||
[restoreTask launch];
|
[restoreTask launch];
|
||||||
|
[restoreTask waitUntilExit];
|
||||||
UIAlertController * finishedRestoreAlert= [UIAlertController
|
|
||||||
alertControllerWithTitle:@"Restoring from backup"
|
NSTask *killPrefsTask = [[NSTask alloc] init];
|
||||||
message:@"Your device will respring when the process is completed."
|
[killPrefsTask setLaunchPath:@"/bin/bash"];
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
[killPrefsTask setArguments:@[ @"killall", @"cfprefsd"]];
|
||||||
[self presentViewController:finishedRestoreAlert animated:YES completion:nil];
|
[killPrefsTask launch];
|
||||||
|
[killPrefsTask waitUntilExit];
|
||||||
[restoreBackupAlert dismissViewControllerAnimated:YES completion:nil];
|
|
||||||
|
NSTask *respringTask = [[NSTask alloc] init];
|
||||||
}];
|
[respringTask setLaunchPath:@"/bin/bash"];
|
||||||
|
[respringTask setArguments:@[ @"sbreload"]];
|
||||||
[restoreBackupAlert addAction:ok];
|
[respringTask launch];
|
||||||
[restoreBackupAlert addAction:[UIAlertAction cancelAction]];
|
[respringTask waitUntilExit];
|
||||||
|
|
||||||
[self presentViewController:restoreBackupAlert animated:YES completion:nil];
|
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:ok];
|
||||||
|
[restoreBackupAlert addAction:[UIAlertAction cancelAction]];
|
||||||
|
|
||||||
|
[self presentViewController:restoreBackupAlert animated:YES completion:nil];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)updateBackup:(id)sender {
|
- (IBAction)updateBackup:(id)sender {
|
||||||
|
|
||||||
if (backupNameSelected == nil){
|
if (backupNameSelected == nil){
|
||||||
|
|
||||||
UIAlertController * updateBackupAlert= [UIAlertController
|
UIAlertController * updateBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Select a Backup!"
|
alertControllerWithTitle:@"Select a Backup!"
|
||||||
message:@"Scroll through the list then let it settle on an item to select the backup."
|
message:@"Scroll through the list then let it settle on an item to select the backup."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
[updateBackupAlert addAction:[UIAlertAction okAction]];
|
[updateBackupAlert addAction:[UIAlertAction okAction]];
|
||||||
|
|
||||||
[self presentViewController:updateBackupAlert animated:YES completion:nil];
|
[self presentViewController:updateBackupAlert animated:YES completion:nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
UIAlertController * updateBackupAlert= [UIAlertController
|
UIAlertController * updateBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Update Backup"
|
alertControllerWithTitle:@"Update Backup"
|
||||||
message:@"The selected backup will be overwritten! Please wait until the completion pop-up appears"
|
message:@"The selected backup will be overwritten! Please wait until the completion pop-up appears"
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[updateBackupAlert dismissViewControllerAnimated:YES completion:nil];
|
[updateBackupAlert dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
NSTask *deleteTask = [[NSTask alloc] init];
|
NSTask *deleteTask = [[NSTask alloc] init];
|
||||||
[deleteTask setLaunchPath:@"/bin/bash"];
|
[deleteTask setLaunchPath:@"/bin/bash"];
|
||||||
[deleteTask setArguments:@[ @"FBDelete", backupNameSelected]];
|
[deleteTask setArguments:@[ @"FBDelete", backupNameSelected]];
|
||||||
[deleteTask launch];
|
[deleteTask launch];
|
||||||
[deleteTask waitUntilExit];
|
[deleteTask waitUntilExit];
|
||||||
|
|
||||||
NSTask *createTask = [[NSTask alloc] init];
|
NSTask *createTask = [[NSTask alloc] init];
|
||||||
[createTask setLaunchPath:@"/bin/bash"];
|
[createTask setLaunchPath:@"/bin/bash"];
|
||||||
[createTask setArguments:@[ @"FBCreate", backupNameSelected, stringTweaksEnabled, stringIconsEnabled, stringWallpaperEnabled]];
|
[createTask setArguments:@[ @"FBCreate", backupNameSelected, stringTweaksEnabled, stringIconsEnabled, stringWallpaperEnabled]];
|
||||||
[createTask launch];
|
[createTask launch];
|
||||||
[createTask waitUntilExit];
|
[createTask waitUntilExit];
|
||||||
|
|
||||||
UIAlertController * finishedUpdateAlert= [UIAlertController
|
UIAlertController * finishedUpdateAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Backup Update Completed"
|
alertControllerWithTitle:@"Backup Update Completed"
|
||||||
message:@"The backup has been successfully updated!"
|
message:@"The backup has been successfully updated!"
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
_backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/FlashBack/Backups/" error:nil];
|
_backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/FlashBack/Backups/" error:nil];
|
||||||
[self->selectedBackupPickerView reloadAllComponents];
|
[self->selectedBackupPickerView reloadAllComponents];
|
||||||
}];
|
}];
|
||||||
[finishedUpdateAlert addAction:ok];
|
[finishedUpdateAlert addAction:ok];
|
||||||
|
|
||||||
[self presentViewController:finishedUpdateAlert animated:YES completion:nil];
|
[self presentViewController:finishedUpdateAlert animated:YES completion:nil];
|
||||||
|
|
||||||
|
|
||||||
}];
|
}];
|
||||||
UIAlertAction* cancel = [UIAlertAction cancelAction];
|
UIAlertAction* cancel = [UIAlertAction cancelAction];
|
||||||
|
|
||||||
[updateBackupAlert addAction:cancel];
|
[updateBackupAlert addAction:cancel];
|
||||||
[updateBackupAlert addAction:ok];
|
[updateBackupAlert addAction:ok];
|
||||||
|
|
||||||
[self presentViewController:updateBackupAlert animated:YES completion:nil];
|
[self presentViewController:updateBackupAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)packageBackup:(id)sender {
|
- (IBAction)packageBackup:(id)sender {
|
||||||
|
|
||||||
if (backupNameSelected == nil){
|
if (backupNameSelected == nil){
|
||||||
|
|
||||||
UIAlertController * selectBackupAlert= [UIAlertController
|
UIAlertController * selectBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Select a Backup!"
|
alertControllerWithTitle:@"Select a Backup!"
|
||||||
message:@"Scroll through the list then let it settle on an item to select the backup."
|
message:@"Scroll through the list then let it settle on an item to select the backup."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
[selectBackupAlert addAction:[UIAlertAction okAction]];
|
[selectBackupAlert addAction:[UIAlertAction okAction]];
|
||||||
|
|
||||||
[self presentViewController:selectBackupAlert animated:YES completion:nil];
|
[self presentViewController:selectBackupAlert animated:YES completion:nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
UIAlertController * packageBackupAlert= [UIAlertController
|
UIAlertController * packageBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Package Backup"
|
alertControllerWithTitle:@"Package Backup"
|
||||||
message:@"This will package the selected backup to a .deb file."
|
message:@"This will package the selected backup to a .deb file."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
UIAlertController * packageBackupWait= [UIAlertController
|
UIAlertController * packageBackupWait= [UIAlertController
|
||||||
alertControllerWithTitle:@"Backup DEB"
|
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]"
|
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];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
[packageBackupAlert dismissViewControllerAnimated:YES completion:nil];
|
[packageBackupAlert dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
[self presentViewController:packageBackupWait animated:YES completion:nil];
|
[self presentViewController:packageBackupWait animated:YES completion:nil];
|
||||||
|
|
||||||
|
|
||||||
NSTask *packageTask = [[NSTask alloc] init];
|
NSTask *packageTask = [[NSTask alloc] init];
|
||||||
[packageTask setLaunchPath:@"/bin/bash"];
|
[packageTask setLaunchPath:@"/bin/bash"];
|
||||||
[packageTask setArguments:@[ @"FBPackage", backupNameSelected]];
|
[packageTask setArguments:@[ @"FBPackage", backupNameSelected]];
|
||||||
[packageTask launch];
|
[packageTask launch];
|
||||||
[packageTask waitUntilExit];
|
[packageTask waitUntilExit];
|
||||||
|
|
||||||
|
|
||||||
[packageBackupWait dismissViewControllerAnimated:YES completion:nil];
|
[packageBackupWait dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
}];
|
}];
|
||||||
UIAlertAction* cancel = [UIAlertAction cancelAction];
|
UIAlertAction* cancel = [UIAlertAction cancelAction];
|
||||||
|
|
||||||
[packageBackupAlert addAction:cancel];
|
[packageBackupAlert addAction:cancel];
|
||||||
[packageBackupAlert addAction:ok];
|
[packageBackupAlert addAction:ok];
|
||||||
|
|
||||||
[self presentViewController:packageBackupAlert animated:YES completion:nil];
|
[self presentViewController:packageBackupAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)deleteBackup:(id)sender {
|
- (IBAction)deleteBackup:(id)sender {
|
||||||
|
|
||||||
if (backupNameSelected == nil){
|
if (backupNameSelected == nil){
|
||||||
|
|
||||||
UIAlertController * selectBackupAlert= [UIAlertController
|
UIAlertController * selectBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Select a Backup!"
|
alertControllerWithTitle:@"Select a Backup!"
|
||||||
message:@"Scroll through the list then let it settle on an item to select the backup."
|
message:@"Scroll through the list then let it settle on an item to select the backup."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
[selectBackupAlert addAction:[UIAlertAction okAction]];
|
[selectBackupAlert addAction:[UIAlertAction okAction]];
|
||||||
|
|
||||||
[self presentViewController:selectBackupAlert animated:YES completion:nil];
|
[self presentViewController:selectBackupAlert animated:YES completion:nil];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UIAlertController * deleteBackupAlert= [UIAlertController
|
UIAlertController * deleteBackupAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Delete Backup"
|
alertControllerWithTitle:@"Delete Backup"
|
||||||
message:@"The selected backup will be deleted!"
|
message:@"The selected backup will be deleted!"
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* ok = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
NSTask *deleteTask = [[NSTask alloc] init];
|
NSTask *deleteTask = [[NSTask alloc] init];
|
||||||
[deleteTask setLaunchPath:@"/bin/bash"];
|
[deleteTask setLaunchPath:@"/bin/bash"];
|
||||||
[deleteTask setArguments:@[ @"FBDelete", backupNameSelected]];
|
[deleteTask setArguments:@[ @"FBDelete", backupNameSelected]];
|
||||||
[deleteTask launch];
|
[deleteTask launch];
|
||||||
[deleteTask waitUntilExit];
|
[deleteTask waitUntilExit];
|
||||||
|
|
||||||
UIAlertController * deleteFinishedAlert= [UIAlertController
|
UIAlertController * deleteFinishedAlert= [UIAlertController
|
||||||
alertControllerWithTitle:@"Backup Deleted"
|
alertControllerWithTitle:@"Backup Deleted"
|
||||||
message:@"The backup has been deleted successfully."
|
message:@"The backup has been deleted successfully."
|
||||||
preferredStyle:UIAlertControllerStyleAlert];
|
preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
UIAlertAction* okey = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
UIAlertAction* okey = [UIAlertAction okActionWithHandler:^(UIAlertAction * action)
|
||||||
{
|
{
|
||||||
|
|
||||||
_backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/FlashBack/Backups/" error:nil];
|
_backupFolderArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@"/var/mobile/Library/FlashBack/Backups/" error:nil];
|
||||||
[self->selectedBackupPickerView reloadAllComponents];
|
[self->selectedBackupPickerView reloadAllComponents];
|
||||||
|
|
||||||
[deleteFinishedAlert dismissViewControllerAnimated:YES completion:nil];
|
[deleteFinishedAlert dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[deleteFinishedAlert addAction:okey];
|
[deleteFinishedAlert addAction:okey];
|
||||||
|
|
||||||
[self presentViewController:deleteFinishedAlert animated:YES completion:nil];
|
[self presentViewController:deleteFinishedAlert animated:YES completion:nil];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[deleteBackupAlert addAction:ok];
|
[deleteBackupAlert addAction:ok];
|
||||||
[deleteBackupAlert addAction:[UIAlertAction cancelAction]];
|
[deleteBackupAlert addAction:[UIAlertAction cancelAction]];
|
||||||
|
|
||||||
[self presentViewController:deleteBackupAlert animated:YES completion:nil];
|
[self presentViewController:deleteBackupAlert animated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (UIStatusBarStyle)preferredStatusBarStyle {
|
- (UIStatusBarStyle)preferredStatusBarStyle {
|
||||||
|
|
||||||
return UIStatusBarStyleLightContent;
|
return UIStatusBarStyleLightContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)viewDidLoad {
|
- (void)viewDidLoad {
|
||||||
|
@ -340,43 +353,43 @@ NSString *backupNameSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidLayoutSubviews {
|
- (void)viewDidLayoutSubviews {
|
||||||
[super viewDidLayoutSubviews];
|
[super viewDidLayoutSubviews];
|
||||||
|
|
||||||
[[selectedBackupPickerView.subviews objectAtIndex:1] setBackgroundColor:[UIColor colorWithWhite:25.f/225.f alpha:0.5]];
|
[[selectedBackupPickerView.subviews objectAtIndex:1] setBackgroundColor:[UIColor colorWithWhite:25.f/225.f alpha:0.5]];
|
||||||
[[selectedBackupPickerView.subviews objectAtIndex:2] setBackgroundColor:[UIColor colorWithWhite:25.f/225.f alpha:0.5]];
|
[[selectedBackupPickerView.subviews objectAtIndex:2] setBackgroundColor:[UIColor colorWithWhite:25.f/225.f alpha:0.5]];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
|
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
|
||||||
if (_backupFolderArray == nil) return;
|
if (_backupFolderArray == nil) return;
|
||||||
|
|
||||||
backupNameSelected = [_backupFolderArray objectAtIndex:row];
|
backupNameSelected = [_backupFolderArray objectAtIndex:row];
|
||||||
selectedBackupText.text=backupNameSelected;
|
selectedBackupText.text=backupNameSelected;
|
||||||
|
|
||||||
selectedBackupURL = [NSMutableString stringWithString: @"/var/mobile/Library/FlashBack/Backups/"];
|
selectedBackupURL = [NSMutableString stringWithString: @"/var/mobile/Library/FlashBack/Backups/"];
|
||||||
[selectedBackupURL appendString: backupNameSelected];
|
[selectedBackupURL appendString: backupNameSelected];
|
||||||
|
|
||||||
selectedBackupImageURL=selectedBackupURL;
|
selectedBackupImageURL=selectedBackupURL;
|
||||||
|
|
||||||
[selectedBackupImageURL appendString: @"/SBFolder/LockBackgroundThumbnail.jpg"];
|
[selectedBackupImageURL appendString: @"/SBFolder/LockBackgroundThumbnail.jpg"];
|
||||||
NSLog(@"%@", selectedBackupImageURL);
|
NSLog(@"%@", selectedBackupImageURL);
|
||||||
NSURL *url = [NSURL fileURLWithPath:selectedBackupImageURL];
|
NSURL *url = [NSURL fileURLWithPath:selectedBackupImageURL];
|
||||||
NSData *data = [NSData dataWithContentsOfURL:url];
|
NSData *data = [NSData dataWithContentsOfURL:url];
|
||||||
selectedBackupImage.image = [UIImage imageWithData:data];
|
selectedBackupImage.image = [UIImage imageWithData:data];
|
||||||
|
|
||||||
NSLog(@"%@", backupNameSelected);
|
NSLog(@"%@", backupNameSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
|
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
|
||||||
return _backupFolderArray.count;
|
return _backupFolderArray.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
|
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
|
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
|
||||||
NSString *name = _backupFolderArray[row];
|
NSString *name = _backupFolderArray[row];
|
||||||
return [[NSAttributedString alloc] initWithString:name attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
|
return [[NSAttributedString alloc] initWithString:name attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<key>Pods-FlashBack.xcscheme_^#shared#^_</key>
|
<key>Pods-FlashBack.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>orderHint</key>
|
<key>orderHint</key>
|
||||||
<integer>0</integer>
|
<integer>1</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>SDWebImage.xcscheme_^#shared#^_</key>
|
<key>SDWebImage.xcscheme_^#shared#^_</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
|
Reference in a new issue