ref |> 集成mPaaS升级
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
13 changed files
with
429 additions
and
4 deletions
sight_harmony/.ohpmrc
0 → 100644
| 1 | +@mpaas:registry=https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/meta |
| 1 | +import { expect } from '@ohos/hypium'; | ||
| 2 | + | ||
| 1 | export { Logger } from './src/main/ets/utils/Logger' | 3 | export { Logger } from './src/main/ets/utils/Logger' |
| 2 | 4 | ||
| 3 | export { ResourcesUtils } from './src/main/ets/utils/ResourcesUtils' | 5 | export { ResourcesUtils } from './src/main/ets/utils/ResourcesUtils' |
| @@ -53,3 +55,7 @@ export { NetworkType } from './src/main/ets/network/NetworkType' | @@ -53,3 +55,7 @@ export { NetworkType } from './src/main/ets/network/NetworkType' | ||
| 53 | export { CustomToast } from './src/main/ets/reusable/CustomToast' | 55 | export { CustomToast } from './src/main/ets/reusable/CustomToast' |
| 54 | 56 | ||
| 55 | export { UmengStats } from "./src/main/ets/umeng/UmengStats" | 57 | export { UmengStats } from "./src/main/ets/umeng/UmengStats" |
| 58 | + | ||
| 59 | +export { MpaasUtils } from './src/main/ets/mpaas/MpaasUtils' | ||
| 60 | + | ||
| 61 | +export { MpaasUpgradeCheck, UpgradeTipContent } from './src/main/ets/mpaas/MpaasUpgradeCheck' |
| 1 | +import { MPUpgradeService } from '@mpaas/upgrade' | ||
| 2 | +import { upgradeRes } from '@mpaas/upgrade/src/main/ets/t4/a' | ||
| 3 | +import { AppUtils } from '../utils/AppUtils' | ||
| 4 | +import { SPHelper } from '../utils/SPHelper' | ||
| 5 | + | ||
| 6 | +export interface UpgradeTipContent { | ||
| 7 | + | ||
| 8 | + content: string | ||
| 9 | + newVersion: string | ||
| 10 | + downloadUrl: string | ||
| 11 | + forceUpgrade: boolean | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +export class MpaasUpgradeCheck { | ||
| 15 | + | ||
| 16 | + /// 默认提示框 | ||
| 17 | + checkNewVersionAndShow() { | ||
| 18 | + try { | ||
| 19 | + MPUpgradeService.checkNewVersionAndShow() | ||
| 20 | + } catch (error) { | ||
| 21 | + console.log("mpaas upgrade fail", JSON.stringify(error)) | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + checkNewVersion(): Promise<UpgradeTipContent | null> { | ||
| 26 | + | ||
| 27 | + return new Promise((resolve, fail) => { | ||
| 28 | + MPUpgradeService.checkNewVersion().then((response)=>{ | ||
| 29 | + let str = JSON.stringify(response) | ||
| 30 | + console.log("mpaas upgrade check", str) | ||
| 31 | + | ||
| 32 | + /* | ||
| 33 | + { | ||
| 34 | + "android64FileSize": 0, | ||
| 35 | + "downloadURL": "https://appgallery.huawei.com/#/app", | ||
| 36 | + "fileSize": 0, | ||
| 37 | + "fullMd5": "no md5", | ||
| 38 | + "guideMemo": "欢迎使用新版本", | ||
| 39 | + "isWifi": 0, | ||
| 40 | + "netType": "ALL", | ||
| 41 | + "newestVersion": "1.0.1", | ||
| 42 | + "resultStatus": 204, | ||
| 43 | + "silentType": 0, | ||
| 44 | + "upgradeVersion": "1.0.1" | ||
| 45 | + }*/ | ||
| 46 | + | ||
| 47 | + let res = response as upgradeRes | ||
| 48 | + | ||
| 49 | + // AliUpgradeNewVersion = 201, /*当前使用的已是最新版本*/ | ||
| 50 | + // AliUpgradeOneTime = 202, /*客户端已有新版本,单次提醒*/ | ||
| 51 | + // AliUpgradeForceUpdate = 203, /*客户端已有新版本,强制升级(已废弃)*/ | ||
| 52 | + // AliUpgradeEveryTime = 204, /*客户端已有新版本,多次提醒*/ | ||
| 53 | + // AliUpgradeRejectLogin = 205, /*限制登录(已废弃)*/ | ||
| 54 | + // AliUpgradeForceUpdateWithLogin = 206 /*客户端已有新版本,强制升级*/ | ||
| 55 | + | ||
| 56 | + const currentAppVersoin = AppUtils.getAppVersionName() | ||
| 57 | + | ||
| 58 | + if (res.resultStatus == 201) { | ||
| 59 | + resolve(null) | ||
| 60 | + return | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // 单次升级控制 | ||
| 64 | + if (res.resultStatus == 202) { | ||
| 65 | + const oldOnceValue = SPHelper.default.getSync("upgradeOnceKey", false) as boolean | ||
| 66 | + if (true == oldOnceValue) { | ||
| 67 | + resolve(null) | ||
| 68 | + return | ||
| 69 | + } | ||
| 70 | + SPHelper.default.save("upgradeOnceKey", true) | ||
| 71 | + } else { | ||
| 72 | + SPHelper.default.save("upgradeOnceKey", false) | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + if (res.resultStatus == 202 || res.resultStatus == 204 || res.resultStatus == 206) { | ||
| 76 | + let content: UpgradeTipContent = { | ||
| 77 | + content: res.guideMemo, | ||
| 78 | + newVersion: res.upgradeVersion, | ||
| 79 | + downloadUrl: res.downloadURL, | ||
| 80 | + forceUpgrade: res.resultStatus == 206 | ||
| 81 | + } | ||
| 82 | + resolve(content) | ||
| 83 | + return | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + resolve(null) | ||
| 87 | + }).catch((error: Error) => { | ||
| 88 | + console.log("mpaas upgrade fail", `name: ${error.name}, message: ${error.message}, \nstack: ${error.stack}`) | ||
| 89 | + fail("检测升级失败") | ||
| 90 | + }) | ||
| 91 | + }) | ||
| 92 | + } | ||
| 93 | +} |
| 1 | +import { MPFramework } from '@mpaas/framework' | ||
| 2 | +import { common } from '@kit.AbilityKit'; | ||
| 3 | + | ||
| 4 | +/* | ||
| 5 | +对接mpaas注意: | ||
| 6 | +* 1、后台创建mpaas.config,需要包名。放到rawfile目录 | ||
| 7 | +* 2、网关加密hs_1222.png图片,放到rawfile目录 | ||
| 8 | +* 3. 配置和加密图片,需要包名和签名对应,否则无法使用 | ||
| 9 | + * */ | ||
| 10 | + | ||
| 11 | +export class MpaasUtils { | ||
| 12 | + | ||
| 13 | + // 启动时onCreate()方法调用 | ||
| 14 | + static initApp(context: common.UIAbilityContext) { | ||
| 15 | + MPFramework.create(context); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + // 获取mPaaS utdid | ||
| 19 | + static async mpaasUtdid() { | ||
| 20 | + let utdid = await MPFramework.instance.udid | ||
| 21 | + return utdid | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + // 登录和退出登录调用,用来管理白名单用 | ||
| 25 | + static setupUserId(userId?: string) { | ||
| 26 | + MPFramework.instance.userId = userId | ||
| 27 | + } | ||
| 28 | +} |
| @@ -63,5 +63,16 @@ export class AppUtils { | @@ -63,5 +63,16 @@ export class AppUtils { | ||
| 63 | // TODO: 待确认,暂时写死Android | 63 | // TODO: 待确认,暂时写死Android |
| 64 | return "Harmony" | 64 | return "Harmony" |
| 65 | } | 65 | } |
| 66 | + | ||
| 67 | + static getFingerprint(): string { | ||
| 68 | + try { | ||
| 69 | + let bundleInfo = | ||
| 70 | + bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO); | ||
| 71 | + let finger = bundleInfo.signatureInfo.fingerprint; | ||
| 72 | + } catch (e) { | ||
| 73 | + Logger.warn(TAG, 'get app signatureinfo error:' + e?.message); | ||
| 74 | + } | ||
| 75 | + return ''; | ||
| 76 | + } | ||
| 66 | } | 77 | } |
| 67 | 78 |
| @@ -5,10 +5,161 @@ | @@ -5,10 +5,161 @@ | ||
| 5 | "lockfileVersion": 3, | 5 | "lockfileVersion": 3, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | "specifiers": { | 7 | "specifiers": { |
| 8 | + "@mpaas/compress@^1.0.0": "@mpaas/compress@1.0.0", | ||
| 9 | + "@mpaas/fake-island@^1.0.0": "@mpaas/fake-island@1.0.0", | ||
| 10 | + "@mpaas/framework@0.0.2": "@mpaas/framework@0.0.2", | ||
| 11 | + "@mpaas/framework@^0.0.2": "@mpaas/framework@0.0.2", | ||
| 12 | + "@mpaas/fs-ext@^1.0.0": "@mpaas/fs-ext@1.0.0", | ||
| 13 | + "@mpaas/lang@^1.0.0": "@mpaas/lang@1.0.0", | ||
| 14 | + "@mpaas/path@^1.0.0": "@mpaas/path@1.0.0", | ||
| 15 | + "@mpaas/rpc@^0.0.2": "@mpaas/rpc@0.0.2", | ||
| 16 | + "@mpaas/shuckle@^1.0.0": "@mpaas/shuckle@1.0.0", | ||
| 17 | + "@mpaas/trace-log@^0.0.2": "@mpaas/trace-log@0.0.2", | ||
| 18 | + "@mpaas/transport_build@^0.0.2": "@mpaas/transport_build@0.0.2", | ||
| 19 | + "@mpaas/udid@0.0.2": "@mpaas/udid@0.0.2", | ||
| 20 | + "@mpaas/upgrade@0.0.2": "@mpaas/upgrade@0.0.2", | ||
| 21 | + "@ohos/crypto-js@^2.0.2": "@ohos/crypto-js@2.0.3", | ||
| 8 | "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16", | 22 | "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16", |
| 9 | - "@ohos/pulltorefresh@^2.0.5": "@ohos/pulltorefresh@2.0.5" | 23 | + "@ohos/pulltorefresh@^2.0.5": "@ohos/pulltorefresh@2.0.5", |
| 24 | + "dayjs@^1.11.7": "dayjs@1.11.7", | ||
| 25 | + "libcompress.so@oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress": "libcompress.so@oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress", | ||
| 26 | + "libframework_api.so@oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api": "libframework_api.so@oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api", | ||
| 27 | + "libgwcli.so@oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types": "libgwcli.so@oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types", | ||
| 28 | + "liblang.so@oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types": "liblang.so@oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types", | ||
| 29 | + "libmplog.so@oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types": "libmplog.so@oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types", | ||
| 30 | + "libshuckle.so@oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle": "libshuckle.so@oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle", | ||
| 31 | + "long@^5.2.1": "long@5.2.1", | ||
| 32 | + "pako@^2.1.0": "pako@2.1.0" | ||
| 10 | }, | 33 | }, |
| 11 | "packages": { | 34 | "packages": { |
| 35 | + "@mpaas/compress@1.0.0": { | ||
| 36 | + "name": "@mpaas/compress", | ||
| 37 | + "integrity": "sha512-x/aUK/zKjoUnd4kYGNAI1JMcEY2n4N6Rn+F+zcIYs8WLgobY6kFXTphLJ/NlSgjJklc2009U8zeStvtjon1zaQ==", | ||
| 38 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/compress/compress-1.0.0.har", | ||
| 39 | + "registryType": "ohpm", | ||
| 40 | + "dependencies": { | ||
| 41 | + "libcompress.so": "file:./src/main/cpp/types/libcompress" | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + "@mpaas/fake-island@1.0.0": { | ||
| 45 | + "name": "@mpaas/fake-island", | ||
| 46 | + "integrity": "sha512-cEt0Zsie0rwfvnYmqA+6pa93L6NLkJKwiqJCoE9Z2hFjhk9s4RSz7F0AUuj4WobrpdElXuipoCNFPXWLb4ZBlA==", | ||
| 47 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/fake-island/fake-island-1.0.0.har", | ||
| 48 | + "registryType": "ohpm", | ||
| 49 | + "dependencies": { | ||
| 50 | + "libgwcli.so": "file:./types" | ||
| 51 | + } | ||
| 52 | + }, | ||
| 53 | + "@mpaas/framework@0.0.2": { | ||
| 54 | + "name": "@mpaas/framework", | ||
| 55 | + "integrity": "sha512-nNpCI44zvg4fN9GNM5m31LdqfLrej9mMo/+BMny8QK+/Jvc3m/itE45bWZZ7unfflq40H2t4YOgtNAIW3m8MaA==", | ||
| 56 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/framework/framework-0.0.2.har", | ||
| 57 | + "registryType": "ohpm", | ||
| 58 | + "dependencies": { | ||
| 59 | + "libframework_api.so": "file:./src/main/cpp/types/libframework_api", | ||
| 60 | + "@mpaas/udid": "0.0.2" | ||
| 61 | + } | ||
| 62 | + }, | ||
| 63 | + "@mpaas/fs-ext@1.0.0": { | ||
| 64 | + "name": "@mpaas/fs-ext", | ||
| 65 | + "integrity": "sha512-4TGUdrkmVSFktp1NcRdcs4uLYH6GvN1aTkMD2z8TJLztz5Hq5fMrvuznsmwTsSaRxGfGuyHPER8enMQo8wcfKA==", | ||
| 66 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/fs-ext/fs-ext-1.0.0.har", | ||
| 67 | + "registryType": "ohpm", | ||
| 68 | + "dependencies": { | ||
| 69 | + "@mpaas/path": "^1.0.0" | ||
| 70 | + } | ||
| 71 | + }, | ||
| 72 | + "@mpaas/lang@1.0.0": { | ||
| 73 | + "name": "@mpaas/lang", | ||
| 74 | + "integrity": "sha512-dcQ2QPrvwZgBhoGUjAbSFfkReDkwqEPMTzy/Xk05dhIB9VVznpLPahlQLVi0Am1FPATCT8J7DDrko9aJLOba+w==", | ||
| 75 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/lang/lang-1.0.0.har", | ||
| 76 | + "registryType": "ohpm", | ||
| 77 | + "dependencies": { | ||
| 78 | + "liblang.so": "file:./types" | ||
| 79 | + } | ||
| 80 | + }, | ||
| 81 | + "@mpaas/path@1.0.0": { | ||
| 82 | + "name": "@mpaas/path", | ||
| 83 | + "integrity": "sha512-TNjPaVOiq4DTiNFexSeI9isxeJ1H4q9Vieh3Bnv66o0U/e7rwV1qjEUtMvihX3MlsX0VKVkT0Xyf/wm18l4XYw==", | ||
| 84 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/path/path-1.0.0.har", | ||
| 85 | + "registryType": "ohpm" | ||
| 86 | + }, | ||
| 87 | + "@mpaas/rpc@0.0.2": { | ||
| 88 | + "name": "@mpaas/rpc", | ||
| 89 | + "integrity": "sha512-BeiXDHW77CpZF5x4nuQc+3A7MfhFfU3+Wc73gac/ZRhIPuAAzfLmlzm5alqdm6oiWAw17ERQydUSG4SQSCHQ4g==", | ||
| 90 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/rpc/rpc-0.0.2.har", | ||
| 91 | + "registryType": "ohpm", | ||
| 92 | + "dependencies": { | ||
| 93 | + "@mpaas/transport_build": "^0.0.2", | ||
| 94 | + "@mpaas/lang": "^1.0.0", | ||
| 95 | + "@mpaas/framework": "^0.0.2" | ||
| 96 | + } | ||
| 97 | + }, | ||
| 98 | + "@mpaas/shuckle@1.0.0": { | ||
| 99 | + "name": "@mpaas/shuckle", | ||
| 100 | + "integrity": "sha512-B0MhrNzwG9pIoPxYVBldyenQWtWfTv5twd/0Ur1LbMpbp09AQ5wrZjKgDoeUtsIls9gzL9T8ngDZU6mRn8SYgQ==", | ||
| 101 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/shuckle/shuckle-1.0.0.har", | ||
| 102 | + "registryType": "ohpm", | ||
| 103 | + "dependencies": { | ||
| 104 | + "libshuckle.so": "file:./src/main/cpp/types/libshuckle", | ||
| 105 | + "@mpaas/framework": "^0.0.2" | ||
| 106 | + } | ||
| 107 | + }, | ||
| 108 | + "@mpaas/trace-log@0.0.2": { | ||
| 109 | + "name": "@mpaas/trace-log", | ||
| 110 | + "integrity": "sha512-Llsdnx3L2tJJDg9vwJY01YsK4IOSmCo4SmAIW9yFHTzylrzFSWdFefRhJbNlkQQilXdYygEkBByXVvT1wFSmAg==", | ||
| 111 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/trace-log/trace-log-0.0.2.har", | ||
| 112 | + "registryType": "ohpm", | ||
| 113 | + "dependencies": { | ||
| 114 | + "@mpaas/lang": "^1.0.0", | ||
| 115 | + "@mpaas/fs-ext": "^1.0.0", | ||
| 116 | + "@mpaas/path": "^1.0.0", | ||
| 117 | + "@mpaas/framework": "0.0.2", | ||
| 118 | + "libmplog.so": "file:types", | ||
| 119 | + "dayjs": "^1.11.7" | ||
| 120 | + } | ||
| 121 | + }, | ||
| 122 | + "@mpaas/transport_build@0.0.2": { | ||
| 123 | + "name": "@mpaas/transport_build", | ||
| 124 | + "integrity": "sha512-utz9C/cKIWbYrNiTBjk1gUhPH4/M73G64hWlrYKDpkfJHJmdYcQmmYV3v7Jit1z7Qg7hhu0aOaZzShqdQdC7rg==", | ||
| 125 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/transport_build/transport_build-0.0.2.har", | ||
| 126 | + "registryType": "ohpm", | ||
| 127 | + "dependencies": { | ||
| 128 | + "@ohos/crypto-js": "^2.0.2", | ||
| 129 | + "dayjs": "^1.11.7", | ||
| 130 | + "pako": "^2.1.0", | ||
| 131 | + "@mpaas/fake-island": "^1.0.0", | ||
| 132 | + "long": "^5.2.1", | ||
| 133 | + "@mpaas/framework": "^0.0.2", | ||
| 134 | + "@mpaas/shuckle": "^1.0.0", | ||
| 135 | + "@mpaas/compress": "^1.0.0" | ||
| 136 | + } | ||
| 137 | + }, | ||
| 138 | + "@mpaas/udid@0.0.2": { | ||
| 139 | + "name": "@mpaas/udid", | ||
| 140 | + "integrity": "sha512-YFLSgBOrIjjmcFm4Cn2BB1tspHKHdB4qipVl4MUhHHDfiUYbLIVuv7x5xB9xPuPf0gKO8rx0yqUuzkaNDoNsAw==", | ||
| 141 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/udid/udid-0.0.2.har", | ||
| 142 | + "registryType": "ohpm" | ||
| 143 | + }, | ||
| 144 | + "@mpaas/upgrade@0.0.2": { | ||
| 145 | + "name": "@mpaas/upgrade", | ||
| 146 | + "integrity": "sha512-VWamULIoJPA6nxUADwwNXd3uOspZeYAsRh05pApVilIdum5ktIMXIFl71jAKsChs3jtrhs9y5EShoZD4MZrGsA==", | ||
| 147 | + "resolved": "https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/dist/@mpaas/upgrade/upgrade-0.0.2.har", | ||
| 148 | + "registryType": "ohpm", | ||
| 149 | + "dependencies": { | ||
| 150 | + "@mpaas/framework": "^0.0.2", | ||
| 151 | + "@mpaas/rpc": "^0.0.2", | ||
| 152 | + "@mpaas/lang": "^1.0.0", | ||
| 153 | + "@mpaas/transport_build": "^0.0.2", | ||
| 154 | + "@mpaas/trace-log": "^0.0.2" | ||
| 155 | + } | ||
| 156 | + }, | ||
| 157 | + "@ohos/crypto-js@2.0.3": { | ||
| 158 | + "name": "@ohos/crypto-js", | ||
| 159 | + "integrity": "sha512-LuHaR1kD5PxnOXnuR1fWvPwGtbed9Q/QGzk6JOh8y5Wdzvi8brPesODZiaWf9scOVRHsbTPOtZw91vWB35p1vQ==", | ||
| 160 | + "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/crypto-js/-/crypto-js-2.0.3.har", | ||
| 161 | + "registryType": "ohpm" | ||
| 162 | + }, | ||
| 12 | "@ohos/hypium@1.0.16": { | 163 | "@ohos/hypium@1.0.16": { |
| 13 | "name": "@ohos/hypium", | 164 | "name": "@ohos/hypium", |
| 14 | "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==", | 165 | "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==", |
| @@ -20,6 +171,60 @@ | @@ -20,6 +171,60 @@ | ||
| 20 | "integrity": "sha512-mgBvJ6Ga70LmAoPKTOEPLFJluHUEAaBt2+7wF7R6223Vw6UEbZrof1MyvVOLEHk8Uc64ASIMW/TNQ8AHraTV5A==", | 171 | "integrity": "sha512-mgBvJ6Ga70LmAoPKTOEPLFJluHUEAaBt2+7wF7R6223Vw6UEbZrof1MyvVOLEHk8Uc64ASIMW/TNQ8AHraTV5A==", |
| 21 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/pulltorefresh/-/pulltorefresh-2.0.5.har", | 172 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/pulltorefresh/-/pulltorefresh-2.0.5.har", |
| 22 | "registryType": "ohpm" | 173 | "registryType": "ohpm" |
| 174 | + }, | ||
| 175 | + "dayjs@1.11.7": { | ||
| 176 | + "name": "dayjs", | ||
| 177 | + "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==", | ||
| 178 | + "resolved": "https://ohpm.openharmony.cn/ohpm/dayjs/-/dayjs-1.11.7.tgz", | ||
| 179 | + "shasum": "4b296922642f70999544d1144a2c25730fce63e2", | ||
| 180 | + "registryType": "ohpm" | ||
| 181 | + }, | ||
| 182 | + "libcompress.so@oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress": { | ||
| 183 | + "name": "libcompress.so", | ||
| 184 | + "resolved": "oh_modules/.ohpm/@mpaas+compress@1.0.0/oh_modules/@mpaas/compress/src/main/cpp/types/libcompress", | ||
| 185 | + "registryType": "local" | ||
| 186 | + }, | ||
| 187 | + "libframework_api.so@oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api": { | ||
| 188 | + "name": "libframework_api.so", | ||
| 189 | + "resolved": "oh_modules/.ohpm/@mpaas+framework@0.0.2/oh_modules/@mpaas/framework/src/main/cpp/types/libframework_api", | ||
| 190 | + "registryType": "local" | ||
| 191 | + }, | ||
| 192 | + "libgwcli.so@oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types": { | ||
| 193 | + "name": "libgwcli.so", | ||
| 194 | + "resolved": "oh_modules/.ohpm/@mpaas+fake-island@1.0.0/oh_modules/@mpaas/fake-island/types", | ||
| 195 | + "registryType": "local" | ||
| 196 | + }, | ||
| 197 | + "liblang.so@oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types": { | ||
| 198 | + "name": "liblang.so", | ||
| 199 | + "resolved": "oh_modules/.ohpm/@mpaas+lang@1.0.0/oh_modules/@mpaas/lang/types", | ||
| 200 | + "registryType": "local" | ||
| 201 | + }, | ||
| 202 | + "libmplog.so@oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types": { | ||
| 203 | + "name": "libmplog.so", | ||
| 204 | + "resolved": "oh_modules/.ohpm/@mpaas+trace-log@0.0.2/oh_modules/@mpaas/trace-log/types", | ||
| 205 | + "registryType": "local" | ||
| 206 | + }, | ||
| 207 | + "libshuckle.so@oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle": { | ||
| 208 | + "name": "lishuckle.so", | ||
| 209 | + "resolved": "oh_modules/.ohpm/@mpaas+shuckle@1.0.0/oh_modules/@mpaas/shuckle/src/main/cpp/types/libshuckle", | ||
| 210 | + "registryType": "local", | ||
| 211 | + "dependencies": { | ||
| 212 | + "@mpaas/framework": "^0.0.2" | ||
| 213 | + } | ||
| 214 | + }, | ||
| 215 | + "long@5.2.1": { | ||
| 216 | + "name": "long", | ||
| 217 | + "integrity": "sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A==", | ||
| 218 | + "resolved": "https://ohpm.openharmony.cn/ohpm/long/-/long-5.2.1.tgz", | ||
| 219 | + "shasum": "e27595d0083d103d2fa2c20c7699f8e0c92b897f", | ||
| 220 | + "registryType": "ohpm" | ||
| 221 | + }, | ||
| 222 | + "pako@2.1.0": { | ||
| 223 | + "name": "pako", | ||
| 224 | + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", | ||
| 225 | + "resolved": "https://ohpm.openharmony.cn/ohpm/pako/-/pako-2.1.0.tgz", | ||
| 226 | + "shasum": "266cc37f98c7d883545d11335c00fbd4062c9a86", | ||
| 227 | + "registryType": "ohpm" | ||
| 23 | } | 228 | } |
| 24 | } | 229 | } |
| 25 | } | 230 | } |
| @@ -9,7 +9,10 @@ | @@ -9,7 +9,10 @@ | ||
| 9 | "main": "", | 9 | "main": "", |
| 10 | "version": "1.0.0", | 10 | "version": "1.0.0", |
| 11 | "dependencies": { | 11 | "dependencies": { |
| 12 | - "@ohos/pulltorefresh": "^2.0.5" | 12 | + "@ohos/pulltorefresh": "^2.0.5", |
| 13 | + "@mpaas/udid": "0.0.2", | ||
| 14 | + "@mpaas/upgrade": "0.0.2", | ||
| 15 | + "@mpaas/framework": "0.0.2" | ||
| 13 | }, | 16 | }, |
| 14 | "dynamicDependencies": {} | 17 | "dynamicDependencies": {} |
| 15 | } | 18 | } |
sight_harmony/products/phone/.ohpmrc
0 → 100644
| 1 | +@mpaas:registry=https://mpaas-ohpm.oss-cn-hangzhou.aliyuncs.com/meta |
| @@ -8,6 +8,7 @@ import { | @@ -8,6 +8,7 @@ import { | ||
| 8 | EmitterEventId, | 8 | EmitterEventId, |
| 9 | EmitterUtils, | 9 | EmitterUtils, |
| 10 | Logger, | 10 | Logger, |
| 11 | + MpaasUtils, | ||
| 11 | NetworkManager, | 12 | NetworkManager, |
| 12 | NetworkType, | 13 | NetworkType, |
| 13 | SPHelper, | 14 | SPHelper, |
| @@ -25,6 +26,10 @@ export default class EntryAbility extends UIAbility { | @@ -25,6 +26,10 @@ export default class EntryAbility extends UIAbility { | ||
| 25 | UmengStats.preInit(this.context) | 26 | UmengStats.preInit(this.context) |
| 26 | SPHelper.init(this.context); | 27 | SPHelper.init(this.context); |
| 27 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | 28 | hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); |
| 29 | + | ||
| 30 | + // mPaaS 初始化 | ||
| 31 | + MpaasUtils.initApp(this.context) | ||
| 32 | + | ||
| 28 | registerRouter(); | 33 | registerRouter(); |
| 29 | LoginModule.startup() | 34 | LoginModule.startup() |
| 30 | NetworkManager.getInstance().init() | 35 | NetworkManager.getInstance().init() |
| 1 | import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } from 'wdComponent'; | 1 | import { BottomNavigationComponent, LogoutViewModel, PermissionDesComponent } from 'wdComponent'; |
| 2 | import { BreakpointConstants } from 'wdConstant'; | 2 | import { BreakpointConstants } from 'wdConstant'; |
| 3 | 3 | ||
| 4 | -import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger } from 'wdKit'; | ||
| 5 | import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; | 4 | import { HWLocationUtils, WDPushNotificationManager } from 'wdHwAbility/Index'; |
| 6 | import { common } from '@kit.AbilityKit'; | 5 | import { common } from '@kit.AbilityKit'; |
| 7 | - | 6 | +import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeCheck } from 'wdKit'; |
| 7 | +import router from '@ohos.router'; | ||
| 8 | +import { promptAction } from '@kit.ArkUI'; | ||
| 9 | +import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog" | ||
| 8 | 10 | ||
| 9 | const TAG = 'MainPage'; | 11 | const TAG = 'MainPage'; |
| 10 | 12 | ||
| @@ -16,6 +18,8 @@ struct MainPage { | @@ -16,6 +18,8 @@ struct MainPage { | ||
| 16 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() | 18 | private breakpointSystem: BreakpointSystem = new BreakpointSystem() |
| 17 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; | 19 | @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; |
| 18 | @State isPermission: boolean = false | 20 | @State isPermission: boolean = false |
| 21 | + upgradeDialogController?: CustomDialogController | ||
| 22 | + | ||
| 19 | watchCurrentBreakpoint() { | 23 | watchCurrentBreakpoint() { |
| 20 | Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); | 24 | Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); |
| 21 | } | 25 | } |
| @@ -61,6 +65,26 @@ struct MainPage { | @@ -61,6 +65,26 @@ struct MainPage { | ||
| 61 | onPageShow() { | 65 | onPageShow() { |
| 62 | Logger.info(TAG, 'onPageShow'); | 66 | Logger.info(TAG, 'onPageShow'); |
| 63 | this.pageShow = Math.random() | 67 | this.pageShow = Math.random() |
| 68 | + | ||
| 69 | + // TODO: 升级检查,暂时不开放 | ||
| 70 | + // this.upgradeCheck() | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + upgradeCheck() { | ||
| 74 | + const mpaas = new MpaasUpgradeCheck() | ||
| 75 | + mpaas.checkNewVersion().then((data) => { | ||
| 76 | + if (data != null) { | ||
| 77 | + | ||
| 78 | + this.upgradeDialogController = new CustomDialogController({ | ||
| 79 | + builder: UpgradeTipDialog({ | ||
| 80 | + tipContent:data | ||
| 81 | + }) | ||
| 82 | + }) | ||
| 83 | + this.upgradeDialogController?.open() | ||
| 84 | + } | ||
| 85 | + }).catch(() => { | ||
| 86 | + | ||
| 87 | + }) | ||
| 64 | } | 88 | } |
| 65 | 89 | ||
| 66 | onBackPress() { | 90 | onBackPress() { |
| 1 | +import { UpgradeTipContent } from 'wdKit/Index' | ||
| 2 | + | ||
| 3 | +@Preview | ||
| 4 | +@CustomDialog | ||
| 5 | +export struct UpgradeTipDialog { | ||
| 6 | + private tipContent: UpgradeTipContent = {} as UpgradeTipContent | ||
| 7 | + cancel?: () => void | ||
| 8 | + confirm?: () => void | ||
| 9 | + controller: CustomDialogController | ||
| 10 | + | ||
| 11 | + build() { | ||
| 12 | + Column() { | ||
| 13 | + Text(this.tipContent.content).fontSize(20).margin({ top: 10, bottom: 10 }) | ||
| 14 | + Flex({ justifyContent: FlexAlign.SpaceAround }) { | ||
| 15 | + Button('cancel') | ||
| 16 | + .onClick(() => { | ||
| 17 | + this.controller.close() | ||
| 18 | + if (this.cancel) { | ||
| 19 | + this.cancel() | ||
| 20 | + } | ||
| 21 | + }).backgroundColor(0xffffff).fontColor(Color.Black) | ||
| 22 | + Button('立即升级') | ||
| 23 | + .onClick(() => { | ||
| 24 | + this.controller.close() | ||
| 25 | + if (this.confirm) { | ||
| 26 | + this.confirm() | ||
| 27 | + } | ||
| 28 | + }).backgroundColor(0xffffff).fontColor(Color.Red) | ||
| 29 | + }.margin({ bottom: 10 }) | ||
| 30 | + } | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + | ||
| 34 | +} |
1.16 KB
| 1 | +{ | ||
| 2 | + "absBase64Code":"", | ||
| 3 | + "appId":"PRI2B87143171150", | ||
| 4 | + "appKey":"PRI2B87143171150_HARMONY", | ||
| 5 | + "base64Code":"", | ||
| 6 | + "v6Base64Code":"", | ||
| 7 | + "workspaceId":"default", | ||
| 8 | + "rpcGW":"http://123.56.249.180/mgw.htm", | ||
| 9 | + "mpaasapi":"http://123.56.249.180/mgw.htm", | ||
| 10 | + "pushPort":"", | ||
| 11 | + "pushGW":"", | ||
| 12 | + "logGW":"", | ||
| 13 | + "mvetAppWS":"10.250.12.199" | ||
| 14 | +} |
-
Please register or login to post a comment