Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expressms/smartapp-sdk",
"version": "1.13.0-alpha.2",
"version": "1.13.0-alpha.9",
"description": "Smartapp SDK",
"main": "build/main/index.js",
"typings": "build/main/index.d.ts",
Expand Down Expand Up @@ -38,7 +38,7 @@
"typescript": "^4.9.5"
},
"dependencies": {
"@expressms/smartapp-bridge": "1.4.1"
"@expressms/smartapp-bridge": "1.4.5"
},
"files": [
"build/main",
Expand Down
18 changes: 18 additions & 0 deletions src/lib/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,23 @@ const getSmartAppList = (): Promise<GetSmartAppListResponse> => {
.then(event => event as GetSmartAppListResponse)
}

/**
* Hide recieved data in logs
* @returns Promise that'll be fullfilled
*/
const hideRecievedData = (): Promise<StatusResponse> => {
if (!bridge) return Promise.reject(ERROR_CODES.NO_BRIDGE)

bridge.hideRecvData()

return bridge
.sendClientEvent({
method: METHODS.HIDE_RECV_DATA,
params: {},
})
.then(event => event as StatusResponse)
}

export {
openClientSettings,
getChats,
Expand All @@ -246,4 +263,5 @@ export {
cleanCache,
getAppVisibility,
getSmartAppList,
hideRecievedData,
}
23 changes: 21 additions & 2 deletions src/lib/routing/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import bridge from "@expressms/smartapp-bridge"
import { LOCATION, METHODS } from '../../types'
import bridge from '@expressms/smartapp-bridge'
import { ERROR_CODES, LOCATION, METHODS, StatusResponse } from '../../types'

export const routingChanged = (isRoot: boolean) => {
return bridge?.sendClientEvent({
Expand Down Expand Up @@ -42,3 +42,22 @@ export const exitSmartAppToCatalog = () => {
params: { appId: '' },
})
}

/**
* Switch on/off swipe navigation in WkWebView
* @param allowed Enable/disable navigation
*/
const allowSwipeNavigation = (allowed: boolean): Promise<StatusResponse> => {
if (!bridge) return Promise.reject(ERROR_CODES.NO_BRIDGE)

return bridge
.sendClientEvent({
method: METHODS.ALLOW_IOS_SWIPE_NAVIGATION,
params: { allowed },
})
.then(event => event as StatusResponse)
}

export const iOS = {
allowSwipeNavigation,
}
2 changes: 2 additions & 0 deletions src/types/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ export enum METHODS {
READ_BLE_GATT_CHARACTERISTIC = 'read_ble_gatt_characteristic',
READ_NFC_TAG = 'read_nfc_tag',
WRITE_NFC_TAG = 'write_nfc_tag',
ALLOW_IOS_SWIPE_NAVIGATION = 'allow_ios_swipe_navigation',
HIDE_RECV_DATA = 'hide_recv_data',
}

export enum STATUS {
Expand Down
1 change: 1 addition & 0 deletions src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum SubscriptionEventType {
LAYOUT_TYPE = 'layout_type',
APP_VISIBILITY = 'app_visibility',
SMARTAPP_LIST = 'smartapp_list',
IOS_SWIPE = 'ios_swipe',
}

export type SubscriptionPayload = {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@expressms/smartapp-bridge@1.4.1":
version "1.4.1"
resolved "https://registry.yarnpkg.com/@expressms/smartapp-bridge/-/smartapp-bridge-1.4.1.tgz#b3fb2270459713eb6a7a147b85e8693ecaa9d45e"
integrity sha512-ZvW21sLQZSBfB1IB901N1EvPCEFmJeglT33JsrPo2rZO6xDJYuF0GA3T2mAVQXiflLEF05/JbcgTBeKRRewQAQ==
"@expressms/smartapp-bridge@1.4.5":
version "1.4.5"
resolved "https://registry.yarnpkg.com/@expressms/smartapp-bridge/-/smartapp-bridge-1.4.5.tgz#7324e87971e1d09742da69549edd0c67281749f1"
integrity sha512-AFhvkCbtMGR5o7355DsIik7iN64MlEWGGD7PUfruLJL25HKMHbGNH6P0N6kPSo8lGiudEAnyyg5uGAnUf8KQvw==
dependencies:
eventemitter3 "^4.0.7"
lodash-es "^4.17.21"
Expand Down