@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.
Files changed (62) hide show
  1. package/Alarmkit.podspec +35 -0
  2. package/LICENSE +20 -0
  3. package/README.md +163 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +129 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/alarmkit/AlarmkitPackage.kt +22 -0
  10. package/android/src/main/java/com/margelo/nitro/alarmkit/Alarmkit.kt +7 -0
  11. package/ios/AlarmKit.swift +296 -0
  12. package/lib/module/AlarmKit.nitro.js +4 -0
  13. package/lib/module/AlarmKit.nitro.js.map +1 -0
  14. package/lib/module/index.js +40 -0
  15. package/lib/module/index.js.map +1 -0
  16. package/lib/module/package.json +1 -0
  17. package/lib/typescript/package.json +1 -0
  18. package/lib/typescript/src/AlarmKit.nitro.d.ts +24 -0
  19. package/lib/typescript/src/AlarmKit.nitro.d.ts.map +1 -0
  20. package/lib/typescript/src/index.d.ts +11 -0
  21. package/lib/typescript/src/index.d.ts.map +1 -0
  22. package/nitro.json +17 -0
  23. package/nitrogen/generated/android/alarmkit+autolinking.cmake +78 -0
  24. package/nitrogen/generated/android/alarmkit+autolinking.gradle +27 -0
  25. package/nitrogen/generated/android/alarmkitOnLoad.cpp +46 -0
  26. package/nitrogen/generated/android/alarmkitOnLoad.hpp +25 -0
  27. package/nitrogen/generated/android/c++/JAlarmCountdown.hpp +57 -0
  28. package/nitrogen/generated/android/c++/JAlarmWeekday.hpp +74 -0
  29. package/nitrogen/generated/android/c++/JCustomizableAlarmButton.hpp +61 -0
  30. package/nitrogen/generated/android/c++/JHybridAlarmKitSpec.cpp +180 -0
  31. package/nitrogen/generated/android/c++/JHybridAlarmKitSpec.hpp +68 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/AlarmCountdown.kt +27 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/AlarmWeekday.kt +30 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/CustomizableAlarmButton.kt +28 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/HybridAlarmKitSpec.kt +76 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/alarmkit/alarmkitOnLoad.kt +35 -0
  37. package/nitrogen/generated/ios/AlarmKit+autolinking.rb +60 -0
  38. package/nitrogen/generated/ios/AlarmKit-Swift-Cxx-Bridge.cpp +72 -0
  39. package/nitrogen/generated/ios/AlarmKit-Swift-Cxx-Bridge.hpp +309 -0
  40. package/nitrogen/generated/ios/AlarmKit-Swift-Cxx-Umbrella.hpp +56 -0
  41. package/nitrogen/generated/ios/AlarmKitAutolinking.mm +33 -0
  42. package/nitrogen/generated/ios/AlarmKitAutolinking.swift +25 -0
  43. package/nitrogen/generated/ios/c++/HybridAlarmKitSpecSwift.cpp +11 -0
  44. package/nitrogen/generated/ios/c++/HybridAlarmKitSpecSwift.hpp +130 -0
  45. package/nitrogen/generated/ios/swift/AlarmCountdown.swift +70 -0
  46. package/nitrogen/generated/ios/swift/AlarmWeekday.swift +60 -0
  47. package/nitrogen/generated/ios/swift/CustomizableAlarmButton.swift +57 -0
  48. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  49. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  50. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +52 -0
  51. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  52. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +46 -0
  53. package/nitrogen/generated/ios/swift/HybridAlarmKitSpec.swift +54 -0
  54. package/nitrogen/generated/ios/swift/HybridAlarmKitSpec_cxx.swift +271 -0
  55. package/nitrogen/generated/shared/c++/AlarmCountdown.hpp +73 -0
  56. package/nitrogen/generated/shared/c++/AlarmWeekday.hpp +98 -0
  57. package/nitrogen/generated/shared/c++/CustomizableAlarmButton.hpp +77 -0
  58. package/nitrogen/generated/shared/c++/HybridAlarmKitSpec.cpp +27 -0
  59. package/nitrogen/generated/shared/c++/HybridAlarmKitSpec.hpp +79 -0
  60. package/package.json +168 -0
  61. package/src/AlarmKit.nitro.ts +48 -0
  62. package/src/index.tsx +96 -0
