### Initialization Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Initialize the SDK by calling the `initWith(appKey: String, config: KIMInitConfig)` method after your app starts. ```Swift // Configure KIMInitConfig let config = KIMInitConfig() // Set private environment entry URL config.entryJsonUrl = URL(string: "https://10.13.4.146") // Initialize SDK KIM.initWith(appKey: "AK20231010GGXQGI", config: config) ``` ```Objective-C // Configure KIMKitConfig KIMKitConfig *config = [[KIMInitConfig alloc] init]; // Set private environment entry URL config.entryJsonUrl = [[NSURL alloc] initWithString:@"https://10.13.4.146"]; // Initialize SDK [KIM initWithAppKey:@"AK20231010GGXQGI" config:config]; ``` -------------------------------- ### Code Example: Online Push Notification Configuration Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/init This example demonstrates how to configure online push notifications using the `KIMCfgNotification` class within the `KIM.init` method. ```APIDOC ### Code example Online push notification configuration: ```kotlin KIM.init(this, appKey, mutableListOf( object : KIMCfgNotification() { override fun getIntent(message: KIMCoreMessage): Intent { val intent = Intent(application, MainActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) val data = "kim://kim.wps.cn/chat?chat_id=" + message.getChatId() intent.data = Uri.parse(data) return intent } override fun getNotificationChannels(): List { return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val channel = NotificationChannel( "kim_message", application.getString(R.string.notification_message), NotificationManager.IMPORTANCE_HIGH ) val channels: MutableList = ArrayList() channels.add(channel) channels } else { ArrayList() } } override fun createNotificationBuilder(): NotificationCompat.Builder { val builder = NotificationCompat.Builder(application, "kim_message") if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { builder.setSmallIcon(R.drawable.ic_notification_logo_transperent) builder.color = ContextCompat.getColor(application, R.color.color_brand_normal) } else { builder.setSmallIcon(R.drawable.ic_notification_logo) } builder.setCategory(NotificationCompat.CATEGORY_MESSAGE) return builder } } )) ``` ``` -------------------------------- ### Initialize Teams SDK Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/init Call this method when your application starts. Requires an Application context, your App Key, and initialization configuration. ```kotlin KIM.init(application: Application, appKey: String, config: KIMInitConfig) ``` -------------------------------- ### Perform a Route Jump Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/router-jump Use the UrlRouter to initiate a jump to a specified URL or deep link. The `start()` method performs the jump and shows a default toast for unsupported links. ```kotlin UrlRouter.with(activity) .url("/") .start() ``` -------------------------------- ### File Selector Component Usage Source: https://open.wps.cn/documents/app-integration-dev/guide/dev-tool-and-source/file-selector-comp This snippet demonstrates how to use the `nextDirectoryChooser` SDK to render and interact with the File Selector Component. It includes basic setup for cancellation and confirmation actions. ```APIDOC ## File Selector Component Usage ### Description This code snippet shows how to initialize and use the File Selector Component via the SDK. It covers basic rendering and handling of cancel/ok events. ### Method `sdk.components.nextDirectoryChooser.render()` ### Parameters #### Request Body - **title** (string) - Required - The title to be displayed in the file selector dialog. - **onCancel** (function) - Required - Callback function executed when the user cancels the selection. - **onOk** (function) - Required - Callback function executed when the user confirms the selection. ### Request Example ```javascript const DirectoryChooser = sdk.components?.nextDirectoryChooser; const destory = DirectoryChooser?.render({ title: "选择文件", onCancel: () => { destory(); }, onOk: () => { destory(); }, }); ``` ### Response #### Success Response The `render` method returns a `destory` function that can be called to close the file selector. #### Response Example ```javascript // Calling the returned destory function to close the component destory(); ``` ``` -------------------------------- ### Get Automatic Local File to Cloud Document Conversion Setting - Kotlin Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/others Retrieves the current setting for automatically converting local files to cloud documents when sending messages. ```kotlin KIM.setting.convertToCloudDocsAuto ``` -------------------------------- ### Initialize WebOffice SDK (JSSDK) Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/flow Basic sample code for frontend initialization of WebOffice documents using JSSDK. Ensure the SDK script is correctly referenced. ```html WebOffice ``` -------------------------------- ### Initialize Collaboration Middleware SDK (Swift) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Initialize the SDK with your application key and configuration. Ensure the `entryJsonUrl` is correctly set for your private environment. ```swift // 配置 KIMInitConfig let config = KIMInitConfig() // 私有化环境设置逗号(英文中为“,”,但你这里仅要求翻译“,”,本身就是标点,无需翻译)。如果是指“逗号”这个词,英文是“comma” 。entryJSONUrl为请求入口地址逗号(英文中为“,”,但你这里仅要求翻译“,”,本身就是标点,无需翻译)。如果是指“逗号”这个词,英文是“comma” 。服务部署后可取到 config.entryJsonUrl = URL(string: "https://10.13.4.146") // Initialization(%1)调用 KIM.initWith(appKey: "AK20231010GGXQGI", config: config) ``` -------------------------------- ### Get Inner App Notification Switch Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieves the current status of the inner app notification switch. ```APIDOC ## Get Inner App Notification Switch ### Description Retrieves the current status of the inner app notification switch. ### Code Example ```kotlin val isInnerAppNotificationSwitchOpen = KIM.setting.isInnerAppNotificationSwitchOpen ``` ``` -------------------------------- ### Initialize Collaboration Middleware SDK (Objective-C) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Initialize the SDK with your application key and configuration. Ensure the `entryJsonUrl` is correctly set for your private environment. ```objectivec // 配置 KIMKitConfig KIMKitConfig *config = [[KIMInitConfig alloc] init]; // 私有化环境设置逗号(英文中为“,”,但你这里仅要求翻译“,”,本身就是标点,无需翻译)。如果是指“逗号”这个词,英文是“comma” 。entryJSONUrl为请求入口地址逗号(英文中为“,”,但你这里仅要求翻译“,”,本身就是标点,无需翻译)。如果是指“逗号”这个词,英文是“comma” 。服务部署后可取到 config.entryJsonUrl = [[NSURL alloc] initWithString:@"https://10.13.4.146"]; // Initialization(%1)调用 [KIM initWithAppKey:@"AK20231010GGXQGI" config:config]; ``` -------------------------------- ### Get Ignore Inner App Notification When Calling Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieves the status for ignoring notification banners during calls and meetings. ```APIDOC ## Get Ignore Inner App Notification When Calling ### Description Retrieves the status for ignoring notification banners during calls and meetings. ### Code Example ```kotlin val isIgnoreInnerAppNotificationWhenCalling = KIM.setting.isIgnoreInnerAppNotificationWhenCalling ``` ``` -------------------------------- ### SDK Entrance - KIM Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/apilist The KIM class serves as the main entry point for the WOASDK. It provides methods for SDK initialization, account login, and retrieving version information. It also offers access to various module entry classes. ```APIDOC ## KIM ### Description WOASDK Entry class, provides SDK methods such as initialization, account login, and obtaining version information. In addition, it also provides access to the entry classes of each module, for example, you can obtain them through `KIM.chatModule` Get Conversation Module `KIMChatModule` Object. ### Version V1.30.0 ``` -------------------------------- ### Get All Tabs - WebOffice SDK Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance Retrieves all header tabs available in the document interface. Use this to understand the available navigation options. ```javascript const tabs = await instance.tabs.getTabs() ``` -------------------------------- ### Initialize Web Instance and Set Command Bars Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance Initialize the WebOfficeSDK instance with basic configuration and then set custom command bars. You can configure multiple components, setting their visibility and enabled states. ```javascript const instance = WebOfficeSDK.init({ officeType: WebOfficeSDK.OfficeType.Writer, appId: 'xxxxx', fileId: 'xxxxx' // Detailed configuration }) instance.setCommandBars([ // Can configure multiple components { cmbId: 'Component ID', attributes: { visible: false, // Hide component enable: false // Disable component, component displays but doesn't respond to click events } } ]) ``` -------------------------------- ### Get Inner App Notification Detail Switch Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieves the current status for displaying message details within notification banners. ```APIDOC ## Get Inner App Notification Detail Switch ### Description Retrieves the current status for displaying message details within notification banners. ### Code Example ```kotlin val isInnerAppNotificationDetailSwitchOpen = KIM.setting.isInnerAppNotificationDetailSwitchOpen ``` ``` -------------------------------- ### WebOfficeSDK Initialization and Command Bar Configuration Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance Demonstrates how to initialize a WebOfficeSDK instance for a specific office type and configure the visibility and enablement of command bar components. ```APIDOC ## WebOfficeSDK Initialization and Command Bar Configuration ### Description Initializes a WebOfficeSDK instance and configures the command bar components. This allows for customization of UI elements like hiding or disabling specific components. ### Usage ```javascript const instance = WebOfficeSDK.init({ officeType: WebOfficeSDK.OfficeType.Writer, appId: 'xxxxx', fileId: 'xxxxx' // Detailed configuration }) instance.setCommandBars([ // Can configure multiple components { cmbId: 'Component ID', attributes: { visible: false, // Hide component enable: false // Disable component, component displays but doesn't respond to click events } } ]) ``` ### Available Components #### Public Component ID| Description ---|--- HeaderLeft| (PC) Header left side, header is divided into left, middle, right three areas HeaderRight| (PC) Header right side, header is divided into left, middle, right three areas FloatQuickHelp| Bottom right help (Jingximang) CooperationPanelOwnerInfo| (Mobile) Current document owner info in collaboration list Logo| (Mobile) Status bar Logo Cooperation| (Mobile) Status bar collaboration avatars More| (Mobile) Status bar more button HistoryVersion| (PC) Top status bar - History menu - History versions HistoryRecord| (PC) Top status bar - History menu - Collaboration records HistoryVersionDivider| (PC) Spreadsheet - Right-click menu - History version/Collaboration records divider SendButton| (Mobile) Top toolbar - Share button CooperHistoryMenuItem| (Mobile) Top toolbar - Collaboration records menu TabPrintPreview| (PC) Top toolbar print button MenuPrintPreview| (PC) Top toolbar print button MobileHeader| (Mobile) Top toolbar #### Word Component ID| Description ---|--- ReviewTrackChanges| Edit, revision status button TrackChanges| Edit, revision status dropdown options ContextMenuConvene| Word right-click summon online collaborators WriterHoverToolbars| (Mobile) Word - Bottom toolbar ReadSetting| (Mobile) Word - Status bar - Reading settings #### Spreadsheet Component ID| Description ---|--- CheckCellHistory| (PC) Cell recent changes #### Presentation Component ID| Description ---|--- WPPMobileMarkButton| (Mobile) Floating notes button PlayComponentToolbar| Toolbar during fullscreen playback WPPPcCommentButton| (PC) Bottom toolbar - Comment button WPPMobileCommentButton| (Mobile) Bottom toolbar - Comment button #### PDF Component ID| Description ---|--- PDFMobilePageBar| (Mobile) Page number ``` -------------------------------- ### Get Ignore Notification During Calls Status Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Check if notification banners are ignored during calls and meetings. This setting applies to the current account and device. ```Kotlin val isIgnoreInnerAppNotificationWhenCalling = KIM.setting.isIgnoreInnerAppNotificationWhenCalling ``` -------------------------------- ### Initialization Method Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/init Before using the SDK's functions, you must first perform initialization. This involves preparing your App Key and configuring the initialization settings. ```APIDOC ## Initialization(%1) Before using SDK the function, initialization must be carried out first. ## Prepare to App Key You must have the correct App Key, to perform initialization. Please contact the project management personnel to obtain App Key. ## Initialization configuration Get App Key, and perform initialization when the program application starts. ### Method definition ```kotlin KIM.init(application: Application, appKey: String, config: KIMInitConfig) ``` ### Parameter description | Parameter | Type | Description | |---|---|---| | application | Application | Apply application | | appKey | String | Obtained from the enterprise management background AppKey | | config | KIMInitConfig | Initialization configuration | KIMInitConfig Note: | Properties | Type | Description | |---|---|---| | options | MutableList | Page configuration items, such as message list UI configuration, online notification configuration, etc. | | entryJsonUrl | String | The service entry address obtained after the private service is deployed. When the service is privately deployed, this parameter needs to be set, otherwise the service cannot be accessed. If not passed, the public network service is used by default. Url The format is generally: domain name/drive/wps-private-entry.json | | allowUnsafeHttps | Boolean | Whether to allow insecure https certificates. The default is false This attribute is to be compatible with the situation where the private network deployment does not use a legitimate https certificate. Considering network security, it is generally not recommended to modify it to true. | | isV7 | Boolean | Whether the private service version is V7. By default, it is determined by sdk packaging configuration. | | subOrigins | Array? | The list of domain names that need to be converted for the multi-domain intercommunication business scenario. | | appDisplayName | String? | app Display name, used for internal page copy display, such as the group invitation page copy. | Optional `KFunConfig` | Class name | Description | |---|---| | `KIMCfgNotification` | Online push notification configuration, needs to inherit and implement methods | `KIMCfgNotification` Supports the following methods: | Method | Parameter | Return type | Description | |---|---|---|---| | getNotificationChannels | | list NotificationChannel | Configure notification channel | | createNotificationBuilder | | NotificationCompat.Builder | Create notification builder, User free configuration notification Display Style | | getIntent | message: KIMCoreMessage Message entity | Intent | Used to build PendingIntent, Click the notification to start the corresponding page | ``` -------------------------------- ### Get Push Notification Configuration Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieve the current setting for receiving general message push notifications. This configuration applies globally to the account. ```Kotlin val canReceivePushNoti = KIM.setting.canReceivePushNotification ``` -------------------------------- ### Get Current Dark Mode Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/theme Retrieve the current theme display mode (light, dark, or system default) using the getCurrentDarkMode method. ```kotlin /** * 获取当前的主题模式,context为空时则默认为跟随系统 * @return ThemeMode */ fun getCurrentDarkMode(context: Context): ThemeMode // 枚举ThemeMode enum class ThemeMode { LIGHT_MODE, // Light mode DARK_MODE, // Dark mode MODE_NIGHT_FOLLOW_SYSTEM, // 跟随系统 } // 获取当前的Theme Style KIM.uiConfig.getCurrentDarkMode(context) ``` -------------------------------- ### KIMExpInterceptor Methods Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/security-control The KIMExpInterceptor interface provides methods to control the entry points for various user actions, such as opening local files, file managers, images, videos, photo albums, cameras, processing captured images, opening cloud files, and loading URLs. The SDK user can decide whether to proceed with the action based on the control status. ```APIDOC ## willOpenLocalFile ### Description Controls the entry point for opening and previewing all local files. The application decides whether to enter the local file preview. ### Method `willOpenLocalFile` ### Parameters #### Path Parameters - `OpenLocalFileChain` (object) - Represents the chain of control for opening local files. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willOpenLocalFileManager ### Description Controls the entry point for all file manager calls. The application decides whether to enter the file manager preview. ### Method `willOpenLocalFileManager` ### Parameters #### Path Parameters - `OpenLocalFileManagerChain` (object) - Represents the chain of control for file manager calls. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willOpenImage ### Description Controls the entry point for all picture previews. The application decides whether to enter the picture preview. ### Method `willOpenImage` ### Parameters #### Path Parameters - `OpenImageChain` (object) - Represents the chain of control for opening images. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willOpenVideo ### Description Controls the entry point for all video previews. The application decides whether to enter the video preview. ### Method `willOpenVideo` ### Parameters #### Path Parameters - `OpenVideoChain` (object) - Represents the chain of control for opening videos. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willOpenPhotoAlbum ### Description Controls the entry point for all photo album previews. The application decides whether to enter the photo album preview. ### Method `willOpenPhotoAlbum` ### Parameters #### Path Parameters - `OpenPhotoAlbumChain` (object) - Represents the chain of control for opening photo albums. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willOpenCamera ### Description Controls the entry point for all camera calls. The application decides whether to enter the camera preview. ### Method `willOpenCamera` ### Parameters #### Path Parameters - `OpenCameraChain` (object) - Represents the chain of control for camera calls. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willPostProcessCapturedImage ### Description Controls the behavior after shooting or screen recording is completed. The application decides whether to send or process the image. ### Method `willPostProcessCapturedImage` ### Parameters #### Path Parameters - `PostProcessCapturedImageChain` (object) - Represents the chain of control for post-processing captured images. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willOpenCloudFile ### Description Controls the entry point for all cloud document previews. The application decides whether to enter the cloud document preview. ### Method `willOpenCloudFile` ### Parameters #### Path Parameters - `OpenCloudFileChain` (object) - Represents the chain of control for opening cloud files. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ## willLoadUrl ### Description Controls the entry point for all web preview calls. ### Method `willLoadUrl` ### Parameters #### Path Parameters - `LoadUrlChain` (object) - Represents the chain of control for loading URLs. ### Response - The method does not return a value directly, but influences the subsequent action based on the control status. ``` -------------------------------- ### Get Push Notification Display Detail Setting Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieve the configuration for whether message details are displayed in the notification bar. This setting is per-account, per-device. ```Kotlin val pushNotiDisplayDetail = KIM.setting.pushNotificationDisplayDetail ``` -------------------------------- ### ready() Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance Loads the Application object, which must be completed before making subsequent API calls to the Application object. Handles potential multiple calls to prevent duplicate loading. ```APIDOC ## ready() This function is used to load the Application object. You need to wait for this function to complete before using the Application object. Note If there are multiple ready function calls in your code, please ensure that the previous ready function has resolved before making the next ready call, otherwise the document instance may be loaded multiple times, eventually resulting in duplicate API calls. ``` -------------------------------- ### Get current display mode Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/theme Retrieves the current theme display mode (light, dark, or follow system) by calling `getCurrentDarkMode` on the `KIMUIConfig` interface. ```APIDOC ## Dark mode SDKProvides built-in dark/light mode switching implementation. You can use related interfaces to freely switch among the dark mode, light mode, and follow system state. ### Get configuration Get the current display mode. By calling this method, you can obtain the current theme display mode. #### Interface definition `KIMUIConfig`: ```kotlin /** * 获取当前的主题模式,context为空时则默认为跟随系统 * @return ThemeMode */ fun getCurrentDarkMode(context: Context): ThemeMode // 枚举ThemeMode enum class ThemeMode { LIGHT_MODE, // Light mode DARK_MODE, // Dark mode MODE_NIGHT_FOLLOW_SYSTEM, // 跟随系统 } ``` #### Code example ```kotlin // 获取当前的Theme Style KIM.uiConfig.getCurrentDarkMode(context) ``` ``` -------------------------------- ### Get Call and Meeting Invitation Notification Setting Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Check the configuration for receiving push notifications for calls and meeting invitations. This setting is associated with the current account. ```Kotlin val canReceiveMeetingPushNoti = KIM.setting.canReceiveMeetingPushNotification ``` -------------------------------- ### Navigate to Workbench Page (Swift) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Use this snippet to navigate to the workbench page, which displays the application list. No specific parameters are required. ```swift let viewController = KIMWorkSpaceViewController() self.navigationController.pushViewController(viewController, animated: true) ``` -------------------------------- ### Get PC Online Push Notification Setting Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Check if message push notifications should be suppressed on this device when the desktop client is online. This setting is per-account, per-device. ```Kotlin val notReceivePushNotiWhenPCOnline = KIM.setting.notReceivePushNotificationWhenPCOnline ``` -------------------------------- ### Navigate to Workbench Page (Objective-C) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Use this snippet to navigate to the workbench page, which displays the application list. No specific parameters are required. ```objective-c KIMWorkSpaceViewController *viewController = [[KIMWorkSpaceViewController alloc] init]; self.navigationController.pushViewController(viewController, animated: true) ``` -------------------------------- ### Get Session List Grouping Mode Setting - Kotlin Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/others Retrieves the current setting for session list grouping mode. Use this to check if grouping is enabled. ```kotlin KIMCategoryCacheManager.getSwitchSync() ``` -------------------------------- ### Render File Selector Component Source: https://open.wps.cn/documents/app-integration-dev/guide/dev-tool-and-source/file-selector-comp Demonstrates how to render the File Selector component using the SDK. Ensure mfPlugins are pre-installed. The `destory` function should be called to clean up the component after use. ```javascript const DirectoryChooser = sdk.components?.nextDirectoryChooser; const destory = DirectoryChooser?.render({ title: "选择文件", onCancel: () => { destory(); }, onOk: () => { destory(); }, }); ``` -------------------------------- ### Navigate to Document Home Page Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/start After a successful connection, enter the document home page to access document list, preview, and editing functionalities. ```Kotlin KIM.getService().goPage(KIMDocumentTabFragment::class.java.getPageName(), this, Bundle()) ``` -------------------------------- ### Get Inner App Notification Switch Status Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieve the current status of the inner app notification switch. This setting controls whether notification banners are displayed. ```Kotlin val isInnerAppNotificationSwitchOpen = KIM.setting.isInnerAppNotificationSwitchOpen ``` -------------------------------- ### Workbench - KIMWorkSpaceModule, KIMWorkSpaceFragment, KIMExpWorkSpace, KIMWebAppFragment, KIMExpWebApp Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/apilist These classes manage the workbench and its applications. KIMWorkSpaceModule provides interfaces for the workbench UI. KIMWorkSpaceFragment displays the workbench application list. KIMWebAppFragment acts as a container for applications. KIMExpWorkSpace and KIMExpWebApp are for custom extensions. ```APIDOC ## Related to the workbench ### KIMWorkSpaceModule ### Description Workbench module class. Provides data interfaces and related pages for the workbench UIConfigure, Pass `KIM.workSpaceModule` Access. ### Version V1.30.0 ### KIMWorkSpaceFragment ### Description Workbench home page Fragment. The page displays the workbench application list, a personalized workbench. Click on a workbench application to enter the application container and use the application's functional services. KIMWorkSpaceActivity Directly includes this Fragment of Activity The interface can be used directly, and the access party can also use this Fragment Embed Your Own Activity. ### Version V1.30.0 ### KIMExpWorkSpace ### Description Interface definition class for workbench views. Used to implement a series of custom functions for workbench pages. ### Version V1.30.0 ### KIMWebAppFragment ### Description Workbench application container Fragment. Provides basic applications or enterprise - self - built application functions, such as basic applications like email applications, calendar applications, and a series of enterprise - self - built applications. KIMWorkSpaceActivity Directly includes this Fragment of Activity The interface can be used directly, and the access party can also use this Fragment Embed Your Own Activity Use. ### Version V1.30.0 ### KIMExpWebApp ### Description Entry class for the workbench application container. Used to implement the creation of the application container page. ### Version V1.30.0 ``` -------------------------------- ### Get Pinned Session Display Type Setting - Kotlin Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/others Retrieves the current setting for the pinned session display type. The options are 'List View' or 'Grid View'. ```kotlin KIMSetting.Instance.instance.chatFoldStickyEnabled ``` -------------------------------- ### Global Configuration - KIMUIConfig and KIMSetting Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/apilist KIMUIConfig is used for global UI theme-related configurations, accessible via `KIM.uiConfig`. KIMSetting provides global settings such as multi-language settings, message push notification settings, and file cache cleaning, accessible via `KIM.setting`. ```APIDOC ## Global Configuration ### KIMUIConfig ### Description Global UI Configuration Class. UI Theme - related configuration declarations are in this class. `KIM.uiConfig` Access. ### Version V1.30.0 ### KIMSetting ### Description Global Settings category provides global setting methods such as multi - language setting, message push notification setting, and file cache cleaning. `KIM.setting` Access. ### Version V1.30.0 ``` -------------------------------- ### Navigate to Workbench Page Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/start After a successful connection, this function allows navigation to the workbench page, which displays the application list and allows access to application details. ```APIDOC ## Navigate to Workbench Page ### Description After a successful connection, this function allows navigation to the workbench page, which displays the application list and allows access to application details. ### Method `KIM.getService().goPage()` ### Parameters - **pageName** (String) - Required - The name of the page to navigate to, obtained using `KIMContactsFragment::class.java.getPageName()`. - **context** (Context) - Required - The current Android context. - **bundle** (Bundle) - Optional - A bundle of arguments to pass to the page. ### Request Example ```kotlin KIM.getService().goPage(KIMContactsFragment::class.java.getPageName(), this, Bundle()) ``` ``` -------------------------------- ### Navigate to Workbench Page Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/start Access the workbench page after a successful connection. This page displays applications, allowing users to navigate to application details. ```Kotlin KIM.getService().goPage(KIMContactsFragment::class.java.getPageName(), this, Bundle()) ``` -------------------------------- ### Get Inner App Notification Detail Switch Status Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/global-config/push-noti Retrieve the current status for displaying message details within notification banners. This setting affects the current account and device. ```Kotlin val isInnerAppNotificationDetailSwitchOpen = KIM.setting.isInnerAppNotificationDetailSwitchOpen ``` -------------------------------- ### Instance Object Methods Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance The instance object exposes methods for performing actions such as saving, destroying the instance, and managing UI elements. ```APIDOC ## Instance Object Methods | Method | Description | |-------------------------|--------------------------------------------------| | save() | Actively save document | | destroy() | Destroy JSSDK instance, close WebOffice display | | ready() | Load Application object | | setCooperUserColor() | Set collaboration user cursor color | | setCommandBars() | Dynamically update component status | | executeCommandBar() | Execute component element command | ``` -------------------------------- ### Implement a Custom Route Interceptor Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/router-jump Create a custom interceptor by inheriting `KUrlInterceptor` and implementing the `intercept` method to handle specific deep links or modify jump behavior. This example shows how to intercept a custom deep link type and path. ```kotlin import com.kingsoft.kim.kit.KIM import com.kingsoft.kim.kit.api.KIMISdkKitService import com.kingsoft.kim.kit.extension.router.KUrlChainData import com.kingsoft.kim.kit.extension.router.KUrlInterceptor import java.util.* class MyDeeplinkInterceptor : KUrlInterceptor() { override fun intercept(chain: Chain): ChainState { if (chain.data.type != MY_DEEP_LINK) { return chain.doNext(chain.data) } if (Objects.equals(PATH_LOCATE, chain.data.uri.path)) { //自定义的跳转逻辑 //startFragment/startActivity return chain.end(chain.data) } return chain.doNext(chain.data) } private fun locateBySeq(chain: Chain, chatId: String, seq: Long) { KIM.getService().getLinkUpService(KIMISdkKitService::class.java) ?.openChat(chain.data.context, chatId, "", seq) } companion object { private const val MY_DEEP_LINK = 15 private const val PATH_LOCATE = "/my" } } ``` -------------------------------- ### Execute Command Bar Action Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance Execute a command bar action after the instance is ready. Ensure the component has finished loading before executing commands. ```javascript window.onload = async function () { const instance = WebOfficeSDK.init({ officeType: WebOfficeSDK.OfficeType.Writer, appId: 'xxxxx', fileId: 'xxxxx' // Detailed configuration }) // Note: Need to wait for component to finish loading when executing command await instance.ready() // Execute component command by calling method instance.executeCommandBar('TabPrintPreview') } ``` -------------------------------- ### Sign-in Connection (Swift) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Log in using the authorization code and App ID. This method initiates the SDK's IM connection after successful authentication. Ensure SSO authentication is configured in your enterprise backend. ```swift KIM.shared.login(authCode: "authCode", appId: "appId") { success, error in if success { // Sign In成功 } else { // Sign In失败 } } ``` -------------------------------- ### Import SDK Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Import the necessary xcframework files into your Xcode project and configure build settings. ```APIDOC ## Import SDK 1. Obtain SDK files (e.g., KIMBase.xcframework, KIMCore.xcframework, WOASDK.xcframework) and import them into your project. 2. Modify your project configuration: a. In `General` -> `Frameworks, Libraries, and Embedded Binaries`, set all required SDK xcframeworks to `Embed & Sign`. b. In `Build Settings` -> `Search Paths` -> `Framework Search Paths`, add the paths to the SDK frameworks. c. In `Build Settings` -> `Architectures` -> `Excluded Architectures`, set `Any iOS Simulator SDK` to `arm64` to support M-series chip simulators. ``` -------------------------------- ### Sign-in Connection (Objective-C) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Log in using the authorization code and App ID. This method initiates the SDK's IM connection after successful authentication. Ensure SSO authentication is configured in your enterprise backend. ```objectivec [KIM.shared loginWithAuthCode:@"authCode" appId:@"appId" complete:^(BOOL success, KIMError *error) { if (success) { // Sign In成功 } else { // Sign In失败 } }]; ``` -------------------------------- ### Navigate to Document Home Page (Swift) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Use this snippet to navigate to the main document management page. No specific parameters are required. ```swift let viewController = KIMDocumentHomeViewController() self.navigationController.pushViewController(viewController, animated: true) ``` -------------------------------- ### Navigate to Document Home Page (Objective-C) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Use this snippet to navigate to the main document management page. No specific parameters are required. ```objective-c KIMDocumentHomeViewController *viewController = [[KIMDocumentHomeViewController alloc] init]; self.navigationController.pushViewController(viewController, animated: true) ``` -------------------------------- ### Configure OpenSDK Authentication Source: https://open.wps.cn/documents/app-integration-dev/guide/open-components/web-component-overview Configure OpenSDK authentication by listening for authorization errors and calling the config method with necessary parameters. Ensure nonceStr, timestamp, and url are consistent with signature generation. ```javascript // 1. 由于服务端返回 { app_id, signature, noncestr, timestamp, tag, url } // 2. 可以监听授权错误场景,建议开发者自行处理失败的场景,当然也可使用OpenSDK.config({...}).catch()方式捕获授权失败 OpenSDK.addEventListener(OpenSDK.Events.AuthError, (err) => { console.error('AuthError', err) }) // 3. OpenSDK 鉴权 await OpenSDK.config({ signature, // 签名 appId: app_id, // 应用 appId timestamp, // Timestamp(sec) nonceStr: noncestr, // 随机字符串 scopes, tag, url, }) ``` -------------------------------- ### Render File Selector for Folder Selection Source: https://open.wps.cn/documents/app-integration-dev/guide/dev-tool-and-source/file-selector-comp Use this to render the file selector component specifically for choosing folders. Ensure the `sdk.components?.nextDirectoryChooser` is available. ```javascript const DirectoryChooser = sdk.components?.nextDirectoryChooser; const destory = DirectoryChooser?.render({ title: "选择文件", selectMode: "folder", onCancel: () => {}, onOk: () => {}, }); ``` -------------------------------- ### Import SDK Modules (Swift) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Import the necessary SDK modules in your Swift project to access its functionalities. ```swift import KIMCore import WOASDK ``` -------------------------------- ### Globally configure the title bar style Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/theme Allows for global configuration of the title bar's appearance, including background, text alignment, colors, and status bar style, by modifying properties of KIMUIConfig. ```APIDOC ## Globally configure the title bar style It can be configured globally by modifying KIMUIConfigRelated properties to configure the title bar style. ### Interface definition Properties| Type| Description ---|---|--- `titleBarBackground`| @DrawableRes Int| Title bar background `titleBarTitleAlignment`| @KIMTextAlignment Int| Title alignment of the title bar, only supports left、center `titleBarTitleColor`| AndroidColon@ColorRes Int| Title color of the title bar `titleBarBackButtonIcon`| @DrawableRes Int| Image of the back button. If empty, the default icon will be used. `titleBarStatusBarStyle`| @KIMStatusBarStyle Int| Style of the system status bar `titleBarTabTextColor`| @ColorRes Int| Title bar Tab Text Color `titleBarTabTextColorSelected`| @ColorRes Int| Title bar Tab Selected text color `titleBarButtonTextColor`| @ColorRes Int| Text button color of the title bar (such as“Confirm”button) `titleBarButtonIconColor`| @ColorRes Int| Icon color of the title bar button `titleBarInputTextColor`| @ColorRes Int| Text color of the title bar input box `titleBarInputHintColor`| @ColorRes Int| Placeholder text color of the title bar input box `robotLabelIcon`| @DrawableRes Int| Robot label icon ### Code example ```kotlin class MyKIMUIConfig : KIMUIConfig() { init { titleBarBackground = R.color.blue titleBarTitleAlignment = KIMTextAlignment.LEFT     titleBarTitleColor = R.color.white             titleBarStatusBarStyle = KIMStatusBarStyle.LIGHT             //... } } KIM.uiConfig = MyKIMUIConfig() ``` ``` -------------------------------- ### AndroidManifest.xml Configuration Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/router-jump Declare your custom `KIMSdkApplication` subclass in the `AndroidManifest.xml` file using the `kim_sdk_application` string resource. This makes your custom application class active. ```xml ``` -------------------------------- ### Navigate to Conversation List Page Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/start After a successful connection, use this to jump to the SDK's conversation list page. Requires the current activity context. ```Kotlin KIM.getService().goPage(KIMChatListFragment::class.java.getPageName(), this, Bundle()) ``` -------------------------------- ### Initialize and Save Document - WebOffice SDK Source: https://open.wps.cn/documents/app-integration-dev/docs-center/online-preview-edit/web/instance Initializes the WebOffice SDK for a specific document type and file, then actively triggers the save interface. The result indicates the save status and file details. ```javascript const instance = WebOfficeSDK.init({ // Required fields officeType: WebOfficeSDK.OfficeType.Writer, appId: 'xxxxx', fileId: 'xxxxx' }) const result = await instance.save() ``` -------------------------------- ### Navigate to Chat Page Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/android/start Jump to the SDK's chat page when a conversation is selected from the list. Pass the chat ID, chat name, and optional arguments. ```Kotlin val args = KIMMessageListFragment.defaultArguments(chatId, chatName, null) KIM.getService().goPage(KIMMessageListFragment::class.java.getPageName(), context, args) ``` -------------------------------- ### Generate Signature in Node.js Source: https://open.wps.cn/documents/app-integration-dev/guide/open-components/web-component-overview This Node.js sample demonstrates how to generate a signature using jsapi_ticket, nonce, timestamp, and URL. Ensure the app_secret is kept secure. ```javascript import { createHmac } from 'crypto' const genSignature = function ( jsapi_ticket: string, nonce: string, timestamp: number, url: string, ) { const signature = createHmac('sha256', app_secret) .update(`noncestr=${nonce}&ticket=${jsapi_ticket}×tamp=${timestamp}&url=${url}`) .digest('hex') console.log('signature', signature) return signature } ``` -------------------------------- ### Enable Multi-File Selection Source: https://open.wps.cn/documents/app-integration-dev/guide/dev-tool-and-source/file-selector-comp Set the `multiSelect` option to `true` to allow users to select multiple files at once within the file selector. ```javascript const DirectoryChooser = sdk.components?.nextDirectoryChooser; const destory = DirectoryChooser?.render({ title: "选择文件", multiSelect: true, onCancel: () => {}, onOk: () => {}, }); ``` -------------------------------- ### Add Framework Search Paths Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Configure Framework Search Paths in your project's Build Settings to include the SDK's framework directories. This ensures Xcode can locate the necessary frameworks. ```plaintext $(inherited) $(PROJECT_DIR)/../framework/KIMBase.xcframework/ios-arm64/KIMBase.framework/Frameworks $(PROJECT_DIR)/../framework/WOASDK.xcframework/ios-arm64/WOASDK.framework/Frameworks ``` -------------------------------- ### Import SDK Modules (Objective-C) Source: https://open.wps.cn/documents/app-integration-dev/collaboration-middleware/iOS/start Import the necessary SDK modules in your Objective-C project to access its functionalities. ```objectivec @import KIMCore; @import WOASDK; ```