Skip to content

Commit

Permalink
Merge pull request #3 from Appbird/feature/#2
Browse files Browse the repository at this point in the history
Feature/ #2
  • Loading branch information
Appbird authored Sep 2, 2021
2 parents 9bf57c8 + bf1bf4f commit f8edd63
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 6 additions & 3 deletions src/ts/client/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { LoginAdministrator, LoginAdministratorReadOnly } from "./Administrator/
import { IAppUsedToChangeState } from "./interface/AppInterfaces";
import firebase from "firebase/app";
import {PageNotificationAdministrator} from "./Administrator/PageNotificationAdministrator"
import {version} from "../AppInfo.json"
export default class App implements IAppUsedToChangeState{
private _state:StateAdministrator;
private loginAd:LoginAdministrator | null = null;
Expand All @@ -21,8 +20,6 @@ export default class App implements IAppUsedToChangeState{
private header:HeaderController = new HeaderController();
private apiCaller:APIAdministrator = new APIAdministrator();
private _notie:PageNotificationAdministrator;

public readonly version:string = version
constructor(articleDOM:HTMLElement,language:LanguageInApplication){
this._state = new StateAdministrator(language);
this._notie = new PageNotificationAdministrator(this);
Expand All @@ -33,6 +30,12 @@ export default class App implements IAppUsedToChangeState{
this.transition("mainMenu",null)
})
}
get version():Promise<string>{
return fetch("https://api.github.com/repos/appbird/kss-recorders/releases/latest")
.then(result => result.json())
.then(result => result.tag_name)
.catch((err) => this.errorCatcher(err));
}
async init(){
try{
const response = await fetch('/__/firebase/init.json');
Expand Down
2 changes: 1 addition & 1 deletion src/ts/client/interface/AppInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { PageStates, RequiredObjectType } from "../view/state/Base/PageStates";


export interface IAppUsedToRead{
readonly version:string;
readonly version:Promise<string>;
state:StateAdministerReadOnly;
loginAdministratorReadOnly:LoginAdministratorReadOnly;
checkIfIntroductionIsOver:()=>boolean;
Expand Down
10 changes: 5 additions & 5 deletions src/ts/client/view/state/mainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class S_MainMenu
},this.generateDetailMenuInfo()]
]
const notice = new NoticeView(appendElement(this.articleDOM,"div"),"mainMenu","headerDescription",context.mainManu,this.app.state.language)
const main = (gsed.gameSystem !== null && gsed.gameMode !== null) ? this.generateMainMenuDescriptionWithTargetMode():this.generateMainMenuDescription()
const main = await ((gsed.gameSystem !== null && gsed.gameMode !== null) ? this.generateMainMenuDescriptionWithTargetMode():this.generateMainMenuDescription())


for (const generator of menuGenerators){
Expand All @@ -61,7 +61,7 @@ export class S_MainMenu

this.deleteLoadingSpinner();
}
generateMainMenuDescription(){
async generateMainMenuDescription(){
return this.articleDOM.appendChild(this.htmlConverter.elementWithoutEscaping`
<div>
Expand All @@ -70,7 +70,7 @@ export class S_MainMenu
<div class="__title">Welcome to <br>Kirby-Speed/Score-Recorders!</div>
</div>
<hr noshade class="u-bold">
<div class="u-width90per u-bolderChara">ver ${this.app.version}</div>
<div class="u-width90per u-bolderChara">${await this.app.version}</div>
<br>
<div class="u-width90per">
${context.description[0]}
Expand All @@ -84,7 +84,7 @@ export class S_MainMenu
`) as HTMLElement;

}
generateMainMenuDescriptionWithTargetMode(){
async generateMainMenuDescriptionWithTargetMode(){
const gsed = this.app.state.gameSystemEnvDisplayed
const gameModeDescription = choiceDescription(gsed.gameMode,this.app.state.language)
if (gsed.gameSystem === null || gsed.gameMode === null) throw new Error(`ゲームモードが設定されていません。`)
Expand All @@ -95,7 +95,7 @@ export class S_MainMenu
<div class="__title">${ `${gsed.gameSystem.English}/${gsed.gameMode.English}<br>Top Menu`}</div>
</div>
<hr noshade class="u-bold">
<div class="u-width90per u-bolderChara">ver ${this.app.version}</div>
<div class="u-width90per u-bolderChara">${await this.app.version}</div>
<br>
<div class="u-background--gray">
<br>
Expand Down

0 comments on commit f8edd63

Please sign in to comment.