react-native-nitro-ali-push 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +215 -2
- package/android/CMakeLists.txt +31 -0
- package/android/build.gradle +139 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/com/margelo/nitro/alipush/AliPushMessageReceiver.kt +156 -0
- package/android/src/main/java/com/margelo/nitro/alipush/HybridAliPushPlugin.kt +303 -0
- package/android/src/main/java/com/margelo/nitro/alipush/ThirdPartMessageActivity.kt +26 -0
- package/ios/HybridAliPushPlugin.swift +516 -0
- package/lib/index.d.ts +195 -0
- package/lib/index.js +269 -0
- package/lib/specs/AliPushPlugin.nitro.d.ts +88 -0
- package/lib/specs/AliPushPlugin.nitro.js +2 -0
- package/lib/types.d.ts +111 -0
- package/lib/types.js +11 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroAliPush+autolinking.cmake +84 -0
- package/nitrogen/generated/android/NitroAliPush+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroAliPushOnLoad.cpp +58 -0
- package/nitrogen/generated/android/NitroAliPushOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JAliPushAppState.hpp +61 -0
- package/nitrogen/generated/android/c++/JAliPushMessage.hpp +98 -0
- package/nitrogen/generated/android/c++/JAliPushMessageType.hpp +58 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_AliPushMessage.hpp +87 -0
- package/nitrogen/generated/android/c++/JHybridAliPushPluginSpec.cpp +338 -0
- package/nitrogen/generated/android/c++/JHybridAliPushPluginSpec.hpp +78 -0
- package/nitrogen/generated/android/c++/JVariant_Double_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Double_String.hpp +68 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AliPushMessage.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AliPushMessage.hpp +80 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/AliPushAppState.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/AliPushMessage.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/AliPushMessageType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Func_void.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Func_void_AliPushMessage.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/HybridAliPushPluginSpec.kt +123 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/NitroAliPushOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_Double_String.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_NullType_AliPushMessage.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_NullType_String.kt +62 -0
- package/nitrogen/generated/ios/NitroAliPush+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Bridge.cpp +89 -0
- package/nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Bridge.hpp +531 -0
- package/nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Umbrella.hpp +60 -0
- package/nitrogen/generated/ios/NitroAliPushAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroAliPushAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridAliPushPluginSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAliPushPluginSpecSwift.hpp +217 -0
- package/nitrogen/generated/ios/swift/AliPushAppState.swift +44 -0
- package/nitrogen/generated/ios/swift/AliPushMessage.swift +191 -0
- package/nitrogen/generated/ios/swift/AliPushMessageType.swift +40 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_AliPushMessage.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__AliPushMessage_.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridAliPushPluginSpec.swift +70 -0
- package/nitrogen/generated/ios/swift/HybridAliPushPluginSpec_cxx.swift +476 -0
- package/nitrogen/generated/ios/swift/Variant_Double_String.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_AliPushMessage.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_String.swift +30 -0
- package/nitrogen/generated/shared/c++/AliPushAppState.hpp +80 -0
- package/nitrogen/generated/shared/c++/AliPushMessage.hpp +123 -0
- package/nitrogen/generated/shared/c++/AliPushMessageType.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridAliPushPluginSpec.cpp +36 -0
- package/nitrogen/generated/shared/c++/HybridAliPushPluginSpec.hpp +85 -0
- package/package.json +61 -4
- package/react-native-nitro-ali-push.podspec +29 -0
- package/src/index.ts +284 -0
- package/src/specs/AliPushPlugin.nitro.ts +104 -0
- package/src/types.ts +117 -0
package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_NullType_String.kt
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_String.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.alipush
|
|
9
|
+
|
|
10
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
11
|
+
import com.margelo.nitro.core.NullType
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the TypeScript variant "NullType | String".
|
|
15
|
+
*/
|
|
16
|
+
@Suppress("ClassName")
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
sealed class Variant_NullType_String {
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
data class First(@DoNotStrip val value: NullType): Variant_NullType_String()
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
data class Second(@DoNotStrip val value: String): Variant_NullType_String()
|
|
23
|
+
|
|
24
|
+
inline fun <reified T> asType(): T? {
|
|
25
|
+
return when (this) {
|
|
26
|
+
is First -> (value) as? T
|
|
27
|
+
is Second -> (value) as? T
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
inline fun <reified T> isType(): Boolean {
|
|
31
|
+
return asType<T>() != null
|
|
32
|
+
}
|
|
33
|
+
inline fun <R> match(first: (NullType) -> R, second: (String) -> R): R {
|
|
34
|
+
return when (this) {
|
|
35
|
+
is First -> first(value)
|
|
36
|
+
is Second -> second(value)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
val isFirst: Boolean
|
|
41
|
+
get() = this is First
|
|
42
|
+
val isSecond: Boolean
|
|
43
|
+
get() = this is Second
|
|
44
|
+
|
|
45
|
+
fun asFirstOrNull(): NullType? {
|
|
46
|
+
val value = (this as? First)?.value ?: return null
|
|
47
|
+
return value
|
|
48
|
+
}
|
|
49
|
+
fun asSecondOrNull(): String? {
|
|
50
|
+
val value = (this as? Second)?.value ?: return null
|
|
51
|
+
return value
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
@JvmStatic
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
fun create(value: NullType): Variant_NullType_String = First(value)
|
|
58
|
+
@JvmStatic
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
fun create(value: String): Variant_NullType_String = Second(value)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroAliPush+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroAliPush+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroAliPush is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroAliPush-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "NitroAliPush-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridAliPushPluginSpecSwift.hpp"
|
|
12
|
+
#include "NitroAliPush-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::alipush::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void()>
|
|
18
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NitroAliPush::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
21
|
+
swiftClosure.call();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = NitroAliPush::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<void(const std::string& /* result */)>
|
|
34
|
+
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = NitroAliPush::Func_void_std__string::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)](const std::string& result) mutable -> void {
|
|
37
|
+
swiftClosure.call(result);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::function<void(double /* result */)>
|
|
42
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
43
|
+
auto swiftClosure = NitroAliPush::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
44
|
+
return [swiftClosure = std::move(swiftClosure)](double result) mutable -> void {
|
|
45
|
+
swiftClosure.call(result);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::function<void(const std::variant<nitro::NullType, AliPushMessage>& /* result */)>
|
|
50
|
+
Func_void_std__variant_nitro__NullType__AliPushMessage_ create_Func_void_std__variant_nitro__NullType__AliPushMessage_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
51
|
+
auto swiftClosure = NitroAliPush::Func_void_std__variant_nitro__NullType__AliPushMessage_::fromUnsafe(swiftClosureWrapper);
|
|
52
|
+
return [swiftClosure = std::move(swiftClosure)](const std::variant<nitro::NullType, AliPushMessage>& result) mutable -> void {
|
|
53
|
+
swiftClosure.call(result);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
58
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
59
|
+
auto swiftClosure = NitroAliPush::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
60
|
+
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
61
|
+
swiftClosure.call(result);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// pragma MARK: std::function<void(const AliPushMessage& /* message */)>
|
|
66
|
+
Func_void_AliPushMessage create_Func_void_AliPushMessage(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
67
|
+
auto swiftClosure = NitroAliPush::Func_void_AliPushMessage::fromUnsafe(swiftClosureWrapper);
|
|
68
|
+
return [swiftClosure = std::move(swiftClosure)](const AliPushMessage& message) mutable -> void {
|
|
69
|
+
swiftClosure.call(message);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// pragma MARK: std::shared_ptr<HybridAliPushPluginSpec>
|
|
74
|
+
std::shared_ptr<HybridAliPushPluginSpec> create_std__shared_ptr_HybridAliPushPluginSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
75
|
+
NitroAliPush::HybridAliPushPluginSpec_cxx swiftPart = NitroAliPush::HybridAliPushPluginSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
76
|
+
return std::make_shared<margelo::nitro::alipush::HybridAliPushPluginSpecSwift>(swiftPart);
|
|
77
|
+
}
|
|
78
|
+
void* NON_NULL get_std__shared_ptr_HybridAliPushPluginSpec_(std__shared_ptr_HybridAliPushPluginSpec_ cppType) {
|
|
79
|
+
std::shared_ptr<margelo::nitro::alipush::HybridAliPushPluginSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::alipush::HybridAliPushPluginSpecSwift>(cppType);
|
|
80
|
+
#ifdef NITRO_DEBUG
|
|
81
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
82
|
+
throw std::runtime_error("Class \"HybridAliPushPluginSpec\" is not implemented in Swift!");
|
|
83
|
+
}
|
|
84
|
+
#endif
|
|
85
|
+
NitroAliPush::HybridAliPushPluginSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
86
|
+
return swiftPart.toUnsafe();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
} // namespace margelo::nitro::alipush::bridge::swift
|