Shows code version in settings as well as

This commit is contained in:
bluearevalo 2024-06-24 11:52:47 -04:00
parent 27504ee6af
commit 516c13aafd
3 changed files with 105 additions and 12 deletions

View file

@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "qaml-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/qaml-ai/qaml-swift",
"state" : {
"branch" : "next",
"revision" : "34ee0823225a19641f03a2a38508fabfd484bdc2"
}
}
],
"version" : 2
}

View file

@ -10,6 +10,9 @@ import 'package:go_router/go_router.dart';
import 'package:matrix/matrix.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:package_info_plus/package_info_plus.dart'; //adding to check app version
import 'settings.dart';
class SettingsView extends StatelessWidget {
@ -17,6 +20,14 @@ class SettingsView extends StatelessWidget {
const SettingsView(this.controller, {super.key});
Future<String> getAppVersion() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
return 'Version: ${packageInfo.version}+${packageInfo.buildNumber}';
}
@override
Widget build(BuildContext context) {
// #Pangea
@ -44,6 +55,8 @@ class SettingsView extends StatelessWidget {
key: const Key('SettingsListViewContent'),
children: <Widget>[
FutureBuilder<Profile>(
future: controller.profileFuture,
builder: (context, snapshot) {
final profile = snapshot.data;
@ -136,6 +149,8 @@ class SettingsView extends StatelessWidget {
],
);
},
),
// #Pangea
// Divider(
@ -239,17 +254,41 @@ class SettingsView extends StatelessWidget {
// onTap: () => PlatformInfos.showDialog(context),
// trailing: const Icon(Icons.chevron_right_outlined),
// ),
ListTile(
leading: const Icon(Icons.shield_outlined),
title: Text(L10n.of(context)!.termsAndConditions),
onTap: () => launchUrlString(AppConfig.termsOfServiceUrl),
trailing: const Icon(Icons.open_in_new_outlined),
),
// Adding the FutureBuilder here
FutureBuilder<String>(
future: getAppVersion(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return ListTile(
leading: Icon(Icons.info_outline),
title: Text(snapshot.data ?? 'Version Not Found'),
);
} else if (snapshot.hasError) {
return ListTile(
leading: Icon(Icons.error_outline),
title: Text('Failed to fetch version'),
);
} else {
return ListTile(
leading: CircularProgressIndicator(),
title: Text('Fetching version...'),
);
}
},
),
// Conditional ListTile based on the environment (staging or not)
if (Environment.isStaging)
ListTile(
leading: const Icon(Icons.shield_outlined),
title: Text(L10n.of(context)!.termsAndConditions),
onTap: () => launchUrlString(AppConfig.termsOfServiceUrl),
trailing: const Icon(Icons.open_in_new_outlined),
leading: const Icon(Icons.bug_report_outlined),
title: Text(L10n.of(context)!.connectedToStaging),
),
if (Environment.isStaging)
ListTile(
leading: const Icon(Icons.bug_report_outlined),
title: Text(L10n.of(context)!.connectedToStaging),
),
// Pangea#
],
),

View file

@ -349,10 +349,10 @@ packages:
dependency: "direct main"
description:
name: emoji_picker_flutter
sha256: "839200a2bd1af9a65d71133a5a246dbf5b24f7e4f6f4c5390130c2e0ed5f85af"
sha256: "7c6681783e06710608df27be0e38aa4ba73ca1ccac370bb0e7a1320723ae4bca"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.1.1"
emoji_proposal:
dependency: "direct main"
description:
@ -975,6 +975,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
globbing:
dependency: transitive
description:
name: globbing
sha256: "4f89cfaf6fa74c9c1740a96259da06bd45411ede56744e28017cc534a12b6e2d"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
go_router:
dependency: "direct main"
description:
@ -1167,6 +1175,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.3.8+1"
injector:
dependency: transitive
description:
name: injector
sha256: ed389bed5b48a699d5b9561c985023d0d5cc88dd5ff2237aadcce5a5ab433e4e
url: "https://pub.dev"
source: hosted
version: "3.0.0"
integration_test:
dependency: "direct dev"
description: flutter
@ -1749,6 +1765,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
properties:
dependency: transitive
description:
name: properties
sha256: "333f427dd4ed07bdbe8c75b9ff864a1e70b5d7a8426a2e8bdd457b65ae5ac598"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
provider:
dependency: "direct main"
description:
@ -1949,6 +1973,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "8.2.0"
sentry_dart_plugin:
dependency: "direct dev"
description:
name: sentry_dart_plugin
sha256: e81fa3e0ffabd04fdcfbfecd6468d4a342f02ab33edca09708c61bcd2be42b7d
url: "https://pub.dev"
source: hosted
version: "1.7.1"
sentry_flutter:
dependency: "direct main"
description:
@ -2234,6 +2266,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.0+1"
system_info2:
dependency: transitive
description:
name: system_info2
sha256: "65206bbef475217008b5827374767550a5420ce70a04d2d7e94d1d2253f3efc9"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
tar:
dependency: transitive
description:
@ -2692,4 +2732,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.19.3"
flutter: ">=3.19.0"