chore: reintegrate environment and flavor loading

This commit is contained in:
Jagandeep Brar
2022-05-02 20:29:58 -04:00
parent 1842e286ba
commit d735f37200
14 changed files with 144 additions and 138 deletions

View File

@@ -2,6 +2,9 @@ import 'package:flutter/material.dart';
import 'package:lunasea/core.dart';
import 'package:lunasea/modules/settings.dart';
import '../../../../system/build/environment.dart';
import '../../../../system/build/flavor.dart';
class SettingsHomeRouter extends SettingsPageRouter {
SettingsHomeRouter() : super('/settings');
@@ -92,7 +95,7 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
trailing: const LunaIconButton(icon: Icons.settings_rounded),
onTap: () async => SettingsSystemRouter().navigateTo(context),
),
if (LunaFlavor().isLowerOrEqualTo(LunaEnvironment.EDGE))
if (LunaEnvironment().isFlavorSupported(LunaFlavor.EDGE))
LunaBlock(
title: 'settings.DebugMenu'.tr(),
body: [TextSpan(text: 'settings.DebugMenuDescription'.tr())],

View File

@@ -3,6 +3,8 @@ import 'package:lunasea/core.dart';
import 'package:lunasea/modules/settings.dart';
import '../../../../core/cache/image_cache/image_cache.dart';
import '../../../../system/build/environment.dart';
import '../../../../system/build/flavor.dart';
class SettingsSystemRouter extends SettingsPageRouter {
SettingsSystemRouter() : super('/settings/system');
@@ -56,7 +58,9 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
}
Widget _versionInformation() {
LunaFlavor _flavor = LunaFlavor();
LunaEnvironment _env = LunaEnvironment();
LunaFlavor _flavor = LunaFlavor.EDGE.from(LunaEnvironment.flavor);
return FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (context, AsyncSnapshot<PackageInfo> snapshot) {
@@ -67,12 +71,12 @@ class _State extends State<_Widget> with LunaScrollControllerMixin {
title: 'Version: $version',
body: [
TextSpan(
text: _flavor.isLowerOrEqualTo(LunaEnvironment.CANDIDATE)
? '${_flavor.environment.name} (${_flavor.shortCommit})'
text: _env.isFlavorSupported(LunaFlavor.CANDIDATE)
? '${_flavor.name} (${_env.getShortCommit()})'
: 'settings.ViewRecentChanges'.tr(),
style: TextStyle(
fontWeight: LunaUI.FONT_WEIGHT_BOLD,
color: _flavor.environment.color,
color: _flavor.color,
),
),
],