Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: initialize in the top widget Moved some initialization processes from `BootState` notifier to the `_init` method in `Aria` widget. Also moved the initialization of `RustLib` into the method. This may shorten the startup duration. * refactor: decide whether to redirect in notifier * refactor: add nameOrUsername getter * feat: show better message for DioException If network request failed, show the error response with `ErrorMessage` widget. * feat: add SwRegisterDialog The `sw/register` endpoint of Misskey is marked `secure` and cannot be accessed using an access token issued with MiAuth. This dialog generates an AiScript code that sends the request and prompts the user to run it on the scratchpad of Misskey Web. Once the code is executed, the scratchpad shows a dialog with the response. Finally, by pasting the response, Aria can indirectly utilise the endpoint. * feat: subscribe to push notification Added a page to register to push notifications. When the switch is enabled, it generates keys that are used to later decrypt Web Push messages sent from Misskey. The keys and an endpoint to which Misskey server sends notifications are then sent. The endpoint must be unique among all subscriptions. If a user is on an Android device and chooses an external UnifiedPush distributor like ntfy, that distributor will provide the endpoint. In this case, encrypted Web Push messages will be distributed, and Aria needs to decrypt that within the app, so the keys will be saved on the device. If the user doesn't have any distributor apps, chooses the internal distributor, or is on iOS, the endpoint directs to [Misskey Web Push Proxy](https://github.com/poppingmoon/misskey-web-push-proxy). The keys will be sent to the proxy to allow it to decrypt the messages on the server. Generation of the endpoint will be implemented in later commits. After that, the endpoint will be stored on the device for later unsubscription. * feat: unsubscribe to push notification * feat: get UnifiedPush endpoint For Android, use [UnifiedPush](https://unifiedpush.org) to get the target endpoint to which Misskey servers send notifications. If multiple distributor apps are installed on the user device, shows a dialog to select one of them. * feat: use EmbeddedDistributor to get FCM token Added [Android FOSS Embedded FCM Distributor] (https://codeberg.org/UnifiedPush/android-embedded_fcm_distributor) for a fallback of UnifiedPush Distributors. If the user does not have any distributor apps installed, this will be automatically selected. Otherwise, it will appear as one of a distributors that the user can choose. According to the official documentation, the `getEndpoint` function is supposed to return an endpoint. However, for Aria, it has been modified to return an FCM token instead, since the actual endpoint will be generated on the Flutter side. The token is prefixed to indicate that the returned value is from the embedded distributor or from an external distributor. On the Flutter side, the prefix is removed and the token will be sent to the proxy to allow it to send notifications via FCM. * feat: request notification permissions for Android * feat: get APNs device token * feat: request notification permissions for iOS * feat: show notification for Android * feat: add localization for iOS notification * feat: save user id of the account Added the `UserIdsNotifier` which saves the `userId` associated with the account. This will be used to determine which account the notification was sent to. The function to save the id will be called on signing in and subscribing to push notifications. This ensures that the id is available when a push notification is received, even if the user was signed in before this feature was added. * feat: redirect on notification tap * feat: unsubscribe on sign out
- Loading branch information