[feat-75] support drag and drop for map zip files
Scope
closes #75
Implementation
Implemented drag and drop for map zip files.
Added Dropzone component to support drag and drop of files.
Created processZip in zip helper file to safely handle zip files, although SonarCloud doesn't seem to like the handling.
Added LocalMapsManagerService.importMap to import the zip file and copied almost the same code in downloadMap for pathing and caching.
Screenshots
How to Test
Drag and drop the following files:
- Valid map zip file
- Invalid zip file
- Any non-zip file
Check if it will be installed in either the specific version folder or shared folder as well.
Check if switching to the playlist tab is not affected by the dropzone.
New Resource Text
List of added resource text
notifications.maps.import-map.titles.success: Map import complete notifications.maps.import-map.titles.error: An error occurred while importing the map notifications.maps.import-map.msgs.success: Imported all maps successfully notifications.maps.import-map.msgs.success: Imported some maps successfully notifications.maps.import-map.msgs.only-accept-zip: Only zip files are supported notifications.maps.import-map.msgs.not-found-zip: Zip file does not exists notifications.maps.import-map.msgs.invalid-zip: Zip file does not contain any dat files
Emoji Guide
For reviewers: Emojis can be added to comments to call out blocking versus non-blocking feedback.
E.g: Praise, minor suggestions, or clarifying questions that donβt block merging the PR.
π’ Nice refactor!
π‘ Why was the default value removed?
E.g: Blocking feedback must be addressed before merging.
π΄ This change will break something important
| Blocking | π΄ β π¨ | RED |
| Non-blocking | π‘ π‘ π€ π | Yellow, thinking, etc |
| Praise | π’ π π π π | Green, hearts, positive emojis, etc |
@Zagrios Side tangent, seems that the call from observer.error shows the call stack error in the renderer. Seems the same as well for the other sendV2 <-> Observer interaction in the codebase as well. Might be a bug in the integration? But might check with you if this is expected.
@Zagrios Side tangent, seems that the call from
observer.errorshows the call stack error in the renderer. Seems the same as well for the other sendV2 <-> Observer interaction in the codebase as well. Might be a bug in the integration? But might check with you if this is expected.
Yeah you need to handle the error in the frontend as well
Yeah you need to handle the error in the frontend as well
Already did in the latest commit, the notification popup shows in the background when I close the error stack in the renderer so I'm not sure what part I've missed π€.
https://github.com/Zagrios/bs-manager/blob/1ccaad2e18d9f7c93c7830ced5350248aeed868e/src/renderer/services/maps-manager.service.ts#L163-L215
Yeah you need to handle the error in the frontend as well
Already did in the latest commit, the notification popup shows in the background when I close the error stack in the renderer so I'm not sure what part I've missed π€.
https://github.com/Zagrios/bs-manager/blob/1ccaad2e18d9f7c93c7830ced5350248aeed868e/src/renderer/services/maps-manager.service.ts#L163-L215
The error comes from this line this.progressBar.show(importProgress$, true); Since the progressBarService shares the same observer, it also receives the error from it.
You need to derive the main observer to create another one that doesn't receive any errors.
You can check the handleDownload() function in oculus-downloader.service.ts
Ahhh gotcha, will amend the last commit so that the PR should be ready for a re-review.
@silentrald I've just pushed some fixes, but I have to go.
I'm still encountering an error when I drop my zip file, as it doesn't find any Info.dat (see the gif).
I get this error message:
[1] 17:37:30.357 > Zip file "C:\Users\Mathieu\Desktop\1.37.3Maps.zip" does not contain any "Info.dat" file
[1] 17:37:30.358 > Error: No "Info.dat" file located in any of the zip files
The const files = zip.file(this.INFO_DAT_REGEX); results as empty array.
@Zagrios might be related to the path separator. Not sure if Windows uses / or \, couldn't check this on my linux machine, though let me try to fix this in a Windows VM.
@Zagrios got it to work on Windows.
Lost your commit though when I did a full rebase but I tried to reapply it on commit 615ac04. Might need to double check that, if I missed some lines, you can cherry pick the commit on your local to this PR.
Quality Gate passed
Issues
6 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
@silentrald can you test to confirm if its still working on Linux ?
@Zagrios can confirm, works on Linux π
Merging π₯π₯

