Skip to content

Commit

Permalink
Merge pull request #1286 from ebkr/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ebkr authored Apr 6, 2024
2 parents 34c4cfd + 0652d70 commit 21ce0b2
Show file tree
Hide file tree
Showing 42 changed files with 1,047 additions and 795 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
### 3.1.48
- Games added:
- Content Warning
- Plasma
- MS store support for Bomb Rush Cyberfunk
- Profile code exports now have a size restriction
- Fixes for Voices of the Void
- Other general fixes/improvements

_Contributions:_
- _anttimaki_
- _cspotcode_
- _Oksamies_
- _ethangreen-dev_

### 3.1.47
- Significant performance improvements
- Games added:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2modman",
"version": "3.1.47",
"version": "3.1.48",
"description": "A simple and easy to use mod manager for several games using Thunderstore.",
"productName": "r2modman",
"author": "ebkr",
Expand Down
38 changes: 10 additions & 28 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
<template>
<div>

<router-view @error="showError" v-if="visible"/>

<div id='errorModal' :class="['modal', 'z-top', {'is-active':(errorMessage !== '')}]">
<div class="modal-background" @click="closeErrorModal()"></div>
<div class='modal-content'>
<div class='notification is-danger'>
<h3 class='title'>Error</h3>
<h5 class="title is-5">{{errorMessage}}</h5>
<p>{{errorStack}}</p>
<div v-if="errorSolution !== ''">
<br/>
<h5 class="title is-5">Suggestion</h5>
<p>{{errorSolution}}</p>
</div>
</div>
</div>
<button class="modal-close is-large" aria-label="close" @click="closeErrorModal()"></button>
</div>

<router-view v-if="visible"/>
<ErrorModal />
</div>
</template>

