add buildtime injectable build version and date
This commit is contained in:
parent
acd7fc8259
commit
40bc2a46e3
|
@ -0,0 +1,6 @@
|
|||
const dev_version = "development";
|
||||
|
||||
class EnvironmentConfig {
|
||||
static const BUILD_VER = String.fromEnvironment('BUILD_VER', defaultValue: dev_version);
|
||||
static const BUILD_DATE = String.fromEnvironment('BUILD_DATE', defaultValue: "now");
|
||||
}
|
|
@ -9,6 +9,8 @@ import 'package:path/path.dart' as path;
|
|||
import 'package:ffi/ffi.dart';
|
||||
import 'package:cwtch/cwtch/cwtch.dart';
|
||||
|
||||
import '../config.dart';
|
||||
|
||||
/////////////////////
|
||||
/// Cwtch API ///
|
||||
/////////////////////
|
||||
|
@ -84,7 +86,10 @@ class CwtchFfi implements Cwtch {
|
|||
home = (envVars['UserProfile'])!;
|
||||
bundledTor = "Tor\\Tor\\tor.exe";
|
||||
}
|
||||
var cwtchDir = path.join(home, ".cwtch/dev/");
|
||||
var cwtchDir = path.join(home, ".cwtch");
|
||||
if (EnvironmentConfig.BUILD_VER == dev_version) {
|
||||
cwtchDir = path.join(cwtchDir, "dev");
|
||||
}
|
||||
print("cwtchDir $cwtchDir");
|
||||
|
||||
var startCwtchC = library.lookup<NativeFunction<start_cwtch_function>>("c_StartCwtch");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cwtch/config.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'dart:async';
|
||||
|
@ -44,7 +45,10 @@ class CwtchGomobile implements Cwtch {
|
|||
// ignore: non_constant_identifier_names
|
||||
Future<void> Start() async {
|
||||
print("gomobile.dart: Start()...");
|
||||
var cwtchDir = path.join((await androidHomeDirectory).path, ".cwtch/dev/");
|
||||
var cwtchDir = path.join((await androidHomeDirectory).path, ".cwtch");
|
||||
if (EnvironmentConfig.BUILD_VER == dev_version) {
|
||||
cwtchDir = path.join(cwtchDir, "dev");
|
||||
}
|
||||
String torPath = path.join(await androidLibraryDir, "libtor.so");
|
||||
print("gomobile.dart: Start invokeMethod Start($cwtchDir, $torPath)...");
|
||||
cwtchPlatform.invokeMethod("Start", {"appDir": cwtchDir, "torPath": torPath});
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
|
|||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../config.dart';
|
||||
|
||||
/// Global Settings View provides access to modify all the Globally Relevant Settings including Locale, Theme and Experiments.
|
||||
class GlobalSettingsView extends StatefulWidget {
|
||||
|
@ -156,7 +157,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
|||
height: 128,
|
||||
)),
|
||||
applicationName: "Cwtch (Flutter UI)",
|
||||
applicationVersion: AppLocalizations.of(context)!.version.replaceAll("%1", constructVersionString(Provider.of<Settings>(context).packageInfo)),
|
||||
applicationVersion: AppLocalizations.of(context)!.versionBuilddate.replaceAll("%1", EnvironmentConfig.BUILD_VER).replaceAll("%2", EnvironmentConfig.BUILD_DATE),
|
||||
applicationLegalese: '\u{a9} 2021 Open Privacy Research Society',
|
||||
),
|
||||
]))));
|
||||
|
|
Loading…
Reference in New Issue