Skip to content

Commit

Permalink
CCS-100748 Add clean_cache event
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Kudinov committed Sep 2, 2024
1 parent 2ec5fc3 commit d1be970
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expressms/smartapp-sdk",
"version": "1.10.0-alpha.1",
"version": "1.10.0-alpha.2",
"description": "Smartapp SDK",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Bridge from '@expressms/smartapp-bridge'
import {
cleanCache,
clientStorageClear,
clientStorageGet,
clientStorageRemove,
Expand Down Expand Up @@ -83,4 +84,5 @@ export {
searchLocalPhonebook,
getUnreadCounter,
getLayoutType,
cleanCache,
}
16 changes: 16 additions & 0 deletions src/lib/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,21 @@ const getLayoutType = async (): Promise<GetLayoutTypeResponse> => {
return response as GetLayoutTypeResponse
}

/**
* Get window layout type "minimal" | "full" | "half".
* @returns Promise that'll be fullfilled with layout data on success, otherwise rejected with reason
*/
const cleanCache = async (): Promise<StatusResponse> => {
if (!bridge) return Promise.reject(ERROR_CODES.NO_BRIDGE)

const response = await bridge.sendClientEvent({
method: METHODS.CLEAN_CACHE,
params: {},
})

return response as StatusResponse
}

export {
openClientSettings,
getChats,
Expand All @@ -204,4 +219,5 @@ export {
searchLocalPhonebook,
getUnreadCounter,
getLayoutType,
cleanCache,
}
1 change: 1 addition & 0 deletions src/types/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export enum METHODS {
SEARCH_LOCAL_PHONEBOOK = 'search_local_phonebook',
GET_UNREAD_COUNTER = 'get_unread_counter',
GET_LAYOUT_TYPE = 'get_layout_type',
CLEAN_CACHE = 'clean_cache',
}

export enum STATUS {
Expand Down

0 comments on commit d1be970

Please sign in to comment.