我在我的Android应用程序中的一个单独的线程中使用Cloud Firestore,所以我不想使用侦听器OnSuccessListener并OnFailureListener在另一个线程中运行.我可以让我的线程等待结果(并在需要时捕获任何异常)吗?
目前查询代码是这样的:
FirebaseFirestore.getInstance().collection("someCollection").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot documentSnapshots) {
// do something on the UI thread with the retrieved data
}
});
Run Code Online (Sandbox Code Playgroud)
我想要的是:
FirebaseFirestore.getInstance().collection("someCollection").getAndWaitForResult();
//Block the thread and wait for result, no callbacks.
//getAndWaitForResult() is not a real function, just something to describe my intention.
Run Code Online (Sandbox Code Playgroud)
我之前曾经使用过Parse Server,而且它在那里非常简单.
我是 Flutter Driver 测试的新手,我有一个问题,即在等待小部件出现时,测试总是超时(30 秒)。我的主课只检查 Firebase 用户是否为空。如果用户登录,则显示仪表板,否则显示登录屏幕。在运行检查时,它会显示一个 SplashScreen。测试“检查颤振驱动程序健康”正常完成。
我试过find.byValueKey("auth_screen")而不是find.byType("AuthScreen"),它给出了同样的问题。
错误日志:
VMServiceFlutterDriver: Connected to Flutter application.
00:01 +0: rendin app check flutter driver health
HealthStatus.ok
00:01 +1: rendin app Check login screen widgets
Splash screen
VMServiceFlutterDriver: waitFor message is taking a long time to complete...
VMServiceFlutterDriver: waitFor message is taking a long time to complete...
00:31 +1 -1: rendin app Check login screen widgets [E]
TimeoutException after 0:00:30.000000: Test timed out after 30 seconds.
Bad state: The …Run Code Online (Sandbox Code Playgroud) 简而言之,它是否context属于 BLoC 类?如果不属于,正确的方法是什么?
我使用 aProvider作为 Firebase DB 和 UI 之间的抽象层。最近,我们进一步抽象以使用 BLoC 模式,以便小部件不会直接操作数据Provider。一切进展顺利,但由于我们同时使用提供程序和 BLoC,我不确定如何BuildContext正确使用它们,因为上下文更多地与 Widgets/UI 相关,而不是与业务逻辑相关。
这是一个例子:
class SomeWidget extends StatelessWidget {
final SomeWidgetBloc bloc;
SomeWidget({Key key, this.bloc});
@override
Widget build(BuildContext context) => StreamBuilder(stream: bloc.getSomeData,
builder: (context, snapshot) {
return Text(snapshot.data ?? "Empty");
}
}
class SomeWidgetBloc {
BuildContext context; // should it be here? Currently, it's needed for the Provider
SomeWidgetBloc(BuildContext context);
Stream<String> get getSomeData {
return Provider.of<SomeFirebaseProvider>(context).fetchSomeData();
}
}
Run Code Online (Sandbox Code Playgroud) 我们的初创公司是使用 Firebase 和 Google Cloud 的“云原生”。我们正在研究事件驱动设计,但我很难将该概念与 Firebase 或 GCP 上的特定服务相匹配。
示例:用户通过移动应用创建合同草稿(Firestore 文档)。我们需要触发以下操作:
到目前为止,我们设法将这些操作放入 Cloud Function 触发器中,但我们的触发器代码变得混乱,并且在极少数情况下,操作运行时间会超过 Cloud Function 阈值(2GB 和 9 分钟)。
我们计划改进代码库并减少基于触发器的操作:
我研究过 Pub/Sub,但认为这有点矫枉过正,因为我们不必处理太多 GCP 之外的服务,而且我们的规模也不需要它。我们可以在 Firebase 工具领域实现上述目标吗?
firebase google-cloud-platform google-cloud-functions google-cloud-firestore
我正在使用Heroku上的Parse Server Example构建一个Android应用程序作为后端.我需要Mailgun从ParseUI类ParseLoginHelpFragment发送密码重置电子邮件.我还没有找到如何让Mailgun与Heroku/Parse Server一起工作的答案.这是我在Heroku上的配置:
也尝试了MAILGUN_SMTP_PORT 589,结果相同.感谢是否有人可以在我的设置中指出错误.
编辑:我知道我需要输入Mailgun API密钥和一些额外的设置.我试过在index.js文件中这样做:
var server = ParseServer({
...otherOptions,
// Enable email verification
verifyUserEmails: true,
// The public URL of your app.
// This will appear in the link that is used to verify email addresses and reset passwords.
// Set the mount path as it is in serverURL
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse App',
// The email adapter …Run Code Online (Sandbox Code Playgroud)