Skip to content

Commit d53b0cd

Browse files
committed
docs: Update documentation
1 parent b689f2c commit d53b0cd

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

documentation/models_documentation.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ The level of detail displayed in notifications on the lock screen.
104104
| `VISIBILITY_SECRET` | Do not reveal any part of this notification on a secure lockscreen. |
105105
| `VISIBILITY_PRIVATE` | Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. |
106106

107+
### :chicken: NotificationPermission
108+
109+
enum class: Represents the result of a notification permission request.
110+
111+
| value | Description |
112+
|----------------------|------------------------------------------------------|
113+
| `granted` | Notification permission has been granted. |
114+
| `denied` | Notification permission has been denied. |
115+
| `permanently_denied` | Notification permission has been permanently denied. |
116+
107117
### :chicken: ServiceRequestResult
108118

109119
sealed class: Represents the result of a service request.
@@ -113,6 +123,13 @@ sealed class: Represents the result of a service request.
113123
| `ServiceRequestSuccess()` | The service request was successful. |
114124
| `ServiceRequestFailure(Object error)` | The service request failed. |
115125

126+
| error | Description |
127+
|----------------------------------|----------------------------------------------------------------------------------------------------------------|
128+
| `ServiceAlreadyStartedException` | The service has already started. |
129+
| `ServiceNotInitializedException` | Not initialized. Please call this function after calling the init function. |
130+
| `ServiceNotStartedException` | The service is not started. |
131+
| `ServiceTimeoutException` | The service request timed out. (ref: https://developer.android.com/guide/components/services#StartingAService) |
132+
116133
### :chicken: TaskStarter
117134

118135
The starter that started the task.

documentation/utility_documentation.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ Launch the app at `route` if it is not running otherwise open it.
1818
It is also possible to pass a route to this function but the route will only
1919
be loaded if the app is not already running.
2020

21+
This function requires the `android.permission.SYSTEM_ALERT_WINDOW` permission and
22+
requires using the `openSystemAlertWindowSettings()` function to grant the permission.
23+
2124
```dart
25+
void requestPermission() async {
26+
if (!await FlutterForegroundTask.canDrawOverlays) {
27+
await FlutterForegroundTask.openSystemAlertWindowSettings();
28+
}
29+
}
30+
2231
void function() => FlutterForegroundTask.launchApp([route]);
2332
```
2433

@@ -72,7 +81,7 @@ Future<bool> function() => FlutterForegroundTask.openIgnoreBatteryOptimizationSe
7281

7382
Request to ignore battery optimization.
7483

75-
This function requires `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission.
84+
This function requires the `android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` permission.
7685

7786
> **Warning**
7887
> It only works when the app is in the foreground.

lib/flutter_foreground_task.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,12 @@ class FlutterForegroundTask {
353353
static void minimizeApp() => _platform.minimizeApp();
354354

355355
/// Launch the app at [route] if it is not running otherwise open it.
356+
///
357+
/// It is also possible to pass a route to this function but the route will only
358+
/// be loaded if the app is not already running.
359+
///
360+
/// This function requires the "android.permission.SYSTEM\_ALERT\_WINDOW" permission and
361+
/// requires using the `openSystemAlertWindowSettings()` function to grant the permission.
356362
static void launchApp([String? route]) => _platform.launchApp(route);
357363

358364
/// Toggles lockScreen visibility.
@@ -375,7 +381,7 @@ class FlutterForegroundTask {
375381

376382
/// Request to ignore battery optimization.
377383
///
378-
/// This function requires "android.permission.REQUEST\_IGNORE\_BATTERY\_OPTIMIZATIONS" permission.
384+
/// This function requires the "android.permission.REQUEST\_IGNORE\_BATTERY\_OPTIMIZATIONS" permission.
379385
static Future<bool> requestIgnoreBatteryOptimization() =>
380386
_platform.requestIgnoreBatteryOptimization();
381387

lib/models/notification_permission.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
/// Represents the result of a notification permission request.
12
enum NotificationPermission {
3+
/// Notification permission has been granted.
24
granted,
5+
6+
/// Notification permission has been denied.
37
denied,
8+
9+
/// Notification permission has been permanently denied.
410
permanently_denied;
511

612
static NotificationPermission fromIndex(int? index) => NotificationPermission

0 commit comments

Comments
 (0)