-
Notifications
You must be signed in to change notification settings - Fork 106
Open
Labels
Description
Taken from review discussions in #1232.
Current implementation uses a generic and complex action sheet handler, which compares localized strings to determine the action to take. Alternative solution is to create a set of the actions:
UIAlertAction *action1 = [UIAlertAction ... handler:^{ [self do_this] }];
UIAlertAction *action2 = [UIAlertAction ... handler:^{ [self do_that] }];
In this case I would need to move the logic of what I am finally showing in the action sheet (currently a simple array of action strings which is majorly defined in AppDelegate) to the place where I am building the sheet. And ideally replacing the string in AppDelegate with enums. Something like this:
AppDelegate:
menu.sheetActions = @[
action_play,
action_queue,
];
ViewController:
UIAlertAction *action1 = [UIAlertAction ... handler:^{ [self play] }];
UIAlertAction *action2 = [UIAlertAction ... handler:^{ [self queue] }];
for (actionID in sheetActions) |
switch (actionID) {
case action_play:
[alertCtrl addAction: action1];
break;
case action_queue:
[alertCtrl addAction: action2];
break;
default:
break;
}
}
Reactions are currently unavailable