Skip to content

Commit 816ca7c

Browse files
authored
[firebase_core] Add Firebase Core plugin (#476)
1 parent 61f26af commit 816ca7c

File tree

19 files changed

+460
-0
lines changed

19 files changed

+460
-0
lines changed

.github/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
- packages/connectivity_plus/**/*
1010
"p: device_info_plus":
1111
- packages/device_info_plus/**/*
12+
"p: firebase_core":
13+
- packages/firebase_core/**/*
1214
"p: flutter_app_badger":
1315
- packages/flutter_app_badger/**/*
1416
"p: flutter_secure_storage":

.github/recipe.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ plugins:
2626
# No tests.
2727
google_sign_in: []
2828
image_picker: []
29+
firebase_core: []
2930
tizen_log: []
3031
tizen_notification: []
3132
wearable_rotary: []

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The _"non-endorsed"_ status means that the plugin is not endorsed by the origina
1919
| [**camera_tizen**](packages/camera) | [camera](https://github.com/flutter/plugins/tree/main/packages/camera) (1st-party) | [![pub package](https://img.shields.io/pub/v/camera_tizen.svg)](https://pub.dev/packages/camera_tizen) | No |
2020
| [**connectivity_plus_tizen**](packages/connectivity_plus) | [connectivity_plus](https://github.com/fluttercommunity/plus_plugins/tree/main/packages/connectivity_plus) (1st-party) | [![pub package](https://img.shields.io/pub/v/connectivity_plus_tizen.svg)](https://pub.dev/packages/connectivity_plus_tizen) | No |
2121
| [**device_info_plus_tizen**](packages/device_info_plus) | [device_info_plus](https://github.com/fluttercommunity/plus_plugins/tree/main/packages/device_info_plus) (1st-party) | [![pub package](https://img.shields.io/pub/v/device_info_plus_tizen.svg)](https://pub.dev/packages/device_info_plus_tizen) | No |
22+
| [**firebase_core_tizen**](packages/firebase_core) | [firebase_core](https://github.com/firebase/flutterfire/tree/master/packages/firebase_core) | [![pub package](https://img.shields.io/pub/v/firebase_core_tizen.svg)](https://pub.dev/packages/firebase_core_tizen) | No |
2223
| [**flutter_app_badger_tizen**](packages/flutter_app_badger) | [flutter_app_badger](https://github.com/g123k/flutter_app_badger) (3rd-party) | [![pub package](https://img.shields.io/pub/v/flutter_app_badger_tizen.svg)](https://pub.dev/packages/flutter_app_badger_tizen) | No |
2324
| [**flutter_secure_storage_tizen**](packages/flutter_secure_storage) | [flutter_secure_storage](https://github.com/mogol/flutter_secure_storage) (3rd-party) | [![pub package](https://img.shields.io/pub/v/flutter_secure_storage_tizen.svg)](https://pub.dev/packages/flutter_secure_storage_tizen) | No |
2425
| [**flutter_tts_tizen**](packages/flutter_tts) | [flutter_tts](https://github.com/dlutton/flutter_tts) (3rd-party) | [![pub package](https://img.shields.io/pub/v/flutter_tts_tizen.svg)](https://pub.dev/packages/flutter_tts_tizen) | No |
@@ -59,6 +60,7 @@ The _"non-endorsed"_ status means that the plugin is not endorsed by the origina
5960
| [**camera_tizen**](packages/camera) | 4.0 ||||| No camera |
6061
| [**connectivity_plus_tizen**](packages/connectivity_plus) | 4.0 | ✔️ | ⚠️ | ✔️ | ✔️ | Returns incorrect connection status |
6162
| [**device_info_plus_tizen**](packages/device_info_plus) | 4.0 | ✔️ | ✔️ | ✔️ | ✔️ |
63+
| [**firebase_core**](packages/firebase_core) | 4.0 | ✔️ | ✔️ | ✔️ | ✔️ |
6264
| [**flutter_app_badger_tizen**](packages/flutter_app_badger) | 4.0 | ✔️ | ✔️ ||| API not supported |
6365
| [**flutter_secure_storage_tizen**](packages/flutter_secure_storage) | 4.0 | ✔️ | ✔️ | ✔️ | ✔️ |
6466
| [**flutter_tts_tizen**](packages/flutter_tts) | 4.0 | ✔️ | ✔️ | ✔️ | ✔️ |

packages/firebase_core/.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
.packages
30+
build/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0
2+
3+
* Initial release.

packages/firebase_core/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD-3-Clause
2+
------------
3+
4+
Copyright (c) 2016-present Invertase Limited <[email protected]> & Contributors
5+
6+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11+
12+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13+
14+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15+
16+
17+
Creative Commons Attribution 3.0 License
18+
----------------------------------------
19+
20+
Copyright (c) 2016-present Invertase Limited <[email protected]> & Contributors
21+
22+
Documentation and other instructional materials provided for this project
23+
(including on a separate documentation repository or it's documentation website) are
24+
licensed under the Creative Commons Attribution 3.0 License. Code samples/blocks
25+
contained therein are licensed under the BSD-3-Clause License (the "License"), as above.
26+
27+
You may obtain a copy of the Creative Commons Attribution 3.0 License at
28+
29+
https://creativecommons.org/licenses/by/3.0/

packages/firebase_core/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# firebase_core_tizen
2+
3+
[![pub package](https://img.shields.io/pub/v/firebase_core_tizen.svg)](https://pub.dev/packages/firebase_core_tizen)
4+
5+
The Tizen implementation of [`firebase_core`](https://github.com/firebase/flutterfire/tree/master/packages/firebase_core).
6+
7+
## Usage
8+
9+
This package is not an _endorsed_ implementation of `firebase_core`. Therefore, you have to include `firebase_core_tizen` alongside `firebase_core` as dependencies in your `pubspec.yaml` file.
10+
11+
```yaml
12+
dependencies:
13+
firebase_core: ^1.9.0
14+
firebase_core_tizen: ^0.1.0
15+
```
16+
17+
For detailed usage see https://github.com/invertase/flutterfire_desktop#flutterfire-desktop.
18+
19+
## Tizen integration
20+
21+
The implementation of `firebase_core` is based on [FlutterFire Desktop Core](https://github.com/invertase/flutterfire_desktop/tree/main/packages/firebase_core/firebase_core_desktop). FlutterFire Desktop provides dart implementation of the Firebase modules.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# The .vscode folder contains launch configuration and tasks you configure in
19+
# VS Code which you may wish to be included in version control, so this line
20+
# is commented out by default.
21+
.vscode/
22+
23+
# Flutter/Dart/Pub related
24+
**/doc/api/
25+
**/ios/Flutter/.last_build_id
26+
.dart_tool/
27+
.flutter-plugins
28+
.flutter-plugins-dependencies
29+
.packages
30+
.pub-cache/
31+
.pub/
32+
/build/
33+
34+
# Web related
35+
lib/generated_plugin_registrant.dart
36+
37+
# Symbolication related
38+
app.*.symbols
39+
40+
# Obfuscation related
41+
app.*.map.json
42+
43+
# Android Studio will place build artifacts here
44+
/android/app/debug
45+
/android/app/profile
46+
/android/app/release
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# firebase_core_tizen_example
2+
3+
Demonstrates how to use the firebase_core_tizen plugin.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Copyright (c) Invertase Limited <[email protected]> & Contributors
2+
// ignore_for_file: public_member_api_docs
3+
4+
import 'dart:async';
5+
import 'dart:developer';
6+
import 'package:firebase_core/firebase_core.dart';
7+
import 'package:flutter/material.dart';
8+
9+
void main() => runApp(const MyApp());
10+
11+
class MyApp extends StatelessWidget {
12+
const MyApp({super.key});
13+
14+
String get name => 'foo';
15+
16+
// fill app keys if needed, you can take ones from
17+
// https://github.com/invertase/flutterfire_desktop/blob/main/packages/firebase_core/firebase_core_desktop/example/lib/main.dart
18+
FirebaseOptions get firebaseOptions => const FirebaseOptions(
19+
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
20+
apiKey: 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy',
21+
projectId: 'react-native-firebase-testing',
22+
messagingSenderId: 'zzzzzzzzzzzz',
23+
);
24+
25+
Future<void> initializeDefault() async {
26+
final FirebaseApp app =
27+
await Firebase.initializeApp(options: firebaseOptions);
28+
log('Initialized default app $app');
29+
print('Initialized default app $app');
30+
}
31+
32+
Future<void> initializeSecondary() async {
33+
final FirebaseApp app = await Firebase.initializeApp(
34+
name: name,
35+
options: firebaseOptions,
36+
);
37+
38+
log('Initialized $app');
39+
print('Initialized $app');
40+
}
41+
42+
void apps() {
43+
log('Currently initialized apps: ${Firebase.apps}');
44+
print('Currently initialized apps: ${Firebase.apps}');
45+
}
46+
47+
void options() {
48+
final FirebaseApp app = Firebase.app(name);
49+
final FirebaseOptions options = app.options;
50+
log('Current options for app $name: $options');
51+
print('Current options for app $name: $options');
52+
}
53+
54+
Future<void> delete() async {
55+
final FirebaseApp app = Firebase.app(name);
56+
await app.delete();
57+
log('App $name deleted');
58+
print('App $name deleted');
59+
}
60+
61+
@override
62+
Widget build(BuildContext context) {
63+
return MaterialApp(
64+
home: Scaffold(
65+
appBar: AppBar(
66+
title: const Text('Firebase Core example app'),
67+
),
68+
body: Padding(
69+
padding: const EdgeInsets.all(20),
70+
child: Column(
71+
mainAxisAlignment: MainAxisAlignment.spaceAround,
72+
crossAxisAlignment: CrossAxisAlignment.stretch,
73+
children: <Widget>[
74+
ElevatedButton(
75+
onPressed: initializeDefault,
76+
child: const Text('Initialize default app'),
77+
),
78+
ElevatedButton(
79+
onPressed: initializeSecondary,
80+
child: const Text('Initialize secondary app'),
81+
),
82+
ElevatedButton(
83+
onPressed: apps,
84+
child: const Text('Get apps'),
85+
),
86+
ElevatedButton(
87+
onPressed: options,
88+
child: const Text('List options'),
89+
),
90+
ElevatedButton(
91+
onPressed: delete,
92+
child: const Text('Delete app'),
93+
),
94+
],
95+
),
96+
),
97+
),
98+
);
99+
}
100+
}

0 commit comments

Comments
 (0)