@zulfio/react-native-alarm-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Alarmkit.podspec +35 -0
- package/LICENSE +20 -0
- package/README.md +163 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +129 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/alarmkit/AlarmkitPackage.kt +22 -0
- package/android/src/main/java/com/margelo/nitro/alarmkit/Alarmkit.kt +7 -0
- package/ios/AlarmKit.swift +296 -0
- package/lib/module/AlarmKit.nitro.js +4 -0
- package/lib/module/AlarmKit.nitro.js.map +1 -0
- package/lib/module/index.js +40 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AlarmKit.nitro.d.ts +24 -0
- package/lib/typescript/src/AlarmKit.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +11 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/alarmkit+autolinking.cmake +78 -0
- package/nitrogen/generated/android/alarmkit+autolinking.gradle +27 -0
- package/nitrogen/generated/android/alarmkitOnLoad.cpp +46 -0
- package/nitrogen/generated/android/alarmkitOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JAlarmCountdown.hpp +57 -0
- package/nitrogen/generated/android/c++/JAlarmWeekday.hpp +74 -0
- package/nitrogen/generated/android/c++/JCustomizableAlarmButton.hpp +61 -0
- package/nitrogen/generated/android/c++/JHybridAlarmKitSpec.cpp +180 -0
- package/nitrogen/generated/android/c++/JHybridAlarmKitSpec.hpp +68 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/AlarmCountdown.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/AlarmWeekday.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/CustomizableAlarmButton.kt +28 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/HybridAlarmKitSpec.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/alarmkitOnLoad.kt +35 -0
- package/nitrogen/generated/ios/AlarmKit+autolinking.rb +60 -0
- package/nitrogen/generated/ios/AlarmKit-Swift-Cxx-Bridge.cpp +72 -0
- package/nitrogen/generated/ios/AlarmKit-Swift-Cxx-Bridge.hpp +309 -0
- package/nitrogen/generated/ios/AlarmKit-Swift-Cxx-Umbrella.hpp +56 -0
- package/nitrogen/generated/ios/AlarmKitAutolinking.mm +33 -0
- package/nitrogen/generated/ios/AlarmKitAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridAlarmKitSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAlarmKitSpecSwift.hpp +130 -0
- package/nitrogen/generated/ios/swift/AlarmCountdown.swift +70 -0
- package/nitrogen/generated/ios/swift/AlarmWeekday.swift +60 -0
- package/nitrogen/generated/ios/swift/CustomizableAlarmButton.swift +57 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +52 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridAlarmKitSpec.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridAlarmKitSpec_cxx.swift +271 -0
- package/nitrogen/generated/shared/c++/AlarmCountdown.hpp +73 -0
- package/nitrogen/generated/shared/c++/AlarmWeekday.hpp +98 -0
- package/nitrogen/generated/shared/c++/CustomizableAlarmButton.hpp +77 -0
- package/nitrogen/generated/shared/c++/HybridAlarmKitSpec.cpp +27 -0
- package/nitrogen/generated/shared/c++/HybridAlarmKitSpec.hpp +79 -0
- package/package.json +168 -0
- package/src/AlarmKit.nitro.ts +48 -0
- package/src/index.tsx +96 -0
package/Alarmkit.podspec
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "AlarmKit"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/raphckrman/react-native-alarmkit.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
s.source_files = [
|
|
18
|
+
"ios/**/*.{swift}",
|
|
19
|
+
"ios/**/*.{m,mm}",
|
|
20
|
+
"cpp/**/*.{hpp,cpp}",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
s.pod_target_xcconfig = {
|
|
24
|
+
# C++ compiler flags, mainly for folly.
|
|
25
|
+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
s.dependency 'React-jsi'
|
|
29
|
+
s.dependency 'React-callinvoker'
|
|
30
|
+
|
|
31
|
+
load 'nitrogen/generated/ios/AlarmKit+autolinking.rb'
|
|
32
|
+
add_nitrogen_files(s)
|
|
33
|
+
|
|
34
|
+
install_modules_dependencies(s)
|
|
35
|
+
end
|
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 raphckrman
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
For testing only, Fork of @raphckrman/react-native-alarm-kit.
|
|
2
|
+
|
|
3
|
+
# 📱 react-native-alarmkit
|
|
4
|
+
|
|
5
|
+
> [!WARNING]
|
|
6
|
+
> This library is still under development. Use at your own risk.
|
|
7
|
+
|
|
8
|
+
This library provides a simple and modern interface for working with alarms in your React Native app using Apple's latest AlarmKit framework (requires **iOS 26.0+**).
|
|
9
|
+
|
|
10
|
+
## ⚙️ Installation
|
|
11
|
+
|
|
12
|
+
### React Native
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> `react-native-nitro-modules` is required because this library leverages [Nitro Modules](https://nitro.margelo.com/).
|
|
15
|
+
```sh
|
|
16
|
+
npm install @raphckrman/react-native-alarm-kit react-native-nitro-modules
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Expo
|
|
20
|
+
```sh
|
|
21
|
+
npx expo add @raphckrman/react-native-alarm-kit react-native-nitro-modules
|
|
22
|
+
npx expo prebuild
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🚀 Usage
|
|
26
|
+
|
|
27
|
+
### Permissions
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { requestAlarmPermission } from '@raphckrman/react-native-alarm-kit';
|
|
31
|
+
|
|
32
|
+
const granted = await requestAlarmPermission();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Schedule a Fixed Alarm (one-time, by timestamp)
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import {
|
|
39
|
+
createAlarmButton,
|
|
40
|
+
scheduleFixedAlarm,
|
|
41
|
+
} from '@raphckrman/react-native-alarm-kit';
|
|
42
|
+
|
|
43
|
+
const stopBtn = await createAlarmButton('Stop', '#FF0000', 'stop.circle');
|
|
44
|
+
const secondBtn = await createAlarmButton('Repeat', '#000000', 'play.circle');
|
|
45
|
+
|
|
46
|
+
// Trigger at a specific Unix timestamp
|
|
47
|
+
const timestamp = Date.now() / 1000 + 60; // 60 seconds from now
|
|
48
|
+
const alarmId = await scheduleFixedAlarm('Morning Alarm', stopBtn, '#FFFFFF', secondBtn, timestamp);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Schedule a Fixed Alarm (timer/countdown)
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
import {
|
|
55
|
+
createAlarmButton,
|
|
56
|
+
createAlarmCountdown,
|
|
57
|
+
scheduleFixedAlarm,
|
|
58
|
+
} from '@raphckrman/react-native-alarm-kit';
|
|
59
|
+
|
|
60
|
+
const stopBtn = await createAlarmButton('Stop', '#FF0000', 'stop.circle');
|
|
61
|
+
const countdown = await createAlarmCountdown(3, 15); // preAlert: 3s, postAlert: 15s
|
|
62
|
+
|
|
63
|
+
// Triggers in 3 seconds, repeats after 15 seconds
|
|
64
|
+
const alarmId = await scheduleFixedAlarm('Timer', stopBtn, '#FFFFFF', undefined, undefined, countdown);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Schedule a Relative Alarm (recurring, by time of day)
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
import {
|
|
71
|
+
createAlarmButton,
|
|
72
|
+
scheduleRelativeAlarm,
|
|
73
|
+
} from '@raphckrman/react-native-alarm-kit';
|
|
74
|
+
|
|
75
|
+
const stopBtn = await createAlarmButton('Stop', '#FF0000', 'stop.circle');
|
|
76
|
+
|
|
77
|
+
// Triggers at 10:00 every Monday, Thursday, and Friday
|
|
78
|
+
const alarmId = await scheduleRelativeAlarm(
|
|
79
|
+
'Daily Standup',
|
|
80
|
+
stopBtn,
|
|
81
|
+
'#FFFFFF',
|
|
82
|
+
10, // hour
|
|
83
|
+
0, // minute
|
|
84
|
+
['monday', 'thursday', 'friday']
|
|
85
|
+
);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Both schedule functions return a `string` — the alarm's UUID — which you should persist to cancel or query the alarm later.
|
|
89
|
+
|
|
90
|
+
### Cancel an Alarm
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import { cancelAlarm } from '@raphckrman/react-native-alarm-kit';
|
|
94
|
+
|
|
95
|
+
const success = await cancelAlarm(alarmId);
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Cancel All Alarms
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
import { cancelAllAlarms } from '@raphckrman/react-native-alarm-kit';
|
|
102
|
+
|
|
103
|
+
const success = await cancelAllAlarms();
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Get a Single Alarm
|
|
107
|
+
|
|
108
|
+
Returns the alarm's current state (`"scheduled"`, `"ringing"`, `"snoozed"`, `"unknown"`), or `null` if no alarm with that ID exists.
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
import { getAlarm } from '@raphckrman/react-native-alarm-kit';
|
|
112
|
+
|
|
113
|
+
const state = await getAlarm(alarmId);
|
|
114
|
+
// "scheduled" | "ringing" | "snoozed" | "unknown" | null
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Get All Alarms
|
|
118
|
+
|
|
119
|
+
Returns an array of UUID strings for every alarm currently tracked by the system.
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
import { getAllAlarms } from '@raphckrman/react-native-alarm-kit';
|
|
123
|
+
|
|
124
|
+
const ids = await getAllAlarms();
|
|
125
|
+
// ["uuid-1", "uuid-2", ...]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 📖 API Reference
|
|
129
|
+
|
|
130
|
+
### `requestAlarmPermission(): Promise<boolean>`
|
|
131
|
+
Requests authorization to schedule alarms. Returns `true` if granted.
|
|
132
|
+
|
|
133
|
+
### `scheduleFixedAlarm(title, stopBtn, tintColor, secondaryBtn?, timestamp?, countdown?): Promise<string>`
|
|
134
|
+
Schedules a one-time alarm at a fixed date/time or as a countdown timer. Either `timestamp` (Unix seconds) or `countdown` must be provided. Returns the alarm UUID.
|
|
135
|
+
|
|
136
|
+
### `scheduleRelativeAlarm(title, stopBtn, tintColor, hour, minute, repeats, secondaryBtn?, countdown?): Promise<string>`
|
|
137
|
+
Schedules a recurring alarm at a specific time of day on the given weekdays. Returns the alarm UUID.
|
|
138
|
+
|
|
139
|
+
### `cancelAlarm(id: string): Promise<boolean>`
|
|
140
|
+
Cancels a scheduled alarm by its UUID. Returns `true` on success.
|
|
141
|
+
|
|
142
|
+
### `cancelAllAlarms(): Promise<boolean>`
|
|
143
|
+
Cancels every scheduled alarm tracked by `AlarmManager`. Returns `true` on success.
|
|
144
|
+
|
|
145
|
+
### `getAlarm(id: string): Promise<string | null>`
|
|
146
|
+
Returns the state of an alarm (`"scheduled"`, `"ringing"`, `"snoozed"`, `"unknown"`), or `null` if not found.
|
|
147
|
+
|
|
148
|
+
### `getAllAlarms(): Promise<string[]>`
|
|
149
|
+
Returns the UUIDs of all alarms currently tracked by `AlarmManager`.
|
|
150
|
+
|
|
151
|
+
### `createAlarmButton(text, textColor, icon): Promise<CustomizableAlarmButton>`
|
|
152
|
+
Helper to build a `CustomizableAlarmButton` object. `icon` is an SF Symbol name (e.g. `"stop.circle"`).
|
|
153
|
+
|
|
154
|
+
### `createAlarmCountdown(preAlert, postAlert): Promise<AlarmCountdown>`
|
|
155
|
+
Helper to build an `AlarmCountdown` object. Both values are in seconds.
|
|
156
|
+
|
|
157
|
+
## 🤝 Contributing
|
|
158
|
+
|
|
159
|
+
We welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) to learn how to get started, report issues, or suggest improvements.
|
|
160
|
+
|
|
161
|
+
## 📄 License
|
|
162
|
+
|
|
163
|
+
This project is licensed under the [MIT License](LICENSE.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
project(alarmkit)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set(PACKAGE_NAME alarmkit)
|
|
5
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Define C++ library and add all sources
|
|
9
|
+
add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp)
|
|
10
|
+
|
|
11
|
+
# Add Nitrogen specs :)
|
|
12
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/alarmkit+autolinking.cmake)
|
|
13
|
+
|
|
14
|
+
# Set up local includes
|
|
15
|
+
include_directories("src/main/cpp" "../cpp")
|
|
16
|
+
|
|
17
|
+
find_library(LOG_LIB log)
|
|
18
|
+
|
|
19
|
+
# Link all libraries together
|
|
20
|
+
target_link_libraries(
|
|
21
|
+
${PACKAGE_NAME}
|
|
22
|
+
${LOG_LIB}
|
|
23
|
+
android # <-- Android core
|
|
24
|
+
)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.getExtOrDefault = {name ->
|
|
3
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['AlarmKit_' + name]
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
repositories {
|
|
7
|
+
google()
|
|
8
|
+
mavenCentral()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
dependencies {
|
|
12
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
13
|
+
// noinspection DifferentKotlinGradleVersion
|
|
14
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
def reactNativeArchitectures() {
|
|
19
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
20
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
apply plugin: "com.android.library"
|
|
24
|
+
apply plugin: "kotlin-android"
|
|
25
|
+
apply from: '../nitrogen/generated/android/alarmkit+autolinking.gradle'
|
|
26
|
+
|
|
27
|
+
apply plugin: "com.facebook.react"
|
|
28
|
+
|
|
29
|
+
def getExtOrIntegerDefault(name) {
|
|
30
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["AlarmKit_" + name]).toInteger()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
android {
|
|
34
|
+
namespace "com.margelo.nitro.alarmkit"
|
|
35
|
+
|
|
36
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
37
|
+
|
|
38
|
+
defaultConfig {
|
|
39
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
40
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
41
|
+
|
|
42
|
+
externalNativeBuild {
|
|
43
|
+
cmake {
|
|
44
|
+
cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
|
|
45
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
46
|
+
abiFilters (*reactNativeArchitectures())
|
|
47
|
+
|
|
48
|
+
buildTypes {
|
|
49
|
+
debug {
|
|
50
|
+
cppFlags "-O1 -g"
|
|
51
|
+
}
|
|
52
|
+
release {
|
|
53
|
+
cppFlags "-O2"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
externalNativeBuild {
|
|
61
|
+
cmake {
|
|
62
|
+
path "CMakeLists.txt"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
packagingOptions {
|
|
67
|
+
excludes = [
|
|
68
|
+
"META-INF",
|
|
69
|
+
"META-INF/**",
|
|
70
|
+
"**/libc++_shared.so",
|
|
71
|
+
"**/libfbjni.so",
|
|
72
|
+
"**/libjsi.so",
|
|
73
|
+
"**/libfolly_json.so",
|
|
74
|
+
"**/libfolly_runtime.so",
|
|
75
|
+
"**/libglog.so",
|
|
76
|
+
"**/libhermes.so",
|
|
77
|
+
"**/libhermes-executor-debug.so",
|
|
78
|
+
"**/libhermes_executor.so",
|
|
79
|
+
"**/libreactnative.so",
|
|
80
|
+
"**/libreactnativejni.so",
|
|
81
|
+
"**/libturbomodulejsijni.so",
|
|
82
|
+
"**/libreact_nativemodule_core.so",
|
|
83
|
+
"**/libjscexecutor.so"
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
buildFeatures {
|
|
88
|
+
buildConfig true
|
|
89
|
+
prefab true
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
buildTypes {
|
|
93
|
+
release {
|
|
94
|
+
minifyEnabled false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
lintOptions {
|
|
99
|
+
disable "GradleCompatible"
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
compileOptions {
|
|
103
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
104
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
sourceSets {
|
|
108
|
+
main {
|
|
109
|
+
java.srcDirs += [
|
|
110
|
+
"generated/java",
|
|
111
|
+
"generated/jni"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
repositories {
|
|
118
|
+
mavenCentral()
|
|
119
|
+
google()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
123
|
+
|
|
124
|
+
dependencies {
|
|
125
|
+
implementation "com.facebook.react:react-android"
|
|
126
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
127
|
+
implementation project(":react-native-nitro-modules")
|
|
128
|
+
}
|
|
129
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.alarmkit
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.TurboReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
|
+
|
|
8
|
+
class AlarmKitPackage : TurboReactPackage() {
|
|
9
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
14
|
+
return ReactModuleInfoProvider { HashMap() }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
companion object {
|
|
18
|
+
init {
|
|
19
|
+
System.loadLibrary("alarmkit")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|