angular - 在应用简历上显示主要内容之前打开模式
问题描述
在我的 ionic 应用程序中,当应用程序恢复时,我会显示锁屏模式。我只想在用户成功输入正确的 pin 时才显示应用程序内容,否则应用程序正在最小化。我的问题是查看模式的延迟。一段时间后显示模态,在那个时候应用程序已经加载并且应用程序的所有内容在一段时间内都是可见的,这是我不想要的。在启动应用程序的情况下,我通过实现APP_INITIALIZE
首先查看模式然后加载应用程序的主要内容的功能成功地解决了这个问题。但我无法在暂停/恢复方法中实现相同的功能。这是我的代码:
app.component.ts
initializeApp() {
this.platform.pause.subscribe(async () => {
const time = (await Storage.get({key: 'pauseTimeout'})).value;
this.pauseTimeout = Number(time + '000');
this.timeout = false;
this.timeoutObj = setTimeout(() => {
this.timeout = true;
}, this.pauseTimeout);
});
this.platform.resume.subscribe(() => {
clearTimeout(this.timeoutObj);
if (this.timeout) {
this.userService.loggedIn_()
.then(async loggedIn => {
if (loggedIn) {
const cred = await this.userService.getCredentials_();
if (cred && cred.passcode) {
const passModal = await this.modalController.create({
component: PasscodePage,
componentProps: { passMethod: 'accessApp' }
});
await passModal.present();
}
}
});
}
});
pauseTimeout
基本上,如果达到,我会显示一个模态。但是由于验证已经花费了一些时间loggedIn
,因此应用程序的主要内容已经在这段时间内加载了。有没有办法在模态解雇后加载该内容?
解决方案
推荐阅读
- sql - 如何在不创建查询的情况下从 Access 表中获取值
- javascript - 即使正确使用 .indexOn,Firebase 也没有定义索引?
- flutter - 颤振热重载在android studio中不起作用
- c - 函数返回类型语法
- postgresql - 如何在 Hibernate HQL 查询中使用 PostgreSQL xmlexists() 函数?
- cordova - Phonegap 构建:iOS 失败
- angular - 如何显示 Angular Observable 返回的 JSON?
- regex - 你可以有“可选的多个任意字符”吗?
- node.js - 如何知道在 lambda 中,何时使用 event 和 event.body
- c++ - Arduino 编译错误:为 "ESP8266WiFi.h" 找到多个库。(Wemos D1 R2 Mini / ESP2866)