Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/firebase_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
## NEXT
## 0.2.1

* Omit obvious local variable types.
* Reformat with a line length of 100.
* Update firebase_core to 4.15.0.
* Fix app reinitialization, deletion, and data collection state.
* Fix code formatting and lint issues.

## 0.2.0

Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This package is not an _endorsed_ implementation of `firebase_core`. Therefore,

```yaml
dependencies:
firebase_core: ^4.14.0
firebase_core_tizen: ^0.2.0
firebase_core: ^4.15.0
firebase_core_tizen: ^0.2.1
```

Then you can import `firebase_core` in your Dart code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Integration tests ported from upstream firebase_core v4.14.0:
// https://github.com/firebase/flutterfire/blob/firebase_core-v4.14.0/tests/integration_test/firebase_core/firebase_core_e2e_test.dart
// Integration tests ported from upstream firebase_core v4.15.0:
// https://github.com/firebase/flutterfire/blob/firebase_core-v4.15.0/tests/integration_test/firebase_core/firebase_core_e2e_test.dart
// Originally authored by the Chromium project authors under a BSD-style
// license.

Expand Down Expand Up @@ -75,6 +75,8 @@ void main() {
await app.setAutomaticDataCollectionEnabled(true);

expect(app.isAutomaticDataCollectionEnabled, true);
expect(Firebase.app().isAutomaticDataCollectionEnabled, true);
expect(Firebase.apps.single.isAutomaticDataCollectionEnabled, true);
});

test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async {
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_core/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
flutter: ">=3.27.0"

dependencies:
firebase_core: ^4.14.0
firebase_core: ^4.15.0
firebase_core_tizen:
path: ../
flutter:
Expand Down
19 changes: 11 additions & 8 deletions packages/firebase_core/lib/firebase_app_tizen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,26 @@ part of 'firebase_core_tizen.dart';

/// A Dart only implementation of a Firebase app instance.
class FirebaseApp extends FirebaseAppPlatform {
FirebaseApp._(super.name, super.options);
FirebaseApp._(this._app, FirebaseOptions options) : super(_app.name, options);

bool _isAutomaticDataCollectionEnabled = false;
final core_dart.FirebaseApp _app;

@override
Future<void> delete() {
core_dart.Firebase.app(name).delete();
return Future<void>.value();
Future<void> delete() async {
if (name == defaultFirebaseAppName) {
throw noDefaultAppDelete();
}
if (core_dart.Firebase.apps.any((app) => identical(app, _app))) {
_app.delete();
}
}

@override
bool get isAutomaticDataCollectionEnabled => _isAutomaticDataCollectionEnabled;
bool get isAutomaticDataCollectionEnabled => _app.isAutomaticDataCollectionEnabled;

@override
Future<void> setAutomaticDataCollectionEnabled(bool enabled) {
_isAutomaticDataCollectionEnabled = enabled;
return Future<void>.value();
return _app.setAutomaticDataCollectionEnabled(enabled);
}

/// Sets whether automatic resource management is enabled or disabled.
Expand Down
16 changes: 10 additions & 6 deletions packages/firebase_core/lib/firebase_core_tizen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FirebaseCore extends FirebasePlatform {
final core_dart.FirebaseOptions options = app.options;

return FirebaseApp._(
app.name,
app,
FirebaseOptions(
apiKey: options.apiKey,
appId: options.appId,
Expand Down Expand Up @@ -50,15 +50,19 @@ class FirebaseCore extends FirebasePlatform {
String? name,
FirebaseOptions? options,
}) async {
name ??= defaultFirebaseAppName;
if (name == defaultFirebaseAppName && options == null) {
if (core_dart.Firebase.apps.any((app) => app.name == name)) {
return app(name);
}
throw coreNotInitialized();
}

assert(
options != null,
'options should be provided to initialize the default app.',
'options should be provided to initialize a new app.',
);

/// Ensures the name isn't null, in case no name
/// passed, [defaultFirebaseAppName] will be used
name ??= defaultFirebaseAppName;

try {
// Initialize the app in firebase_core_dart
final dartOptions = core_dart.FirebaseOptions.fromMap(options!.asMap);
Expand Down
2 changes: 1 addition & 1 deletion packages/firebase_core/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: firebase_core_tizen
description: Tizen implementation of the firebase_core plugin.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/main/packages/firebase_core
version: 0.2.0
version: 0.2.1

environment:
sdk: ^3.6.0
Expand Down
Loading