no message
This commit is contained in:
parent
1af1ecfbb9
commit
114980dab0
@ -23,27 +23,26 @@ class _MyAppState extends State<MyApp> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
OpenIM.iMManager
|
OpenIM.iMManager
|
||||||
.initSDK(
|
.initSDK(
|
||||||
platformID: 2,
|
platformID: 3,
|
||||||
apiAddr: 'http://192.168.77.135:10002',
|
apiAddr: 'http://192.168.77.135:10002',
|
||||||
wsAddr: 'ws://192.168.77.135:10001',
|
wsAddr: 'ws://192.168.77.135:10001',
|
||||||
dataDir: './',
|
dataDir: './',
|
||||||
listener: OnConnectListener())
|
listener: OnConnectListener())
|
||||||
|
.then((value) {});
|
||||||
|
OpenIM.iMManager.userManager.setUserListener(OnUserListener());
|
||||||
|
|
||||||
|
OpenIM.iMManager
|
||||||
|
.login(
|
||||||
|
userID: "8bfe13b5eac44e87963652abb91d80d2",
|
||||||
|
token:
|
||||||
|
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiI4YmZlMTNiNWVhYzQ0ZTg3OTYzNjUyYWJiOTFkODBkMiIsIlBsYXRmb3JtSUQiOjMsImV4cCI6MTc1NDM2NDkwNCwiaWF0IjoxNzQ2NTg4ODk5fQ.575xwR9lzJo1i5Te-Ul-99odONfxbzDXW0_2Kv3nFEE")
|
||||||
.then((value) {
|
.then((value) {
|
||||||
print('SDK initialized successfully');
|
OpenIM.iMManager.conversationManager
|
||||||
|
.getAllConversationList()
|
||||||
OpenIM.iMManager.userManager.setUserListener(OnUserListener());
|
|
||||||
|
|
||||||
OpenIM.iMManager
|
|
||||||
.login(
|
|
||||||
userID: "3e8b8fb2ecd8414db50838d9f7bcb19d",
|
|
||||||
token:
|
|
||||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiIzZThiOGZiMmVjZDg0MTRkYjUwODM4ZDlmN2JjYjE5ZCIsIlBsYXRmb3JtSUQiOjIsImV4cCI6MTc1Mzc1MTYyNywiaWF0IjoxNzQ1OTc1NjIyfQ.S-CxfETXYyLFe2VqStwbrVCRcB5j2T2qi-52y1L-3OI")
|
|
||||||
.then((value) {
|
.then((value) {
|
||||||
print('Login successful');
|
print('Get all conversation list successful');
|
||||||
}).catchError((error) {
|
|
||||||
print('Login failed: $error');
|
|
||||||
});
|
});
|
||||||
});
|
}).catchError((error) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -14,13 +14,6 @@ namespace ThreadUtil {
|
|||||||
static std::condition_variable g_queueCondition;
|
static std::condition_variable g_queueCondition;
|
||||||
static bool g_initialized = false;
|
static bool g_initialized = false;
|
||||||
static HANDLE g_workerThread = NULL;
|
static HANDLE g_workerThread = NULL;
|
||||||
|
|
||||||
// Function to initialize the platform thread ID
|
|
||||||
void InitializePlatformThreadId() {
|
|
||||||
g_platformThreadId = GetCurrentThreadId();
|
|
||||||
g_initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Worker thread function
|
// Worker thread function
|
||||||
unsigned __stdcall WorkerThreadProc(void* param) {
|
unsigned __stdcall WorkerThreadProc(void* param) {
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -39,6 +32,16 @@ namespace ThreadUtil {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// Function to initialize the platform thread ID
|
||||||
|
void InitializePlatformThreadId() {
|
||||||
|
g_platformThreadId = GetCurrentThreadId();
|
||||||
|
|
||||||
|
// Create worker thread
|
||||||
|
g_workerThread = (HANDLE)_beginthreadex(NULL, 0, WorkerThreadProc, NULL, 0, NULL);
|
||||||
|
g_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Function to ensure code runs on the platform thread
|
// Function to ensure code runs on the platform thread
|
||||||
void RunOnPlatformThread(std::function<void()> callback) {
|
void RunOnPlatformThread(std::function<void()> callback) {
|
||||||
@ -46,8 +49,7 @@ namespace ThreadUtil {
|
|||||||
if (!g_initialized) {
|
if (!g_initialized) {
|
||||||
InitializePlatformThreadId();
|
InitializePlatformThreadId();
|
||||||
|
|
||||||
// Create worker thread
|
|
||||||
g_workerThread = (HANDLE)_beginthreadex(NULL, 0, WorkerThreadProc, NULL, 0, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're already on the platform thread, execute directly
|
// If we're already on the platform thread, execute directly
|
||||||
|
Loading…
x
Reference in New Issue
Block a user