Toasts and alerts
// Permission ui.toast — fire-and-forget, returns void
sdk.showToast({ title: 'Đã lưu', description: 'Optional second line', action: 'success' })
// action: 'success' | 'warning' | 'error' | 'info' (default 'info'); an empty title is not shown
// No permission — resolves with the id of the tapped button
const choice = await sdk.showAlert({
title: 'Xoá bản nháp?',
message: 'Không thể hoàn tác.',
buttons: [
{ id: 'cancel', text: 'Huỷ' },
{ id: 'delete', text: 'Xoá' },
],
})
if (choice === 'delete') {
/* … */
}
- Omit
buttonsfor a single OK button, which resolves'ok'. - If you pass
buttons, it must be non-empty. An empty list would show an alert nobody can dismiss. Android shows at most 3 buttons.