Skip to content

Commit

Permalink
Merge pull request #30 from KizKizz/backend-rework
Browse files Browse the repository at this point in the history
dup mods fix 3
  • Loading branch information
KizKizz authored Jul 18, 2022
2 parents 9f39116 + 3fffb5c commit 85a9f0f
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 30 deletions.
4 changes: 2 additions & 2 deletions app_version_check/app_version.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "PSO2NGS Mod Manager",
"version": "1.4.2",
"version": "1.4.3",
"description": [
"Fixed a bug when applying duplicated mods - part 2",
"Fixed a bug when applying duplicated mods - part 3",
"Minor bug fixes"
],
"windows_file": "",
Expand Down
4 changes: 2 additions & 2 deletions lib/file_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Future<void> modsToDataAdder(List<ModFile> modList) async {
for (var modList in duplicateModsApplied) {
for (var element in modList) {
modAppliedDup.add(element);
File(element.backupIcePath).copySync(element.originalIcePath);
//File(element.backupIcePath).copySync(element.originalIcePath);
element.isApplied = false;
}
}
Expand Down Expand Up @@ -277,7 +277,7 @@ Future<void> modsToDataAdder(List<ModFile> modList) async {
for (var modList in duplicateModsApplied) {
for (var element in modList) {
modAppliedDup.add(element);
File(element.backupIcePath).copySync(element.originalIcePath);
//File(element.backupIcePath).copySync(element.originalIcePath);
element.isApplied = false;
}
}
Expand Down
101 changes: 77 additions & 24 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,23 +285,92 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
width: 40,
height: 30,
child: MaterialButton(
onPressed: addItemVisible || isRefreshing
onPressed: isRefreshing
? null
: (() {
if (!isRefreshing) {
isModSelected = false;
modsViewAppBarName = 'Available Mods';
isRefreshing = true;
//cateList.clear();
setState(() {});
//closing adders
setState(() {
if (addCategoryVisible) {
categoryAddController.clear();
//addCategoryVisible = false;
switch (cateAdderAniController.status) {
case AnimationStatus.completed:
cateAdderAniController.reverse().whenComplete(() {
addCategoryVisible = false;
Provider.of<stateProvider>(context, listen: false).addingBoxStateFalse();
setState(() {});
});
break;

default:
}
}

if (addItemVisible) {
_newItemDragDropList.clear();
_newSingleItemDragDropList.clear();
_singleItemIcon = null;
newItemAddController.clear();
newSingleItemAddController.clear();
selectedCategoryForMutipleItems = null;
selectedCategoryForSingleItem = null;
isErrorInSingleItemName = false;
context.read<stateProvider>().singleItemDropAddClear();
context.read<stateProvider>().itemsDropAddClear();
Provider.of<stateProvider>(context, listen: false).addingBoxStateFalse();
//addItemVisible = false;
switch (itemAdderAniController.status) {
case AnimationStatus.completed:
itemAdderAniController.reverse().whenComplete(() {
addItemVisible = false;
setState(() {});
});
break;
default:
}
}

if (addModToItemVisible) {
_newModToItemDragDropList.clear();
newModToItemAddController.clear();
isModAddFolderOnly = true;
context.read<stateProvider>().modsDropAddClear();
//addModToItemVisible = false;
switch (modAdderAniController.status) {
case AnimationStatus.completed:
modAdderAniController.reverse().whenComplete(() {
addModToItemVisible = false;
Provider.of<stateProvider>(context, listen: false).addingBoxStateFalse();
setState(() {});
});
break;
default:
}
}

isModSelected = false;
modsViewAppBarName = 'Available Mods';
isRefreshing = true;
});
}
refreshList();
Future.delayed(const Duration(milliseconds: 500), () async {
allModFiles = await modsLoader();
cateList = categories(allModFiles);
appliedModsListGet = getAppliedModsList();
iceFiles = dataDir.listSync(recursive: true).whereType<File>().toList();
Provider.of<stateProvider>(context, listen: false).cateListItemCountSetNoListener(cateList.length);
isRefreshing = false;
}).whenComplete(() {
isRefreshing = false;
setState(() {});
});
}),
child: Row(
children: [
Icon(
Icons.refresh,
color: addItemVisible || isRefreshing
color: isRefreshing
? Theme.of(context).disabledColor
: MyApp.themeNotifier.value == ThemeMode.light
? Theme.of(context).primaryColorDark
Expand Down Expand Up @@ -3085,20 +3154,4 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
],
);
}

//Helpers functions

void refreshList() {
Future.delayed(const Duration(milliseconds: 500), () async {
allModFiles = await modsLoader();
cateList = categories(allModFiles);
appliedModsListGet = getAppliedModsList();
iceFiles = dataDir.listSync(recursive: true).whereType<File>().toList();
Provider.of<stateProvider>(context, listen: false).cateListItemCountSetNoListener(cateList.length);
isRefreshing = false;
}).whenComplete(() {
isRefreshing = false;
setState(() {});
});
}
}
4 changes: 2 additions & 2 deletions windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#else
#define VERSION_AS_NUMBER 1,4,2
#define VERSION_AS_NUMBER 1,4,3
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "1.4.2"
#define VERSION_AS_STRING "1.4.3"
#endif

VS_VERSION_INFO VERSIONINFO
Expand Down

0 comments on commit 85a9f0f

Please sign in to comment.