@@ -0,0 +1,70 @@
1
+ ///
2
+ /// AlarmCountdown.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `AlarmCountdown`, backed by a C++ struct.
12
+ */
13
+ public typealias AlarmCountdown = margelo.nitro.alarmkit.AlarmCountdown
14
+
15
+ public extension AlarmCountdown {
16
+ private typealias bridge = margelo.nitro.alarmkit.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `AlarmCountdown`.
20
+ */
21
+ init(preAlert: Double?, postAlert: Double?) {
22
+ self.init({ () -> bridge.std__optional_double_ in
23
+ if let __unwrappedValue = preAlert {
24
+ return bridge.create_std__optional_double_(__unwrappedValue)
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_double_ in
29
+ if let __unwrappedValue = postAlert {
30
+ return bridge.create_std__optional_double_(__unwrappedValue)
31
+ } else {
32
+ return .init()
33
+ }
34
+ }())
35
+ }
36
+
37
+ var preAlert: Double? {
38
+ @inline(__always)
39
+ get {
40
+ return self.__preAlert.value
41
+ }
42
+ @inline(__always)
43
+ set {
44
+ self.__preAlert = { () -> bridge.std__optional_double_ in
45
+ if let __unwrappedValue = newValue {
46
+ return bridge.create_std__optional_double_(__unwrappedValue)
47
+ } else {
48
+ return .init()
49
+ }
50
+ }()
51
+ }
52
+ }
53
+
54
+ var postAlert: Double? {
55
+ @inline(__always)
56
+ get {
57
+ return self.__postAlert.value
58
+ }
59
+ @inline(__always)
60
+ set {
61
+ self.__postAlert = { () -> bridge.std__optional_double_ in
62
+ if let __unwrappedValue = newValue {
63
+ return bridge.create_std__optional_double_(__unwrappedValue)
64
+ } else {
65
+ return .init()
66
+ }
67
+ }()
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,60 @@
1
+ ///
2
+ /// AlarmWeekday.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /**
9
+ * Represents the JS union `AlarmWeekday`, backed by a C++ enum.
10
+ */
11
+ public typealias AlarmWeekday = margelo.nitro.alarmkit.AlarmWeekday
12
+
13
+ public extension AlarmWeekday {
14
+ /**
15
+ * Get a AlarmWeekday for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "monday":
21
+ self = .monday
22
+ case "tuesday":
23
+ self = .tuesday
24
+ case "wednesday":
25
+ self = .wednesday
26
+ case "thursday":
27
+ self = .thursday
28
+ case "friday":
29
+ self = .friday
30
+ case "saturday":
31
+ self = .saturday
32
+ case "sunday":
33
+ self = .sunday
34
+ default:
35
+ return nil
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Get the String value this AlarmWeekday represents.
41
+ */
42
+ var stringValue: String {
43
+ switch self {
44
+ case .monday:
45
+ return "monday"
46
+ case .tuesday:
47
+ return "tuesday"
48
+ case .wednesday:
49
+ return "wednesday"
50
+ case .thursday:
51
+ return "thursday"
52
+ case .friday:
53
+ return "friday"
54
+ case .saturday:
55
+ return "saturday"
56
+ case .sunday:
57
+ return "sunday"
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,57 @@
1
+ ///
2
+ /// CustomizableAlarmButton.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `CustomizableAlarmButton`, backed by a C++ struct.
12
+ */
13
+ public typealias CustomizableAlarmButton = margelo.nitro.alarmkit.CustomizableAlarmButton
14
+
15
+ public extension CustomizableAlarmButton {
16
+ private typealias bridge = margelo.nitro.alarmkit.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `CustomizableAlarmButton`.
20
+ */
21
+ init(text: String, textColor: String, icon: String) {
22
+ self.init(std.string(text), std.string(textColor), std.string(icon))
23
+ }
24
+
25
+ var text: String {
26
+ @inline(__always)
27
+ get {
28
+ return String(self.__text)
29
+ }
30
+ @inline(__always)
31
+ set {
32
+ self.__text = std.string(newValue)
33
+ }
34
+ }
35
+
36
+ var textColor: String {
37
+ @inline(__always)
38
+ get {
39
+ return String(self.__textColor)
40
+ }
41
+ @inline(__always)
42
+ set {
43
+ self.__textColor = std.string(newValue)
44
+ }
45
+ }
46
+
47
+ var icon: String {
48
+ @inline(__always)
49
+ get {
50
+ return String(self.__icon)
51
+ }
52
+ @inline(__always)
53
+ set {
54
+ self.__icon = std.string(newValue)
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_bool.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: Bool) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_bool {
15
+ public typealias bridge = margelo.nitro.alarmkit.bridge.swift
16
+
17
+ private let closure: (_ value: Bool) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: Bool) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: Bool) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_bool`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
44
+ return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_std__exception_ptr.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ error: Error) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__exception_ptr {
15
+ public typealias bridge = margelo.nitro.alarmkit.bridge.swift
16
+
17
+ private let closure: (_ error: Error) -> Void
18
+
19
+ public init(_ closure: @escaping (_ error: Error) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(error: std.exception_ptr) -> Void {
25
+ self.closure(RuntimeError.from(cppError: error))
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
44
+ return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,52 @@
1
+ ///
2
+ /// Func_void_std__optional_std__string_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: String?) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__optional_std__string_ {
15
+ public typealias bridge = margelo.nitro.alarmkit.bridge.swift
16
+
17
+ private let closure: (_ value: String?) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: String?) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: bridge.std__optional_std__string_) -> Void {
25
+ self.closure({ () -> String? in
26
+ if let __unwrapped = value.value {
27
+ return String(__unwrapped)
28
+ } else {
29
+ return nil
30
+ }
31
+ }())
32
+ }
33
+
34
+ /**
35
+ * Casts this instance to a retained unsafe raw pointer.
36
+ * This acquires one additional strong reference on the object!
37
+ */
38
+ @inline(__always)
39
+ public func toUnsafe() -> UnsafeMutableRawPointer {
40
+ return Unmanaged.passRetained(self).toOpaque()
41
+ }
42
+
43
+ /**
44
+ * Casts an unsafe pointer to a `Func_void_std__optional_std__string_`.
45
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__optional_std__string_>`.
46
+ * This removes one strong reference from the object!
47
+ */
48
+ @inline(__always)
49
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__optional_std__string_ {
50
+ return Unmanaged<Func_void_std__optional_std__string_>.fromOpaque(pointer).takeRetainedValue()
51
+ }
52
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_std__string.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: String) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__string {
15
+ public typealias bridge = margelo.nitro.alarmkit.bridge.swift
16
+
17
+ private let closure: (_ value: String) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: String) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: std.string) -> Void {
25
+ self.closure(String(value))
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_std__string`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
44
+ return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_std__vector_std__string_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: [String]) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__vector_std__string_ {
15
+ public typealias bridge = margelo.nitro.alarmkit.bridge.swift
16
+
17
+ private let closure: (_ value: [String]) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: [String]) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: bridge.std__vector_std__string_) -> Void {
25
+ self.closure(value.map({ __item in String(__item) }))
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_std__vector_std__string_`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_std__string_>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_std__string_ {
44
+ return Unmanaged<Func_void_std__vector_std__string_>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// HybridAlarmKitSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridAlarmKitSpec``
12
+ public protocol HybridAlarmKitSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func requestAlarmPermission() throws -> Promise<Bool>
18
+ func scheduleFixedAlarm(title: String, stopBtn: CustomizableAlarmButton, tintColor: String, secondaryBtn: CustomizableAlarmButton?, timestamp: Double?, countdown: AlarmCountdown?) throws -> Promise<String>
19
+ func scheduleRelativeAlarm(title: String, stopBtn: CustomizableAlarmButton, tintColor: String, hour: Double, minute: Double, repeats: [AlarmWeekday], secondaryBtn: CustomizableAlarmButton?, countdown: AlarmCountdown?) throws -> Promise<String>
20
+ func cancelAlarm(id: String) throws -> Promise<Bool>
21
+ func cancelAllAlarms() throws -> Promise<Bool>
22
+ func getAlarm(id: String) throws -> Promise<String?>
23
+ func getAllAlarms() throws -> Promise<[String]>
24
+ }
25
+
26
+ /// See ``HybridAlarmKitSpec``
27
+ public class HybridAlarmKitSpec_base {
28
+ private weak var cxxWrapper: HybridAlarmKitSpec_cxx? = nil
29
+ public func getCxxWrapper() -> HybridAlarmKitSpec_cxx {
30
+ #if DEBUG
31
+ guard self is HybridAlarmKitSpec else {
32
+ fatalError("`self` is not a `HybridAlarmKitSpec`! Did you accidentally inherit from `HybridAlarmKitSpec_base` instead of `HybridAlarmKitSpec`?")
33
+ }
34
+ #endif
35
+ if let cxxWrapper = self.cxxWrapper {
36
+ return cxxWrapper
37
+ } else {
38
+ let cxxWrapper = HybridAlarmKitSpec_cxx(self as! HybridAlarmKitSpec)
39
+ self.cxxWrapper = cxxWrapper
40
+ return cxxWrapper
41
+ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * A Swift base-protocol representing the AlarmKit HybridObject.
47
+ * Implement this protocol to create Swift-based instances of AlarmKit.
48
+ * ```swift
49
+ * class HybridAlarmKit : HybridAlarmKitSpec {
50
+ * // ...
51
+ * }
52
+ * ```
53
+ */
54
+ public typealias HybridAlarmKitSpec = HybridAlarmKitSpec_protocol & HybridAlarmKitSpec_base