Skip to content

Commit

Permalink
feat(web): update to web: ^1.0.0 (#13200)
Browse files Browse the repository at this point in the history
* feat(web): update to web 1.0.0

* update example apps

* update JS Interop

* update CI

* Update other packages dependencies

* fix typing

* test: skip app check `activate()` on web

* analyse issue

* test: revert skip

* test: move app check web to seperate test runner

* test: update app check test runner

* test: use macos runner

* chore: remove code comment

* test: update e2e tests for web

* update

* update

* test: fix app-check test runner

* chore: improve logic

* revert logic

* test: update test running implementation

* test: use debug token for app check

---------

Co-authored-by: russellwheatley <russellwheatley85@gmail.com>
  • Loading branch information
Lyokone and russellwheatley authored Sep 10, 2024
1 parent 6969e48 commit 8fab04a
Show file tree
Hide file tree
Showing 28 changed files with 60 additions and 62 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,7 @@ jobs:
java-version: '17'
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
# TODO: Remove this once WASM is on stable.
channel: 'master'
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@7e70fbe34bbd91a75eb505eeb4174b0ac9a1df52
with:
Expand Down
4 changes: 2 additions & 2 deletions packages/cloud_firestore/cloud_firestore_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/cloud_fir
version: 4.2.0

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
_flutterfire_internals: ^1.3.41
Expand Down
4 changes: 2 additions & 2 deletions packages/cloud_functions/cloud_functions_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/cloud_fun
version: 4.9.12

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
cloud_functions_platform_interface: ^5.5.34
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Analytics extends JsObjectWrapper<analytics_interop.AnalyticsJsImpl> {

static Future<bool> isSupported() async {
final result = await analytics_interop.isSupported().toDart;
return (result! as JSBoolean).toDart;
return result.toDart;
}

/// Non-null App for this instance of analytics service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ external AnalyticsJsImpl initializeAnalytics(

@JS()
@staticInterop
external JSPromise /* bool */ isSupported();
external JSPromise<JSBoolean> isSupported();

@JS()
@staticInterop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/firebase_
version: 0.5.9+2

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
_flutterfire_internals: ^1.3.41
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ homepage: https://github.com/firebase/flutterfire/tree/main/packages/firebase_ap
version: 0.1.2+13

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
_flutterfire_internals: ^1.3.41
Expand All @@ -16,7 +16,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
web: ^0.5.1
web: ^1.0.0

dev_dependencies:
build_runner: ^2.3.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class Installations

Future<String> getId() => (installations_interop.getId(jsObject))
.toDart
.then((value) => value! as String);
.then((value) => value as String);

Future<String> getToken([bool forceRefresh = false]) =>
(installations_interop.getToken(jsObject, forceRefresh.toJS))
.toDart
.then((value) => value! as String);
.then((value) => value as String);

JSFunction? _onIdChangedUnsubscribe;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ external InstallationsJsImpl getInstallations([AppJsImpl? app]);

@JS()
@staticInterop
external JSPromise /* String */ getId(InstallationsJsImpl installations);
external JSPromise<JSString> getId(InstallationsJsImpl installations);

@JS()
@staticInterop
external JSPromise /* String */ getToken(InstallationsJsImpl installations,
external JSPromise<JSString> getToken(InstallationsJsImpl installations,
[JSBoolean? forceRefresh]);

@JS()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ homepage: https://github.com/firebase/flutterfire/tree/main/packages/firebase_ap
repository: https://github.com/firebase/flutterfire/tree/main/packages/firebase_app_installations/firebase_app_installations_web

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
_flutterfire_internals: ^1.3.41
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class RecaptchaVerifierFactoryWeb extends RecaptchaVerifierFactoryPlatform {
}

_delegate = auth_interop.RecaptchaVerifier(
element,
element.toJS,
parameters,
auth.delegate,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class Auth extends JsObjectWrapper<auth_interop.AuthJsImpl> {
Future<List<String>> fetchSignInMethodsForEmail(String email) => auth_interop
.fetchSignInMethodsForEmail(jsObject, email.toJS)
.toDart
.then((value) => List<String>.from((value! as JSArray).toDart));
.then((value) => List<String>.from(value.toDart));

/// Checks if an incoming link is a sign-in with email link.
bool isSignInWithEmailLink(String emailLink) =>
Expand Down Expand Up @@ -1168,7 +1168,7 @@ class RecaptchaVerifier
/// }
/// });
factory RecaptchaVerifier(
container, Map<String, dynamic> parameters, Auth auth) {
JSAny container, Map<String, dynamic> parameters, Auth auth) {
return RecaptchaVerifier.fromJsObject(
auth_interop.RecaptchaVerifierJsImpl(
auth.jsObject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ external JSPromise deleteUser(
);

@JS()
// Promise<List>
external JSPromise fetchSignInMethodsForEmail(AuthJsImpl auth, JSString email);
external JSPromise<JSArray<JSString>> fetchSignInMethodsForEmail(
AuthJsImpl auth, JSString email);

@JS()
external JSBoolean isSignInWithEmailLink(JSString emailLink);
Expand Down
6 changes: 3 additions & 3 deletions packages/firebase_auth/firebase_auth_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/firebase_
version: 5.12.6

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.16.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
firebase_auth_platform_interface: ^7.4.4
Expand All @@ -18,7 +18,7 @@ dependencies:
sdk: flutter
http_parser: ^4.0.0
meta: ^1.8.0
web: ^0.5.1
web: ^1.0.0

dev_dependencies:
flutter_test:
Expand Down
6 changes: 3 additions & 3 deletions packages/firebase_core/firebase_core_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/firebase_
version: 2.17.5

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.16.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
firebase_core_platform_interface: ^5.2.1
Expand All @@ -15,7 +15,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
meta: ^1.8.0
web: ^0.5.1
web: ^1.0.0

dev_dependencies:
flutter_test:
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_database/firebase_database_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ version: 0.2.5+14
homepage: https://github.com/firebase/flutterfire/tree/main/packages/firebase_database/firebase_database_web

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
collection: ^1.18.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ class Messaging extends JsObjectWrapper<messaging_interop.MessagingJsImpl> {
return _expando[jsObject] ??= Messaging._fromJsObject(jsObject);
}

static Future<bool> isSupported() => messaging_interop
.isSupported()
.toDart
.then((value) => (value! as JSBoolean).toDart);
static Future<bool> isSupported() =>
messaging_interop.isSupported().toDart.then((value) => value.toDart);

Messaging._fromJsObject(messaging_interop.MessagingJsImpl jsObject)
: super.fromJsObject(jsObject);
Expand All @@ -47,14 +45,14 @@ class Messaging extends JsObjectWrapper<messaging_interop.MessagingJsImpl> {
/// that can be used to send push messages to this user.
Future<String> getToken({String? vapidKey}) async {
try {
final token = ((await messaging_interop
final token = (await messaging_interop
.getToken(
jsObject,
vapidKey == null
? null
: messaging_interop.GetTokenOptions(
vapidKey: vapidKey.toJS))
.toDart)! as JSString)
.toDart)
.toDart;
return token;
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ external MessagingJsImpl getMessaging([AppJsImpl? app]);

@JS()
@staticInterop
external JSPromise /* bool */ deleteToken(MessagingJsImpl messaging);
external JSPromise<JSBoolean> deleteToken(MessagingJsImpl messaging);

@JS()
@staticInterop
external JSPromise /* String */ getToken(
external JSPromise<JSString> getToken(
MessagingJsImpl messaging, GetTokenOptions? getTokenOptions);

@JS('isSupported')
@staticInterop
external JSPromise /* bool */ isSupported();
external JSPromise<JSBoolean> isSupported();

@JS()
@staticInterop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/firebase_
version: 3.8.13

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
_flutterfire_internals: ^1.3.41
Expand All @@ -18,7 +18,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
meta: ^1.8.0
web: ^0.5.1
web: ^1.0.0

dev_dependencies:
firebase_core_platform_interface: ^5.2.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ homepage: https://github.com/firebase/flutterfire/tree/main/packages/firebase_pe
version: 0.1.6+13

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
_flutterfire_internals: ^1.3.41
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class RemoteConfig
Future<bool> activate() async => remote_config_interop
.activate(jsObject)
.toDart
.then((value) => (value! as JSBoolean).toDart);
.then((value) => value.toDart);

/// Ensures the last activated config are available to the getters.
Future<void> ensureInitialized() async =>
Expand All @@ -101,7 +101,7 @@ class RemoteConfig
/// If the fetched configs were already activated, the promise will resolve to false.
Future<bool> fetchAndActivate() async =>
remote_config_interop.fetchAndActivate(jsObject).toDart.then(
(value) => (value! as JSBoolean).toDart,
(value) => value.toDart,
);

/// Returns all config values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ external RemoteConfigJsImpl getRemoteConfig([AppJsImpl? app]);

@JS()
@staticInterop
external JSPromise /* bool */ activate(RemoteConfigJsImpl remoteConfig);
external JSPromise<JSBoolean> activate(RemoteConfigJsImpl remoteConfig);

@JS()
@staticInterop
external JSPromise ensureInitialized(RemoteConfigJsImpl remoteConfig);

@JS()
@staticInterop
external JSPromise /* bool */ fetchAndActivate(RemoteConfigJsImpl remoteConfig);
external JSPromise<JSBoolean> fetchAndActivate(RemoteConfigJsImpl remoteConfig);

@JS()
@staticInterop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repository: https://github.com/firebase/flutterfire/tree/main/packages/firebase_
version: 1.6.13

environment:
sdk: '>=3.2.0 <4.0.0'
flutter: '>=3.3.0'
sdk: '>=3.4.0 <4.0.0'
flutter: '>=3.22.0'

dependencies:
firebase_core: ^3.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: firebase_storage_example
description: Demonstrates how to use the firebase_storage plugin.

environment:
sdk: '>=3.2.0 <4.0.0'
sdk: '>=3.4.0 <4.0.0'

dependencies:
firebase_core: ^3.4.0
Expand All @@ -11,7 +11,7 @@ dependencies:
sdk: flutter
image_picker: ^1.0.2
image_picker_for_web: ^2.1.12
web: ^0.5.1
web: ^1.0.0

flutter:
uses-material-design: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class StorageReference
/// Returns a long lived download URL for this reference.
Future<Uri> getDownloadURL() async {
final uriString = await storage_interop.getDownloadURL(jsObject).toDart;
final dartString = (uriString! as JSString).toDart;
final dartString = uriString.toDart;
return Uri.parse(dartString);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ external JSPromise /* void */ deleteObject(ReferenceJsImpl ref);

@JS()
@staticInterop
external JSPromise /* String */ getBlob(ReferenceJsImpl ref,
external JSPromise<JSString> getBlob(ReferenceJsImpl ref,
[JSNumber? maxDownloadSizeBytes]);

@JS()
@staticInterop
external JSPromise /* List<String> */ getBytes(ReferenceJsImpl ref,
external JSPromise<JSArray<JSString>> getBytes(ReferenceJsImpl ref,
[JSNumber? maxDownloadSizeBytes]);

@JS()
@staticInterop
external JSPromise /* String */ getDownloadURL(ReferenceJsImpl ref);
external JSPromise<JSString> getDownloadURL(ReferenceJsImpl ref);

@JS()
@staticInterop
Expand Down
Loading

0 comments on commit 8fab04a

Please sign in to comment.