Login to add login status judgment
This commit is contained in:
parent
79cbae718c
commit
5bdb9879a7
@ -53,5 +53,5 @@ dependencies {
|
|||||||
// 本地依赖,现将aar复制到libs/io/openim/core-sdk/0.0.1/ 下,命名core-sdk-0.0.1.aar
|
// 本地依赖,现将aar复制到libs/io/openim/core-sdk/0.0.1/ 下,命名core-sdk-0.0.1.aar
|
||||||
// implementation 'io.openim:core-sdk:0.0.1@aar'
|
// implementation 'io.openim:core-sdk:0.0.1@aar'
|
||||||
// api 'io.openim:core-sdk:2.3.5-t44@aar'
|
// api 'io.openim:core-sdk:2.3.5-t44@aar'
|
||||||
implementation 'io.openim:core-sdk:3.0.0-beta06@aar'
|
implementation 'io.openim:core-sdk:3.0.0-beta08@aar'
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ export 'src/enum/group_type.dart';
|
|||||||
export 'src/enum/group_verification.dart';
|
export 'src/enum/group_verification.dart';
|
||||||
export 'src/enum/im_platform.dart';
|
export 'src/enum/im_platform.dart';
|
||||||
export 'src/enum/listener_type.dart';
|
export 'src/enum/listener_type.dart';
|
||||||
|
export 'src/enum/login_status.dart';
|
||||||
export 'src/enum/message_status.dart';
|
export 'src/enum/message_status.dart';
|
||||||
export 'src/enum/message_type.dart';
|
export 'src/enum/message_type.dart';
|
||||||
export 'src/enum/sdk_error_code.dart';
|
export 'src/enum/sdk_error_code.dart';
|
||||||
|
5
lib/src/enum/login_status.dart
Normal file
5
lib/src/enum/login_status.dart
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
class LoginStatus {
|
||||||
|
static const logout = 1;
|
||||||
|
static const logging = 2;
|
||||||
|
static const logged = 3;
|
||||||
|
}
|
@ -8,7 +8,6 @@ class MessageFailedCode {
|
|||||||
|
|
||||||
/// 已被移除群聊/群已解散
|
/// 已被移除群聊/群已解散
|
||||||
static const int notInGroup = 1205;
|
static const int notInGroup = 1205;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 添加好友失败
|
/// 添加好友失败
|
||||||
|
@ -467,10 +467,10 @@ class IMManager {
|
|||||||
required OnConnectListener listener,
|
required OnConnectListener listener,
|
||||||
int logLevel = 6,
|
int logLevel = 6,
|
||||||
String objectStorage = 'cos',
|
String objectStorage = 'cos',
|
||||||
String? encryptionKey,
|
// String? encryptionKey,
|
||||||
bool isNeedEncryption = false,
|
// bool isNeedEncryption = false,
|
||||||
bool isCompression = false,
|
// bool isCompression = false,
|
||||||
bool isExternalExtensions = false,
|
// bool isExternalExtensions = false,
|
||||||
bool isLogStandardOutput = true,
|
bool isLogStandardOutput = true,
|
||||||
String? logFilePath,
|
String? logFilePath,
|
||||||
String? operationID,
|
String? operationID,
|
||||||
@ -487,10 +487,10 @@ class IMManager {
|
|||||||
"dataDir": dataDir,
|
"dataDir": dataDir,
|
||||||
"logLevel": logLevel,
|
"logLevel": logLevel,
|
||||||
"objectStorage": objectStorage,
|
"objectStorage": objectStorage,
|
||||||
"encryptionKey": encryptionKey,
|
// "encryptionKey": encryptionKey,
|
||||||
"isNeedEncryption": isNeedEncryption,
|
// "isNeedEncryption": isNeedEncryption,
|
||||||
"isCompression": isCompression,
|
// "isCompression": isCompression,
|
||||||
"isExternalExtensions": isExternalExtensions,
|
// "isExternalExtensions": isExternalExtensions,
|
||||||
"isLogStandardOutput": isLogStandardOutput,
|
"isLogStandardOutput": isLogStandardOutput,
|
||||||
"logFilePath": logFilePath,
|
"logFilePath": logFilePath,
|
||||||
"operationID": Utils.checkOperationID(operationID),
|
"operationID": Utils.checkOperationID(operationID),
|
||||||
@ -499,7 +499,7 @@ class IMManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 登录
|
/// 登录
|
||||||
/// [uid] 用户id
|
/// [userID] 用户id
|
||||||
/// [token] 登录token,从业务服务器上获取
|
/// [token] 登录token,从业务服务器上获取
|
||||||
/// [defaultValue] 获取失败后使用的默认值
|
/// [defaultValue] 获取失败后使用的默认值
|
||||||
Future<UserInfo> login({
|
Future<UserInfo> login({
|
||||||
@ -507,7 +507,14 @@ class IMManager {
|
|||||||
required String token,
|
required String token,
|
||||||
String? operationID,
|
String? operationID,
|
||||||
Future<UserInfo> Function()? defaultValue,
|
Future<UserInfo> Function()? defaultValue,
|
||||||
|
bool checkLoginStatus = true,
|
||||||
}) async {
|
}) async {
|
||||||
|
int? status;
|
||||||
|
if (checkLoginStatus) {
|
||||||
|
// 1: logout 2: logging 3:logged
|
||||||
|
status = await getLoginStatus();
|
||||||
|
}
|
||||||
|
if (status != LoginStatus.logging && status != LoginStatus.logged) {
|
||||||
await _channel.invokeMethod(
|
await _channel.invokeMethod(
|
||||||
'login',
|
'login',
|
||||||
_buildParam({
|
_buildParam({
|
||||||
@ -516,6 +523,7 @@ class IMManager {
|
|||||||
'operationID': Utils.checkOperationID(operationID),
|
'operationID': Utils.checkOperationID(operationID),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
this.isLogined = true;
|
this.isLogined = true;
|
||||||
this.userID = userID;
|
this.userID = userID;
|
||||||
this.token = token;
|
this.token = token;
|
||||||
@ -544,6 +552,7 @@ class IMManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 获取登录状态
|
/// 获取登录状态
|
||||||
|
/// 1: logout 2: logging 3:logged
|
||||||
Future<int?> getLoginStatus() =>
|
Future<int?> getLoginStatus() =>
|
||||||
_channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
_channel.invokeMethod<int>('getLoginStatus', _buildParam({}));
|
||||||
|
|
||||||
|
@ -145,7 +145,6 @@ class MessageManager {
|
|||||||
}))
|
}))
|
||||||
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
|
||||||
|
|
||||||
|
|
||||||
/// 正在输入提示
|
/// 正在输入提示
|
||||||
/// [msgTip] 自定义内容
|
/// [msgTip] 自定义内容
|
||||||
Future typingStatusUpdate({
|
Future typingStatusUpdate({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user