Dialogs

MesiboDialogs shows the same alerts and bottom sheets as the messaging UI. The app can use it for its own dialogs, so that they look the same. MesiboDialogs.Options (MesiboDialogOptions on iOS) sets the content:

OptionDescription
title, messageThe title and the text
positiveLabel, onPositiveThe positive button and its handler. No label: common.okTitle
negativeLabel, onNegativeThe negative button and its handler. No label: no negative button
destructiveThe positive button in red
sheetA bottom sheet instead of a centered dialog
items, onSelectA list of choices instead of a message. onSelect gets the index of the tapped item
destructiveItemsThe indexes of items shown in red
MesiboDialogs.Options o = new MesiboDialogs.Options();
o.title = "Delete chats?";
o.positiveLabel = "Delete";
o.negativeLabel = MesiboUI.getConfig().common.cancelTitle;
o.destructive = true;
o.onPositive = () -> deleteChats();
MesiboDialogs.show(context, o);

MesiboDialogs.alert(context, "Signed Out", "Login again to continue.");
val o = MesiboDialogs.Options()
o.title = "Delete chats?"
o.positiveLabel = "Delete"
o.negativeLabel = MesiboUI.getConfig().common.cancelTitle
o.destructive = true
o.onPositive = Runnable { deleteChats() }
MesiboDialogs.show(context, o)

MesiboDialogs.alert(context, "Signed Out", "Login again to continue.")
let o = MesiboDialogOptions()
o.title = "Delete chats?"
o.positiveLabel = "Delete"
o.negativeLabel = MesiboUI.getConfig().common.cancelTitle
o.destructive = true
o.onPositive = { self.deleteChats() }
MesiboDialogs.show(self, options: o)

MesiboDialogs.alert(self, title: "Signed Out", message: "Login again to continue.")
MesiboDialogOptions *o = [MesiboDialogOptions new];
o.title = @"Delete chats?";
o.positiveLabel = @"Delete";
o.negativeLabel = [MesiboUI getConfig].common.cancelTitle;
o.destructive = YES;
o.onPositive = ^{ [self deleteChats]; };
[MesiboDialogs show:self options:o];

[MesiboDialogs alert:self title:@"Signed Out" message:@"Login again to continue."];