Skip to content

Commit

Permalink
Add delay and split post and reload
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozRatej committed Jul 12, 2023
1 parent 5b92d04 commit f45f849
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/pages/web_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,11 @@ class WebViewAppState extends ConsumerState<WebViewApp> {
case ChannelAction.registerFcmDevice:
String? token = ref.read(pushTokenProvider).value;
if (token != null) {
Uri? beforePostUrl = await controller.getUrl();
var postData = Uint8List.fromList(utf8.encode("token=$token"));
controller
.postUrl(url: Uri.parse(message.url!), postData: postData).whenComplete(() => controller.reload());
await controller.postUrl(url: Uri.parse(message.url!), postData: postData);
await Future.delayed(const Duration(milliseconds: 200));
await controller.loadUrl(urlRequest: URLRequest(url: beforePostUrl));
}
var status = await Permission.notification.status;
// status.isDenied: The user has previously denied the notification permission
Expand Down

0 comments on commit f45f849

Please sign in to comment.