我遇到了一个问题,该问题导致我在某些Android设备中无法使用Angular构建的PWA应用程序(我猜是这样)。当用户离线时,输入字段将被禁用,并且也不会显示已缓存的数据(如果它们确实已存储)。
但是,当我尝试在某些iPhone或什至在新的Android设备上进行操作时,它都可以正常工作。我附加了一些打印文件(Android 7.0可以在线工作/离线时不工作,而iPhone在离线时可以正常工作)。 Google Chrome DevTools上的Service Worker也可以在线和离线使用。
这是Android版本的不兼容吗?如果是这样,是否有办法使其在较旧的Android设备/版本中运行?
GitHub代码:https://github.com/paulotokarskiglinski/fullstack-pedidos
实时版本:https://fullstack-pedidos.herokuapp.com/
清单(manifest.json):
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
],
"dataGroups": [
{
"name": "clientes-api",
"urls": ["https://fullstack-pedidos.herokuapp.com/clientes"],
"cacheConfig": {
"strategy": "freshness",
"maxSize": 100,
"maxAge": "1h",
"timeout": "5s"
}
},
{
"name": "pedidos-api",
"urls": ["https://fullstack-pedidos.herokuapp.com/pedidos"],
"cacheConfig": {
"strategy": "freshness",
"maxSize": 100,
"maxAge": "1h",
"timeout": "5s"
}
},
{
"name": "produtos-api",
"urls": ["https://fullstack-pedidos.herokuapp.com/produtos"],
"cacheConfig": {
"strategy": "freshness",
"maxSize": 100,
"maxAge": "1h",
"timeout": "5s"
}
}
]
}
依赖项(package.json):
[...]
"dependencies": {
"@angular/animations": "^6.1.0",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/pwa": "^0.12.4",
"@angular/router": "^6.1.0",
"@angular/service-worker": "^6.1.0",
"cookie-parser": "~1.4.3",
"core-js": "^2.5.4",
"debug": "~2.6.9",
"ejs": "~2.5.7",
"express": "~4.16.0",
"http-errors": "~1.6.2",
"mongoose": "^5.3.14",
"morgan": "~1.9.0",
"rxjs": "~6.2.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.9",
"@angular/cli": "^7.3.9",
"@angular/compiler-cli": "^7.2.8",
"@angular/language-service": "^6.1.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^4.0.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "^3.2.4",
"webpack-dev-server": "^3.2.1"
}
[...]
跟随打印:
谢谢。