mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 03:02:22 +01:00
Final version
This commit is contained in:
@@ -9,6 +9,7 @@ import 'package:flutter_localized_locales/flutter_localized_locales.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
|
import 'package:reboot_launcher/src/controller/info_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/matchmaker_controller.dart';
|
import 'package:reboot_launcher/src/controller/matchmaker_controller.dart';
|
||||||
import 'package:reboot_launcher/src/controller/update_controller.dart';
|
import 'package:reboot_launcher/src/controller/update_controller.dart';
|
||||||
import 'package:reboot_launcher/src/dialog/abstract/info_bar.dart';
|
import 'package:reboot_launcher/src/dialog/abstract/info_bar.dart';
|
||||||
@@ -173,6 +174,7 @@ Future<Object?> _initStorage() async {
|
|||||||
Get.put(BuildController());
|
Get.put(BuildController());
|
||||||
Get.put(SettingsController());
|
Get.put(SettingsController());
|
||||||
Get.put(HostingController());
|
Get.put(HostingController());
|
||||||
|
Get.put(InfoController());
|
||||||
var updateController = UpdateController();
|
var updateController = UpdateController();
|
||||||
Get.put(updateController);
|
Get.put(updateController);
|
||||||
updateController.update();
|
updateController.update();
|
||||||
|
|||||||
@@ -16,9 +16,4 @@ class BuildController extends GetxController {
|
|||||||
}
|
}
|
||||||
selectedBuild.value = builds[0];
|
selectedBuild.value = builds[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset(){
|
|
||||||
_builds = null;
|
|
||||||
selectedBuild.value = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
9
gui/lib/src/controller/info_controller.dart
Normal file
9
gui/lib/src/controller/info_controller.dart
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:reboot_common/common.dart';
|
||||||
|
|
||||||
|
class InfoController extends GetxController {
|
||||||
|
List<String>? links;
|
||||||
|
Map<String, String> linksData;
|
||||||
|
|
||||||
|
InfoController() : linksData = {};
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import 'package:get_storage/get_storage.dart';
|
|||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:reboot_common/common.dart';
|
import 'package:reboot_common/common.dart';
|
||||||
import 'package:reboot_launcher/main.dart';
|
import 'package:reboot_launcher/main.dart';
|
||||||
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
|
|
||||||
class SettingsController extends GetxController {
|
class SettingsController extends GetxController {
|
||||||
late final GetStorage _storage;
|
late final GetStorage _storage;
|
||||||
@@ -39,12 +40,10 @@ class SettingsController extends GetxController {
|
|||||||
firstRun.listen((value) => _storage.write("first_run", value));
|
firstRun.listen((value) => _storage.write("first_run", value));
|
||||||
themeMode = Rx(ThemeMode.values.elementAt(_storage.read("theme") ?? 0));
|
themeMode = Rx(ThemeMode.values.elementAt(_storage.read("theme") ?? 0));
|
||||||
themeMode.listen((value) => _storage.write("theme", value.index));
|
themeMode.listen((value) => _storage.write("theme", value.index));
|
||||||
language = RxString(_storage.read("language") ?? _defaultLocale);
|
language = RxString(_storage.read("language") ?? currentLocale);
|
||||||
language.listen((value) => _storage.write("language", value));
|
language.listen((value) => _storage.write("language", value));
|
||||||
}
|
}
|
||||||
|
|
||||||
String get _defaultLocale => Intl.getCurrentLocale().split("_")[0];
|
|
||||||
|
|
||||||
TextEditingController _createController(String key, String name) {
|
TextEditingController _createController(String key, String name) {
|
||||||
var controller = TextEditingController(text: _storage.read(key) ?? _controllerDefaultPath(name));
|
var controller = TextEditingController(text: _storage.read(key) ?? _controllerDefaultPath(name));
|
||||||
controller.addListener(() => _storage.write(key, controller.text));
|
controller.addListener(() => _storage.write(key, controller.text));
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:markdown_widget/widget/markdown.dart';
|
||||||
|
import 'package:reboot_common/common.dart';
|
||||||
|
import 'package:reboot_launcher/src/controller/info_controller.dart';
|
||||||
import 'package:reboot_launcher/src/page/abstract/page.dart';
|
import 'package:reboot_launcher/src/page/abstract/page.dart';
|
||||||
import 'package:reboot_launcher/src/page/abstract/page_setting.dart';
|
import 'package:reboot_launcher/src/page/abstract/page_setting.dart';
|
||||||
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
import 'package:reboot_launcher/src/page/abstract/page_type.dart';
|
||||||
import 'package:reboot_launcher/src/util/translations.dart';
|
import 'package:reboot_launcher/src/util/translations.dart';
|
||||||
import 'package:reboot_launcher/src/util/tutorial.dart';
|
|
||||||
import 'package:reboot_launcher/src/widget/common/setting_tile.dart';
|
import 'package:reboot_launcher/src/widget/common/setting_tile.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:skeletons/skeletons.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class InfoPage extends RebootPage {
|
class InfoPage extends RebootPage {
|
||||||
const InfoPage({Key? key}) : super(key: key);
|
const InfoPage({Key? key}) : super(key: key);
|
||||||
@@ -30,101 +38,86 @@ class InfoPage extends RebootPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _InfoPageState extends RebootPageState<InfoPage> {
|
class _InfoPageState extends RebootPageState<InfoPage> {
|
||||||
@override
|
final InfoController _infoController = Get.find<InfoController>();
|
||||||
Widget? get button => null;
|
late Future<List<String>> _fetchFuture;
|
||||||
|
late double _height;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<SettingTile> get settings => [
|
void initState() {
|
||||||
SettingTile(
|
_fetchFuture = _infoController.links != null
|
||||||
title: 'What is Project Reboot?',
|
? Future.value(_infoController.links)
|
||||||
subtitle: 'Project Reboot allows anyone to easily host a game server for most of Fortnite\'s seasons. '
|
: _initQuery();
|
||||||
'The project was started on Discord by Milxnor. '
|
super.initState();
|
||||||
'The project is no longer being actively maintained.',
|
}
|
||||||
titleStyle: FluentTheme
|
|
||||||
.of(context)
|
Future<List<String>> _initQuery() async {
|
||||||
.typography
|
var response = await http.get(Uri.parse("https://api.github.com/repos/Auties00/reboot_launcher/contents/documentation/$currentLocale"));
|
||||||
.title,
|
List<String> results = jsonDecode(response.body)
|
||||||
contentWidth: null,
|
.map<String>((entry) => entry["download_url"] as String)
|
||||||
),
|
.toList();
|
||||||
SettingTile(
|
return _infoController.links = results;
|
||||||
title: 'What is a game server?',
|
}
|
||||||
subtitle: 'When you join a Fortnite Game, your client connects to a game server that allows you to play with others. '
|
|
||||||
'You can join someone else\'s game server, or host one on your PC by going to the "Host" tab. ',
|
Future<String> _readLink(String url) async {
|
||||||
titleStyle: FluentTheme
|
var known = _infoController.linksData[url];
|
||||||
.of(context)
|
if(known != null) {
|
||||||
.typography
|
return known;
|
||||||
.title,
|
}
|
||||||
contentWidth: null,
|
|
||||||
),
|
var response = await http.get(Uri.parse(url));
|
||||||
SettingTile(
|
return _infoController.linksData[url] = response.body;
|
||||||
title: 'What is a client?',
|
}
|
||||||
subtitle: 'A client is the actual Fortnite game. '
|
|
||||||
'You can download any version of Fortnite from the launcher in the "Play" tab. '
|
@override
|
||||||
'You can also import versions from your local PC, but remember that these may be corrupted. '
|
Widget build(BuildContext context) {
|
||||||
'If a local version doesn\'t work, try installing it from the launcher before reporting a bug.',
|
super.build(context);
|
||||||
titleStyle: FluentTheme
|
_height = MediaQuery.of(context).size.height / 3;
|
||||||
.of(context)
|
return FutureBuilder(
|
||||||
.typography
|
future: _fetchFuture,
|
||||||
.title,
|
builder: (context, linksSnapshot) {
|
||||||
contentWidth: null,
|
var linksData = linksSnapshot.data;
|
||||||
),
|
return ListView.builder(
|
||||||
SettingTile(
|
itemBuilder: (context, index) {
|
||||||
title: 'What is an authenticator?',
|
if (index % 2 == 0) {
|
||||||
subtitle: 'An authenticator is a program that handles authentication, parties and voice chats. '
|
return const SizedBox(
|
||||||
'By default, a LawinV1 server will be started for you to play. '
|
height: 16.0
|
||||||
'You can use also use an authenticator running locally(on your PC) or remotely(on another PC). '
|
);
|
||||||
'Changing the authenticator settings can break the client and game server: unless you are an advanced user, do not edit, for any reason, these settings! '
|
}
|
||||||
'If you need to restore these settings, go to the "Settings" tab and click on "Restore Defaults". ',
|
|
||||||
titleStyle: FluentTheme
|
return Card(
|
||||||
.of(context)
|
borderRadius: const BorderRadius.vertical(top: Radius.circular(4.0)),
|
||||||
.typography
|
child: _buildBody(linksData, index)
|
||||||
.title,
|
);
|
||||||
contentWidth: null,
|
},
|
||||||
),
|
itemCount: linksData == null ? null : linksData.length * 2
|
||||||
SettingTile(
|
);
|
||||||
title: 'Do I need to update DLLs?',
|
}
|
||||||
subtitle: 'No, all the files that the launcher uses are automatically updated. '
|
);
|
||||||
'You can use your own DLLs by going to the "Settings" tab, but make sure that they don\'t create a console that reads IO or the launcher will stop working correctly. '
|
}
|
||||||
'Unless you are an advanced user, changing these options is not recommended',
|
|
||||||
titleStyle: FluentTheme
|
Widget _buildBody(List<String>? linksData, int index) {
|
||||||
.of(context)
|
if (linksData == null) {
|
||||||
.typography
|
return SkeletonLine(
|
||||||
.title,
|
style: SkeletonLineStyle(
|
||||||
contentWidth: null,
|
height: _height
|
||||||
),
|
),
|
||||||
SettingTile(
|
);
|
||||||
title: 'Where can I report bugs or ask for new features?',
|
}
|
||||||
subtitle: 'Go to the "Settings" tab and click on report bug. '
|
|
||||||
'Please make sure to be as specific as possible when filing a report as it\'s crucial to make it as easy to fix/implement',
|
return FutureBuilder(
|
||||||
titleStyle: FluentTheme
|
future: _readLink(linksData[index ~/ 2]),
|
||||||
.of(context)
|
builder: (context, linkDataSnapshot) => SizedBox(
|
||||||
.typography
|
height: _height,
|
||||||
.title,
|
child: MarkdownWidget(
|
||||||
contentWidth: null,
|
data: linkDataSnapshot.data ?? ""
|
||||||
),
|
),
|
||||||
SettingTile(
|
)
|
||||||
title: 'How can I make my game server accessible for other players?',
|
);
|
||||||
subtitle: Text.rich(
|
}
|
||||||
TextSpan(
|
|
||||||
children: [
|
@override
|
||||||
TextSpan(
|
List<SettingTile> get settings => [];
|
||||||
text: 'Follow ',
|
|
||||||
style: FluentTheme.of(context).typography.body
|
@override
|
||||||
),
|
Widget? get button => null;
|
||||||
TextSpan(
|
|
||||||
text: 'this tutorial',
|
|
||||||
mouseCursor: SystemMouseCursors.click,
|
|
||||||
style: FluentTheme.of(context).typography.body?.copyWith(color: FluentTheme.of(context).accentColor),
|
|
||||||
recognizer: TapGestureRecognizer()..onTap = openPortTutorial
|
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
|
||||||
),
|
|
||||||
titleStyle: FluentTheme
|
|
||||||
.of(context)
|
|
||||||
.typography
|
|
||||||
.title,
|
|
||||||
contentWidth: null,
|
|
||||||
)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:fluent_ui/fluent_ui.dart';
|
import 'package:fluent_ui/fluent_ui.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/reboot_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/reboot_localizations.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
AppLocalizations? _translations;
|
AppLocalizations? _translations;
|
||||||
bool _init = false;
|
bool _init = false;
|
||||||
@@ -15,4 +16,6 @@ AppLocalizations get translations {
|
|||||||
void loadTranslations(BuildContext context) {
|
void loadTranslations(BuildContext context) {
|
||||||
_translations = AppLocalizations.of(context)!;
|
_translations = AppLocalizations.of(context)!;
|
||||||
_init = true;
|
_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String get currentLocale => Intl.getCurrentLocale().split("_")[0];
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ dependencies:
|
|||||||
intl: any
|
intl: any
|
||||||
windows_taskbar: ^1.1.2
|
windows_taskbar: ^1.1.2
|
||||||
flutter_localized_locales: ^2.0.5
|
flutter_localized_locales: ^2.0.5
|
||||||
|
markdown_widget: ^2.2.0
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
xml: ^6.3.0
|
xml: ^6.3.0
|
||||||
|
|||||||
Reference in New Issue
Block a user