Fix: Mandatory restart was not happening

This commit is contained in:
zontreck 2024-11-23 16:37:24 -07:00
parent d64a34605c
commit 63f248f9cf
4 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,3 @@
class Consts { class Consts {
static const VERSION = "1.1.112324.1559"; static const VERSION = "1.1.112324.1636";
} }

View file

@ -28,7 +28,9 @@ class ModManagerState extends State<ModManager> {
M.enabled = false; M.enabled = false;
} }
setState(() {}); setState(() {
settings.restartRequired = true;
});
}, },
icon: Icon(Icons.swipe_down)), icon: Icon(Icons.swipe_down)),
IconButton( IconButton(
@ -37,7 +39,9 @@ class ModManagerState extends State<ModManager> {
M.enabled = true; M.enabled = true;
} }
setState(() {}); setState(() {
settings.restartRequired = true;
});
}, },
icon: Icon(Icons.swipe_up)) icon: Icon(Icons.swipe_up))
], ],
@ -64,11 +68,10 @@ class ModManagerState extends State<ModManager> {
settings.inst!.mods[i] = settings.inst!.mods[i - 1]; settings.inst!.mods[i] = settings.inst!.mods[i - 1];
} }
settings.inst!.mods[newIndex] = item; settings.inst!.mods[newIndex] = item;
settings.restartRequired = true;
} }
setState(() { setState(() {
settings.Write(); settings.Write();
settings.restartRequired = true;
}); });
}, },
itemBuilder: (ctx, idx) { itemBuilder: (ctx, idx) {

View file

@ -122,15 +122,17 @@ class HomePageState extends State<HomePage> {
ListTile( ListTile(
title: Text("Save Changes"), title: Text("Save Changes"),
subtitle: Text( subtitle: Text(
"This will upload the settings to the server and trigger a restart"), "This will upload the settings to the server and trigger a restart (If required)"),
onTap: () async { onTap: () async {
Settings settings = Settings(); Settings settings = Settings();
C2SUploadSettingsPacket upload = C2SUploadSettingsPacket(); C2SUploadSettingsPacket upload = C2SUploadSettingsPacket();
upload.srvSettings = settings.serialize(); upload.srvSettings = settings.serialize();
upload.performRestart = requireRestart; upload.performRestart =
requireRestart || settings.restartRequired;
await settings.client!.send(upload, !requireRestart); await settings.client!.send(upload,
settings.restartRequired ? false : !requireRestart);
Settings.Clear(); Settings.Clear();
setState(() {}); setState(() {});

View file

@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.1.112324+1559 version: 1.1.112324+1636
environment: environment:
sdk: ">=3.1.4 <4.0.0" sdk: ">=3.1.4 <4.0.0"