mirror of
https://github.com/WuKongIM/WuKongIMFlutterSDK
synced 2025-06-01 00:30:14 +00:00
update connection device id with uid
This commit is contained in:
parent
ae12f93edb
commit
fe7664f4d0
@ -28,3 +28,5 @@
|
|||||||
* Add some methods
|
* Add some methods
|
||||||
### 1.1.4
|
### 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:
|
dependencies:
|
||||||
wukongimfluttersdk: ^1.1.4
|
wukongimfluttersdk: ^1.1.5
|
||||||
```
|
```
|
||||||
#### 引入
|
#### 引入
|
||||||
```dart
|
```dart
|
||||||
|
@ -499,7 +499,7 @@ packages:
|
|||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "1.1.4"
|
version: "1.1.5"
|
||||||
x25519:
|
x25519:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -4,6 +4,8 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:connectivity/connectivity.dart';
|
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/const.dart';
|
||||||
|
|
||||||
import 'package:wukongimfluttersdk/db/wk_db_helper.dart';
|
import 'package:wukongimfluttersdk/db/wk_db_helper.dart';
|
||||||
@ -289,13 +291,14 @@ class WKConnectionManager {
|
|||||||
_sendPacket(ackPacket);
|
_sendPacket(ackPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
_sendConnectPacket() {
|
_sendConnectPacket() async {
|
||||||
|
var deviceID = await _getDeviceID();
|
||||||
var connectPacket = ConnectPacket(
|
var connectPacket = ConnectPacket(
|
||||||
uid: WKIM.shared.options.uid!,
|
uid: WKIM.shared.options.uid!,
|
||||||
token: WKIM.shared.options.token!,
|
token: WKIM.shared.options.token!,
|
||||||
version: WKIM.shared.options.protoVersion,
|
version: WKIM.shared.options.protoVersion,
|
||||||
clientKey: base64Encode(CryptoUtils.dhPublicKey!),
|
clientKey: base64Encode(CryptoUtils.dhPublicKey!),
|
||||||
deviceID: "flutter",
|
deviceID: deviceID,
|
||||||
clientTimestamp: DateTime.now().millisecondsSinceEpoch);
|
clientTimestamp: DateTime.now().millisecondsSinceEpoch);
|
||||||
_sendPacket(connectPacket);
|
_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 {
|
class SendingMsg {
|
||||||
SendPacket sendPacket;
|
SendPacket sendPacket;
|
||||||
int sendCount = 0;
|
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
|
# 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
|
# 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.
|
# 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
|
homepage: https://github.com/WuKongIM/WuKongIMFlutterSDK
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user