-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: chat message with image upload done
- Loading branch information
1 parent
e127a46
commit 4d2669d
Showing
24 changed files
with
112 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,7 @@ build/ | |
.dart_frog | ||
|
||
# Test related files | ||
coverage/ | ||
coverage/ | ||
|
||
# Firebase related files | ||
firebase_options.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
||
import 'package:cats_backend/config/config.dart'; | ||
import 'package:firebase_dart/firebase_dart.dart'; | ||
|
||
late FirebaseApp app; | ||
late FirebaseStorage storage; | ||
|
||
late FirebaseOptions firebaseOptions; | ||
|
||
class FirebaseService { | ||
static Future<void> initializeFirebase() async { | ||
try { | ||
// read firebase_options file as Map | ||
final file = File(Config.firebaseOptionsDir); | ||
print('File Path: ${file.path}'); | ||
final content = file.readAsStringSync(); | ||
final data = jsonDecode(content) as Map<String, dynamic>; | ||
firebaseOptions = FirebaseOptions.fromMap(data); | ||
} catch (e) { | ||
print('====> Error reading Firebase Options: $e <===='); | ||
} | ||
|
||
print('====> Initializing Firebase... <===='); | ||
try { | ||
FirebaseDart.setup(); | ||
app = await Firebase.initializeApp( | ||
options: firebaseOptions, | ||
); | ||
|
||
print('====> Firebase App initialized Successfully <===='); | ||
|
||
storage = FirebaseStorage.instanceFor(app: app); | ||
print('==================> Connected to Firebase ✅ <=================='); | ||
} catch (e) { | ||
print('====> Error initializing Firebase: $e <===='); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export 'firebase_service.dart'; | ||
export 'mongo_service.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:cats_backend/services/services.dart'; | ||
import 'package:dart_frog/dart_frog.dart'; | ||
|
||
Future<void> init(InternetAddress ip, int port) async { | ||
// Any code initialized within this method will only run on server start,any | ||
// hot reloads afterwards will not trigger this method until a hot restart. | ||
|
||
print('Init -> IP: $ip, Port: $port'); | ||
|
||
// Initialize the MongoDB service | ||
await mongoDbService.initializeMongo(); | ||
|
||
// Initialize the firebase | ||
await FirebaseService.initializeFirebase(); | ||
} | ||
|
||
Future<HttpServer> run(Handler handler, InternetAddress ip, int port) { | ||
// 1. Execute any custom code prior to starting the server... | ||
|
||
// 2. Use the provided `handler`, `ip`, and `port` to create a | ||
// custom `HttpServer`. Or use the Dart Frog serve method to do that for you. | ||
return serve(handler, ip, port); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.