Commit 0fb3e190 authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent 1c12b52c
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"ng": "ng", "ng": "ng",
"start": "ng serve --aot", "start": "ng serve --aot",
"build": "ng build --i18n-locale zh-CN --base-href /mobile/ --prod", "build": "ng build --i18n-locale zh-CN --base-href /mobile/ --prod",
"build:dev": "ng build --i18n-locale zh-CN --base-href /mobile2/ --prod",
"postinstall": "patch -i webpack.patch -p0 -t", "postinstall": "patch -i webpack.patch -p0 -t",
"lint": "ng lint" "lint": "ng lint"
}, },
......
...@@ -41,9 +41,7 @@ export class NewRoomComponent { ...@@ -41,9 +41,7 @@ export class NewRoomComponent {
} }
share(host_password: string) { share(host_password: string) {
return navigator.share({ this.ygopro.share('房间密码是' + host_password);
text: '房间密码是' + host_password
});
} }
set_start_lp() { set_start_lp() {
......
...@@ -396,6 +396,15 @@ export class YGOProService { ...@@ -396,6 +396,15 @@ export class YGOProService {
alert(JSON.stringify({ method: 'backHome', params: [] })); alert(JSON.stringify({ method: 'backHome', params: [] }));
} }
} }
share(text: string) {
try {
window.ygopro.share(text);
} catch (error) {
console.error(error);
alert(JSON.stringify({ method: 'share', params: [text] }));
}
}
} }
type Message = type Message =
......
...@@ -14,6 +14,7 @@ interface Window { ...@@ -14,6 +14,7 @@ interface Window {
openDrawer(): void; openDrawer(): void;
backHome(): void; backHome(): void;
share(text: string): void
updateUser(name: string, avatar: string, status: string): void; updateUser(name: string, avatar: string, status: string): void;
readFile(path: string): string; readFile(path: string): string;
...@@ -25,6 +26,6 @@ interface Window { ...@@ -25,6 +26,6 @@ interface Window {
}; };
} }
interface Navigator { // interface Navigator {
share: (options: { title?: string; text?: string; url?: string }) => Promise<{}>; // share: (options: { title?: string; text?: string; url?: string }) => Promise<{}>;
} // }
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