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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_String.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <variant>
|
|
12
|
+
|
|
13
|
+
#include <NitroModules/Null.hpp>
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <variant>
|
|
16
|
+
#include <NitroModules/JNull.hpp>
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::alipush {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_String".
|
|
24
|
+
*/
|
|
25
|
+
class JVariant_NullType_String: public jni::JavaClass<JVariant_NullType_String> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/alipush/Variant_NullType_String;";
|
|
28
|
+
|
|
29
|
+
static jni::local_ref<JVariant_NullType_String> create_0(jni::alias_ref<JNull> value) {
|
|
30
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_String(jni::alias_ref<JNull>)>("create");
|
|
31
|
+
return method(javaClassStatic(), value);
|
|
32
|
+
}
|
|
33
|
+
static jni::local_ref<JVariant_NullType_String> create_1(jni::alias_ref<jni::JString> value) {
|
|
34
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_String(jni::alias_ref<jni::JString>)>("create");
|
|
35
|
+
return method(javaClassStatic(), value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static jni::local_ref<JVariant_NullType_String> fromCpp(const std::variant<nitro::NullType, std::string>& variant) {
|
|
39
|
+
switch (variant.index()) {
|
|
40
|
+
case 0: return create_0(JNull::null());
|
|
41
|
+
case 1: return create_1(jni::make_jstring(std::get<1>(variant)));
|
|
42
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[[nodiscard]] std::variant<nitro::NullType, std::string> toCpp() const;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
namespace JVariant_NullType_String_impl {
|
|
50
|
+
class First final: public jni::JavaClass<First, JVariant_NullType_String> {
|
|
51
|
+
public:
|
|
52
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/alipush/Variant_NullType_String$First;";
|
|
53
|
+
|
|
54
|
+
[[nodiscard]] jni::local_ref<JNull> getValue() const {
|
|
55
|
+
static const auto field = javaClassStatic()->getField<JNull>("value");
|
|
56
|
+
return getFieldValue(field);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
class Second final: public jni::JavaClass<Second, JVariant_NullType_String> {
|
|
61
|
+
public:
|
|
62
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/alipush/Variant_NullType_String$Second;";
|
|
63
|
+
|
|
64
|
+
[[nodiscard]] jni::local_ref<jni::JString> getValue() const {
|
|
65
|
+
static const auto field = javaClassStatic()->getField<jni::JString>("value");
|
|
66
|
+
return getFieldValue(field);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
} // namespace JVariant_NullType_String_impl
|
|
70
|
+
} // namespace margelo::nitro::alipush
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AliPushAppState.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 androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "AliPushAppState".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class AliPushAppState(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
ACTIVE(0),
|
|
20
|
+
INACTIVE(1),
|
|
21
|
+
BACKGROUND(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AliPushMessage.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 androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
import com.margelo.nitro.core.AnyMap
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "AliPushMessage".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class AliPushMessage(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val title: String?,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val subtitle: String?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val body: String?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val badge: Double?,
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
val extras: AnyMap?,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
val type: AliPushMessageType?,
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
val actionIdentifier: String?,
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
val appState: AliPushAppState?,
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
val date: Variant_Double_String?
|
|
48
|
+
) {
|
|
49
|
+
/* primary constructor */
|
|
50
|
+
|
|
51
|
+
override fun equals(other: Any?): Boolean {
|
|
52
|
+
if (this === other) return true
|
|
53
|
+
if (other !is AliPushMessage) return false
|
|
54
|
+
return Objects.deepEquals(this.title, other.title)
|
|
55
|
+
&& Objects.deepEquals(this.subtitle, other.subtitle)
|
|
56
|
+
&& Objects.deepEquals(this.body, other.body)
|
|
57
|
+
&& Objects.deepEquals(this.badge, other.badge)
|
|
58
|
+
&& Objects.deepEquals(this.extras, other.extras)
|
|
59
|
+
&& Objects.deepEquals(this.type, other.type)
|
|
60
|
+
&& Objects.deepEquals(this.actionIdentifier, other.actionIdentifier)
|
|
61
|
+
&& Objects.deepEquals(this.appState, other.appState)
|
|
62
|
+
&& Objects.deepEquals(this.date, other.date)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override fun hashCode(): Int {
|
|
66
|
+
return arrayOf<Any?>(
|
|
67
|
+
title,
|
|
68
|
+
subtitle,
|
|
69
|
+
body,
|
|
70
|
+
badge,
|
|
71
|
+
extras,
|
|
72
|
+
type,
|
|
73
|
+
actionIdentifier,
|
|
74
|
+
appState,
|
|
75
|
+
date
|
|
76
|
+
).contentDeepHashCode()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
companion object {
|
|
80
|
+
/**
|
|
81
|
+
* Constructor called from C++
|
|
82
|
+
*/
|
|
83
|
+
@DoNotStrip
|
|
84
|
+
@Keep
|
|
85
|
+
@Suppress("unused")
|
|
86
|
+
@JvmStatic
|
|
87
|
+
private fun fromCpp(title: String?, subtitle: String?, body: String?, badge: Double?, extras: AnyMap?, type: AliPushMessageType?, actionIdentifier: String?, appState: AliPushAppState?, date: Variant_Double_String?): AliPushMessage {
|
|
88
|
+
return AliPushMessage(title, subtitle, body, badge, extras, type, actionIdentifier, appState, date)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AliPushMessageType.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 androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "AliPushMessageType".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class AliPushMessageType(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
NOTIFICATION(0),
|
|
20
|
+
MESSAGE(1);
|
|
21
|
+
|
|
22
|
+
companion object
|
|
23
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.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 androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `() => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void: () -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `() => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_cxx: Func_void {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(): Unit
|
|
59
|
+
= invoke_cxx()
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `() => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `() -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_java(private val function: () -> Unit): Func_void {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(): Unit {
|
|
76
|
+
return this.function()
|
|
77
|
+
}
|
|
78
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Func_void_AliPushMessage.kt
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_AliPushMessage.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 androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(message: struct) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_AliPushMessage: (AliPushMessage) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(message: AliPushMessage): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(message: struct) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_AliPushMessage_cxx: Func_void_AliPushMessage {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(message: AliPushMessage): Unit
|
|
59
|
+
= invoke_cxx(message)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(message: AliPushMessage): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(message: struct) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(AliPushMessage) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_AliPushMessage_java(private val function: (AliPushMessage) -> Unit): Func_void_AliPushMessage {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(message: AliPushMessage): Unit {
|
|
76
|
+
return this.function(message)
|
|
77
|
+
}
|
|
78
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/HybridAliPushPluginSpec.kt
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAliPushPluginSpec.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 androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.Promise
|
|
15
|
+
import com.margelo.nitro.core.NullType
|
|
16
|
+
import com.margelo.nitro.core.HybridObject
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A Kotlin class representing the AliPushPlugin HybridObject.
|
|
20
|
+
* Implement this abstract class to create Kotlin-based instances of AliPushPlugin.
|
|
21
|
+
*/
|
|
22
|
+
@DoNotStrip
|
|
23
|
+
@Keep
|
|
24
|
+
@Suppress(
|
|
25
|
+
"KotlinJniMissingFunction", "unused",
|
|
26
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
27
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
28
|
+
)
|
|
29
|
+
abstract class HybridAliPushPluginSpec: HybridObject() {
|
|
30
|
+
// Properties
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// Methods
|
|
34
|
+
@DoNotStrip
|
|
35
|
+
@Keep
|
|
36
|
+
abstract fun initPush(appKey: String, appSecret: String): Promise<Unit>
|
|
37
|
+
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
abstract fun getDeviceId(): Promise<String>
|
|
41
|
+
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
abstract fun bindAccount(account: String): Promise<Unit>
|
|
45
|
+
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
abstract fun unbindAccount(): Promise<Unit>
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
abstract fun bindTag(target: Double, tags: Array<String>, alias: Variant_NullType_String?): Promise<Unit>
|
|
53
|
+
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
@Keep
|
|
56
|
+
abstract fun unbindTag(target: Double, tags: Array<String>, alias: Variant_NullType_String?): Promise<Unit>
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
abstract fun listTags(target: Double): Promise<String>
|
|
61
|
+
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
@Keep
|
|
64
|
+
abstract fun addAlias(alias: String): Promise<Unit>
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
abstract fun removeAlias(alias: String): Promise<Unit>
|
|
69
|
+
|
|
70
|
+
@DoNotStrip
|
|
71
|
+
@Keep
|
|
72
|
+
abstract fun listAliases(): Promise<String>
|
|
73
|
+
|
|
74
|
+
@DoNotStrip
|
|
75
|
+
@Keep
|
|
76
|
+
abstract fun setApplicationIconBadgeNumber(badge: Double): Promise<Unit>
|
|
77
|
+
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
abstract fun getApplicationIconBadgeNumber(): Promise<Double>
|
|
81
|
+
|
|
82
|
+
@DoNotStrip
|
|
83
|
+
@Keep
|
|
84
|
+
abstract fun getInitialMessage(): Promise<Variant_NullType_AliPushMessage>
|
|
85
|
+
|
|
86
|
+
@DoNotStrip
|
|
87
|
+
@Keep
|
|
88
|
+
abstract fun getAuthorizationStatus(): Promise<Boolean>
|
|
89
|
+
|
|
90
|
+
@DoNotStrip
|
|
91
|
+
@Keep
|
|
92
|
+
abstract fun syncBadgeNum(badge: Double): Promise<Unit>
|
|
93
|
+
|
|
94
|
+
abstract fun addListener(listener: (message: AliPushMessage) -> Unit): () -> Unit
|
|
95
|
+
|
|
96
|
+
@DoNotStrip
|
|
97
|
+
@Keep
|
|
98
|
+
private fun addListener_cxx(listener: Func_void_AliPushMessage): Func_void {
|
|
99
|
+
val __result = addListener(listener)
|
|
100
|
+
return Func_void_java(__result)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Default implementation of `HybridObject.toString()`
|
|
104
|
+
override fun toString(): String {
|
|
105
|
+
return "[HybridObject AliPushPlugin]"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// C++ backing class
|
|
109
|
+
@DoNotStrip
|
|
110
|
+
@Keep
|
|
111
|
+
protected open class CxxPart(javaPart: HybridAliPushPluginSpec): HybridObject.CxxPart(javaPart) {
|
|
112
|
+
// C++ JHybridAliPushPluginSpec::CxxPart::initHybrid(...)
|
|
113
|
+
@FastNative
|
|
114
|
+
external override fun initHybrid(): HybridData
|
|
115
|
+
}
|
|
116
|
+
override fun createCxxPart(): CxxPart {
|
|
117
|
+
return CxxPart(this)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
companion object {
|
|
121
|
+
protected const val TAG = "HybridAliPushPluginSpec"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroAliPushOnLoad.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 android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class NitroAliPushOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "NitroAliPushOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "NitroAliPush".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading NitroAliPush C++ library...")
|
|
25
|
+
System.loadLibrary("NitroAliPush")
|
|
26
|
+
Log.i(TAG, "Successfully loaded NitroAliPush C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load NitroAliPush C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_Double_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
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the TypeScript variant "Double | String".
|
|
15
|
+
*/
|
|
16
|
+
@Suppress("ClassName")
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
sealed class Variant_Double_String {
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
data class First(@DoNotStrip val value: Double): Variant_Double_String()
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
data class Second(@DoNotStrip val value: String): Variant_Double_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: (Double) -> 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(): Double? {
|
|
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: Double): Variant_Double_String = First(value)
|
|
58
|
+
@JvmStatic
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
fun create(value: String): Variant_Double_String = Second(value)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_AliPushMessage.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 | AliPushMessage".
|
|
15
|
+
*/
|
|
16
|
+
@Suppress("ClassName")
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
sealed class Variant_NullType_AliPushMessage {
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
data class First(@DoNotStrip val value: NullType): Variant_NullType_AliPushMessage()
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
data class Second(@DoNotStrip val value: AliPushMessage): Variant_NullType_AliPushMessage()
|
|
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: (AliPushMessage) -> 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(): AliPushMessage? {
|
|
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_AliPushMessage = First(value)
|
|
58
|
+
@JvmStatic
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
fun create(value: AliPushMessage): Variant_NullType_AliPushMessage = Second(value)
|
|
61
|
+
}
|
|
62
|
+
}
|