Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(messaging): change usage of Platform.isIos to defaultTargetPlatform to allow mocking platform more easily #12183

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -4,7 +4,6 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:io' show Platform;
import 'dart:ui';

import 'package:firebase_core/firebase_core.dart';
Expand Down Expand Up @@ -131,7 +130,8 @@ class MethodChannelFirebaseMessaging extends FirebaseMessagingPlatform {
// Messaging requests. See this issue:
// https://github.com/firebase/flutterfire/issues/10625
Future<void> _APNSTokenCheck() async {
if (Platform.isMacOS || Platform.isIOS) {
if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
Comment on lines +133 to +134
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultTargetPlatform doesn't care if the platform is running on web browser or not, it could be TargetPlatform.iOS but on web browser, we need to handle this case as well

String? token = await getAPNSToken();

if (token == null) {
Expand Down