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

updateUser

parent bc508048
{
"name": "mycard-mobile",
"version": "1.0.18",
"version": "1.0.19",
"license": "UNLISENCED",
"scripts": {
"ng": "ng",
......
......@@ -36,6 +36,7 @@ import { StorageService } from './storage.service';
import { ToolbarComponent } from './toolbar/toolbar.component';
import { WatchComponent } from './watch/watch.component';
import { WindbotComponent } from './windbot/windbot.component';
import './ygopro.d';
import { YGOProService } from './ygopro.service';
@NgModule({
......@@ -48,7 +49,7 @@ import { YGOProService } from './ygopro.service';
WindbotComponent,
WatchComponent,
ToolbarComponent,
ResultDialogComponent,
ResultDialogComponent
],
imports: [
BrowserModule,
......@@ -74,11 +75,11 @@ import { YGOProService } from './ygopro.service';
ReactiveFormsModule,
JsonpModule,
MdMenuModule,
MdProgressSpinnerModule,
MdProgressSpinnerModule
],
providers: [YGOProService, StorageService],
bootstrap: [AppComponent],
entryComponents: [MatchDialogComponent, ResultDialogComponent],
entryComponents: [MatchDialogComponent, ResultDialogComponent]
})
export class AppModule {
}
......@@ -60,6 +60,13 @@ export class LoginService {
this.token = token;
this.user = <any>fromPairs(Array.from(new URLSearchParams(Buffer.from(token, 'base64').toString())));
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) {
......
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> {
}
}
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