Minor fixes

This commit is contained in:
Alessandro Autiero
2023-06-04 00:52:31 +02:00
parent 30f1b0f162
commit 0f7d47ef10
11 changed files with 361 additions and 284 deletions

View File

@@ -43,7 +43,6 @@ void main() async {
Get.put(SettingsController()); Get.put(SettingsController());
Get.put(HostingController()); Get.put(HostingController());
doWhenWindowReady(() { doWhenWindowReady(() {
appWindow.minSize = const Size(kDefaultWindowWidth, kDefaultWindowHeight);
var controller = Get.find<SettingsController>(); var controller = Get.find<SettingsController>();
var size = Size(controller.width, controller.height); var size = Size(controller.width, controller.height);
var window = appWindow as WinDesktopWindow; var window = appWindow as WinDesktopWindow;

View File

@@ -36,7 +36,7 @@ Future<void> startGame() async {
stdout.writeln("No username was specified, using $username by default. Use --username to specify one"); stdout.writeln("No username was specified, using $username by default. Use --username to specify one");
} }
_gameProcess = await Process.start(gamePath, createRebootArgs(username!, host, "")) _gameProcess = await Process.start(gamePath, createRebootArgs(username!, "", host, ""))
..exitCode.then((_) => _onClose()) ..exitCode.then((_) => _onClose())
..outLines.forEach((line) => _onGameOutput(line, dll, host, verbose)); ..outLines.forEach((line) => _onGameOutput(line, dll, host, verbose));
} }

View File

@@ -103,6 +103,7 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
appBar: NavigationAppBar( appBar: NavigationAppBar(
title: _draggableArea, title: _draggableArea,
actions: WindowTitleBar(focused: _focused()), actions: WindowTitleBar(focused: _focused()),
automaticallyImplyLeading: false,
leading: _backButton leading: _backButton
), ),
pane: NavigationPane( pane: NavigationPane(
@@ -119,7 +120,8 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
transitionBuilder: (child, animation) => child transitionBuilder: (child, animation) => child
)) ))
), ),
Obx(() => isWin11 && _focused.value ? const WindowBorder() : const SizedBox()) if(isWin11)
Obx(() => _focused.value ? const WindowBorder() : const SizedBox())
] ]
); );
} }
@@ -129,13 +131,15 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
entry.value; entry.value;
} }
var onBack = _onBack();
return PaneItem( return PaneItem(
enabled: onBack != null,
icon: const Icon(FluentIcons.back, size: 14.0), icon: const Icon(FluentIcons.back, size: 14.0),
body: const SizedBox.shrink(), body: const SizedBox.shrink(),
).build( ).build(
context, context,
false, false,
_onBack(), onBack,
displayMode: PaneDisplayMode.compact displayMode: PaneDisplayMode.compact
); );
}); });
@@ -157,7 +161,10 @@ class _HomePageState extends State<HomePage> with WindowListener, AutomaticKeepA
}; };
} }
void _onIndexChanged(int index) => _index.value = index; void _onIndexChanged(int index) {
_navigationStatus[_index()].value = false;
_index.value = index;
}
TextBox get _autoSuggestBox => TextBox( TextBox get _autoSuggestBox => TextBox(
key: _searchKey, key: _searchKey,

View File

@@ -7,11 +7,8 @@ import 'package:reboot_launcher/src/ui/widget/home/version_selector.dart';
import 'package:reboot_launcher/src/ui/widget/shared/setting_tile.dart'; import 'package:reboot_launcher/src/ui/widget/shared/setting_tile.dart';
import '../../model/update_status.dart'; import '../../model/update_status.dart';
import '../../util/reboot.dart';
import '../controller/update_controller.dart';
import 'browse_page.dart'; import 'browse_page.dart';
class HostingPage extends StatefulWidget { class HostingPage extends StatefulWidget {
final GlobalKey<NavigatorState> navigatorKey; final GlobalKey<NavigatorState> navigatorKey;
final RxBool nestedNavigation; final RxBool nestedNavigation;
@@ -34,6 +31,20 @@ class _HostingPageState extends State<HostingPage> with AutomaticKeepAliveClient
return Obx(() => !_settingsController.autoUpdate() || _hostingController.updateStatus().isDone() ? _body : _updateScreen); return Obx(() => !_settingsController.autoUpdate() || _hostingController.updateStatus().isDone() ? _body : _updateScreen);
} }
Widget get _updateScreen => const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ProgressRing(),
SizedBox(height: 16.0),
Text("Updating Reboot DLL...")
],
),
],
);
Widget get _body => Navigator( Widget get _body => Navigator(
key: widget.navigatorKey, key: widget.navigatorKey,
initialRoute: "home", initialRoute: "home",
@@ -49,17 +60,37 @@ class _HostingPageState extends State<HostingPage> with AutomaticKeepAliveClient
Widget _createScreen(String? name) { Widget _createScreen(String? name) {
switch(name){ switch(name){
case "home": case "home":
return _homeScreen; return _HostPage(widget.navigatorKey, widget.nestedNavigation);
case "browse": case "browse":
return const BrowsePage(); return const BrowsePage();
default: default:
throw Exception("Unknown page: $name"); throw Exception("Unknown page: $name");
} }
} }
}
Widget get _homeScreen => Column( class _HostPage extends StatefulWidget {
crossAxisAlignment: CrossAxisAlignment.start, final GlobalKey<NavigatorState> navigatorKey;
mainAxisSize: MainAxisSize.max, final RxBool nestedNavigation;
const _HostPage(this.navigatorKey, this.nestedNavigation, {Key? key}) : super(key: key);
@override
State<_HostPage> createState() => _HostPageState();
}
class _HostPageState extends State<_HostPage> with AutomaticKeepAliveClientMixin {
final HostingController _hostingController = Get.find<HostingController>();
@override
bool get wantKeepAlive => true;
@override
Widget build(BuildContext context) {
super.build(context);
return Column(
children: [
Expanded(
child: ListView(
children: [ children: [
Obx(() => SizedBox( Obx(() => SizedBox(
width: double.infinity, width: double.infinity,
@@ -145,33 +176,24 @@ class _HostingPageState extends State<HostingPage> with AutomaticKeepAliveClient
child: const Text("Browse") child: const Text("Browse")
) )
), ),
const Expanded(child: SizedBox()), ],
),
),
const SizedBox(
height: 8.0,
),
const LaunchButton( const LaunchButton(
host: true host: true
) )
], ],
); );
}
InfoBar get _rebootGuiInfo => const InfoBar( InfoBar get _rebootGuiInfo => const InfoBar(
title: Text("A window will pop up after the game server is started to modify its in-game settings"), title: Text("A window will pop up after the game server is started to modify its in-game settings"),
severity: InfoBarSeverity.info severity: InfoBarSeverity.info
); );
Widget get _updateScreen => const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ProgressRing(),
SizedBox(height: 16.0),
Text("Updating Reboot DLL...")
],
),
],
);
Widget get _updateError => MouseRegion( Widget get _updateError => MouseRegion(
cursor: SystemMouseCursors.click, cursor: SystemMouseCursors.click,
child: GestureDetector( child: GestureDetector(

View File

@@ -69,7 +69,9 @@ class _GamePageState extends State<_GamePage> {
@override @override
Widget build(BuildContext context) => Column( Widget build(BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.start, children: [
Expanded(
child: ListView(
children: [ children: [
SettingTile( SettingTile(
title: "Credentials", title: "Credentials",
@@ -167,8 +169,13 @@ class _GamePageState extends State<_GamePage> {
isChild: true isChild: true
) )
] ]
)
],
),
),
const SizedBox(
height: 8.0,
), ),
const Expanded(child: SizedBox()),
const LaunchButton( const LaunchButton(
host: false host: false
) )

View File

@@ -29,7 +29,9 @@ class _ServerPageState extends State<ServerPage> with AutomaticKeepAliveClientMi
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Obx(() => Column( return Obx(() => Column(
crossAxisAlignment: CrossAxisAlignment.start, children: [
Expanded(
child: ListView(
children: [ children: [
const SizedBox( const SizedBox(
width: double.infinity, width: double.infinity,
@@ -93,9 +95,14 @@ class _ServerPageState extends State<ServerPage> with AutomaticKeepAliveClientMi
child: const Text("Open") child: const Text("Open")
) )
), ),
const Expanded(child: SizedBox()),
const ServerButton()
] ]
),
),
const SizedBox(
height: 8.0,
),
ServerButton()
],
)); ));
} }

View File

@@ -33,8 +33,7 @@ class _SettingsPageState extends State<SettingsPage> with AutomaticKeepAliveClie
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Column( return ListView(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
SettingTile( SettingTile(
title: "File settings", title: "File settings",

View File

@@ -185,7 +185,7 @@ class _LaunchButtonState extends State<LaunchButton> {
} }
Future<Process> _createGameProcess(String gamePath, bool host) async { Future<Process> _createGameProcess(String gamePath, bool host) async {
var gameArgs = createRebootArgs(_safeUsername, host, _gameController.customLaunchArgs.text); var gameArgs = createRebootArgs(_safeUsername, _gameController.password.text, host, _gameController.customLaunchArgs.text);
var gameProcess = await Process.start(gamePath, gameArgs); var gameProcess = await Process.start(gamePath, gameArgs);
gameProcess gameProcess
..exitCode.then((_) => _onEnd()) ..exitCode.then((_) => _onEnd())

View File

@@ -0,0 +1,31 @@
import 'package:fluent_ui/fluent_ui.dart';
class SquaredPaneItem extends PaneItem {
SquaredPaneItem({
super.key,
required super.title,
required super.icon,
required super.body,
});
@override
Widget build(
BuildContext context,
bool selected,
VoidCallback? onPressed, {
PaneDisplayMode? displayMode,
bool showTextOnTop = true,
int? itemIndex,
bool? autofocus,
}) {
return Column(
children: [
SizedBox.square(
dimension: 48,
child: icon
),
title!
],
);
}
}

View File

@@ -82,9 +82,13 @@ Future<void> resetWinNat() async {
await runElevated(binary.path, ""); await runElevated(binary.path, "");
} }
List<String> createRebootArgs(String username, bool host, String additionalArgs) { List<String> createRebootArgs(String username, String password, bool host, String additionalArgs) {
if(password.isNotEmpty) {
username = username.isEmpty ? kDefaultPlayerName : username; username = username.isEmpty ? kDefaultPlayerName : username;
username = host ? "$username${Random().nextInt(1000)}" : username; username = host ? "$username${Random().nextInt(1000)}" : username;
username = '$username@projectreboot.dev';
}
password = password.isNotEmpty ? password : "Rebooted";
var args = [ var args = [
"-epicapp=Fortnite", "-epicapp=Fortnite",
"-epicenv=Prod", "-epicenv=Prod",
@@ -95,8 +99,8 @@ List<String> createRebootArgs(String username, bool host, String additionalArgs)
"-fromfl=eac", "-fromfl=eac",
"-fltoken=3db3ba5dcbd2e16703f3978d", "-fltoken=3db3ba5dcbd2e16703f3978d",
"-caldera=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiYmU5ZGE1YzJmYmVhNDQwN2IyZjQwZWJhYWQ4NTlhZDQiLCJnZW5lcmF0ZWQiOjE2Mzg3MTcyNzgsImNhbGRlcmFHdWlkIjoiMzgxMGI4NjMtMmE2NS00NDU3LTliNTgtNGRhYjNiNDgyYTg2IiwiYWNQcm92aWRlciI6IkVhc3lBbnRpQ2hlYXQiLCJub3RlcyI6IiIsImZhbGxiYWNrIjpmYWxzZX0.VAWQB67RTxhiWOxx7DBjnzDnXyyEnX7OljJm-j2d88G_WgwQ9wrE6lwMEHZHjBd1ISJdUO1UVUqkfLdU5nofBQ", "-caldera=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50X2lkIjoiYmU5ZGE1YzJmYmVhNDQwN2IyZjQwZWJhYWQ4NTlhZDQiLCJnZW5lcmF0ZWQiOjE2Mzg3MTcyNzgsImNhbGRlcmFHdWlkIjoiMzgxMGI4NjMtMmE2NS00NDU3LTliNTgtNGRhYjNiNDgyYTg2IiwiYWNQcm92aWRlciI6IkVhc3lBbnRpQ2hlYXQiLCJub3RlcyI6IiIsImZhbGxiYWNrIjpmYWxzZX0.VAWQB67RTxhiWOxx7DBjnzDnXyyEnX7OljJm-j2d88G_WgwQ9wrE6lwMEHZHjBd1ISJdUO1UVUqkfLdU5nofBQ",
"-AUTH_LOGIN=$username@projectreboot.dev", "-AUTH_LOGIN=$username",
"-AUTH_PASSWORD=Rebooted", "-AUTH_PASSWORD=${password.isNotEmpty ? password : "Rebooted"}",
"-AUTH_TYPE=epic" "-AUTH_TYPE=epic"
]; ];

View File

@@ -42,6 +42,7 @@ dependencies:
uuid: ^3.0.6 uuid: ^3.0.6
supabase_flutter: ^1.10.0 supabase_flutter: ^1.10.0
supabase: ^1.9.1 supabase: ^1.9.1
fluentui_system_icons: ^1.1.202
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: