mirror of
https://github.com/WuKongIM/WuKongIMFlutterSDK
synced 2025-05-29 15:12:20 +00:00
update connection device id with uid
This commit is contained in:
parent
ae12f93edb
commit
fe7664f4d0
@ -27,4 +27,6 @@
|
||||
### 1.1.3
|
||||
* Add some methods
|
||||
### 1.1.4
|
||||
* update set reddot method
|
||||
* update set reddot method
|
||||
### 1.1.5
|
||||
* update connnection device id with uid
|
@ -9,7 +9,7 @@
|
||||
#### 安装
|
||||
```
|
||||
dependencies:
|
||||
wukongimfluttersdk: ^1.1.4
|
||||
wukongimfluttersdk: ^1.1.5
|
||||
```
|
||||
#### 引入
|
||||
```dart
|
||||
|
@ -499,7 +499,7 @@ packages:
|
||||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.1.4"
|
||||
version: "1.1.5"
|
||||
x25519:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -4,6 +4,8 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
import 'package:connectivity/connectivity.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:wukongimfluttersdk/db/const.dart';
|
||||
|
||||
import 'package:wukongimfluttersdk/db/wk_db_helper.dart';
|
||||
@ -289,13 +291,14 @@ class WKConnectionManager {
|
||||
_sendPacket(ackPacket);
|
||||
}
|
||||
|
||||
_sendConnectPacket() {
|
||||
_sendConnectPacket() async {
|
||||
var deviceID = await _getDeviceID();
|
||||
var connectPacket = ConnectPacket(
|
||||
uid: WKIM.shared.options.uid!,
|
||||
token: WKIM.shared.options.token!,
|
||||
version: WKIM.shared.options.protoVersion,
|
||||
clientKey: base64Encode(CryptoUtils.dhPublicKey!),
|
||||
deviceID: "flutter",
|
||||
deviceID: deviceID,
|
||||
clientTimestamp: DateTime.now().millisecondsSinceEpoch);
|
||||
_sendPacket(connectPacket);
|
||||
}
|
||||
@ -513,6 +516,18 @@ class WKConnectionManager {
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> _getDeviceID() async {
|
||||
SharedPreferences preferences = await SharedPreferences.getInstance();
|
||||
String wkUid = WKIM.shared.options.uid!;
|
||||
String key = "${wkUid}_device_id";
|
||||
var deviceID = preferences.getString(key);
|
||||
if (deviceID == null || deviceID == "") {
|
||||
deviceID = "${const Uuid().v4().toString().replaceAll("-", "")}5";
|
||||
preferences.setString(key, deviceID);
|
||||
}
|
||||
return deviceID;
|
||||
}
|
||||
|
||||
class SendingMsg {
|
||||
SendPacket sendPacket;
|
||||
int sendCount = 0;
|
||||
|
@ -15,7 +15,7 @@ description: wukong IM flutter sdk
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.1.4
|
||||
version: 1.1.5
|
||||
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
||||
|
||||
environment:
|
||||
|
Loading…
x
Reference in New Issue
Block a user