From 02c1068bc11556d6271517a2261014837f577eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 24 Oct 2024 12:11:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(push):=20=E9=9B=86=E6=88=90=E4=B8=AA?= =?UTF-8?q?=E6=8E=A8=20SDK=20=E5=B9=B6=E4=BC=98=E5=8C=96=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E5=8A=9F=E8=83=BD-=20=E5=9C=A8=20AppAbility=20=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AA=E6=8E=A8=20SDK=20=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=92=8C=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=20-=20?= =?UTF-8?q?=E5=9C=A8=20GlobalValue=20=E5=92=8C=20StorageKeys=20=E4=B8=AD?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AA=E6=8E=A8=20CID=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=20-=20=E6=96=B0=E5=A2=9E=20PushData=20?= =?UTF-8?q?=E7=B1=BB=E5=92=8C=E7=9B=B8=E5=85=B3=20API=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=20-=20=E5=AE=9E=E7=8E=B0=20MiniAppManager=20=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=20pushIdBind=20=E6=96=B9=E6=B3=95=20-=20=E6=96=B0=E5=A2=9E=20P?= =?UTF-8?q?ushBean=E3=80=81PushListenerBean=20=E7=AD=89=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E7=B1=BB=20-=20=E5=9C=A8=20MainView=20?= =?UTF-8?q?=E5=92=8C=20LoginView=20=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=20-=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20CertManager=20=E4=B8=AD=E7=9A=84=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=80=BB=E8=BE=91-=20=E5=9C=A8=20Index=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=AD=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E6=8E=A8=E9=80=81=E5=8A=9F=E8=83=BD=20-=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A1=B9=E7=9B=AE=E4=BE=9D=E8=B5=96=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=AA=E6=8E=A8=20SDK=20=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ets/utils/ToolsHelper.ets | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/ets/utils/ToolsHelper.ets b/src/main/ets/utils/ToolsHelper.ets index 98766db..98f2422 100644 --- a/src/main/ets/utils/ToolsHelper.ets +++ b/src/main/ets/utils/ToolsHelper.ets @@ -261,6 +261,23 @@ export class ToolsHelper { } } + static encryptStringToNumber(str: string): number { + let result = 0; + for (let i = 0; i < str.length; i++) { + result = result * 256 + str.charCodeAt(i); + } + return result; + } + + static decryptNumberToString(num: number): string { + let result = ''; + while (num > 0) { + result = String.fromCharCode(num & 255) + result; + num >>>= 8; + } + return result.replace(/[\s\0]+$/, ''); // 移除结尾的空白字符 + } + /** * 获取调用栈第一个类 */ @@ -321,7 +338,7 @@ export class ToolsHelper { private static setTimeOutMap: Map = new Map() private static uniqueIdMap = new WeakMap(); - public static getUuid() { + public static getUuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => { let r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); @@ -334,5 +351,4 @@ export class ToolsHelper { } return ToolsHelper.uniqueIdMap.get(fun)!; } - } \ No newline at end of file