-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ff930d
commit 97eeece
Showing
187 changed files
with
4,440 additions
and
3,218 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (C) 2021 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
|
@@ -23,8 +23,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; | |
import 'package:http/http.dart' as http; | ||
import 'package:injectable/injectable.dart'; | ||
import 'package:libretrack/core/model/request_builder.dart'; | ||
import 'package:libretrack/env.dart'; | ||
import 'package:pretty_http_logger/pretty_http_logger.dart'; | ||
|
||
part 'http_client.freezed.dart'; | ||
|
||
|
@@ -118,16 +116,3 @@ class HttpClientImpl implements HttpClient { | |
@override | ||
void close() => _client.close(); | ||
} | ||
|
||
@module | ||
abstract class ClientModule { | ||
@Injectable(env: [Env.prod]) | ||
http.Client get clientProd => http.Client(); | ||
|
||
@Injectable(env: [Env.dev]) | ||
http.Client get clientDev => HttpClientWithMiddleware.build( | ||
middlewares: [ | ||
HttpLogger(logLevel: LogLevel.BODY), | ||
], | ||
); | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (C) 2021 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
|
@@ -25,8 +25,6 @@ import 'package:libretrack/core/entity/entity.dart'; | |
import 'package:libretrack/core/platform_info.dart'; | ||
import 'package:libretrack/core/storage/database.dart'; | ||
|
||
import '../../env.dart'; | ||
|
||
abstract class ServiceAuthStorage { | ||
Future<void> insert({ | ||
required TrackingServiceType type, | ||
|
@@ -212,6 +210,7 @@ Future<AuthData?> _secureStorageGet( | |
return authData.isEmpty ? null : authData; | ||
} | ||
|
||
@visibleForTesting | ||
class TestFlutterSecureStorage implements FlutterSecureStorage { | ||
final Map<String?, String?> _keyValueMap = {}; | ||
final Map<String, List<ValueChanged<String?>>> _listeners = {}; | ||
|
@@ -344,12 +343,3 @@ class TestFlutterSecureStorage implements FlutterSecureStorage { | |
_keyValueMap[key] = value; | ||
} | ||
} | ||
|
||
@module | ||
abstract class FlutterSecureStorageModule { | ||
@Injectable(env: [Env.prod, Env.dev]) | ||
FlutterSecureStorage get storage => const FlutterSecureStorage(); | ||
|
||
@Injectable(env: [Env.test]) | ||
FlutterSecureStorage get testStorage => TestFlutterSecureStorage(); | ||
} |
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,38 @@ | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
// | ||
// LibreTrack is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// LibreTrack is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with LibreTrack. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import 'dart:async'; | ||
|
||
import 'package:injectable/injectable.dart'; | ||
import 'package:libretrack/core/storage/database.dart'; | ||
import 'package:libretrack/env.dart'; | ||
|
||
@module | ||
abstract class AppDatabaseModule { | ||
@Singleton(env: [Env.prod, Env.dev]) | ||
@preResolve | ||
Future<AppDatabase> get db async => $FloorAppDatabase | ||
.databaseBuilder('libretrack.db') | ||
.addMigrations(migrations) | ||
.build(); | ||
|
||
@Singleton(env: [Env.test]) | ||
@preResolve | ||
Future<AppDatabase> get inMemoryDb async => | ||
$FloorAppDatabase.inMemoryDatabaseBuilder().build(); | ||
} |
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,35 @@ | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
// | ||
// LibreTrack is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// LibreTrack is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with LibreTrack. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import 'package:http/http.dart' as http; | ||
import 'package:injectable/injectable.dart'; | ||
import 'package:libretrack/env.dart'; | ||
import 'package:pretty_http_logger/pretty_http_logger.dart'; | ||
|
||
@module | ||
abstract class ClientModule { | ||
@Injectable(env: [Env.prod]) | ||
http.Client get clientProd => http.Client(); | ||
|
||
@Injectable(env: [Env.dev]) | ||
http.Client get clientDev => HttpClientWithMiddleware.build( | ||
middlewares: [ | ||
HttpLogger(logLevel: LogLevel.BODY), | ||
], | ||
); | ||
} |
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,31 @@ | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
// | ||
// LibreTrack is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// LibreTrack is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with LibreTrack. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import 'package:flutter_secure_storage/flutter_secure_storage.dart'; | ||
import 'package:injectable/injectable.dart'; | ||
import 'package:libretrack/core/storage/service_auth_storage.dart'; | ||
import 'package:libretrack/env.dart'; | ||
|
||
@module | ||
abstract class FlutterSecureStorageModule { | ||
@Injectable(env: [Env.prod, Env.dev]) | ||
FlutterSecureStorage get storage => const FlutterSecureStorage(); | ||
|
||
@Injectable(env: [Env.test]) | ||
FlutterSecureStorage get testStorage => TestFlutterSecureStorage(); | ||
} |
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,57 @@ | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
// | ||
// LibreTrack is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// LibreTrack is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with LibreTrack. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import 'package:injectable/injectable.dart'; | ||
import 'package:libretrack/core/settings/settings.dart'; | ||
import 'package:libretrack/core/settings/shared_pref_migrator.dart'; | ||
import 'package:libretrack/env.dart'; | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
|
||
@module | ||
abstract class SharedPreferencesModule { | ||
@Singleton(env: [Env.prod, Env.dev]) | ||
@preResolve | ||
Future<SharedPreferences> get prefOld async => | ||
SharedPreferences.getInstance(); | ||
|
||
@Singleton(env: [Env.prod, Env.dev]) | ||
@preResolve | ||
Future<SharedPreferencesAsync> pref(SharedPreferences prefOld) async { | ||
final pref = SharedPreferencesAsync(); | ||
final migrator = SharedPreferencesMigrator( | ||
oldPrefs: prefOld, | ||
newPrefs: pref, | ||
); | ||
await migrator.migrate(); | ||
|
||
return pref; | ||
} | ||
|
||
@Singleton(env: [Env.test]) | ||
@preResolve | ||
Future<SharedPreferencesAsync> get testPref async => | ||
TestSharedPreferencesAsync(); | ||
|
||
@Singleton(env: [Env.test]) | ||
@preResolve | ||
Future<SharedPreferences> get testOldPref async { | ||
// ignore: invalid_use_of_visible_for_testing_member | ||
SharedPreferences.setMockInitialValues({}); | ||
return SharedPreferences.getInstance(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// Copyright (C) 2021 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021-2024 Yaroslav Pronin <[email protected]> | ||
// Copyright (C) 2021 Insurgo Inc. <[email protected]> | ||
// | ||
// This file is part of LibreTrack. | ||
|
@@ -16,5 +16,6 @@ | |
// You should have received a copy of the GNU General Public License | ||
// along with LibreTrack. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
export 'about_cubit.dart'; | ||
export 'about_page.dart'; | ||
export 'model/about_cubit.dart'; | ||
export 'model/about_state.dart'; |
Oops, something went wrong.