-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from Flajt/dev
Fix: Notification issue
- Loading branch information
Showing
10 changed files
with
103 additions
and
31 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
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,12 +1,21 @@ | ||
// ignore_for_file: non_constant_identifier_names | ||
// ignore_for_file: non_constant_identifier_names, constant_identifier_names | ||
|
||
import 'dart:ui'; | ||
import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
|
||
final String GET_KEY_URL = dotenv.env["GET_KEY_URL"] ?? ""; | ||
final String CHECK_KEY_URL = dotenv.env["CHECK_KEY_URL"] ?? ""; | ||
final String SIGN_URL = dotenv.env["SIGN_URL"] ?? ""; | ||
final String VERIFY_URL = dotenv.env["VERIFY_URL"] ?? ""; | ||
final String SENTRY_DSN = dotenv.env["SENTRY_DSN"] ?? ""; | ||
const List<Locale> SUPPORTED_LOCALS = [ | ||
Locale("en"), | ||
Locale("de"), | ||
Locale("sn"), | ||
Locale("fr"), | ||
Locale("jp"), | ||
Locale("zn"), | ||
Locale("ar") | ||
]; | ||
|
||
// ignore: constant_identifier_names | ||
const String WIKI_URL = "https://github.com/Flajt/decentproof-app/wiki/FAQ"; |
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,34 @@ | ||
import 'dart:ui'; | ||
|
||
import 'package:decentproof/constants.dart'; | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:easy_localization/src/easy_localization_controller.dart'; | ||
import 'package:easy_localization/src/localization.dart'; | ||
|
||
/// Load translations from assets and keep them in memory | ||
/// Can be used to load translations in foreground services etc | ||
/// Please also use `final Localization L = Localization.instance;` in the foreground service with `L.tr("my.key")` | ||
/// See: https://github.com/aissat/easy_localization/issues/210#issuecomment-806089855 | ||
Future<void> loadTranslations() async { | ||
//this will only set EasyLocalizationController.savedLocale | ||
await EasyLocalizationController.initEasyLocation(); | ||
|
||
final controller = EasyLocalizationController( | ||
saveLocale: true, //mandatory to use EasyLocalizationController.savedLocale | ||
fallbackLocale: const Locale('en'), | ||
supportedLocales: SUPPORTED_LOCALS, | ||
assetLoader: const RootBundleAssetLoader(), | ||
useOnlyLangCode: true, | ||
useFallbackTranslations: true, | ||
path: "assets/translations", | ||
onLoadError: (e) {}, | ||
); | ||
|
||
//Load translations from assets | ||
await controller.loadTranslations(); | ||
|
||
//load translations into exploitable data, kept in memory | ||
Localization.load(controller.locale, | ||
translations: controller.translations, | ||
fallbackTranslations: controller.fallbackTranslations); | ||
} |
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,33 @@ | ||
import "package:decentproof/constants.dart"; | ||
import "package:flutter_dotenv/flutter_dotenv.dart"; | ||
import "package:test/test.dart"; | ||
|
||
// While it seems senseless at first, this is to figure out if the env vars can be accessed in the CI/CD pipeline. | ||
void main() { | ||
setUp(() async { | ||
await dotenv.load(fileName: ".env"); | ||
}); | ||
group( | ||
"Constants", | ||
() { | ||
test("SENTRY_DSN is not empty", () { | ||
expect(SENTRY_DSN, isNotEmpty); | ||
}); | ||
test("SIGN_URL is not empty", () { | ||
expect(SIGN_URL, isNotEmpty); | ||
}); | ||
test("VERIFY_URL is not empty", () { | ||
expect(VERIFY_URL, isNotEmpty); | ||
}); | ||
test("GET_KEY_URL is not empty", () { | ||
expect(GET_KEY_URL, isNotEmpty); | ||
}); | ||
test("CHECK_KEY_URL is not empty", () { | ||
expect(CHECK_KEY_URL, isNotEmpty); | ||
}); | ||
test("WIKI_URL is not empty", () { | ||
expect(WIKI_URL, isNotEmpty); | ||
}); | ||
}, | ||
); | ||
} |