Skip to content

Commit

Permalink
Merge pull request #93 from humhub/88-silent-flutterchannel-registerf…
Browse files Browse the repository at this point in the history
…cmdevice-output

Add delay and split post and reload, Firebase register Token
  • Loading branch information
luke- committed Jul 13, 2023
2 parents 99b3572 + f45f849 commit ad98653
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 @@ -146,9 +146,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 ad98653

Please sign in to comment.