Skip to content

Commit

Permalink
chore: fix cyclic dependencies in the project (#10914)
Browse files Browse the repository at this point in the history
* chore: fix cyclic dependencies in the project

* chore: fix cyclic dependencies in the project

* chore: fix cyclic dependencies in the project

* chore: fix cyclic dependencies in the project
  • Loading branch information
Lyokone committed May 16, 2023
1 parent da2df35 commit c738d9f
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ dependencies:

dev_dependencies:
build_runner: ^2.3.3
firebase_app_check: ^0.1.4
firebase_core_platform_interface: ^4.8.0
flutter_test:
sdk: flutter
Expand Down
2 changes: 0 additions & 2 deletions packages/firebase_auth/firebase_auth_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ dependencies:
meta: ^1.8.0

dev_dependencies:
firebase_auth: ^4.6.0
firebase_core_platform_interface: ^4.8.0
flutter_test:
sdk: flutter

Expand Down
1 change: 0 additions & 1 deletion packages/firebase_core/firebase_core_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ dependencies:
meta: ^1.8.0

dev_dependencies:
firebase_core: ^2.12.0
flutter_test:
sdk: flutter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
@TestOn('browser')
import 'dart:js' as js;

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:flutter_test/flutter_test.dart';
Expand All @@ -24,7 +23,7 @@ void main() {
'should throw exception if no default app is available & no options are provided',
() async {
await expectLater(
Firebase.initializeApp,
FirebasePlatform.instance.initializeApp,
throwsAssertionError,
);
});
Expand All @@ -39,7 +38,7 @@ void main() {
test('should throw exception if no options are provided with a named app',
() async {
await expectLater(
() => Firebase.initializeApp(name: 'foo'),
() => FirebasePlatform.instance.initializeApp(name: 'foo'),
throwsAssertionError,
);
});
Expand Down Expand Up @@ -67,7 +66,7 @@ void main() {
});

await expectLater(
() => Firebase.app('foo'),
() => FirebasePlatform.instance.app('foo'),
throwsA(noAppExists('foo')),
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@TestOn('browser')
import 'dart:js' as js;

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -37,7 +36,7 @@ void main() {
test('.apps', () {
(js.context['firebase_core'] as js.JsObject)['getApps'] =
js.allowInterop(js.JsArray<dynamic>.new);
final List<FirebaseApp> apps = Firebase.apps;
final List<FirebaseAppPlatform> apps = FirebasePlatform.instance.apps;
expect(apps, hasLength(0));
});

Expand All @@ -55,7 +54,7 @@ void main() {
});
});

final FirebaseApp app = Firebase.app('foo');
final FirebaseAppPlatform app = FirebasePlatform.instance.app('foo');

expect(app.name, equals('foo'));

Expand Down Expand Up @@ -98,7 +97,8 @@ void main() {
});
});

