Skip to content
This repository was archived by the owner on Dec 4, 2024. It is now read-only.

Commit adb1bf2

Browse files
authored
Merge pull request #2 from xl666666/master
react-native-background-timer新增harmony代码
2 parents f766219 + 38604a3 commit adb1bf2

File tree

17 files changed

+178
-0
lines changed

17 files changed

+178
-0
lines changed

harmony/background_timer.har

2.47 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/node_modules
2+
/oh_modules
3+
/.preview
4+
/build
5+
/.cxx
6+
/.test
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default class BuildProfile {
2+
static readonly HAR_VERSION = '1.0.0';
3+
static readonly BUILD_MODE_NAME = 'debug';
4+
static readonly DEBUG = true;
5+
static readonly TARGET_NAME = 'default';
6+
}

harmony/background_timer/Index.ets

Whitespace-only changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"apiType": "stageMode",
3+
"buildOption": {
4+
"sourceOption": {
5+
// "workers": [
6+
// "./src/main/ets/BackgroundTimerWorker.ets"
7+
// ]
8+
}
9+
},
10+
"buildOptionSet": [
11+
{
12+
"name": "release",
13+
"arkOptions": {
14+
"obfuscation": {
15+
"ruleOptions": {
16+
"enable": true,
17+
"files": [
18+
"./obfuscation-rules.txt"
19+
]
20+
},
21+
"consumerFiles": [
22+
"./consumer-rules.txt"
23+
]
24+
}
25+
},
26+
},
27+
],
28+
"targets": [
29+
{
30+
"name": "default"
31+
},
32+
{
33+
"name": "ohosTest"
34+
}
35+
]
36+
}

harmony/background_timer/consumer-rules.txt

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { harTasks } from '@ohos/hvigor-ohos-plugin';
2+
3+
export default {
4+
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
5+
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
6+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Define project specific obfuscation rules here.
2+
# You can include the obfuscation configuration files in the current module's build-profile.json5.
3+
#
4+
# For more details, see
5+
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
6+
7+
# Obfuscation options:
8+
# -disable-obfuscation: disable all obfuscations
9+
# -enable-property-obfuscation: obfuscate the property names
10+
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
11+
# -compact: remove unnecessary blank spaces and all line feeds
12+
# -remove-log: remove all console.* statements
13+
# -print-namecache: print the name cache that contains the mapping from the old names to new names
14+
# -apply-namecache: reuse the given cache file
15+
16+
# Keep options:
17+
# -keep-property-name: specifies property names that you want to keep
18+
# -keep-global-name: specifies names that you want to keep in the global scope
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "background_timer",
3+
"version": "1.0.0",
4+
"description": "Please describe the basic information.",
5+
"main": "Index.ets",
6+
"author": "",
7+
"license": "Apache-2.0",
8+
dependencies: {
9+
"@rnoh/react-native-openharmony": 'file:../react_native_openharmony'
10+
}
11+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { RNPackage, TurboModulesFactory } from '@rnoh/react-native-openharmony/ts';
2+
import type { TurboModule, TurboModuleContext } from '@rnoh/react-native-openharmony/ts';
3+
import { BackgroundTimerTurboModule } from './BackgroundTimerTurboModule';
4+
5+
class BackgroundTimerTurboModuleFactory extends TurboModulesFactory {
6+
createTurboModule(name: string): TurboModule | null {
7+
if (name === 'BackgroundTimerTurboModule') {
8+
return new BackgroundTimerTurboModule(this.ctx);
9+
}
10+
return null;
11+
}
12+
13+
hasTurboModule(name: string): boolean {
14+
return name === 'BackgroundTimerTurboModule';
15+
}
16+
}
17+
18+
export class BackgroundTimerTurboModulePackage extends RNPackage {
19+
createTurboModulesFactory(ctx: TurboModuleContext): TurboModulesFactory {
20+
return new BackgroundTimerTurboModuleFactory(ctx);
21+
}
22+
}

0 commit comments

Comments
 (0)