Skip to content

Commit 7aabcde

Browse files
committed
feat: Buat UI dan pengecekan accessibility permission ketika start task
1 parent 19cbe3b commit 7aabcde

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

lib/core/util/widget_helper.dart

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class WidgetHelper {
112112
text: '\n${'note'.tr()}',
113113
),
114114
TextSpan(
115-
text: ' ${'note_description_screen_recording_mac'.tr()}',
115+
text: ' ${'note_description_permission'.tr()}',
116116
),
117117
],
118118
),
@@ -135,4 +135,51 @@ class WidgetHelper {
135135
},
136136
);
137137
}
138+
139+
void showDialogPermissionAccessibility(BuildContext context) {
140+
showDialog(
141+
context: context,
142+
barrierDismissible: false,
143+
builder: (context) {
144+
return AlertDialog(
145+
title: Text(
146+
'title_accessibility_mac'.tr(),
147+
),
148+
content: Column(
149+
crossAxisAlignment: CrossAxisAlignment.start,
150+
mainAxisSize: MainAxisSize.min,
151+
children: [
152+
Text(
153+
'description_accessibility_mac'.tr(),
154+
),
155+
Text.rich(
156+
TextSpan(
157+
children: [
158+
TextSpan(
159+
text: '\n${'note'.tr()}',
160+
),
161+
TextSpan(
162+
text: ' ${'note_description_permission'.tr()}',
163+
),
164+
],
165+
),
166+
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
167+
fontStyle: FontStyle.italic,
168+
fontWeight: FontWeight.w500,
169+
),
170+
),
171+
],
172+
),
173+
actions: [
174+
TextButton(
175+
onPressed: () {
176+
Navigator.pop(context);
177+
},
178+
child: Text('ok'.tr()),
179+
),
180+
],
181+
);
182+
},
183+
);
184+
}
138185
}

lib/feature/presentation/page/home/home_page.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,14 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
595595
return;
596596
}
597597

598+
if (isPermissionScreenRecordingGranted!) {
599+
final isPermissionAccessibilityGranted = await platformChannelHelper.checkPermissionAccessibility();
600+
if (mounted && isPermissionAccessibilityGranted != null && !isPermissionAccessibilityGranted) {
601+
widgetHelper.showDialogPermissionAccessibility(context);
602+
return;
603+
}
604+
}
605+
598606
if (selectedTask != itemTask) {
599607
if (selectedTask != null) {
600608
selectedTask!.trackedInSeconds = valueNotifierTotalTracked.value;

0 commit comments

Comments
 (0)