From f8514daf7a49750b3bc22233d919c4292a2098e7 Mon Sep 17 00:00:00 2001 From: axtlos Date: Thu, 21 Apr 2022 18:38:14 +0200 Subject: [PATCH] (maybe) fix password issue --- jade_log.txt | 10 +- lib/functions/install.dart | 2 +- lib/functions/locale.dart | 8 + lib/functions/location/location.dart | 223 --------------------------- lib/functions/location/region.dart | 70 --------- lib/main.dart | 10 +- 6 files changed, 23 insertions(+), 300 deletions(-) delete mode 100644 lib/functions/location/location.dart delete mode 100644 lib/functions/location/region.dart diff --git a/jade_log.txt b/jade_log.txt index c68d39f..3d4fff2 100644 --- a/jade_log.txt +++ b/jade_log.txt @@ -1,3 +1,9 @@ -Chosen location: Africa -Chosen Region: Johannesburg \ No newline at end of file +Chosen location: Asia +Chosen Region: Aqtau +Chosen layout: at +Chosen variant: normal +Username: e +Username: +Username: u +Enable sudo: true \ No newline at end of file diff --git a/lib/functions/install.dart b/lib/functions/install.dart index 2bd3ea4..449d0b4 100644 --- a/lib/functions/install.dart +++ b/lib/functions/install.dart @@ -12,7 +12,7 @@ test(setOutput, running, setRunning, config, writeToLog) async { writeToLog("Json config: $config"); var process = await Process.start('pkexec', ['jade', 'config', '/tmp/jade.json']); - //await Process.start('/opt/jade_gui/scripts/jadeemu.sh', []); + //await Process.start('/opt/jade_gui/scripts/jadeemu.sh', []); process.stdout.transform(utf8.decoder).forEach(setOutput); setRunning(true); } diff --git a/lib/functions/locale.dart b/lib/functions/locale.dart index 9e8aa59..bcc8148 100644 --- a/lib/functions/locale.dart +++ b/lib/functions/locale.dart @@ -5,6 +5,14 @@ import 'package:jade_gui/classes/location.dart'; Local chosenLocation = locations[0]; Location chosenRegion = locations[0].location[0]; +String getChosenLocation() { + return chosenLocation.name; +} + +Location getSelectedLocPack() { + return chosenRegion; +} + Widget regionTemplate(variant, chosenLayout, nextPage, writeToLog) { return Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, diff --git a/lib/functions/location/location.dart b/lib/functions/location/location.dart deleted file mode 100644 index 94c6edb..0000000 --- a/lib/functions/location/location.dart +++ /dev/null @@ -1,223 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:jade_gui/locales/locales.dart'; -import 'package:jade_gui/classes/location.dart'; - -Location choosenLocPack = const Location(); -Widget locationTemplate(location, nextSlide) { - return Container( - padding: const EdgeInsets.all(8), - color: const Color.fromARGB(100, 169, 0, 255), - child: Container( - padding: const EdgeInsets.all(8), - color: const Color.fromARGB(100, 169, 0, 255), - child: ElevatedButton( - onPressed: () { - nextSlide(); - choosenLocPack = location; - }, - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: const Color.fromARGB(100, 169, 0, 255), - padding: const EdgeInsets.all(10), - ), - child: Column( - children: [ - Image( - image: AssetImage( - '${location.image}', - ), - height: 300, - width: 300, - ), - Text(location.location, - style: const TextStyle( - fontWeight: FontWeight.bold, - )), - ], - ), - ), - ), - ); -} - -Widget location(region, nextSlide) { - return SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const SizedBox(height: 20), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'Please choose your Locale', - style: TextStyle( - fontSize: 50, - fontWeight: FontWeight.bold, - color: Color.fromARGB(255, 169, 0, 255)), - ), - Text( - '$region/', - style: const TextStyle( - fontSize: 30, color: Color.fromARGB(255, 169, 0, 255)), - ) - ], - ), - const SizedBox(height: 10), - GridView.count( - primary: false, - padding: const EdgeInsets.all(20), - shrinkWrap: true, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - crossAxisCount: 3, - children: options(region, locations, nextSlide), - ), - ], - ), - ); -} - -List options(region, locations, nextSlide) { - List widget; - - switch (region) { - case "Africa": - { - widget = locations[0] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "America": - { - widget = locations[1] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Antarctica": - { - widget = locations[2] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Arctic": - { - widget = locations[3] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Asia": - { - widget = locations[4] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Atlantic": - { - widget = locations[5] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Australia": - { - widget = locations[6] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Brazil": - { - widget = locations[7] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Canada": - { - widget = locations[8] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Chile": - { - widget = locations[9] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Europe": - { - widget = locations[10] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Indian": - { - widget = locations[11] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Mexico": - { - widget = locations[12] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "Pacific": - { - widget = locations[13] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - case "US": - { - widget = locations[14] - .location - .map((location) => locationTemplate(location, nextSlide)) - .toList(); - break; - } - default: - widget = const [ - Text( - 'You should not see this, report this at git.tar.black/crystal/jade_gui', - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: Colors.red, - ), - ), - ]; - } - // Finally returning a Widget - return widget; -} - -Location getSelectedLocPack() { - return choosenLocPack; -} diff --git a/lib/functions/location/region.dart b/lib/functions/location/region.dart deleted file mode 100644 index b6fe720..0000000 --- a/lib/functions/location/region.dart +++ /dev/null @@ -1,70 +0,0 @@ -import 'package:flutter/material.dart'; - -String selectedRegion = ""; - -Widget locationTemplate(next, location) { - return Container( - padding: const EdgeInsets.all(8), - color: const Color.fromARGB(100, 169, 0, 255), - child: Container( - padding: const EdgeInsets.all(8), - color: const Color.fromARGB(100, 169, 0, 255), - child: ElevatedButton( - onPressed: () { - next(); - selectedRegion = location.name; - }, - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: const Color.fromARGB(100, 169, 0, 255), - padding: const EdgeInsets.all(10), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(location.name), - ], - ), - ), - ), - ); -} - -Widget region(next, locations) { - return SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - Text( - 'Please choose your Locale', - style: TextStyle( - fontSize: 50, - fontWeight: FontWeight.bold, - color: Color.fromARGB(255, 169, 0, 255)), - ), - ], - ), - const SizedBox(height: 10), - GridView.count( - primary: false, - padding: const EdgeInsets.all(20), - shrinkWrap: true, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - crossAxisCount: 3, - children: locations - .map((location) => locationTemplate(next, location)) - .toList(), - ), - ], - ), - ); -} - -String getSelectedRegion() { - return selectedRegion; -} diff --git a/lib/main.dart b/lib/main.dart index 4266826..4646837 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:jade_gui/functions/location/location.dart'; import 'package:jade_gui/functions/welcome.dart'; import 'package:jade_gui/functions/locale.dart'; import 'package:jade_gui/functions/keyboard.dart'; @@ -15,6 +14,8 @@ import 'package:jade_gui/desktops/desktops.dart'; import 'dart:io'; +Map env = Platform.environment; + Future checkIsEfi( setState, runningEfi, @@ -36,7 +37,9 @@ Future checkIsEfi( } Future writeToLog(String message) async { - await File('jade_log.txt').readAsString().then((String contents) { + await File('${env["HOME"]}/jade_log.txt') + .readAsString() + .then((String contents) { File("jade_log.txt").writeAsString(contents + "\n" + message); }); } @@ -55,7 +58,7 @@ Future setPassword(clearPass, setState) async { return result.stdout; }); debugPrint(password); - setState(password); + setState(password.replaceAll("\n", "")); } class Jadegui extends StatefulWidget { @@ -405,7 +408,6 @@ class _JadeguiState extends State { }); }, ); - break; case 4: debugPrint(password);