Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #406

Merged
merged 15 commits into from
Aug 3, 2023
Merged

Bug fixes #406

merged 15 commits into from
Aug 3, 2023

Conversation

thesuzerain
Copy link
Contributor

@thesuzerain thesuzerain commented Aug 1, 2023

Fixes #230
Fixes #234
Fixes #290
Fixes #313
Fixes #382
Fixes #388
Fixes #396
Fixes #399
Fixes #400
Fixes #407

Fixes permissions in Info.plist for voice chat on Mac
Fixes deadlock preventing app closing via safeprocesses
Potential fix for title bar issues

Comment on lines 163 to 166
impl Dependency {
// As Modrinth doesn't always provide the project ID, we have to infer it from the version ID
pub async fn populate(&mut self) -> crate::Result<()> {
let mut dep = self;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this IMO is a pretty bad way of solving this specific issue. I think you can remove the fix for this GH issue and I can fix this one

Comment on lines 107 to 146
#[tauri::command]
pub async fn profile_get_installed_duplicate_nonversional_dependencies(
path: ProfilePathId,
mut dependencies: Vec<Dependency>,
) -> Result<Vec<Dependency>> {
use futures::prelude::*;

// Not all dependencies have a project id, so we need to check if the project id is None and populate it
// using try_for_each_concurrent, and running .populate() on each dependency
let stream = futures::stream::iter(dependencies.iter_mut())
.map(Ok::<_, theseus::Error>);

stream
.try_for_each_concurrent(None, |dependency| async move {
dependency.populate().await?;
Ok(())
})
.await?;

// Iterate over all projects in the profile, and check if any of the dependencies are installed with a different version
let mut duplicates = Vec::new();
let profile = profile_get(path, None).await?;
if let Some(profile) = profile {
profile.projects.into_iter().for_each(|(_, project)| {
if let ProjectMetadata::Modrinth {
project, version, ..
} = &project.metadata
{
dependencies.iter().for_each(|dependency| {
if dependency.version_id != Some(version.id.clone())
&& dependency.project_id == Some(project.id.clone())
{
duplicates.push(dependency.clone());
}
})
}
});
}
Ok(duplicates)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above. Don't like this fix (quite a lot of code smell imo). I'll fix this in my auth PR so I think this can be removed from this PR

Comment on lines 62 to 67
export async function check_duplicate_nonversional_dependencies(path, dependencies) {
return await invoke('plugin:profile|profile_get_installed_duplicate_nonversional_dependencies', {
path,
dependencies,
})
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also can be removed

Comment on lines 44 to 46
// if duplicates has a version that matches, skip
if (duplicates.find((d) => d.version_id === dep.version_id)) continue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

Comment on lines 39 to 42
const duplicates = await check_duplicate_nonversional_dependencies(
profile.path,
version.dependencies
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed

onlyOpenSource.value = false
selectedVersions.value = []
selectedEnvironments.value = []
await onSearchChange(1)
await onSearchChangeToTop(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why were these and others changed to to top? these operations should not affect the scroll pos

for (const file of event.payload) {
await add_project_from_path(props.instance.path, file, 'mod').catch(handleError)
}
initProjects(await get(props.instance.path).catch(handleError))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixpanel needs to be added in this else statement as well, or at least moved out of this

@thesuzerain thesuzerain marked this pull request as ready for review August 3, 2023 15:12
@thesuzerain thesuzerain merged commit b772f91 into master Aug 3, 2023
6 checks passed
@thesuzerain thesuzerain deleted the bug-fixes branch August 3, 2023 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment