[add] 沒有FCMToken就在要一次

This commit is contained in:
建喵 2022-08-30 11:37:02 +08:00
parent cf6f6f393c
commit fd5f31fd66

View File

@ -1,3 +1,4 @@
import { CoroutineV2 } from "./Engine/CatanEngine/CoroutineV2/CoroutineV2";
import { System_Eevent } from "./Engine/CatanEngine/CSharp/System/System_Eevent";
import NativeClass from "./NativeClass";
@ -109,7 +110,16 @@ export default class Manager extends cc.Component {
}
public onLoadOK(): void {
CoroutineV2.Single(this.GetFCMToken()).Start();
}
public *GetFCMToken(): IterableIterator<any> {
const FCMToken: string = NativeClass.Instance.GetFCMToken();
if (!FCMToken) {
yield CoroutineV2.WaitTime(1);
yield this.GetFCMToken();
return;
}
console.log(`FCMToken ${FCMToken}`);
NativeClass.Instance.CocosBridge(System_Eevent.SetFCMToken, `"${FCMToken}"`);
}