Skip to content

Commit

Permalink
chore: release v3.8.2-2 (#143)
Browse files Browse the repository at this point in the history
* feat: add new input state api (#137)

* fix: update friends params type & add deprecated description

* fix: add db method & app sdk version  add field

* chore: core update v3.8.2

* chore: release 3.8.2-2
  • Loading branch information
Bloomingg authored Nov 22, 2024
1 parent 2e351cb commit e04e55a
Show file tree
Hide file tree
Showing 17 changed files with 180 additions and 6 deletions.
Binary file modified assets/openIM.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions assets/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v3.8.2
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openim/wasm-client-sdk",
"version": "3.8.2",
"version": "3.8.2-2",
"description": "open im sdk for web",
"source": "src/index.ts",
"main": "lib/index.js",
Expand Down
13 changes: 13 additions & 0 deletions src/api/database/alter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Database } from '@jlongster/sql.js';
export function alterTable(db: Database) {
alter351(db);
alter380(db);
alter381(db);
}

function alter351(db: Database) {
Expand All @@ -28,3 +29,15 @@ function alter380(db: Database) {
// alter table error
}
}

function alter381(db: Database) {
try {
db.exec(
`
ALTER TABLE local_app_sdk_version ADD COLUMN installed numeric;
`
);
} catch (error) {
// alter table error
}
}
23 changes: 23 additions & 0 deletions src/api/database/conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getConversation as databaseGetConversation,
getHiddenConversationList as databaseGetHiddenConversationList,
getAllSingleConversationIDList as databaseGetAllSingleConversationIDList,
findAllUnreadConversationConversationID as databaseFindAllUnreadConversationConversationID,
getAllConversationIDList as databaseGetAllConversationIDList,
updateColumnsConversation as databaseUpdateColumnsConversation,
getTotalUnreadMsgCount as databaseGetTotalUnreadMsgCount,
Expand Down Expand Up @@ -87,6 +88,28 @@ export async function getAllConversationListToSync(): Promise<string> {
}
}

export async function findAllUnreadConversationConversationID(): Promise<string> {
try {
const db = await getInstance();

const execResult = databaseFindAllUnreadConversationConversationID(db);

return formatResponse(
converSqlExecResult(execResult[0], 'CamelCase').map(
item => item.conversationID
)
);
} catch (e) {
console.error(e);

return formatResponse(
undefined,
DatabaseErrorCode.ErrorInit,
JSON.stringify(e)
);
}
}

export async function getAllSingleConversationIDList(): Promise<string> {
try {
const db = await getInstance();
Expand Down
6 changes: 4 additions & 2 deletions src/api/database/localAppSdkVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function getAppSDKVersion(): Promise<string> {
}

return formatResponse(
converSqlExecResult(execResult[0], 'CamelCase', [])[0]
converSqlExecResult(execResult[0], 'CamelCase', ['installed'])[0]
);
} catch (e) {
console.error(e);
Expand All @@ -53,7 +53,9 @@ export async function setAppSDKVersion(

const execResult = databaseGetAppSDKVersion(db);

const result = converSqlExecResult(execResult[0], 'CamelCase', []);
const result = converSqlExecResult(execResult[0], 'CamelCase', [
'installed',
]);
if (result[0] && result[0].version) {
databaseUpdateAppSDKVersion(
db,
Expand Down
3 changes: 3 additions & 0 deletions src/api/database/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ export async function getMessageList(
startTime: number,
isReverse = false
): Promise<string> {
if (startTime <= 0) {
return getMessageListNoTime(conversationID, count, isReverse);
}
try {
const db = await getInstance();

Expand Down
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ export function initDatabaseAPI(isLogStandardOutput = true): void {
window.getAllSingleConversationIDList = registeMethodOnWindow(
'getAllSingleConversationIDList'
);
window.findAllUnreadConversationConversationID = registeMethodOnWindow(
'findAllUnreadConversationConversationID'
);
window.getAllConversationIDList = registeMethodOnWindow(
'getAllConversationIDList'
);
Expand Down
5 changes: 5 additions & 0 deletions src/api/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ import {
batchInsertTempCacheMessageList,
InsertTempCacheMessage,
getAllSingleConversationIDList,
findAllUnreadConversationConversationID,
getAllConversationIDList,
getPageFriendList,
getGroupMemberAllGroupIDs,
Expand Down Expand Up @@ -319,6 +320,10 @@ rpc.registerMethod(
'setMultipleConversationRecvMsgOpt',
setMultipleConversationRecvMsgOpt
);
rpc.registerMethod(
'findAllUnreadConversationConversationID',
findAllUnreadConversationConversationID
);
rpc.registerMethod(
'getAllSingleConversationIDList',
getAllSingleConversationIDList
Expand Down
3 changes: 3 additions & 0 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ export enum CbEvents {
OnProgress = 'OnProgress',
OnRecvNewMessage = 'OnRecvNewMessage',
OnRecvNewMessages = 'OnRecvNewMessages',
OnRecvOnlineOnlyMessage = 'OnRecvOnlineOnlyMessage',
OnRecvOfflineNewMessage = 'onRecvOfflineNewMessage',
OnRecvOnlineOnlyMessages = 'OnRecvOnlineOnlyMessages',
OnRecvOfflineNewMessages = 'onRecvOfflineNewMessages',
OnRecvMessageRevoked = 'OnRecvMessageRevoked',
OnNewRecvMessageRevoked = 'OnNewRecvMessageRevoked',
OnRecvC2CReadReceipt = 'OnRecvC2CReadReceipt',
OnRecvGroupReadReceipt = 'OnRecvGroupReadReceipt',
OnConversationChanged = 'OnConversationChanged',
OnNewConversation = 'OnNewConversation',
OnConversationUserInputStatusChanged = 'OnConversationUserInputStatusChanged',
OnSyncServerFailed = 'OnSyncServerFailed',
OnSyncServerFinish = 'OnSyncServerFinish',
OnSyncServerProgress = 'OnSyncServerProgress',
Expand Down
82 changes: 81 additions & 1 deletion src/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ import {
UpdateFriendsParams,
SetConversationParams,
GetSpecifiedFriendsParams,
ChangeInputStatesParams,
GetInputstatesParams,
} from '../types/params';

import {
Expand All @@ -97,7 +99,12 @@ import {
WSEvent,
WsResponse,
} from '../types/entity';
import { GroupAtType, LoginStatus, MessageReceiveOptType } from '@/types/enum';
import {
GroupAtType,
LoginStatus,
MessageReceiveOptType,
Platform,
} from '@/types/enum';
import { logBoxStyleValue } from '@/utils';
class SDK extends Emitter {
private wasmInitializedPromise: Promise<any>;
Expand Down Expand Up @@ -550,6 +557,9 @@ class SDK extends Emitter {
]);
};

/**
* @deprecated Use setConversation instead.
*/
setConversationPrivateChat = <T>(
params: SetConversationPrivateStateParams,
operationID = uuidv4()
Expand All @@ -567,6 +577,9 @@ class SDK extends Emitter {
);
};

/**
* @deprecated Use setConversation instead.
*/
setConversationBurnDuration = <T>(
params: SetBurnDurationParams,
operationID = uuidv4()
Expand Down Expand Up @@ -634,6 +647,9 @@ class SDK extends Emitter {
);
};

/**
* @deprecated Use setSelfInfo instead.
*/
SetSelfInfoEx = <T>(data: PartialUserItem, operationID = uuidv4()) => {
return this._invoker<T>('SetSelfInfoEx', window.setSelfInfo, [
operationID,
Expand Down Expand Up @@ -891,6 +907,9 @@ class SDK extends Emitter {
[operationID, JSON.stringify(data.message), data.groupID, data.sendID]
);
};
/**
* @deprecated Use changeInputStates instead.
*/
typingStatusUpdate = <T>(
data: TypingUpdateParams,
operationID = uuidv4()
Expand All @@ -901,6 +920,23 @@ class SDK extends Emitter {
data.msgTip,
]);
};
changeInputStates = (
data: ChangeInputStatesParams,
operationID = uuidv4()
) => {
return this._invoker<void>('changeInputStates ', window.changeInputStates, [
operationID,
data.conversationID,
data.focus,
]);
};
getInputstates = (data: GetInputstatesParams, operationID = uuidv4()) => {
return this._invoker<Platform[]>('getInputstates ', window.getInputstates, [
operationID,
data.conversationID,
data.userID,
]);
};
clearConversationAndDeleteAllMsg = <T>(
data: string,
operationID = uuidv4()
Expand Down Expand Up @@ -934,6 +970,9 @@ class SDK extends Emitter {
// [operationID, data.offset, data.count]
// );
// };
/**
* @deprecated Use setConversation instead.
*/
setConversationEx = (
data: SetConversationExParams,
operationID = uuidv4()
Expand Down Expand Up @@ -976,6 +1015,9 @@ class SDK extends Emitter {
]);
};

/**
* @deprecated Use setConversation instead.
*/
setConversationDraft = <T>(
data: SetConversationDraftParams,
operationID = uuidv4()
Expand All @@ -987,6 +1029,9 @@ class SDK extends Emitter {
);
};

/**
* @deprecated Use setConversation instead.
*/
pinConversation = <T>(
data: SetConversationPinParams,
operationID = uuidv4()
Expand All @@ -1006,13 +1051,18 @@ class SDK extends Emitter {
[operationID]
);
};

getConversationRecvMessageOpt = (data: string[], operationID = uuidv4()) => {
return this._invoker<ConversationItem[]>(
'getConversationRecvMessageOpt ',
window.getConversationRecvMessageOpt,
[operationID, JSON.stringify(data)]
);
};

/**
* @deprecated Use setConversation instead.
*/
setConversationRecvMessageOpt = <T>(
data: SetConversationRecvOptParams,
operationID = uuidv4()
Expand Down Expand Up @@ -1096,6 +1146,9 @@ class SDK extends Emitter {
JSON.stringify(data),
]);
};
/**
* @deprecated Use updateFriends instead.
*/
setFriendRemark = <T>(data: RemarkFriendParams, operationID = uuidv4()) => {
return this._invoker<T>('setFriendRemark ', window.updateFriends, [
operationID,
Expand All @@ -1105,6 +1158,9 @@ class SDK extends Emitter {
}),
]);
};
/**
* @deprecated Use updateFriends instead.
*/
pinFriends = <T>(data: PinFriendParams, operationID = uuidv4()) => {
return this._invoker<T>('pinFriends ', window.updateFriends, [
operationID,
Expand All @@ -1114,6 +1170,9 @@ class SDK extends Emitter {
}),
]);
};
/**
* @deprecated Use updateFriends instead.
*/
setFriendsEx = <T>(data: SetFriendExParams, operationID = uuidv4()) => {
return this._invoker<T>('setFriendsEx ', window.updateFriends, [
operationID,
Expand Down Expand Up @@ -1250,6 +1309,9 @@ class SDK extends Emitter {
[operationID, JSON.stringify(data)]
);
};
/**
* @deprecated Use setGroupInfo instead.
*/
setGroupApplyMemberFriend = <T>(
data: SetMemberPermissionParams,
operationID = uuidv4()
Expand All @@ -1262,6 +1324,9 @@ class SDK extends Emitter {
}),
]);
};
/**
* @deprecated Use setGroupInfo instead.
*/
setGroupLookMemberInfo = <T>(
data: SetMemberPermissionParams,
operationID = uuidv4()
Expand Down Expand Up @@ -1303,6 +1368,9 @@ class SDK extends Emitter {
JSON.stringify(data),
]);
};
/**
* @deprecated Use setGroupMemberInfo instead.
*/
setGroupMemberNickname = <T>(
data: SetGroupMemberNickParams,
operationID = uuidv4()
Expand Down Expand Up @@ -1420,6 +1488,9 @@ class SDK extends Emitter {
[operationID, data.groupID, data.fromUserID, data.handleMsg]
);
};
/**
* @deprecated Use setConversation instead.
*/
resetConversationGroupAtType = <T>(data: string, operationID = uuidv4()) => {
return this._invoker<T>(
'resetConversationGroupAtType ',
Expand All @@ -1433,6 +1504,9 @@ class SDK extends Emitter {
]
);
};
/**
* @deprecated Use setGroupMemberInfo instead.
*/
setGroupMemberRoleLevel = <T>(
data: SetGroupRoleParams,
operationID = uuidv4()
Expand All @@ -1450,6 +1524,9 @@ class SDK extends Emitter {
]
);
};
/**
* @deprecated Use setGroupInfo instead.
*/
setGroupVerification = <T>(
data: SetGroupVerificationParams,
operationID = uuidv4()
Expand All @@ -1469,6 +1546,9 @@ class SDK extends Emitter {
[operationID, data]
);
};
/**
* @deprecated Use setSelfInfo instead.
*/
setGlobalRecvMessageOpt = <T>(
opt: MessageReceiveOptType,
operationID = uuidv4()
Expand Down
1 change: 1 addition & 0 deletions src/sqls/localAppSdkVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function localAppSDKVersions(db: Database): QueryExecResult[] {
`
create table if not exists 'local_app_sdk_version' (
'version' varchar(255),
'installed' numeric,
primary key ('version')
)
`
Expand Down
Loading

0 comments on commit e04e55a

Please sign in to comment.