Commit 5441828e authored by 神楽坂玲奈's avatar 神楽坂玲奈

updateUser

parent bc508048
{ {
"name": "mycard-mobile", "name": "mycard-mobile",
"version": "1.0.18", "version": "1.0.19",
"license": "UNLISENCED", "license": "UNLISENCED",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
......
...@@ -36,6 +36,7 @@ import { StorageService } from './storage.service'; ...@@ -36,6 +36,7 @@ import { StorageService } from './storage.service';
import { ToolbarComponent } from './toolbar/toolbar.component'; import { ToolbarComponent } from './toolbar/toolbar.component';
import { WatchComponent } from './watch/watch.component'; import { WatchComponent } from './watch/watch.component';
import { WindbotComponent } from './windbot/windbot.component'; import { WindbotComponent } from './windbot/windbot.component';
import './ygopro.d';
import { YGOProService } from './ygopro.service'; import { YGOProService } from './ygopro.service';
@NgModule({ @NgModule({
...@@ -48,7 +49,7 @@ import { YGOProService } from './ygopro.service'; ...@@ -48,7 +49,7 @@ import { YGOProService } from './ygopro.service';
WindbotComponent, WindbotComponent,
WatchComponent, WatchComponent,
ToolbarComponent, ToolbarComponent,
ResultDialogComponent, ResultDialogComponent
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
...@@ -74,11 +75,11 @@ import { YGOProService } from './ygopro.service'; ...@@ -74,11 +75,11 @@ import { YGOProService } from './ygopro.service';
ReactiveFormsModule, ReactiveFormsModule,
JsonpModule, JsonpModule,
MdMenuModule, MdMenuModule,
MdProgressSpinnerModule, MdProgressSpinnerModule
], ],
providers: [YGOProService, StorageService], providers: [YGOProService, StorageService],
bootstrap: [AppComponent], bootstrap: [AppComponent],
entryComponents: [MatchDialogComponent, ResultDialogComponent], entryComponents: [MatchDialogComponent, ResultDialogComponent]
}) })
export class AppModule { export class AppModule {
} }
...@@ -60,6 +60,13 @@ export class LoginService { ...@@ -60,6 +60,13 @@ export class LoginService {
this.token = token; this.token = token;
this.user = <any>fromPairs(Array.from(new URLSearchParams(Buffer.from(token, 'base64').toString()))); this.user = <any>fromPairs(Array.from(new URLSearchParams(Buffer.from(token, 'base64').toString())));
localStorage.setItem('login', token); localStorage.setItem('login', token);
if (window.ygopro) {
try {
window.ygopro.updateUser(this.user.username, this.user.avatar_url, this.user.email);
} catch (error) {
console.error(error);
}
}
} }
avatar(username: string) { avatar(username: string) {
......
interface Window {
ygopro: {
// 加入房间
join (address: string, port: number, username: string, password: string): void
// 编辑卡组
edit_deck (): void
// 观看录像,进入观看录像界面
watch_replay(): void
// 残局模式
puzzle_mode(): void
openDrawer(): void
backHome(): void
share(text: string): void
updateUser(name: string, avatar: string, status: string): void
readFile(path: string): string
writeFile(path: string, data: string): string
readdir(path: string): string
unlink(path: string): boolean
getFileLastModified(path: string): number
setFileLastModified(path: string, time: number): void
};
}
...@@ -460,35 +460,3 @@ export class RoomListDataSource extends DataSource<any> { ...@@ -460,35 +460,3 @@ export class RoomListDataSource extends DataSource<any> {
} }
} }
declare global {
interface Window {
ygopro: {
// 加入房间
join (address: string, port: number, username: string, password: string): void
// 编辑卡组
edit_deck (): void
// 观看录像,进入观看录像界面
watch_replay(): void
// 残局模式
puzzle_mode(): void
openDrawer(): void
backHome(): void
share(text: string): void
readFile(path: string): string
writeFile(path: string, data: string): string
readdir(path: string): string
unlink(path: string): boolean
getFileLastModified(path: string): number
setFileLastModified(path: string, time: number): void
};
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment