import 'package:flutter/material.dart'; import '../api/oa_client.dart'; import '../pages/approvals_page.dart'; import '../pages/record_detail_page.dart'; import '../pages/todos_page.dart'; import '../pages/work_assign_page.dart'; import '../session/session.dart'; import 'biz_route.dart'; /// Opens a system notification at its business destination. System notices are /// workflow entries, never an IM peer conversation. void openNoticeTarget( BuildContext context, OaClient api, { required SessionStore session, required String kind, required String bizType, required String bizId, String title = '系统通知', }) { if (bizType == 'WORK_ASSIGN') { Navigator.of(context).push(MaterialPageRoute( builder: (_) => WorkAssignPage(session: session, api: api), )); return; } final seed = { 'bizType': bizType, 'bizId': bizId, 'id': bizId, 'title': title, }; if (bizId.isNotEmpty && fetchPathOf(seed) != null) { openRecord(context, api, seed, title: title); return; } if (kind == 'approval' || bizType.contains('APPROVAL')) { Navigator.of(context) .push(MaterialPageRoute(builder: (_) => ApprovalsPage(api: api))); return; } Navigator.of(context) .push(MaterialPageRoute(builder: (_) => TodosPage(api: api))); }