Added api for sending feedback
This commit is contained in:
@ -2,9 +2,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:package_info/package_info.dart';
|
||||
|
||||
@ -21,18 +19,17 @@ class UpdateUserIndex extends MhslApi<void> {
|
||||
|
||||
@override
|
||||
Future<http.Response> request(Uri uri) {
|
||||
return http.post(uri, body: jsonEncode(params.toJson()));
|
||||
String data = jsonEncode(params.toJson());
|
||||
log("Updating userindex:\n $data");
|
||||
return http.post(uri, body: data);
|
||||
}
|
||||
|
||||
static void index() async {
|
||||
String userId = sha512.convert(utf8.encode("${AccountData().getUsername()}:${AccountData().getPassword()}")).toString();
|
||||
String deviceId = sha512.convert(utf8.encode("$userId@${await FirebaseMessaging.instance.getToken()}")).toString();
|
||||
log("Userindex:\n userid:$userId\n deviceid:$deviceId");
|
||||
UpdateUserIndex(
|
||||
UpdateUserIndexParams(
|
||||
username: AccountData().getUsername(),
|
||||
user: userId,
|
||||
device: deviceId,
|
||||
user: AccountData().getUserId(),
|
||||
device: await AccountData().getDeviceId(),
|
||||
appVersion: int.parse((await PackageInfo.fromPlatform()).buildNumber),
|
||||
deviceInfo: jsonEncode((await DeviceInfoPlugin().deviceInfo).data).toString(),
|
||||
),
|
||||
|
Reference in New Issue
Block a user