应用签名证书和上传证书有什么区别?我在将 Google Play 游戏与我的应用程序集成时遇到问题(我将此作为另一个问题发布),并且我注意到用于在 Google API 控制台上自动生成的客户端 ID 的证书称为签名证书。
但是,当我在 Android Studio 上运行登录报告时看到的内容称为上传证书。
client Id 应该设置哪一个?顺便说一句,两者都没有解决我的问题,但我很好奇其中的区别。
我一直在使用,vue-bootstrap但我正在考虑切换到vuetify. 但是,我发现对于某些组件,vue-bootstrap与后端集成要容易得多。
所以现在我正在考虑根据组件使用两者。是否还有意义同时使用vue-bootstrap,并vuetify在同一个项目?或者如果我同时使用这两个框架会有问题吗?
我想更改启动器图标的形状而不是使用圆形图标,但模拟器上的图标始终是圆形的。我试图删除包含圆形图标的文件夹并删除android:roundIcon="@mipmap/ic_launcher_round"清单文件,但仍然显示圆形图标。
如何避免使用圆形图标作为启动器图标?我看到我的设备上安装的一些应用程序图标总是方形的,这就是我想要做的。
我正在尝试使用 Firestore 创建一个类似聊天的应用程序,并尝试列出聊天中的所有消息,并在每次添加消息时更新它。
我首先尝试了这种方式来实现。
mounted() {
docRef.collection('messages').orderBy('timestamp', 'desc').limit(1).onSnapshot((querySnapShot) => {
querySnapShot.forEach((doc) => {
if (!doc.metadata.hasPendingWrites) {
this.messages.push(doc.data())
}
})
})
}
Run Code Online (Sandbox Code Playgroud)
这种方式看起来很有效,因为这种方式只获取集合中的最新消息。然而我发现这种方式有问题。当用户刷新页面时,用户无法获取过去的消息。
所以我就这样改了。
mounted() {
docRef.collection('messages').orderBy('timestamp', 'asc').onSnapshot((querySnapShot) => {
querySnapShot.docChanges().forEach((change) => {
if (change.type === 'added') {
this.messages.push(change.doc.data())
}
})
})
}
Run Code Online (Sandbox Code Playgroud)
这种方式按我的预期工作。但这种方式需要很多请求,因为每次集合更改时我都需要读取集合中的所有文档。
在聊天中列出消息的有效方法是什么?
我认为如果我先获取所有当前消息并为新消息设置侦听器,但在我进入页面后立即触发侦听器,即使集合中没有更改并读取最新消息两次,它也是有效的。
我想知道如何访问 json 中的嵌套数据。
AppLocalizations.of(context).translate('Information.about');
Run Code Online (Sandbox Code Playgroud)
en.json
{
"Information" : {
"about": "About"
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试了上面的方法,但它无法访问嵌套数据。
这是翻译方法。
class AppLocalizations {
final Locale locale;
AppLocalizations(this.locale);
static AppLocalizations of(BuildContext context) {
return Localizations.of<AppLocalizations>(context, AppLocalizations);
}
// Static member to get access to the delegate from 'main.dart' file
static const LocalizationsDelegate<AppLocalizations> delegate = _AppLocalizationsDelegate();
Map<String, String> _localizedValues;
Future<bool> load() async {
// Load a language JSON file from the 'i18n' folder
String value = await rootBundle.loadString('i18n/${locale.languageCode}.json');
Map<String, dynamic> jsonMap = jsonDecode(value);
_localizedValues = jsonMap.map((key, value) …Run Code Online (Sandbox Code Playgroud) 我创建了一个服务帐户电子邮件cloudfunctions.invoker并向该电子邮件添加了角色,以便我可以确保只有云任务可以触发云功能,然后我删除了AllUsers角色。但是当云任务尝试运行云函数时,状态码为UNAUTHENTICATED(16): HTTP status code 401,执行失败。
我当前的代码和控制台是这样的。
index.ts
export const addTasks = functions.https.onCall((data, context) => {
if (!context.auth) {
throw new functions.https.HttpsError('failed-precondition', 'You are not authenticated.')
}
const client = new tasks.CloudTasksClient()
const projectId = functions.config().project.id
const queue = 'queue'
const location = functions.config().project.location
const parent = client.queuePath(projectId, location, queue)
const url = `https://${location}-${projectId}.cloudfunctions.net/executeSomething`
const serviceAccountEmail = functions.config().project.email
const task: tasks.protos.google.cloud.tasks.v2.ITask = {
httpRequest: {
httpMethod: 'POST',
url: url,
oidcToken: {
serviceAccountEmail: serviceAccountEmail,
},
}, …Run Code Online (Sandbox Code Playgroud) firebase google-cloud-platform google-cloud-functions google-cloud-tasks
我想要做的是覆盖templates/account/email/email_confirmation_message.txt.
我想改变这部分
To confirm this is correct, go to {{ activate_url }}
Run Code Online (Sandbox Code Playgroud)
像
http://localhost:8080/confirm_email/{{ key }}
Run Code Online (Sandbox Code Playgroud)
然而,我无法弄清楚{{ activate_url }}从哪里来。我想将 发送key到由rest-auth.
如何重写电子邮件上的 url 链接?或者如果它太复杂了,在前端验证电子邮件的简单方法是什么?
django single-page-application django-rest-framework django-allauth django-rest-auth
好像在recylerview中的位置在滚动时会发生变化。
我想做的就是这样。
Adapter.java
@Override
public void onBindViewHolder(aViewHolder holder, int position) {
if (position == 0) {
holder.zeroIcon.setVisibility(View.VISIBLE);
} else if (position == 1) {
holder.oneIcon.setVisiblity(View.VISIBLE);
} else {
holder.otherIcon.setVisiblity(View.VISIBLE);
}
// Set text on each item
...
}
@Override
public int getItemCount() { return models.size(); }
public class aViewHolder extends RecyclerView.ViewHolder {
private ImageView zeroIcon;
private ImageView oneIcon;
private ImageView otherIcon;
public aViewHolder(View itemView) {
super(itemView);
zeroIcon = itemview.findViewById(...);
...
}
}
Run Code Online (Sandbox Code Playgroud)
我GONE在xml文件中将这些图标的可见性设置为默认值。
当我第一次看到recylerview时,图标将根据其位置显示在我期望的位置。
但是,当我向下滚动并向上滚动时,不正确的图标也会显示在不正确的位置。otherIcon …
我正在尝试制作隐私政策和服务条款链接。
Widget privacyPolicyLinkAndTermsOfService() {
return Container(
child: Center(
child: Text(
'By continuing, you agree to our Terms of Service and Privacy Policy.',
style: TextStyle(
fontSize: 14.0,
),
),
),
);
Run Code Online (Sandbox Code Playgroud)
通过这种方式,文本不会溢出,但我无法制作文本链接的一部分。因此,我尝试Row将文本和链接部分用作子项并将其分开。但是,当我使用Row和分隔文本作为孩子时,文本会溢出。在制作文本链接的一部分时,如何防止它们溢出?
我是创建 REST API 的新手,所以我可能会误解一些内容。我正在使用 Django Rest Framework 创建 REST API。我正在尝试创建一个对象并从我的移动应用程序发送它。
但是,API 返回 400。我认为它仍然无法将对象与请求用户关联起来,我想知道如何做到这一点。
models.py
class Item(models.Model):
item_name = models.CharField()
created_at = models.DateTimeField(auto_now_add=True)
created_by = models.ForeignKey(CustomUser, on_delete=models.CASCADE)
Run Code Online (Sandbox Code Playgroud)
serializers.py
class ItemSerializer(serializers.ModelSerializer):
class Meta:
model = Item
fields = ('item_name', 'created_by')
Run Code Online (Sandbox Code Playgroud)
和views.py
class ListItems(generics.ListCreateAPIView):
queryset = Item.objects.all()
serializer_class = ItemSerializer
Run Code Online (Sandbox Code Playgroud)
我想知道的是在发布对象时如何将对象与请求用户关联起来,就像我们所做的那样
if form.is_valid():
item = form.save(commit=False)
item.created_by = request.user
item.save()
Run Code Online (Sandbox Code Playgroud) 我是 VueJS 的新手。我正在创建注册和登录页面,用户应该将电子邮件和密码发送到后端(我使用的是 Django)以检查数据是否有效。如果其中之一无效,我想在表单上显示错误消息。
我看到了一些关于验证的文档,似乎我必须编写一堆验证代码。现在我想知道是否有一种简单的方法可以做到这一点。我想根据服务器端的验证器来验证它们。
Login.vue
export default {
data() {
return {
form: {
email: '',
password: '',
}
}
},
methods: {
onSubmit(event) {
event.preventDefault()
// validate the inputs here and shows error messages if they are not valid
const path = `http://127.0.0.1:8000/users/login/`
axios.post(path, this.form).then((resp) => {
location.href = '/'
})
.catch((err) => {
console.log(err)
})
}
}
Run Code Online (Sandbox Code Playgroud)
}
任何人都可以给我提示吗?
我想做的是在计划的时间使用云功能和云任务更改 firestore 中的数据。但云任务没有按时运行。添加任务后立即执行。
我的代码是这样的。
index.js
exports.addTasks = functions.https.onCall((data, context) => {
const client = new tasks.CloudTasksClient()
const projectId = ...
const queue = ...
const location = ...
const parent = client.queuePath(projectId, location, queue)
const url = ... .cloudfunctions.net/doSomething?docId=' + docId
const task = {
httpRequest: {
httpMethod: 'POST',
url: url,
scheduleTime: {
seconds: 3 * 60 + Date.now() / 1000,
},
}
}
const request = {
parent: parent,
task: task,
}
client.createTask(request)
})
exports.doSomething = functions.https.onRequest((req, res) => …Run Code Online (Sandbox Code Playgroud) google-cloud-platform google-cloud-functions google-cloud-tasks
android ×3
vue.js ×3
django ×2
firebase ×2
flutter ×2
java ×1
javascript ×1
validation ×1
vuejs2 ×1
vuetify.js ×1