final FirebaseApp app = await Firebase.initializeApp(
final FirebaseAppPlatform app =
await FirebasePlatform.instance.initializeApp(
name: 'foo',
options: const FirebaseOptions(
apiKey: 'abc',
Expand Down
33 changes: 0 additions & 33 deletions packages/firebase_ui_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,10 @@ dev_dependencies:
flutter_lints: ^2.0.0
mockito: ^5.2.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.

false_secrets:
- '/example/**/google-services.json'
- '/example/**/firebase_options.dart'
- '/example/**/GoogleService-Info.plist'
- 'example/lib/config.dart'

flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages
35 changes: 0 additions & 35 deletions packages/firebase_ui_oauth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,11 @@ dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
firebase_ui_oauth_google: ^1.2.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

false_secrets:
- '/example/**/google-services.json'
- '/example/**/firebase_options.dart'
- '/example/**/GoogleService-Info.plist'
- '/example/lib/config.dart'

# The following section is specific to Flutter packages.
flutter:

# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware

# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages
4 changes: 1 addition & 3 deletions packages/firebase_ui_oauth/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: _flutterfire_internals,firebase_auth,firebase_auth_platform_interface,firebase_auth_web,firebase_core,firebase_core_platform_interface,firebase_core_web,firebase_dynamic_links,firebase_dynamic_links_platform_interface,firebase_ui_auth,firebase_ui_localizations,firebase_ui_oauth_google,firebase_ui_shared
# melos_managed_dependency_overrides: _flutterfire_internals,firebase_auth,firebase_auth_platform_interface,firebase_auth_web,firebase_core,firebase_core_platform_interface,firebase_core_web,firebase_dynamic_links,firebase_dynamic_links_platform_interface,firebase_ui_auth,firebase_ui_localizations,firebase_ui_shared
dependency_overrides:
_flutterfire_internals:
path: ../_flutterfire_internals
Expand All @@ -22,7 +22,5 @@ dependency_overrides:
path: ../firebase_ui_auth
firebase_ui_localizations:
path: ../firebase_ui_localizations
firebase_ui_oauth_google:
path: ../firebase_ui_oauth_google
firebase_ui_shared:
path: ../firebase_ui_shared
54 changes: 52 additions & 2 deletions packages/firebase_ui_oauth/test/flutterfire_ui_oauth_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

import 'package:firebase_auth/firebase_auth.dart' show FirebaseAuth;
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:firebase_ui_oauth/firebase_ui_oauth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:firebase_ui_oauth/firebase_ui_oauth.dart';
import 'package:firebase_ui_oauth_google/firebase_ui_oauth_google.dart';

class FakeAssetBundle extends Fake implements AssetBundle {
final String svgStr = '''<svg viewBox="0 0 10 10"></svg>''';
Expand All @@ -17,6 +16,57 @@ class FakeAssetBundle extends Fake implements AssetBundle {
Future<String> loadString(String key, {bool cache = true}) async => svgStr;
}

// Duplicated from packages/firebase_ui_oauth_google/lib/src/theme.dart
// to prevent circular dependency
const _googleBlue = Color(0xff4285f4);
const _googleWhite = Color(0xffffffff);
const _googleDark = Color(0xff757575);

const _backgroundColor = ThemedColor(_googleBlue, _googleWhite);
const _color = ThemedColor(_googleWhite, _googleDark);
const _iconBackgroundColor = ThemedColor(_googleWhite, _googleWhite);

const _iconSvg = '''
<svg width="38px" height="38px" viewBox="0 0 38 38" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="Google-Button" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="btn_google_signin_dark_normal" transform="translate(-5.000000, -5.000000)">
<rect id="button-bg-copy" fill="#FFFFFF" x="5" y="5" width="38" height="38" rx="1"></rect>
<g id="logo_googleg_48dp" transform="translate(15.000000, 15.000000)">
<path d="M17.64,9.20454545 C17.64,8.56636364 17.5827273,7.95272727 17.4763636,7.36363636 L9,7.36363636 L9,10.845 L13.8436364,10.845 C13.635,11.97 13.0009091,12.9231818 12.0477273,13.5613636 L12.0477273,15.8195455 L14.9563636,15.8195455 C16.6581818,14.2527273 17.64,11.9454545 17.64,9.20454545 L17.64,9.20454545 Z" id="Shape" fill="#4285F4"></path>
<path d="M9,18 C11.43,18 13.4672727,17.1940909 14.9563636,15.8195455 L12.0477273,13.5613636 C11.2418182,14.1013636 10.2109091,14.4204545 9,14.4204545 C6.65590909,14.4204545 4.67181818,12.8372727 3.96409091,10.71 L0.957272727,10.71 L0.957272727,13.0418182 C2.43818182,15.9831818 5.48181818,18 9,18 L9,18 Z" id="Shape" fill="#34A853"></path>
<path d="M3.96409091,10.71 C3.78409091,10.17 3.68181818,9.59318182 3.68181818,9 C3.68181818,8.40681818 3.78409091,7.83 3.96409091,7.29 L3.96409091,4.95818182 L0.957272727,4.95818182 C0.347727273,6.17318182 0,7.54772727 0,9 C0,10.4522727 0.347727273,11.8268182 0.957272727,13.0418182 L3.96409091,10.71 L3.96409091,10.71 Z" id="Shape" fill="#FBBC05"></path>
<path d="M9,3.57954545 C10.3213636,3.57954545 11.5077273,4.03363636 12.4404545,4.92545455 L15.0218182,2.34409091 C13.4631818,0.891818182 11.4259091,0 9,0 C5.48181818,0 2.43818182,2.01681818 0.957272727,4.95818182 L3.96409091,7.29 C4.67181818,5.16272727 6.65590909,3.57954545 9,3.57954545 L9,3.57954545 Z" id="Shape" fill="#EA4335"></path>
<polygon id="Shape" points="0 0 18 0 18 18 0 18"></polygon>
</g>
</g>
</g>
</svg>
''';

const _iconSrc = ThemedIconSrc(_iconSvg, _iconSvg);

class GoogleProviderButtonStyle extends ThemedOAuthProviderButtonStyle {
const GoogleProviderButtonStyle();

@override
ThemedColor get backgroundColor => _backgroundColor;

@override
ThemedColor get color => _color;

@override
ThemedIconSrc get iconSrc => _iconSrc;

@override
ThemedColor get iconBackgroundColor => _iconBackgroundColor;

@override
double get iconPadding => 1;

@override
String get assetsPackage => 'firebase_ui_oauth_google';
}

class FakeOAuthProvider extends OAuthProvider {
@override
ProviderArgs get desktopSignInArgs => throw UnimplementedError();
Expand Down
35 changes: 0 additions & 35 deletions packages/firebase_ui_oauth_google/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,9 @@ dev_dependencies:
sdk: flutter
flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

false_secrets:
- '/example/**/google-services.json'
- '/example/**/firebase_options.dart'
- '/example/**/GoogleService-Info.plist'

# The following section is specific to Flutter packages.
flutter:

# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware

# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages

0 comments on commit c738d9f

Please sign in to comment.