added a showversion button with popup to the interface
This commit is contained in:
15
app.go
15
app.go
@@ -3,9 +3,11 @@ package main
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
|
"log"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/tidwall/gjson"
|
"github.com/tidwall/gjson"
|
||||||
)
|
)
|
||||||
@@ -43,3 +45,14 @@ func (a *App) onSecondInstanceLaunch(secondInstanceData options.SecondInstanceDa
|
|||||||
runtime.Show(*wailsContext)
|
runtime.Show(*wailsContext)
|
||||||
go runtime.EventsEmit(*wailsContext, "launchArgs", secondInstanceArgs)
|
go runtime.EventsEmit(*wailsContext, "launchArgs", secondInstanceArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) ShowVersion() {
|
||||||
|
version := gjson.Get(wailsJSON, "info.productVersion")
|
||||||
|
_, err := runtime.MessageDialog(*wailsContext, runtime.MessageDialogOptions{
|
||||||
|
Title: "Version",
|
||||||
|
Message: "AniTrack Version: " + version.String(),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -13,11 +13,12 @@
|
|||||||
loginToSimkl,
|
loginToSimkl,
|
||||||
logoutOfAniList,
|
logoutOfAniList,
|
||||||
logoutOfMAL,
|
logoutOfMAL,
|
||||||
logoutOfSimkl,
|
logoutOfSimkl
|
||||||
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
||||||
import * as runtime from "../../wailsjs/runtime";
|
import * as runtime from "../../wailsjs/runtime";
|
||||||
import type {MyAnimeListUser} from "../mal/types/MALTypes";
|
import type {MyAnimeListUser} from "../mal/types/MALTypes";
|
||||||
import type {SimklUser} from "../simkl/types/simklTypes";
|
import type {SimklUser} from "../simkl/types/simklTypes";
|
||||||
|
import { ShowVersion } from "../../wailsjs/go/main/App";
|
||||||
|
|
||||||
let currentAniListUser: AniListUser;
|
let currentAniListUser: AniListUser;
|
||||||
let currentMALUser: MyAnimeListUser;
|
let currentMALUser: MyAnimeListUser;
|
||||||
@@ -119,6 +120,15 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="py-2">
|
<div class="py-2">
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
dropdownUser()
|
||||||
|
ShowVersion()
|
||||||
|
}}
|
||||||
|
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
|
||||||
|
>
|
||||||
|
Version
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
on:click={() => runtime.Quit()}
|
on:click={() => runtime.Quit()}
|
||||||
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
|
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
|
||||||
|
|||||||
2
frontend/wailsjs/go/main/App.d.ts
vendored
2
frontend/wailsjs/go/main/App.d.ts
vendored
@@ -42,6 +42,8 @@ export function MyAnimeListLogin():Promise<void>;
|
|||||||
|
|
||||||
export function MyAnimeListUpdate(arg1:main.MALAnime,arg2:main.MALUploadStatus):Promise<main.MalListStatus>;
|
export function MyAnimeListUpdate(arg1:main.MALAnime,arg2:main.MALUploadStatus):Promise<main.MalListStatus>;
|
||||||
|
|
||||||
|
export function ShowVersion():Promise<void>;
|
||||||
|
|
||||||
export function SimklGetUserWatchlist():Promise<main.SimklWatchListType>;
|
export function SimklGetUserWatchlist():Promise<main.SimklWatchListType>;
|
||||||
|
|
||||||
export function SimklLogin():Promise<void>;
|
export function SimklLogin():Promise<void>;
|
||||||
|
|||||||
@@ -82,6 +82,10 @@ export function MyAnimeListUpdate(arg1, arg2) {
|
|||||||
return window['go']['main']['App']['MyAnimeListUpdate'](arg1, arg2);
|
return window['go']['main']['App']['MyAnimeListUpdate'](arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ShowVersion() {
|
||||||
|
return window['go']['main']['App']['ShowVersion']();
|
||||||
|
}
|
||||||
|
|
||||||
export function SimklGetUserWatchlist() {
|
export function SimklGetUserWatchlist() {
|
||||||
return window['go']['main']['App']['SimklGetUserWatchlist']();
|
return window['go']['main']['App']['SimklGetUserWatchlist']();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user