Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sdk-public
HarmonyOsDemo
Commits
41843963
Commit
41843963
authored
Dec 11, 2025
by
lujie
Browse files
Merge branch 'feat-demo' into 'main'
feat(app): init See merge request
!1
parents
8d522ac0
b8124cc0
Changes
101
Hide whitespace changes
Inline
Side-by-side
tuanjieLib/src/main/ets/workers/WorkerProxy.ets
0 → 100644
View file @
41843963
/**
* @desc Run on UI/main thread, process message from worker thread and postMessage to worker thread
*/
import worker, { MessageEvents } from '@ohos.worker';
import { Constants } from '../common/Constants';
import { TuanjieLog } from '../common/TuanjieLog';
import { Tuanjie } from '../utils/TuanjieNative';
import { PROCESS_UI_BUILTIN_MESSAGE, PROCESS_UI_HANDLER, PROCESS_UI_MESSAGE, kCustomHandler } from './MessageProcessor';
import "../gen/BuiltinHostMsgRegistration";
export class WorkerProxy {
public threadWorker: worker.ThreadWorker;
public mModules: Record<string, ESObject> = {
};
public mUserExtraModules: Record<string, ESObject> = { };
private constructor() {
TuanjieLog.debug('%{public}s', 'WorkerProxy.constructor');
this.threadWorker = new worker.ThreadWorker("./TuanjieMainWorker.ets");
this.threadWorker.onerror = (e) => {
let msg = e.message;
let filename = e.filename;
let lineno = e.lineno;
let colno = e.colno;
TuanjieLog.error(`TuanjieMainWorker Error ${msg} ${filename} ${lineno} ${colno}`);
}
const self = this;
this.threadWorker.onmessage = (msg) => {
msg.data.src = "Worker.TuanjieMain";
if (msg.data.type == "RUN_ON_UI_THREAD") {
Tuanjie.nativeProcessUIThreadMessage();
} else if (msg.data.type == "RUN_ON_UI_THREAD_JS") {
PROCESS_UI_BUILTIN_MESSAGE(msg.data)
} else if (msg.data.type == "RUN_ON_UI_THREAD_USER_EVENT") {
PROCESS_UI_MESSAGE(msg.data);
} else if (msg.data.type == kCustomHandler) {
PROCESS_UI_HANDLER(msg.data);
} else {
TuanjieLog.warn("Unknown UI message type=%{public}s", msg.type);
}
}
}
public static Instance(): WorkerProxy {
let tuanjieMainWorker = AppStorage.get<WorkerProxy>(Constants.APP_KEY_TUANJIE_MAIN_WORKER);
if (tuanjieMainWorker == null) {
tuanjieMainWorker = new WorkerProxy();
AppStorage.setOrCreate(Constants.APP_KEY_TUANJIE_MAIN_WORKER, tuanjieMainWorker);
}
return tuanjieMainWorker;
}
public static getInstance(): worker.ThreadWorker {
return WorkerProxy.Instance().threadWorker;
}
/**
* post message to worker thread. For now we have only one worker - TuanjieMainWorker
* @param msg
*/
public static postMessage(msg: ESObject, targetWorker: string | undefined) {
if (targetWorker === undefined)
WorkerProxy.Instance().threadWorker.postMessage(msg);
// for now we have only worker
}
}
export function POST_MESSAGE(msg: ESObject) {
POST_MESSAGE_TO_WORKER(msg, undefined)
}
export function POST_MESSAGE_TO_WORKER(msg: ESObject, targetWorker: string | undefined) {
if (!msg.type)
msg.type = "RUN_ON_UI_THREAD_USER_EVENT";
WorkerProxy.postMessage(msg, targetWorker);
}
tuanjieLib/src/main/module.json5
0 → 100644
View file @
41843963
{
"module": {
"name": "tuanjieLib",
"type": "har",
"description": "$string:module_desc",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
'abilities': [],
"metadata": [
{
"name": "ArkTSPartialUpdate",
"value": "true"
},
{
"name": "partialUpdateStrictCheck",
"value": "warn"
}
],
"installationFree": false,
"requestPermissions": [
{
"name": "ohos.permission.INTERNET",
"usedScene": {
"abilities": [
"TuanjiePlayerAbility"
],
"when": "always"
},
"reason": "$string:default_reason"
},
{
"name": "ohos.permission.ACCELEROMETER",
"usedScene": {
"abilities": [
"TuanjiePlayerAbility"
],
"when": "always"
},
"reason": "$string:default_reason"
}
]
}
}
\ No newline at end of file
tuanjieLib/src/main/resources/base/element/color.json
0 → 100644
View file @
41843963
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FF231F20"
}
]
}
\ No newline at end of file
tuanjieLib/src/main/resources/base/element/integer.json
0 → 100644
View file @
41843963
{
"integer"
:
[
{
"name"
:
"ShowStaticSplashScreen"
,
"value"
:
0
},
{
"name"
:
"StaticSplashScreenFit"
,
"value"
:
0
}
]
}
\ No newline at end of file
tuanjieLib/src/main/resources/base/element/string.json
0 → 100644
View file @
41843963
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"default_reason"
,
"value"
:
"permission request"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"HonmonyBridge"
},
{
"name"
:
"permission_microphone_reason_desc"
,
"value"
:
"request microphone permission"
}
]
}
\ No newline at end of file
tuanjieLib/src/main/resources/base/media/app_splash.png
0 → 100644
View file @
41843963
12.4 KB
tuanjieLib/src/main/resources/base/media/ic_launcher_background.png
0 → 100644
View file @
41843963
1.01 KB
tuanjieLib/src/main/resources/base/media/ic_launcher_foreground.png
0 → 100644
View file @
41843963
8.91 KB
tuanjieLib/src/main/resources/base/media/icon.png
0 → 100644
View file @
41843963
8.91 KB
tuanjieLib/src/main/resources/base/media/layeredIcon.json
0 → 100644
View file @
41843963
{
"layeredIcon"
:
{
"foreground"
:
"$media:ic_launcher_foreground"
,
"background"
:
"$media:ic_launcher_background"
}
}
tuanjieLib/src/main/resources/base/profile/main_pages.json
0 → 100644
View file @
41843963
{
"src"
:
[
"pages/Index"
]
}
tuanjieLib/src/main/resources/en_US/element/string.json
0 → 100644
View file @
41843963
{
"string"
:
[
{
"name"
:
"module_desc"
,
"value"
:
"module description"
},
{
"name"
:
"default_reason"
,
"value"
:
"permission request"
},
{
"name"
:
"EntryAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"EntryAbility_label"
,
"value"
:
"HonmonyBridge"
},
{
"name"
:
"permission_microphone_reason_desc"
,
"value"
:
"request microphone permission"
}
]
}
\ No newline at end of file
tuanjieLib/src/main/resources/rawfile/Data/Managed/Metadata/global-metadata.dat
0 → 100644
View file @
41843963
File added
tuanjieLib/src/main/resources/rawfile/Data/Managed/Resources/mscorlib.dll-resources.dat
0 → 100644
View file @
41843963
File added
tuanjieLib/src/main/resources/rawfile/Data/RuntimeInitializeOnLoads.json
0 → 100644
View file @
41843963
{
"root"
:[{
"assemblyName"
:
"Unity.VisualScripting.Core"
,
"nameSpace"
:
"Unity.VisualScripting"
,
"className"
:
"RuntimeVSUsageUtility"
,
"methodName"
:
"RuntimeInitializeOnLoadBeforeSceneLoad"
,
"loadTypes"
:
1
,
"isUnityClass"
:
true
}]}
tuanjieLib/src/main/resources/rawfile/Data/ScriptingAssemblies.json
0 → 100644
View file @
41843963
{
"names"
:[
"UnityEngine.dll"
,
"UnityEngine.AIModule.dll"
,
"UnityEngine.ARModule.dll"
,
"UnityEngine.AccessibilityModule.dll"
,
"UnityEngine.AndroidAppViewModule.dll"
,
"UnityEngine.AndroidJNIModule.dll"
,
"UnityEngine.AnimationModule.dll"
,
"UnityEngine.AssetBundleModule.dll"
,
"UnityEngine.AudioModule.dll"
,
"UnityEngine.AutoStreamingModule.dll"
,
"UnityEngine.ClothModule.dll"
,
"UnityEngine.ContentLoadModule.dll"
,
"UnityEngine.CoreModule.dll"
,
"UnityEngine.CrashReportingModule.dll"
,
"UnityEngine.DSPGraphModule.dll"
,
"UnityEngine.DirectorModule.dll"
,
"UnityEngine.GIModule.dll"
,
"UnityEngine.GameCenterModule.dll"
,
"UnityEngine.GridModule.dll"
,
"UnityEngine.HotReloadModule.dll"
,
"UnityEngine.IMGUIModule.dll"
,
"UnityEngine.ImageConversionModule.dll"
,
"UnityEngine.InfinityModule.dll"
,
"UnityEngine.InputModule.dll"
,
"UnityEngine.InputLegacyModule.dll"
,
"UnityEngine.JSONSerializeModule.dll"
,
"UnityEngine.LocalizationModule.dll"
,
"UnityEngine.OcclusionCullingModule.dll"
,
"UnityEngine.OpenHarmonyJSModule.dll"
,
"UnityEngine.ParticleSystemModule.dll"
,
"UnityEngine.PerformanceReportingModule.dll"
,
"UnityEngine.PhysicsModule.dll"
,
"UnityEngine.Physics2DModule.dll"
,
"UnityEngine.ProfilerModule.dll"
,
"UnityEngine.PropertiesModule.dll"
,
"UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll"
,
"UnityEngine.ScreenCaptureModule.dll"
,
"UnityEngine.SharedInternalsModule.dll"
,
"UnityEngine.SpriteMaskModule.dll"
,
"UnityEngine.SpriteShapeModule.dll"
,
"UnityEngine.StreamingModule.dll"
,
"UnityEngine.SubstanceModule.dll"
,
"UnityEngine.SubsystemsModule.dll"
,
"UnityEngine.TLSModule.dll"
,
"UnityEngine.TerrainModule.dll"
,
"UnityEngine.TerrainPhysicsModule.dll"
,
"UnityEngine.TextCoreFontEngineModule.dll"
,
"UnityEngine.TextCoreTextEngineModule.dll"
,
"UnityEngine.TextRenderingModule.dll"
,
"UnityEngine.TextureManagerModule.dll"
,
"UnityEngine.TilemapModule.dll"
,
"UnityEngine.UIModule.dll"
,
"UnityEngine.UIElementsModule.dll"
,
"UnityEngine.UmbraModule.dll"
,
"UnityEngine.UnityAnalyticsModule.dll"
,
"UnityEngine.UnityAnalyticsCommonModule.dll"
,
"UnityEngine.UnityConnectModule.dll"
,
"UnityEngine.UnityCurlModule.dll"
,
"UnityEngine.UnityTestProtocolModule.dll"
,
"UnityEngine.UnityWebRequestModule.dll"
,
"UnityEngine.UnityWebRequestAssetBundleModule.dll"
,
"UnityEngine.UnityWebRequestAudioModule.dll"
,
"UnityEngine.UnityWebRequestTextureModule.dll"
,
"UnityEngine.UnityWebRequestWWWModule.dll"
,
"UnityEngine.VFXModule.dll"
,
"UnityEngine.VehiclesModule.dll"
,
"UnityEngine.VideoModule.dll"
,
"UnityEngine.WindModule.dll"
,
"UnityEngine.XRModule.dll"
,
"Unity.Timeline.dll"
,
"UnityEngine.UI.dll"
,
"Unity.TextMeshPro.dll"
,
"Unity.VisualScripting.Core.dll"
,
"Unity.VisualScripting.State.dll"
,
"Unity.VisualScripting.Flow.dll"
,
"Unity.VisualScripting.Antlr3.Runtime.dll"
],
"types"
:[
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
2
,
16
,
16
,
16
,
16
,
16
,
16
,
16
]}
\ No newline at end of file
tuanjieLib/src/main/resources/rawfile/Data/boot.config
0 → 100644
View file @
41843963
player
-
connection
-
mode
=
Listen
player
-
connection
-
guid
=
2414720699
player
-
connection
-
debug
=
0
player
-
connection
-
project
-
name
=
HonmonyBridge
player
-
connection
-
ip
=
10
.
1
.
70
.
3
serialized
-
file
-
monobehaviour
-
typetree
-
only
=
0
wait
-
for
-
native
-
debugger
=
0
hdr
-
display
-
enabled
=
0
gc
-
max
-
time
-
slice
=
3
openHarmonyStartInFullscreen
=
1
openHarmonyRenderOutsideSafeArea
=
1
logStartupTiming
=
0
build
-
guid
=
ea302243af7442aab2570797309baf81
tuanjieLib/src/main/resources/rawfile/Data/data.tj3d
0 → 100644
View file @
41843963
File added
tuanjieLib/src/main/resources/rawfile/Data/tuanjie default resources
0 → 100644
View file @
41843963
File added
tuanjieLib/src/main/resources/rawfile/Data/tuanjie_app_guid
0 → 100644
View file @
41843963
45003644-4461-42d6-85b7-1ea8a4313eb6
\ No newline at end of file
Prev
1
2
3
4
5
6
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment