小编Kas*_*ash的帖子

FirebaseAppDelegateProxyEnabled 有何作用?

我的问题(后台通知):

我正在使用React Native Firebase。一切都很好,直到最近我更新到了该库的 6.7.1 版本。更新后后台通知(应用程序关闭时)停止工作。前台正在工作。

在这里找到了一个建议,可以转到FirebaseAppDelegateProxyEnabledinfo.plistYES中。

它确实有效!我现在可以正常接收通知了。

但什么是调酒呢?

我真的不明白这种 swizzling 方法是什么,设置它YESNOdo 之间有什么区别?我在 firebase 文档中读到了它:Method swizzling in Firebase Cloud Messaging。我真的无法理解。有人可以以更清楚的方式解释一下,这有什么区别?

firebase firebase-cloud-messaging react-native-firebase

10
推荐指数
1
解决办法
8866
查看次数

What's the right way to implement offline fallback with workbox

I am implementing PWA into my project, I have setted up the serviceworker.js, and I am using workbox.js for cache routing and strategies.

1- I add the offline page to cache on install event, when a user first visit the site:

/**
 * Add on install
 */
self.addEventListener('install', (event) => {
  const urls = ['/offline/'];
  const cacheName = workbox.core.cacheNames.runtime;
  event.waitUntil(caches.open(cacheName).then((cache) => cache.addAll(urls)))
});
Run Code Online (Sandbox Code Playgroud)

2- Catch & cache pages with a specific regex, like these:

https://website.com/posts/the-first-post

https://website.com/posts/

https://website.com/articles/

workbox.routing.registerRoute(
  new RegExp('/posts|/articles'), …
Run Code Online (Sandbox Code Playgroud)

service-worker progressive-web-apps workbox

5
推荐指数
1
解决办法
3250
查看次数

如何指向 serviceworker.js 中的当前目录

我的 service worker 安装在一个临时目录中

主要网站在: https:example.com

分期开启: https:example.com/test/

服务工作者路径: https:example.com/test/serviceworker.js

这是我注册服务工作者的方式:

navigator.serviceWorker.register('https:example.com/test/serviceworker.js', {scope: '/test/'})
.then(registration => {
  console.log(`Service Worker registered! Scope: ${registration.scope}`);
})
Run Code Online (Sandbox Code Playgroud)

Service Worker 工作正常,并已安装。

我担心的是,在 serviceworker.js 中,我想使用/自动指向当前目录的路径,在这种情况下:/staging/

例如,当我想在临时站点中缓存主页时

/**
 * Cache the homepage.
 */
workbox.routing.registerRoute('/', workbox.strategies.staleWhileRevalidate();
Run Code Online (Sandbox Code Playgroud)

这里的缓存https:example.com不是https:example.com/test/

我知道我可以简单地更改registerRoute('/')registerRoute('/staging/)'

但这效率不高,并且会使我需要为 localhost、暂存和部署使用不同版本的 serviceworker。我想知道在此处执行此操作的正确方法是什么,因此我可以将范围“/”设置为 serviceworker.js 所在的当前目录。谢谢。

service-worker workbox

5
推荐指数
1
解决办法
1168
查看次数

在抽屉导航器中卸载或重新渲染屏幕

我最近刚刚添加了抽屉导航器并将我的屏幕包裹在 createDrawerNavigator()

这些是我目前的路线:

  • 主页.js
  • Post.js
  • 设置.js

当用户从Home导航到Post 时,我传递一个包含 post 数据的参数。

onPress={() => this.props.navigation.navigate('Post', {postData: postData})}
Run Code Online (Sandbox Code Playgroud)

当用户从Post返回Home时,post 将被卸载。并在单击另一篇文章时重新安装新数据。

我的问题是,通过实施抽屉,导航回主页时不会卸载帖子屏幕,我一遍又一遍地不断打开第一个帖子的相同道具和屏幕。

这是我的路线设置:

onPress={() => this.props.navigation.navigate('Post', {postData: postData})}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

我希望每个帖子屏幕在从主页导航到它时打开并重新呈现为新的。

react-native react-navigation

3
推荐指数
2
解决办法
9221
查看次数

符号"〜"在VCL中的含义是什么?

我看到这用于清漆vcl if语句"〜"

if (req.url ~ "phpMyAdmin") {
    return (pass);
}
Run Code Online (Sandbox Code Playgroud)

我知道它有点像==时间in_array()

if ( req.http.User-Agent ~ "(Android|iPhone|iPad|BlackBerry|SAMSUNG)") 
   return(pass);
}
Run Code Online (Sandbox Code Playgroud)

有人可以解释它实际意味着什么.它也是一个默认的php运算符吗?它和使用之间有什么区别==

varnish

1
推荐指数
1
解决办法
184
查看次数