diff --git a/.idea/Daflv4.iml b/.idea/Daflv4.iml
index 2c95479..23209a3 100644
--- a/.idea/Daflv4.iml
+++ b/.idea/Daflv4.iml
@@ -10,5 +10,6 @@
+
\ No newline at end of file
diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart
index 0803ff6..0aea77e 100644
--- a/Sources/dafl_project_flutter/lib/main.dart
+++ b/Sources/dafl_project_flutter/lib/main.dart
@@ -1,6 +1,7 @@
import 'dart:async';
import 'package:dafl_project_flutter/persistence/database_saver.dart';
import 'package:fluttertoast/fluttertoast.dart';
+import 'package:path_provider/path_provider.dart';
import 'dart:math';
import './views/pages/home/p_home.dart';
import './views/pages/main/p_main.dart';
diff --git a/Sources/dafl_project_flutter/lib/persistence/database_connexion.dart b/Sources/dafl_project_flutter/lib/persistence/database_connexion.dart
index f9cf314..643a27c 100644
--- a/Sources/dafl_project_flutter/lib/persistence/database_connexion.dart
+++ b/Sources/dafl_project_flutter/lib/persistence/database_connexion.dart
@@ -1,20 +1,41 @@
+import 'dart:convert';
+import 'dart:io';
+
+import 'package:flutter/services.dart';
+import 'package:path_provider/path_provider.dart';
+
import '../model/user.dart';
import 'package:postgresql2/constants.dart';
import 'package:postgresql2/pool.dart';
import 'package:postgresql2/postgresql.dart';
class DatabaseConnexion{
- String? psqlUser = 'postgres';
- String? psqlPswd = 'mdpDaflBd';
- String? psqlHost = '89.83.54.48';
- String? psqlDataBase = 'BD-DaflMusic';
+ final String filePath = 'assets/logs.txt';
+
+ String? _psqlUser;
+ String? _psqlPswd;
+ String? _psqlHost;
+ String? _psqlDataBase;
+
+
+ Future _loadLogs() async {
+ final _loadedData = await rootBundle.loadString(filePath);
+
+ final _logs = LineSplitter.split(_loadedData).toList();
+
+ _psqlUser = _logs[0];
+ _psqlPswd = _logs[1];
+ _psqlHost = _logs[2];
+ _psqlDataBase = _logs[3];
+ }
//Initialise connexion to the database
- Future initConnexion(){
- var uri = 'postgres://$psqlUser:$psqlPswd@$psqlHost:5442/$psqlDataBase';
+ Future initConnexion() async{
+ await _loadLogs();
+
+ var uri = 'postgres://$_psqlUser:$_psqlPswd@$_psqlHost:5442/$_psqlDataBase';
return connect(uri);
}
-
}
\ No newline at end of file
diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock
index 552dcf5..96388e7 100644
--- a/Sources/dafl_project_flutter/pubspec.lock
+++ b/Sources/dafl_project_flutter/pubspec.lock
@@ -43,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
+ charcode:
+ dependency: transitive
+ description:
+ name: charcode
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.3.1"
checked_yaml:
dependency: transitive
description:
@@ -71,6 +78,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.16.0"
+ convert:
+ dependency: transitive
+ description:
+ name: convert
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.1"
crypto:
dependency: transitive
description:
@@ -99,6 +113,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
+ ffi:
+ dependency: transitive
+ description:
+ name: ffi
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.1"
+ file:
+ dependency: transitive
+ description:
+ name: file
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
@@ -205,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
+ logging:
+ dependency: transitive
+ description:
+ name: logging
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
matcher:
dependency: transitive
description:
@@ -226,6 +261,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
+ mime:
+ dependency: transitive
+ description:
+ name: mime
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.2"
nested:
dependency: transitive
description:
@@ -247,6 +289,55 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.2"
+ path_provider:
+ dependency: "direct main"
+ description:
+ name: path_provider
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.11"
+ path_provider_android:
+ dependency: transitive
+ description:
+ name: path_provider_android
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.21"
+ path_provider_ios:
+ dependency: transitive
+ description:
+ name: path_provider_ios
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.11"
+ path_provider_linux:
+ dependency: transitive
+ description:
+ name: path_provider_linux
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.7"
+ path_provider_macos:
+ dependency: transitive
+ description:
+ name: path_provider_macos
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.6"
+ path_provider_platform_interface:
+ dependency: transitive
+ description:
+ name: path_provider_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.0.5"
+ path_provider_windows:
+ dependency: transitive
+ description:
+ name: path_provider_windows
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.3"
petitparser:
dependency: transitive
description:
@@ -254,6 +345,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0"
+ platform:
+ dependency: transitive
+ description:
+ name: platform
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.1.0"
+ plugin_platform_interface:
+ dependency: transitive
+ description:
+ name: plugin_platform_interface
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.3"
+ postgresql2:
+ dependency: "direct main"
+ description:
+ name: postgresql2
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.3"
+ process:
+ dependency: transitive
+ description:
+ name: process
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "4.2.4"
provider:
dependency: "direct main"
description:
@@ -261,6 +380,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.4"
+ rikulo_commons:
+ dependency: transitive
+ description:
+ name: rikulo_commons
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "5.2.1"
rive:
dependency: "direct main"
description:
@@ -343,6 +469,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.6"
+ win32:
+ dependency: transitive
+ description:
+ name: win32
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "3.0.1"
+ xdg_directories:
+ dependency: transitive
+ description:
+ name: xdg_directories
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.2.0+2"
xml:
dependency: transitive
description:
diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml
index cbd0b78..e41b996 100644
--- a/Sources/dafl_project_flutter/pubspec.yaml
+++ b/Sources/dafl_project_flutter/pubspec.yaml
@@ -43,6 +43,8 @@ dependencies:
animations: ^2.0.7
fluttertoast: ^8.1.1
vibration: ^1.7.6
+ postgresql2: ^1.0.3
+ path_provider: ^2.0.11
dev_dependencies:
flutter_test:
@@ -87,6 +89,7 @@ flutter:
assets:
- assets/images/
- assets/fonts/
+ - assets/logs.txt
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
diff --git a/Sources/dafl_project_flutter/test/testController.dart b/Sources/dafl_project_flutter/test/testController.dart
deleted file mode 100644
index d892d84..0000000
--- a/Sources/dafl_project_flutter/test/testController.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-import '../lib/controller/controller.dart';
-import '../lib/persistence/database_saver.dart';
-
-
-void main(){
-
-}
diff --git a/Sources/dafl_project_flutter/test/testFileRead.dart b/Sources/dafl_project_flutter/test/testFileRead.dart
new file mode 100644
index 0000000..d5b2113
--- /dev/null
+++ b/Sources/dafl_project_flutter/test/testFileRead.dart
@@ -0,0 +1,15 @@
+import 'package:dafl_project_flutter/main.dart';
+import 'package:dafl_project_flutter/persistence/database_connexion.dart';
+import 'package:flutter/cupertino.dart';
+
+
+Future main() async {
+ MyApp mainApp = MyApp();
+
+ runApp(mainApp);
+
+ DatabaseConnexion d = DatabaseConnexion();
+
+ d.initConnexion();
+
+}
\ No newline at end of file
diff --git a/Sources/dafl_project_flutter/test/test_database_acces.dart b/Sources/dafl_project_flutter/test/test_database_acces.dart
deleted file mode 100644
index cbf05a4..0000000
--- a/Sources/dafl_project_flutter/test/test_database_acces.dart
+++ /dev/null
@@ -1,20 +0,0 @@
-import 'dart:async';
-
-import 'package:dafl_project_flutter/persistence/database_connexion.dart';
-import 'package:postgresql2/postgresql.dart';
-
-import '../lib/persistence/database_saver.dart';
-
-
-void main() async{
- DatabaseConnexion d = DatabaseConnexion();
-
- final conn = await d.initConnexion();
-
- conn.query('select * from utilisateur').toList().then((rows) {
- for (var row in rows) {
- print(row[0]); // Or by column index.
- }
- });
-
-}