Skip to content

Commit

Permalink
Change UIAlertController to YTAlertView
Browse files Browse the repository at this point in the history
  • Loading branch information
dayanch96 committed Mar 29, 2024
1 parent 9deb285 commit 315cfac
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions Source/Prefs/YTMDownloads.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,6 @@ - (void)renameFileForIndexPath:(NSIndexPath *)indexPath {
NSURL *audioURL = [documentsURL URLByAppendingPathComponent:[NSString stringWithFormat:@"YTMusicUltimate/%@", self.audioFiles[indexPath.row]]];
NSURL *coverURL = [documentsURL URLByAppendingPathComponent:[NSString stringWithFormat:@"YTMusicUltimate/%@.png", [self.audioFiles[indexPath.row] stringByDeletingPathExtension]]];

// UITextField *textField = [[UITextField alloc] init];
// textField.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
// textField.clearButtonMode = UITextFieldViewModeWhileEditing;
// textField.borderStyle = UITextBorderStyleRoundedRect;
// textField.text = [self.audioFiles[indexPath.row] stringByDeletingPathExtension];
// textField.placeholder = [self.audioFiles[indexPath.row] stringByDeletingPathExtension];

UITextView *textView = [[UITextView alloc] init];
textView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.15];
textView.layer.cornerRadius = 3.0;
Expand Down Expand Up @@ -375,14 +368,7 @@ - (void)removeAll {
NSURL *documentsURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *audiosFolder = [documentsURL URLByAppendingPathComponent:@"YTMusicUltimate"];

UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:[NSString stringWithFormat:LOC(@"DELETE_MESSAGE"), LOC(@"ALL_DOWNLOADS")]
preferredStyle:UIAlertControllerStyleAlert];

[alert addAction:[UIAlertAction actionWithTitle:LOC(@"CANCEL") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
}]];

[alert addAction:[UIAlertAction actionWithTitle:LOC(@"DELETE") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
YTAlertView *alertView = [NSClassFromString(@"YTAlertView") confirmationDialogWithAction:^{
BOOL audiosRemoved = [[NSFileManager defaultManager] removeItemAtURL:audiosFolder error:nil];

if (audiosRemoved) {
Expand All @@ -393,9 +379,11 @@ - (void)removeAll {
[self.tableView reloadData];
});
}
}]];

[self presentViewController:alert animated:YES completion:nil];
}
actionTitle:LOC(@"DELETE")];
alertView.title = @"YTMusicUltimate";
alertView.subtitle = [NSString stringWithFormat:LOC(@"DELETE_MESSAGE"), LOC(@"ALL_DOWNLOADS")];
[alertView show];
}

@end

0 comments on commit 315cfac

Please sign in to comment.