@zulfio/react-native-alarm-kit 1.0.1 → 1.0.3
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 +2 -1
- package/ios/AlarmKit.swift +75 -72
- package/nitro.json +1 -1
- package/nitrogen/generated/ios/{AlarmKit+autolinking.rb → RNAlarmKit+autolinking.rb} +4 -4
- package/nitrogen/generated/ios/{AlarmKit-Swift-Cxx-Bridge.cpp → RNAlarmKit-Swift-Cxx-Bridge.cpp} +10 -10
- package/nitrogen/generated/ios/{AlarmKit-Swift-Cxx-Bridge.hpp → RNAlarmKit-Swift-Cxx-Bridge.hpp} +2 -2
- package/nitrogen/generated/ios/{AlarmKit-Swift-Cxx-Umbrella.hpp → RNAlarmKit-Swift-Cxx-Umbrella.hpp} +9 -9
- package/nitrogen/generated/ios/{AlarmKitAutolinking.mm → RNAlarmKitAutolinking.mm} +5 -5
- package/nitrogen/generated/ios/{AlarmKitAutolinking.swift → RNAlarmKitAutolinking.swift} +2 -2
- package/nitrogen/generated/ios/c++/HybridAlarmKitSpecSwift.hpp +5 -5
- package/nitrogen/generated/ios/swift/HybridAlarmKitSpec_cxx.swift +1 -1
- package/package.json +1 -1
package/Alarmkit.podspec
CHANGED
|
@@ -11,6 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.module_name = "RNAlarmKit"
|
|
14
15
|
s.source = { :git => "https://github.com/raphckrman/react-native-alarmkit.git", :tag => "#{s.version}" }
|
|
15
16
|
|
|
16
17
|
|
|
@@ -28,7 +29,7 @@ Pod::Spec.new do |s|
|
|
|
28
29
|
s.dependency 'React-jsi'
|
|
29
30
|
s.dependency 'React-callinvoker'
|
|
30
31
|
|
|
31
|
-
load 'nitrogen/generated/ios/
|
|
32
|
+
load 'nitrogen/generated/ios/RNAlarmKit+autolinking.rb'
|
|
32
33
|
add_nitrogen_files(s)
|
|
33
34
|
|
|
34
35
|
install_modules_dependencies(s)
|
package/ios/AlarmKit.swift
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
#if canImport(AlarmKit)
|
|
1
2
|
import AlarmKit
|
|
3
|
+
#endif
|
|
2
4
|
import SwiftUI
|
|
3
5
|
import NitroModules
|
|
4
6
|
|
|
@@ -6,6 +8,7 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
6
8
|
@available(iOS 15.1, *)
|
|
7
9
|
public func requestAlarmPermission() throws -> NitroModules.Promise<Bool> {
|
|
8
10
|
return NitroModules.Promise.async {
|
|
11
|
+
#if canImport(AlarmKit)
|
|
9
12
|
if #available(iOS 26.0, *) {
|
|
10
13
|
let manager = AlarmManager.shared
|
|
11
14
|
let state: AlarmManager.AuthorizationState
|
|
@@ -16,22 +19,23 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
16
19
|
throw error
|
|
17
20
|
}
|
|
18
21
|
return state == .authorized
|
|
19
|
-
} else {
|
|
20
|
-
throw NSError(
|
|
21
|
-
domain: "AlarmKitError",
|
|
22
|
-
code: 1,
|
|
23
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
24
|
-
)
|
|
25
22
|
}
|
|
23
|
+
#endif
|
|
24
|
+
throw NSError(
|
|
25
|
+
domain: "AlarmKitError",
|
|
26
|
+
code: 1,
|
|
27
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
28
|
+
)
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
|
-
|
|
31
|
+
|
|
29
32
|
@available(iOS 15.1, *)
|
|
30
33
|
public func scheduleFixedAlarm(title: String, stopBtn: CustomizableAlarmButton, tintColor: String, secondaryBtn: CustomizableAlarmButton?, timestamp: Double?, countdown: AlarmCountdown?) throws -> NitroModules.Promise<String> {
|
|
31
34
|
return NitroModules.Promise.async {
|
|
35
|
+
#if canImport(AlarmKit)
|
|
32
36
|
if #available(iOS 26.0, *) {
|
|
33
37
|
let manager = AlarmManager.shared
|
|
34
|
-
|
|
38
|
+
|
|
35
39
|
let stopButton = AlarmButton(
|
|
36
40
|
text: LocalizedStringResource(stringLiteral: stopBtn.text),
|
|
37
41
|
textColor: Color(StringToColor(hex: stopBtn.textColor)),
|
|
@@ -45,7 +49,6 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
45
49
|
textColor: Color(StringToColor(hex: btn.textColor)),
|
|
46
50
|
systemImageName: btn.icon
|
|
47
51
|
)
|
|
48
|
-
|
|
49
52
|
alertPresentationAlert = AlarmPresentation.Alert(
|
|
50
53
|
title: LocalizedStringResource(stringLiteral: title),
|
|
51
54
|
stopButton: stopButton,
|
|
@@ -60,25 +63,24 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
let presentation = AlarmPresentation(alert: alertPresentationAlert)
|
|
63
|
-
let
|
|
64
|
-
|
|
66
|
+
let countdownDuration = Alarm.CountdownDuration(preAlert: countdown?.preAlert, postAlert: countdown?.postAlert)
|
|
67
|
+
|
|
65
68
|
nonisolated struct EmptyMetadata: AlarmMetadata {}
|
|
66
69
|
let attributes = AlarmAttributes<EmptyMetadata>(presentation: presentation, tintColor: Color(StringToColor(hex: tintColor)))
|
|
67
70
|
|
|
68
71
|
var schedule: Alarm.Schedule? = nil
|
|
69
|
-
|
|
70
72
|
if let timestamp = timestamp {
|
|
71
73
|
let date = Date(timeIntervalSince1970: timestamp)
|
|
72
74
|
schedule = Alarm.Schedule.fixed(date)
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
|
|
75
77
|
let configuration = AlarmManager.AlarmConfiguration(
|
|
76
|
-
countdownDuration:
|
|
78
|
+
countdownDuration: countdownDuration,
|
|
77
79
|
schedule: schedule,
|
|
78
80
|
attributes: attributes,
|
|
79
81
|
sound: .default
|
|
80
82
|
)
|
|
81
|
-
|
|
83
|
+
|
|
82
84
|
let uuid = UUID()
|
|
83
85
|
do {
|
|
84
86
|
_ = try await manager.schedule(id: uuid, configuration: configuration)
|
|
@@ -86,14 +88,13 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
86
88
|
} catch {
|
|
87
89
|
throw error
|
|
88
90
|
}
|
|
89
|
-
} else {
|
|
90
|
-
print("error")
|
|
91
|
-
throw NSError(
|
|
92
|
-
domain: "AlarmKitError",
|
|
93
|
-
code: 1,
|
|
94
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
95
|
-
)
|
|
96
91
|
}
|
|
92
|
+
#endif
|
|
93
|
+
throw NSError(
|
|
94
|
+
domain: "AlarmKitError",
|
|
95
|
+
code: 1,
|
|
96
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
97
|
+
)
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -109,6 +110,7 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
109
110
|
countdown: AlarmCountdown?
|
|
110
111
|
) throws -> NitroModules.Promise<String> {
|
|
111
112
|
return NitroModules.Promise.async {
|
|
113
|
+
#if canImport(AlarmKit)
|
|
112
114
|
if #available(iOS 26.0, *) {
|
|
113
115
|
let manager = AlarmManager.shared
|
|
114
116
|
|
|
@@ -117,7 +119,6 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
117
119
|
textColor: Color(StringToColor(hex: stopBtn.textColor)),
|
|
118
120
|
systemImageName: stopBtn.icon
|
|
119
121
|
)
|
|
120
|
-
|
|
121
122
|
let alertPresentationAlert: AlarmPresentation.Alert
|
|
122
123
|
|
|
123
124
|
if let btn = secondaryBtn {
|
|
@@ -126,7 +127,6 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
126
127
|
textColor: Color(StringToColor(hex: btn.textColor)),
|
|
127
128
|
systemImageName: btn.icon
|
|
128
129
|
)
|
|
129
|
-
|
|
130
130
|
alertPresentationAlert = AlarmPresentation.Alert(
|
|
131
131
|
title: LocalizedStringResource(stringLiteral: title),
|
|
132
132
|
stopButton: stopButton,
|
|
@@ -141,30 +141,29 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
let presentation = AlarmPresentation(alert: alertPresentationAlert)
|
|
144
|
-
let
|
|
144
|
+
let countdownDuration = Alarm.CountdownDuration(preAlert: countdown?.preAlert, postAlert: countdown?.postAlert)
|
|
145
145
|
|
|
146
146
|
nonisolated struct EmptyMetadata: AlarmMetadata {}
|
|
147
147
|
let attributes = AlarmAttributes<EmptyMetadata>(presentation: presentation, tintColor: Color(StringToColor(hex: tintColor)))
|
|
148
148
|
|
|
149
149
|
let time = Alarm.Schedule.Relative.Time(hour: Int(hour), minute: Int(minute))
|
|
150
|
-
|
|
151
150
|
let localeWeekdays: [Locale.Weekday] = repeats.map { alarmWeekday in
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
151
|
+
switch alarmWeekday {
|
|
152
|
+
case .monday: return .monday
|
|
153
|
+
case .tuesday: return .tuesday
|
|
154
|
+
case .wednesday: return .wednesday
|
|
155
|
+
case .thursday: return .thursday
|
|
156
|
+
case .friday: return .friday
|
|
157
|
+
case .saturday: return .saturday
|
|
158
|
+
case .sunday: return .sunday
|
|
159
|
+
}
|
|
161
160
|
}
|
|
162
161
|
let recurrence = Alarm.Schedule.Relative.Recurrence.weekly(localeWeekdays)
|
|
163
162
|
let relativeSchedule = Alarm.Schedule.Relative(time: time, repeats: recurrence)
|
|
164
163
|
let schedule = Alarm.Schedule.relative(relativeSchedule)
|
|
165
164
|
|
|
166
165
|
let configuration = AlarmManager.AlarmConfiguration(
|
|
167
|
-
countdownDuration:
|
|
166
|
+
countdownDuration: countdownDuration,
|
|
168
167
|
schedule: schedule,
|
|
169
168
|
attributes: attributes,
|
|
170
169
|
sound: .default
|
|
@@ -177,19 +176,20 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
177
176
|
} catch {
|
|
178
177
|
throw error
|
|
179
178
|
}
|
|
180
|
-
} else {
|
|
181
|
-
throw NSError(
|
|
182
|
-
domain: "AlarmKitError",
|
|
183
|
-
code: 1,
|
|
184
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
185
|
-
)
|
|
186
179
|
}
|
|
180
|
+
#endif
|
|
181
|
+
throw NSError(
|
|
182
|
+
domain: "AlarmKitError",
|
|
183
|
+
code: 1,
|
|
184
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
185
|
+
)
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
@available(iOS 15.1, *)
|
|
191
190
|
public func cancelAlarm(id: String) throws -> NitroModules.Promise<Bool> {
|
|
192
191
|
return NitroModules.Promise.async {
|
|
192
|
+
#if canImport(AlarmKit)
|
|
193
193
|
if #available(iOS 26.0, *) {
|
|
194
194
|
guard let uuid = UUID(uuidString: id) else {
|
|
195
195
|
throw NSError(
|
|
@@ -204,38 +204,40 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
204
204
|
} catch {
|
|
205
205
|
throw error
|
|
206
206
|
}
|
|
207
|
-
} else {
|
|
208
|
-
throw NSError(
|
|
209
|
-
domain: "AlarmKitError",
|
|
210
|
-
code: 1,
|
|
211
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
212
|
-
)
|
|
213
207
|
}
|
|
208
|
+
#endif
|
|
209
|
+
throw NSError(
|
|
210
|
+
domain: "AlarmKitError",
|
|
211
|
+
code: 1,
|
|
212
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
213
|
+
)
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
@available(iOS 15.1, *)
|
|
218
218
|
public func cancelAllAlarms() throws -> NitroModules.Promise<Bool> {
|
|
219
219
|
return NitroModules.Promise.async {
|
|
220
|
+
#if canImport(AlarmKit)
|
|
220
221
|
if #available(iOS 26.0, *) {
|
|
221
222
|
let alarms = await AlarmManager.shared.alarms
|
|
222
223
|
for alarm in alarms {
|
|
223
224
|
try await AlarmManager.shared.cancel(id: alarm.id)
|
|
224
225
|
}
|
|
225
226
|
return true
|
|
226
|
-
} else {
|
|
227
|
-
throw NSError(
|
|
228
|
-
domain: "AlarmKitError",
|
|
229
|
-
code: 1,
|
|
230
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
231
|
-
)
|
|
232
227
|
}
|
|
228
|
+
#endif
|
|
229
|
+
throw NSError(
|
|
230
|
+
domain: "AlarmKitError",
|
|
231
|
+
code: 1,
|
|
232
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
233
|
+
)
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
|
|
236
237
|
@available(iOS 15.1, *)
|
|
237
238
|
public func getAlarm(id: String) throws -> NitroModules.Promise<String?> {
|
|
238
239
|
return NitroModules.Promise.async {
|
|
240
|
+
#if canImport(AlarmKit)
|
|
239
241
|
if #available(iOS 26.0, *) {
|
|
240
242
|
guard let uuid = UUID(uuidString: id) else { return nil }
|
|
241
243
|
let alarms = await AlarmManager.shared.alarms
|
|
@@ -246,45 +248,46 @@ class AlarmKit: HybridAlarmKitSpec {
|
|
|
246
248
|
case .snoozed: return "snoozed"
|
|
247
249
|
default: return "unknown"
|
|
248
250
|
}
|
|
249
|
-
} else {
|
|
250
|
-
throw NSError(
|
|
251
|
-
domain: "AlarmKitError",
|
|
252
|
-
code: 1,
|
|
253
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
254
|
-
)
|
|
255
251
|
}
|
|
252
|
+
#endif
|
|
253
|
+
throw NSError(
|
|
254
|
+
domain: "AlarmKitError",
|
|
255
|
+
code: 1,
|
|
256
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
257
|
+
)
|
|
256
258
|
}
|
|
257
259
|
}
|
|
258
260
|
|
|
259
261
|
@available(iOS 15.1, *)
|
|
260
262
|
public func getAllAlarms() throws -> NitroModules.Promise<[String]> {
|
|
261
263
|
return NitroModules.Promise.async {
|
|
264
|
+
#if canImport(AlarmKit)
|
|
262
265
|
if #available(iOS 26.0, *) {
|
|
263
266
|
let alarms = await AlarmManager.shared.alarms
|
|
264
267
|
return alarms.map { $0.id.uuidString }
|
|
265
|
-
} else {
|
|
266
|
-
throw NSError(
|
|
267
|
-
domain: "AlarmKitError",
|
|
268
|
-
code: 1,
|
|
269
|
-
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
270
|
-
)
|
|
271
268
|
}
|
|
269
|
+
#endif
|
|
270
|
+
throw NSError(
|
|
271
|
+
domain: "AlarmKitError",
|
|
272
|
+
code: 1,
|
|
273
|
+
userInfo: [NSLocalizedDescriptionKey: "AlarmKit requires iOS 26.0 or later"]
|
|
274
|
+
)
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
}
|
|
275
278
|
|
|
276
|
-
func StringToColor
|
|
277
|
-
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
|
279
|
+
func StringToColor(hex: String) -> UIColor {
|
|
280
|
+
var cString: String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
|
278
281
|
|
|
279
|
-
if
|
|
282
|
+
if cString.hasPrefix("#") {
|
|
280
283
|
cString.remove(at: cString.startIndex)
|
|
281
284
|
}
|
|
282
285
|
|
|
283
|
-
if
|
|
286
|
+
if cString.count != 6 {
|
|
284
287
|
return UIColor.gray
|
|
285
288
|
}
|
|
286
289
|
|
|
287
|
-
var rgbValue:UInt64 = 0
|
|
290
|
+
var rgbValue: UInt64 = 0
|
|
288
291
|
Scanner(string: cString).scanHexInt64(&rgbValue)
|
|
289
292
|
|
|
290
293
|
return UIColor(
|
|
@@ -293,4 +296,4 @@ func StringToColor (hex:String) -> UIColor {
|
|
|
293
296
|
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
|
|
294
297
|
alpha: CGFloat(1.0)
|
|
295
298
|
)
|
|
296
|
-
}
|
|
299
|
+
}
|
package/nitro.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
#
|
|
2
|
+
# RNAlarmKit+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
5
|
# Copyright © 2026 Marc Rousavy @ Margelo
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
# # ...
|
|
15
15
|
#
|
|
16
16
|
# # Add all files generated by Nitrogen
|
|
17
|
-
# load 'nitrogen/generated/ios/
|
|
17
|
+
# load 'nitrogen/generated/ios/RNAlarmKit+autolinking.rb'
|
|
18
18
|
# add_nitrogen_files(spec)
|
|
19
19
|
# end
|
|
20
20
|
# ```
|
|
21
21
|
|
|
22
22
|
def add_nitrogen_files(spec)
|
|
23
|
-
Pod::UI.puts "[NitroModules] 🔥
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 RNAlarmKit is boosted by nitro!"
|
|
24
24
|
|
|
25
25
|
spec.dependency "NitroModules"
|
|
26
26
|
|
|
@@ -37,7 +37,7 @@ def add_nitrogen_files(spec)
|
|
|
37
37
|
# Generated specs
|
|
38
38
|
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
39
|
# Swift to C++ bridging helpers
|
|
40
|
-
"nitrogen/generated/ios/
|
|
40
|
+
"nitrogen/generated/ios/RNAlarmKit-Swift-Cxx-Bridge.hpp"
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
package/nitrogen/generated/ios/{AlarmKit-Swift-Cxx-Bridge.cpp → RNAlarmKit-Swift-Cxx-Bridge.cpp}
RENAMED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// RNAlarmKit-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "RNAlarmKit-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
|
-
#include "AlarmKit-Swift-Cxx-Umbrella.hpp"
|
|
12
11
|
#include "HybridAlarmKitSpecSwift.hpp"
|
|
12
|
+
#include "RNAlarmKit-Swift-Cxx-Umbrella.hpp"
|
|
13
13
|
|
|
14
14
|
namespace margelo::nitro::alarmkit::bridge::swift {
|
|
15
15
|
|
|
16
16
|
// pragma MARK: std::function<void(bool /* result */)>
|
|
17
17
|
Func_void_bool create_Func_void_bool(void* _Nonnull swiftClosureWrapper) {
|
|
18
|
-
auto swiftClosure =
|
|
18
|
+
auto swiftClosure = RNAlarmKit::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
19
19
|
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
20
20
|
swiftClosure.call(result);
|
|
21
21
|
};
|
|
@@ -23,7 +23,7 @@ namespace margelo::nitro::alarmkit::bridge::swift {
|
|
|
23
23
|
|
|
24
24
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
25
25
|
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* _Nonnull swiftClosureWrapper) {
|
|
26
|
-
auto swiftClosure =
|
|
26
|
+
auto swiftClosure = RNAlarmKit::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
27
27
|
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
28
28
|
swiftClosure.call(error);
|
|
29
29
|
};
|
|
@@ -31,7 +31,7 @@ namespace margelo::nitro::alarmkit::bridge::swift {
|
|
|
31
31
|
|
|
32
32
|
// pragma MARK: std::function<void(const std::string& /* result */)>
|
|
33
33
|
Func_void_std__string create_Func_void_std__string(void* _Nonnull swiftClosureWrapper) {
|
|
34
|
-
auto swiftClosure =
|
|
34
|
+
auto swiftClosure = RNAlarmKit::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
35
35
|
return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void {
|
|
36
36
|
swiftClosure.call(result);
|
|
37
37
|
};
|
|
@@ -39,7 +39,7 @@ namespace margelo::nitro::alarmkit::bridge::swift {
|
|
|
39
39
|
|
|
40
40
|
// pragma MARK: std::function<void(const std::optional<std::string>& /* result */)>
|
|
41
41
|
Func_void_std__optional_std__string_ create_Func_void_std__optional_std__string_(void* _Nonnull swiftClosureWrapper) {
|
|
42
|
-
auto swiftClosure =
|
|
42
|
+
auto swiftClosure = RNAlarmKit::Func_void_std__optional_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
43
43
|
return [swiftClosure = std::move(swiftClosure)](const std::optional<std::string>& result) mutable -> void {
|
|
44
44
|
swiftClosure.call(result);
|
|
45
45
|
};
|
|
@@ -47,7 +47,7 @@ namespace margelo::nitro::alarmkit::bridge::swift {
|
|
|
47
47
|
|
|
48
48
|
// pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
|
|
49
49
|
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* _Nonnull swiftClosureWrapper) {
|
|
50
|
-
auto swiftClosure =
|
|
50
|
+
auto swiftClosure = RNAlarmKit::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
51
51
|
return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& result) mutable -> void {
|
|
52
52
|
swiftClosure.call(result);
|
|
53
53
|
};
|
|
@@ -55,7 +55,7 @@ namespace margelo::nitro::alarmkit::bridge::swift {
|
|
|
55
55
|
|
|
56
56
|
// pragma MARK: std::shared_ptr<margelo::nitro::alarmkit::HybridAlarmKitSpec>
|
|
57
57
|
std::shared_ptr<margelo::nitro::alarmkit::HybridAlarmKitSpec> create_std__shared_ptr_margelo__nitro__alarmkit__HybridAlarmKitSpec_(void* _Nonnull swiftUnsafePointer) {
|
|
58
|
-
|
|
58
|
+
RNAlarmKit::HybridAlarmKitSpec_cxx swiftPart = RNAlarmKit::HybridAlarmKitSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
59
59
|
return std::make_shared<margelo::nitro::alarmkit::HybridAlarmKitSpecSwift>(swiftPart);
|
|
60
60
|
}
|
|
61
61
|
void* _Nonnull get_std__shared_ptr_margelo__nitro__alarmkit__HybridAlarmKitSpec_(std__shared_ptr_margelo__nitro__alarmkit__HybridAlarmKitSpec_ cppType) {
|
|
@@ -65,7 +65,7 @@ namespace margelo::nitro::alarmkit::bridge::swift {
|
|
|
65
65
|
throw std::runtime_error("Class \"HybridAlarmKitSpec\" is not implemented in Swift!");
|
|
66
66
|
}
|
|
67
67
|
#endif
|
|
68
|
-
|
|
68
|
+
RNAlarmKit::HybridAlarmKitSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
69
69
|
return swiftPart.toUnsafe();
|
|
70
70
|
}
|
|
71
71
|
|
package/nitrogen/generated/ios/{AlarmKit-Swift-Cxx-Bridge.hpp → RNAlarmKit-Swift-Cxx-Bridge.hpp}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// RNAlarmKit-Swift-Cxx-Bridge.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
@@ -19,7 +19,7 @@ namespace margelo::nitro::alarmkit { class HybridAlarmKitSpec; }
|
|
|
19
19
|
|
|
20
20
|
// Forward declarations of Swift defined types
|
|
21
21
|
// Forward declaration of `HybridAlarmKitSpec_cxx` to properly resolve imports.
|
|
22
|
-
namespace
|
|
22
|
+
namespace RNAlarmKit { class HybridAlarmKitSpec_cxx; }
|
|
23
23
|
|
|
24
24
|
// Include C++ defined types
|
|
25
25
|
#include "AlarmCountdown.hpp"
|
package/nitrogen/generated/ios/{AlarmKit-Swift-Cxx-Umbrella.hpp → RNAlarmKit-Swift-Cxx-Umbrella.hpp}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// RNAlarmKit-Swift-Cxx-Umbrella.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
@@ -31,7 +31,7 @@ namespace margelo::nitro::alarmkit { class HybridAlarmKitSpec; }
|
|
|
31
31
|
#include <vector>
|
|
32
32
|
|
|
33
33
|
// C++ helpers for Swift
|
|
34
|
-
#include "
|
|
34
|
+
#include "RNAlarmKit-Swift-Cxx-Bridge.hpp"
|
|
35
35
|
|
|
36
36
|
// Common C++ types used in Swift
|
|
37
37
|
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
@@ -41,16 +41,16 @@ namespace margelo::nitro::alarmkit { class HybridAlarmKitSpec; }
|
|
|
41
41
|
|
|
42
42
|
// Forward declarations of Swift defined types
|
|
43
43
|
// Forward declaration of `HybridAlarmKitSpec_cxx` to properly resolve imports.
|
|
44
|
-
namespace
|
|
44
|
+
namespace RNAlarmKit { class HybridAlarmKitSpec_cxx; }
|
|
45
45
|
|
|
46
46
|
// Include Swift defined types
|
|
47
|
-
#if __has_include("
|
|
47
|
+
#if __has_include("RNAlarmKit-Swift.h")
|
|
48
48
|
// This header is generated by Xcode/Swift on every app build.
|
|
49
|
-
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "
|
|
50
|
-
#include "
|
|
49
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "RNAlarmKit".
|
|
50
|
+
#include "RNAlarmKit-Swift.h"
|
|
51
51
|
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
52
|
-
#elif __has_include(<
|
|
53
|
-
#include <
|
|
52
|
+
#elif __has_include(<RNAlarmKit/RNAlarmKit-Swift.h>)
|
|
53
|
+
#include <RNAlarmKit/RNAlarmKit-Swift.h>
|
|
54
54
|
#else
|
|
55
|
-
#error
|
|
55
|
+
#error RNAlarmKit's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "RNAlarmKit", and try building the app first.
|
|
56
56
|
#endif
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// RNAlarmKitAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
9
|
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
-
#import "
|
|
10
|
+
#import "RNAlarmKit-Swift-Cxx-Umbrella.hpp"
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
13
|
#include "HybridAlarmKitSpecSwift.hpp"
|
|
14
14
|
|
|
15
|
-
@interface
|
|
15
|
+
@interface RNAlarmKitAutolinking : NSObject
|
|
16
16
|
@end
|
|
17
17
|
|
|
18
|
-
@implementation
|
|
18
|
+
@implementation RNAlarmKitAutolinking
|
|
19
19
|
|
|
20
20
|
+ (void) load {
|
|
21
21
|
using namespace margelo::nitro;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
25
|
"AlarmKit",
|
|
26
26
|
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
-
std::shared_ptr<margelo::nitro::alarmkit::HybridAlarmKitSpec> hybridObject =
|
|
27
|
+
std::shared_ptr<margelo::nitro::alarmkit::HybridAlarmKitSpec> hybridObject = RNAlarmKit::RNAlarmKitAutolinking::createAlarmKit();
|
|
28
28
|
return hybridObject;
|
|
29
29
|
}
|
|
30
30
|
);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// RNAlarmKitAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
public final class
|
|
8
|
+
public final class RNAlarmKitAutolinking {
|
|
9
9
|
public typealias bridge = margelo.nitro.alarmkit.bridge.swift
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "HybridAlarmKitSpec.hpp"
|
|
11
11
|
|
|
12
12
|
// Forward declaration of `HybridAlarmKitSpec_cxx` to properly resolve imports.
|
|
13
|
-
namespace
|
|
13
|
+
namespace RNAlarmKit { class HybridAlarmKitSpec_cxx; }
|
|
14
14
|
|
|
15
15
|
// Forward declaration of `CustomizableAlarmButton` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::alarmkit { struct CustomizableAlarmButton; }
|
|
@@ -27,7 +27,7 @@ namespace margelo::nitro::alarmkit { enum class AlarmWeekday; }
|
|
|
27
27
|
#include <vector>
|
|
28
28
|
#include "AlarmWeekday.hpp"
|
|
29
29
|
|
|
30
|
-
#include "
|
|
30
|
+
#include "RNAlarmKit-Swift-Cxx-Umbrella.hpp"
|
|
31
31
|
|
|
32
32
|
namespace margelo::nitro::alarmkit {
|
|
33
33
|
|
|
@@ -44,13 +44,13 @@ namespace margelo::nitro::alarmkit {
|
|
|
44
44
|
class HybridAlarmKitSpecSwift: public virtual HybridAlarmKitSpec {
|
|
45
45
|
public:
|
|
46
46
|
// Constructor from a Swift instance
|
|
47
|
-
explicit HybridAlarmKitSpecSwift(const
|
|
47
|
+
explicit HybridAlarmKitSpecSwift(const RNAlarmKit::HybridAlarmKitSpec_cxx& swiftPart):
|
|
48
48
|
HybridObject(HybridAlarmKitSpec::TAG),
|
|
49
49
|
_swiftPart(swiftPart) { }
|
|
50
50
|
|
|
51
51
|
public:
|
|
52
52
|
// Get the Swift part
|
|
53
|
-
inline
|
|
53
|
+
inline RNAlarmKit::HybridAlarmKitSpec_cxx& getSwiftPart() noexcept {
|
|
54
54
|
return _swiftPart;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -124,7 +124,7 @@ namespace margelo::nitro::alarmkit {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
private:
|
|
127
|
-
|
|
127
|
+
RNAlarmKit::HybridAlarmKitSpec_cxx _swiftPart;
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
} // namespace margelo::nitro::alarmkit
|
|
@@ -20,7 +20,7 @@ import NitroModules
|
|
|
20
20
|
public class HybridAlarmKitSpec_cxx {
|
|
21
21
|
/**
|
|
22
22
|
* The Swift <> C++ bridge's namespace (`margelo::nitro::alarmkit::bridge::swift`)
|
|
23
|
-
* from `
|
|
23
|
+
* from `RNAlarmKit-Swift-Cxx-Bridge.hpp`.
|
|
24
24
|
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
25
|
*/
|
|
26
26
|
public typealias bridge = margelo.nitro.alarmkit.bridge.swift
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zulfio/react-native-alarm-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "This library provides a simple and modern interface for working with alarms in your React Native app using Apple’s latest AlarmKit framework.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|