Rebasing and conflict resolution

Signed-off-by: Matheus Alves <matheus.r.noya.alves@tecnico.ulisboa.pt>
Co-authored-by: Inês Simões <ines.p.simoes@tecnico.ulisboa.pt>
This commit is contained in:
Matheus Alves 2025-07-22 22:47:11 +01:00
parent 428c175cb5
commit 8594614e64
3 changed files with 37 additions and 37 deletions

View File

@ -1000,30 +1000,30 @@ export class GameData {
const secretId = this.secretId; const secretId = this.secretId;
const trainerId = this.trainerId; const trainerId = this.trainerId;
if (!bypassLogin) { if (bypassLogin) {
pokerogueApi.savedata.session
.update({ slot: slotId, trainerId, secretId, clientSessionId }, encrypted)
.then(error => {
if (error) {
console.error("Failed to update session name:", error);
resolve(false);
} else {
localStorage.setItem(`sessionData${slotId ? slotId : ""}_${loggedInUser?.username}`, encrypted);
updateUserInfo().then(success => {
if (success !== null && !success) {
return resolve(false);
}
});
resolve(true);
}
});
} else {
localStorage.setItem( localStorage.setItem(
`sessionData${slotId ? slotId : ""}_${loggedInUser?.username}`, `sessionData${slotId ? slotId : ""}_${loggedInUser?.username}`,
encrypt(updatedDataStr, bypassLogin), encrypt(updatedDataStr, bypassLogin),
); );
resolve(true); resolve(true);
return;
} }
pokerogueApi.savedata.session
.update({ slot: slotId, trainerId, secretId, clientSessionId }, encrypted)
.then(error => {
if (error) {
console.error("Failed to update session name:", error);
resolve(false);
} else {
localStorage.setItem(`sessionData${slotId ? slotId : ""}_${loggedInUser?.username}`, encrypted);
updateUserInfo().then(success => {
if (success !== null && !success) {
return resolve(false);
}
});
resolve(true);
}
});
}); });
} }

View File

@ -1,7 +1,7 @@
import i18next from "i18next";
import type { InputFieldConfig } from "./form-modal-ui-handler"; import type { InputFieldConfig } from "./form-modal-ui-handler";
import { FormModalUiHandler } from "./form-modal-ui-handler"; import { FormModalUiHandler } from "./form-modal-ui-handler";
import type { ModalConfig } from "./modal-ui-handler"; import type { ModalConfig } from "./modal-ui-handler";
import i18next from "i18next";
export default class RenameRunFormUiHandler extends FormModalUiHandler { export default class RenameRunFormUiHandler extends FormModalUiHandler {
getModalTitle(_config?: ModalConfig): string { getModalTitle(_config?: ModalConfig): string {
@ -34,21 +34,21 @@ export default class RenameRunFormUiHandler extends FormModalUiHandler {
} }
show(args: any[]): boolean { show(args: any[]): boolean {
if (super.show(args)) { if (!super.show(args)) {
if (this.inputs?.length) { return false;
this.inputs.forEach(input => {
input.text = "";
});
}
const config = args[0] as ModalConfig;
this.submitAction = _ => {
this.sanitizeInputs();
const sanitizedName = btoa(encodeURIComponent(this.inputs[0].text));
config.buttonActions[0](sanitizedName);
return true;
};
return true;
} }
return false; if (this.inputs?.length) {
this.inputs.forEach(input => {
input.text = "";
});
}
const config = args[0] as ModalConfig;
this.submitAction = _ => {
this.sanitizeInputs();
const sanitizedName = btoa(encodeURIComponent(this.inputs[0].text));
config.buttonActions[0](sanitizedName);
return true;
};
return true;
} }
} }

View File

@ -1,12 +1,12 @@
import * as account from "#app/account";
import * as bypassLoginModule from "#app/global-vars/bypass-login"; import * as bypassLoginModule from "#app/global-vars/bypass-login";
import { pokerogueApi } from "#app/plugins/api/pokerogue-api"; import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
import type { SessionSaveData } from "#app/system/game-data"; import type { SessionSaveData } from "#app/system/game-data";
import { AbilityId } from "#enums/ability-id";
import { MoveId } from "#enums/move-id"; import { MoveId } from "#enums/move-id";
import GameManager from "#test/testUtils/gameManager"; import { GameManager } from "#test/testUtils/gameManager";
import Phaser from "phaser"; import Phaser from "phaser";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import * as account from "#app/account";
import { AbilityId } from "#enums/ability-id";
describe("System - Rename Run", () => { describe("System - Rename Run", () => {
let phaserGame: Phaser.Game; let phaserGame: Phaser.Game;