import IPostMessage from '../../IPostMessage'; import IApp, { AppType } from './IApp'; /** * The `sos.management.app` API groups together methods for managing the signageOS application installed on the system. * *
* App Management Capabilities * | Capability | Description | * |:------------|:-------------| * | `APP_UPGRADE` | If the signageOS application can upgrade itself to a specific version | * * If you want to check if the device supports this capability, use [`sos.management.supports()`](https://developers.signageos.io/sdk/sos_management/#supports). *
*/ export default class App implements IApp { private messagePrefix; private postMessage; /** @internal */ constructor(messagePrefix: string, postMessage: IPostMessage); /** * The `getType()` method returns the type of the platform the application is running on. * * :::info * - If you need to get a specific Android brand or Raspberry Pi model, use the `sos.management.firmware.getType()`. * - `default` type is always Emulator. * ::: * * @returns {Promise} Resolves to the type of the application platform. * @since 4.0.0 * * @example * const appType = await sos.management.app.getType(); * console.log(appType); // tizen, linux, webos, etc. */ getType(): Promise; /** * The `getVersion()` method returns the version of the Core App that is currently running on the device. * * @returns {Promise} Resolves to the version of the Core application. * @since 4.0.0 * * @example * const version = await sos.management.app.getVersion(); * console.log(`Current application version is: ${version}`); // e.g. '4.0.0', '5.2.1', etc. */ getVersion(): Promise; /** * The `upgrade(version, baseUrl?)` method upgrades the signageOS application using version and baseUrl. Platform users can install the general * application version directly with passing just the version number. Optionally, the baseUrl can be passed as an argument to specify the server * where the application files are accessible. * * @param version The version of the application being installed. * @param [baseUrl='https://2.signageos.io'] Optional server URL where application files are located. * @returns {Promise} A promise that resolves when the upgrade starts. * @throws {Error} If the upgrade fails. * @since 4.0.0 * * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/app-upgrade | How to upgrade application via applets} * * @example * await sos.management.app.upgrade('4.0.0', 'https://2.signageos.io') */ upgrade(version: string, baseUrl?: string): Promise; /** * The `upgrade(baseUrl, version)` does the same as `upgrade(version, baseUrl)`. * * @alias upgrade(version: string, baseUrl?: string) * * @param baseUrl The server URL where application files are located. * @param version The version of the application being installed. * * @since 4.0.0 */ upgrade(baseUrl: string, version: string): Promise; /** * The `upgrade(appUri)` method upgrades the signageOS application with the provided `appUri`. Open users can upgrade the app passing * a URL where the application files are hosted. * * :::warning Strict URL and folder structure requirements * The `appUri` **must** follow the exact folder structure produced by the signageOS Device-app Builder. * The upgrade will fail silently (device reverts to the previous version) if the URL does not match the expected format. * * Key rules: * 1. **The folder structure on your server must match the ZIP package from signageOS exactly.** Do not rename files or reorganize folders. * 2. **HTTP redirects (e.g., 302) are not supported.** Files must be directly accessible at the expected URLs. * 3. **The URL must not end with a trailing slash (`/`).** A trailing slash causes the upgrade to fail. * ::: * * The expected URL format differs per platform: * * | Platform | URL format | * |----------|-----------| * | **Tizen** | Point to the **folder** containing `sssp_config.xml` and `*.wgt` — not to a specific file. E.g. `https://cdn.example.com/app/tizen/2.10.1/landscape` | * | **SSSP** | Point to the **folder** containing `sssp_config.xml` and `*.wgt`. E.g. `https://cdn.example.com/app/sssp/2.10.1/landscape_full-hd` | * | **webOS 1, 2** | Point to the **ZIP file** directly. E.g. `https://cdn.example.com/app/webos/2.10.1/ApplicationName.zip` | * | **webOS 3+** | Point to the **IPK file** directly. E.g. `https://cdn.example.com/app/webos/2.10.1/ApplicationName.ipk` | * | **BrightSign** | Point to the **zip file** directly. E.g. `https://cdn.example.com/app/brightsign/2.10.1/display-brightsign.zip` | * | **Android** | Point to the **APK file** directly. E.g. `https://cdn.example.com/app/android/2.10.1/io.signageos.android.apk` | * | **Windows** | Point to the **zip file** directly. E.g. `https://cdn.example.com/app/windows/2.10.1/windows_2.10.1.zip` | * | **ChromeOS** | Not supported | * * For the full folder structure reference and deployment guide, see * [Build & Deploy Your Applet Via Core App with built-in Applet](https://docs.signageos.io/devspace/general-topics/deployment/build-deploy-your-applet-via-core-app-with-built-in-applet). * * @param appUri URL where the application files are hosted. Must follow the platform-specific format described above. * @returns {Promise} A promise that resolves when the upgrade starts. * @throws {Error} If the upgrade fails. * @since 4.0.0 * * @example // {@link https://github.com/signageos/applet-examples/tree/master/examples/management-js-api/app-upgrade | How to upgrade application via applets} * * @example * // Upgrade Tizen device — point to the FOLDER, not a specific file. No trailing slash. * await sos.management.app.upgrade('https://cdn.your-cms.com/app/tizen/2.10.1/landscape'); * * @example * // Upgrade BrightSign device — point to the zip file directly * await sos.management.app.upgrade('https://cdn.your-cms.com/app/brightsign/2.10.1/display-brightsign.zip'); */ upgrade(appUri: string): Promise; private getMessage; }