feat: 实现日历提醒 in-app fallback 机制及通知服务重构
This commit is contained in:
@@ -1,17 +1,23 @@
|
||||
enum ReminderAction {
|
||||
cancel('cancel'),
|
||||
snooze10m('snooze_10m'),
|
||||
timeout30s('timeout_30s'),
|
||||
autoArchive('auto_archive');
|
||||
archive('archive'),
|
||||
snooze10m('snooze10m');
|
||||
|
||||
const ReminderAction(this.value);
|
||||
|
||||
final String value;
|
||||
|
||||
static ReminderAction fromValue(String raw) {
|
||||
return ReminderAction.values.firstWhere(
|
||||
(item) => item.value == raw,
|
||||
orElse: () => ReminderAction.timeout30s,
|
||||
);
|
||||
switch (raw) {
|
||||
case 'archive':
|
||||
case 'cancel':
|
||||
case 'auto_archive':
|
||||
return ReminderAction.archive;
|
||||
case 'snooze10m':
|
||||
case 'snooze_10m':
|
||||
case 'timeout_30s':
|
||||
return ReminderAction.snooze10m;
|
||||
default:
|
||||
throw ArgumentError.value(raw, 'raw', 'Unsupported reminder action');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user