Expand Down Expand Up @@ -64,23 +46,23 @@ import GenericProfileInstaller from './r2mm/installing/profile_installers/Generi
import ConnectionProviderImpl from './r2mm/connection/ConnectionProviderImpl';
import ConnectionProvider from './providers/generic/connection/ConnectionProvider';
import UtilityMixin from './components/mixins/UtilityMixin.vue';
import ErrorModal from './components/modals/ErrorModal.vue';
@Component
@Component({
components: {
ErrorModal,
}
})
export default class App extends mixins(UtilityMixin) {
private settings: ManagerSettings | null = null;
private visible: boolean = false;
async created() {
// Use as default game for settings load.
GameManager.activeGame = GameManager.unsetGame();
// Load settings using the default game before the actual game is selected.
const settings: ManagerSettings = await this.$store.dispatch('setActiveGame', GameManager.defaultGame);
this.hookThunderstoreModListRefresh();
this.hookProfileModListRefresh();
await this.checkCdnConnection();
const settings = await ManagerSettings.getSingleton(GameManager.activeGame);
this.settings = settings;
InstallationRuleApplicator.apply();
InstallationRules.validate();
Expand Down
2 changes: 1 addition & 1 deletion src/_managerinf/ManagerInformation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import VersionNumber from '../model/VersionNumber';

export default class ManagerInformation {
public static VERSION: VersionNumber = new VersionNumber('3.1.47');
public static VERSION: VersionNumber = new VersionNumber('3.1.48');
public static IS_PORTABLE: boolean = false;
public static APP_NAME: string = "r2modman";
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/Plasma.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 9 additions & 10 deletions src/components/ExpandableCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class='card-header-icon mod-logo' v-if="image !== ''">
<figure class='image is-48x48 image-parent'>
<img :src='image' alt='Mod Logo' class='image-overlap'/>
<img v-if="funkyMode" src='../assets/funky_mode.png' alt='Mod Logo' class='image-overlap'/>
<img v-if="$store.state.profile.funkyMode" src='../assets/funky_mode.png' alt='Mod Logo' class='image-overlap'/>
</figure>
</div>
<span ref="title" class='card-header-title'><slot name='title'></slot></span>
Expand Down Expand Up @@ -56,21 +56,19 @@
id: string | undefined;
@Prop({default: false})
funkyMode: boolean | undefined;
@Prop({default: false})
expandedByDefault: boolean | undefined;
@Prop({default: false})
showSort: boolean | undefined;
allowSorting: boolean | undefined;
@Prop({default: true})
enabled: boolean | undefined;
// Keep track of visibility
visible: boolean | undefined = false;
@Watch('expandedByDefault')
get showSort() {
return this.allowSorting && this.$store.getters["profile/canSortMods"];
}
@Watch('$store.state.profile.expandedByDefault')
visibilityChanged(current: boolean) {
this.visible = current;
}
Expand All @@ -80,7 +78,8 @@
}
async created() {
this.visible = this.expandedByDefault;
await this.$store.dispatch('profile/loadModCardSettings');
this.visible = this.$store.state.profile.expandedByDefault;
}
}
</script>
Expand Down
10 changes: 4 additions & 6 deletions src/components/SettingsLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,12 @@ export default class SettingsLoader extends Vue {
}
const getDefaultGame = () => {
const defaultGame = GameManager.unsetGame();
// Don't trust the non-null asserted typing of .unsetGame().
if (defaultGame === undefined) {
throw new Error("GameManager.unsetGame() returned undefined");
// Don't trust the non-null asserted typing of GameManager.defaultGame.
if (GameManager.defaultGame === undefined) {
throw new Error("GameManager.defaultGame returned undefined");
}
return defaultGame;
return GameManager.defaultGame;
};
</script>
4 changes: 2 additions & 2 deletions src/components/config-components/ConfigSelectionLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ import ProfileModList from '../../r2mm/mods/ProfileModList';
this.configFiles = this.configFiles.filter(value => value.getName() !== file.getName());
this.textChanged();
} catch (e) {
this.$emit("error", new R2Error(
this.$store.commit("error/handleError", R2Error.fromThrownValue(
e,
"Failed to delete config file",
(e as Error).message,
`Try running ${ManagerInformation.APP_NAME} as an administrator.`
));
}
Expand Down
10 changes: 3 additions & 7 deletions src/components/importing/LocalFileImportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,15 @@ export default class LocalFileImportModal extends Vue {
const installCallback = (async (success: boolean, error: any | null) => {
if (!success && error !== null) {
this.showError(error);
this.$store.commit("error/handleError", R2Error.fromThrownValue(error));
return;
}
const updatedModListResult = await ProfileModList.getModList(this.contextProfile!);
if (updatedModListResult instanceof R2Error) {
this.showError(updatedModListResult);
this.$store.commit("error/handleError", updatedModListResult);
return;
}
await this.$store.dispatch("updateModList", updatedModListResult);
await this.$store.dispatch("profile/updateModList", updatedModListResult);
this.emitClose();
});
Expand All @@ -308,10 +308,6 @@ export default class LocalFileImportModal extends Vue {
}
}
private showError(err: R2Error) {
this.$emit("error", err);
}
created() {
this.contextProfile = Profile.getActiveProfile();
}
Expand Down
44 changes: 3 additions & 41 deletions src/components/mixins/UtilityMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,19 @@ import Vue from 'vue';
import Component from 'vue-class-component';
import R2Error from '../../model/errors/R2Error';
import GameManager from '../../model/game/GameManager';
import Profile from '../../model/Profile';
import CdnProvider from '../../providers/generic/connection/CdnProvider';
import LoggerProvider, { LogSeverity } from '../../providers/ror2/logging/LoggerProvider';
import ThunderstorePackages from '../../r2mm/data/ThunderstorePackages';
import ProfileModList from '../../r2mm/mods/ProfileModList';
import ApiCacheUtils from '../../utils/ApiCacheUtils';
@Component
export default class UtilityMixin extends Vue {
private errorMessage: string = '';
private errorStack: string = '';
private errorSolution: string = '';
readonly REFRESH_INTERVAL = 5 * 60 * 1000;
private tsRefreshFailed = false;
showError(error: R2Error) {
this.errorMessage = error.name;
this.errorStack = error.message;
this.errorSolution = error.solution;
LoggerProvider.instance.Log(LogSeverity.ERROR, `[${error.name}]: ${error.message}`);
}
closeErrorModal() {
this.errorMessage = '';
this.errorStack = '';
this.errorSolution = '';
}
hookProfileModListRefresh() {
setInterval(this.refreshProfileModList, this.REFRESH_INTERVAL);
}
hookThunderstoreModListRefresh() {
setInterval(this.tryRefreshThunderstoreModList, this.REFRESH_INTERVAL);
}
async refreshProfileModList() {
const profile = Profile.getActiveProfile();
// If no profile is selected on game selection then getActiveProfile will return undefined.
if (profile === undefined) {
return;
}
const modList = await ProfileModList.getModList(profile);
if (!(modList instanceof R2Error)) {
this.$store.dispatch("updateModList", modList);
}
}
async refreshThunderstoreModList() {
// Don't do background update on index route since the game
// isn't really chosen yet, nor in the splash screen since it
Expand All @@ -65,9 +26,10 @@ export default class UtilityMixin extends Vue {
return;
}
const response = await ThunderstorePackages.update(GameManager.activeGame);
const response = await ThunderstorePackages.update(this.$store.state.activeGame);
await ApiCacheUtils.storeLastRequest(response.data);
await this.$store.dispatch("updateThunderstoreModList", ThunderstorePackages.PACKAGES);
await this.$store.dispatch("profile/tryLoadModListFromDisk");
}
/**
Expand Down Expand Up @@ -101,7 +63,7 @@ export default class UtilityMixin extends Vue {
await CdnProvider.checkCdnConnection();
} catch (error: unknown) {
if (error instanceof R2Error) {
this.showError(error);
this.$store.commit('error/handleError', error);
} else {
console.error(error);
}
Expand Down
51 changes: 51 additions & 0 deletions src/components/modals/ErrorModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import R2Error from "../../model/errors/R2Error";
@Component
export default class ErrorModal extends Vue {
get error(): R2Error | null {
return this.$store.state.error.error;
}
get name() {
return this.error ? this.error.name : '';
}
get message() {
return this.error ? this.error.message : '';
}
get solution() {
return this.error ? this.error.solution : '';
}
close() {
this.$store.commit('error/discardError');
}
}
</script>

<template>
<div v-if="error !== null" id="errorModal" class="modal z-top is-active">
<div class="modal-background" @click="close"></div>
<div class="modal-content">
<div class="notification is-danger">
<h3 class="title">Error</h3>
<h5 class="title is-5">{{name}}</h5>
<p>{{message}}</p>
<div v-if="solution">
<h5 class="title is-5">Suggestion</h5>
<p>{{solution}}</p>
</div>
</div>
</div>
<button class="modal-close is-large" aria-label="close" @click="close"></button>
</div>
</template>

<style scoped lang="scss">
p + div {
margin-top: 1.5rem;
}
</style>
6 changes: 3 additions & 3 deletions src/components/navigation/NavigationLayout.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<template>
<div id="content" class="columns">
<div class="column non-selectable is-one-quarter">
<NavigationMenu @error="$emit('error', $event)" />
<NavigationMenu />
</div>
<div class="column">
<router-view @error="$emit('error', $event)" />
<router-view />
</div>
<GameRunningModal :activeGame="activeGame" />
</div>
Expand All @@ -22,7 +22,7 @@ import GameManager from '../../model/game/GameManager';
components: {GameRunningModal, NavigationMenu}
})
export default class NavigationLayout extends Vue {
activeGame = GameManager.unsetGame();
activeGame = GameManager.defaultGame;
created() {
this.activeGame = GameManager.activeGame;
Expand Down
11 changes: 3 additions & 8 deletions src/components/navigation/NavigationMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class NavigationMenu extends Vue {
}
get localModCount(): number {
return (this.$store.state.localModList || []).length;
return this.$store.state.profile.modList.length;
}
getTagLinkClasses(routeNames: string[]) {
Expand All @@ -111,14 +111,9 @@ export default class NavigationMenu extends Vue {
this.$store.commit("openGameRunningModal");
await launch(this.activeGame, this.contextProfile!, mode);
} catch (error) {
if (error instanceof R2Error) {
this.$store.commit("closeGameRunningModal");
this.$emit("error", error);
} else {
throw error;
}
this.$store.commit("closeGameRunningModal");
this.$store.commit("error/handleError", R2Error.fromThrownValue(error));
}
}
created() {
Expand Down
Loading

0 comments on commit 21ce0b2

Please sign in to comment.