@onekeyfe/react-native-device-utils 6.7.0-6 → 6.7.0-60
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/README.md +117 -87
- package/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt +156 -35
- package/ios/DualScreenDetector.swift +170 -0
- package/ios/MainMenuController.swift +170 -0
- package/ios/ReactNativeDeviceUtils.swift +29 -4
- package/ios/WindowControlsInsetsObserver.swift +151 -0
- package/lib/typescript/src/ReactNativeDeviceUtils.nitro.d.ts +46 -0
- package/nitrogen/generated/android/c++/JFunc_void_MainMenuCommand.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_WindowControlsInsets.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.cpp +45 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.hpp +6 -0
- package/nitrogen/generated/android/c++/JMainMenuCommand.hpp +61 -0
- package/nitrogen/generated/android/c++/JMainMenuConfig.hpp +90 -0
- package/nitrogen/generated/android/c++/JMainMenuLink.hpp +61 -0
- package/nitrogen/generated/android/c++/JWindowControlsInsets.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/Func_void_MainMenuCommand.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/Func_void_WindowControlsInsets.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec.kt +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuCommand.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuConfig.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuLink.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/WindowControlsInsets.kt +66 -0
- package/nitrogen/generated/android/reactnativedeviceutilsOnLoad.cpp +4 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp +73 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp +12 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.hpp +55 -1
- package/nitrogen/generated/ios/swift/Func_void_MainMenuCommand.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_WindowControlsInsets.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec.swift +6 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec_cxx.swift +79 -0
- package/nitrogen/generated/ios/swift/MainMenuCommand.swift +44 -0
- package/nitrogen/generated/ios/swift/MainMenuConfig.swift +50 -0
- package/nitrogen/generated/ios/swift/MainMenuLink.swift +34 -0
- package/nitrogen/generated/ios/swift/WindowControlsInsets.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.cpp +6 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.hpp +15 -0
- package/nitrogen/generated/shared/c++/MainMenuCommand.hpp +80 -0
- package/nitrogen/generated/shared/c++/MainMenuConfig.hpp +98 -0
- package/nitrogen/generated/shared/c++/MainMenuLink.hpp +87 -0
- package/nitrogen/generated/shared/c++/WindowControlsInsets.hpp +95 -0
- package/package.json +8 -7
- package/src/ReactNativeDeviceUtils.nitro.ts +54 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JMainMenuCommand.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 "MainMenuCommand.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "MainMenuCommand" and the Kotlin enum "MainMenuCommand".
|
|
19
|
+
*/
|
|
20
|
+
struct JMainMenuCommand final: public jni::JavaClass<JMainMenuCommand> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/MainMenuCommand;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum MainMenuCommand.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
MainMenuCommand toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<MainMenuCommand>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JMainMenuCommand> fromCpp(MainMenuCommand value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case MainMenuCommand::ABOUT:
|
|
46
|
+
static const auto fieldABOUT = clazz->getStaticField<JMainMenuCommand>("ABOUT");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldABOUT);
|
|
48
|
+
case MainMenuCommand::PREFERENCES:
|
|
49
|
+
static const auto fieldPREFERENCES = clazz->getStaticField<JMainMenuCommand>("PREFERENCES");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldPREFERENCES);
|
|
51
|
+
case MainMenuCommand::LOCKNOW:
|
|
52
|
+
static const auto fieldLOCKNOW = clazz->getStaticField<JMainMenuCommand>("LOCKNOW");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldLOCKNOW);
|
|
54
|
+
default:
|
|
55
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
56
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JMainMenuConfig.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 "MainMenuConfig.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JMainMenuLink.hpp"
|
|
14
|
+
#include "MainMenuLink.hpp"
|
|
15
|
+
#include <string>
|
|
16
|
+
#include <vector>
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ struct "MainMenuConfig" and the Kotlin data class "MainMenuConfig".
|
|
24
|
+
*/
|
|
25
|
+
struct JMainMenuConfig final: public jni::JavaClass<JMainMenuConfig> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/MainMenuConfig;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Convert this Java/Kotlin-based struct to the C++ struct MainMenuConfig by copying all values to C++.
|
|
32
|
+
*/
|
|
33
|
+
[[maybe_unused]]
|
|
34
|
+
[[nodiscard]]
|
|
35
|
+
MainMenuConfig toCpp() const {
|
|
36
|
+
static const auto clazz = javaClassStatic();
|
|
37
|
+
static const auto fieldAboutTitle = clazz->getField<jni::JString>("aboutTitle");
|
|
38
|
+
jni::local_ref<jni::JString> aboutTitle = this->getFieldValue(fieldAboutTitle);
|
|
39
|
+
static const auto fieldPreferencesTitle = clazz->getField<jni::JString>("preferencesTitle");
|
|
40
|
+
jni::local_ref<jni::JString> preferencesTitle = this->getFieldValue(fieldPreferencesTitle);
|
|
41
|
+
static const auto fieldLockNowTitle = clazz->getField<jni::JString>("lockNowTitle");
|
|
42
|
+
jni::local_ref<jni::JString> lockNowTitle = this->getFieldValue(fieldLockNowTitle);
|
|
43
|
+
static const auto fieldHelpLinks = clazz->getField<jni::JArrayClass<JMainMenuLink>>("helpLinks");
|
|
44
|
+
jni::local_ref<jni::JArrayClass<JMainMenuLink>> helpLinks = this->getFieldValue(fieldHelpLinks);
|
|
45
|
+
return MainMenuConfig(
|
|
46
|
+
aboutTitle->toStdString(),
|
|
47
|
+
preferencesTitle->toStdString(),
|
|
48
|
+
lockNowTitle->toStdString(),
|
|
49
|
+
[&](auto&& __input) {
|
|
50
|
+
size_t __size = __input->size();
|
|
51
|
+
std::vector<MainMenuLink> __vector;
|
|
52
|
+
__vector.reserve(__size);
|
|
53
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
54
|
+
auto __element = __input->getElement(__i);
|
|
55
|
+
__vector.push_back(__element->toCpp());
|
|
56
|
+
}
|
|
57
|
+
return __vector;
|
|
58
|
+
}(helpLinks)
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
/**
|
|
64
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
65
|
+
*/
|
|
66
|
+
[[maybe_unused]]
|
|
67
|
+
static jni::local_ref<JMainMenuConfig::javaobject> fromCpp(const MainMenuConfig& value) {
|
|
68
|
+
using JSignature = JMainMenuConfig(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JMainMenuLink>>);
|
|
69
|
+
static const auto clazz = javaClassStatic();
|
|
70
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
71
|
+
return create(
|
|
72
|
+
clazz,
|
|
73
|
+
jni::make_jstring(value.aboutTitle),
|
|
74
|
+
jni::make_jstring(value.preferencesTitle),
|
|
75
|
+
jni::make_jstring(value.lockNowTitle),
|
|
76
|
+
[&](auto&& __input) {
|
|
77
|
+
size_t __size = __input.size();
|
|
78
|
+
jni::local_ref<jni::JArrayClass<JMainMenuLink>> __array = jni::JArrayClass<JMainMenuLink>::newArray(__size);
|
|
79
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
80
|
+
const auto& __element = __input[__i];
|
|
81
|
+
auto __elementJni = JMainMenuLink::fromCpp(__element);
|
|
82
|
+
__array->setElement(__i, *__elementJni);
|
|
83
|
+
}
|
|
84
|
+
return __array;
|
|
85
|
+
}(value.helpLinks)
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JMainMenuLink.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 "MainMenuLink.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "MainMenuLink" and the Kotlin data class "MainMenuLink".
|
|
21
|
+
*/
|
|
22
|
+
struct JMainMenuLink final: public jni::JavaClass<JMainMenuLink> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/MainMenuLink;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct MainMenuLink by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
MainMenuLink toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldTitle = clazz->getField<jni::JString>("title");
|
|
35
|
+
jni::local_ref<jni::JString> title = this->getFieldValue(fieldTitle);
|
|
36
|
+
static const auto fieldUrl = clazz->getField<jni::JString>("url");
|
|
37
|
+
jni::local_ref<jni::JString> url = this->getFieldValue(fieldUrl);
|
|
38
|
+
return MainMenuLink(
|
|
39
|
+
title->toStdString(),
|
|
40
|
+
url->toStdString()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JMainMenuLink::javaobject> fromCpp(const MainMenuLink& value) {
|
|
50
|
+
using JSignature = JMainMenuLink(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
51
|
+
static const auto clazz = javaClassStatic();
|
|
52
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
|
+
return create(
|
|
54
|
+
clazz,
|
|
55
|
+
jni::make_jstring(value.title),
|
|
56
|
+
jni::make_jstring(value.url)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JWindowControlsInsets.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 "WindowControlsInsets.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "WindowControlsInsets" and the Kotlin data class "WindowControlsInsets".
|
|
21
|
+
*/
|
|
22
|
+
struct JWindowControlsInsets final: public jni::JavaClass<JWindowControlsInsets> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativedeviceutils/WindowControlsInsets;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct WindowControlsInsets by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
WindowControlsInsets toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldTop = clazz->getField<double>("top");
|
|
35
|
+
double top = this->getFieldValue(fieldTop);
|
|
36
|
+
static const auto fieldLeft = clazz->getField<double>("left");
|
|
37
|
+
double left = this->getFieldValue(fieldLeft);
|
|
38
|
+
static const auto fieldBottom = clazz->getField<double>("bottom");
|
|
39
|
+
double bottom = this->getFieldValue(fieldBottom);
|
|
40
|
+
static const auto fieldRight = clazz->getField<double>("right");
|
|
41
|
+
double right = this->getFieldValue(fieldRight);
|
|
42
|
+
return WindowControlsInsets(
|
|
43
|
+
top,
|
|
44
|
+
left,
|
|
45
|
+
bottom,
|
|
46
|
+
right
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
53
|
+
*/
|
|
54
|
+
[[maybe_unused]]
|
|
55
|
+
static jni::local_ref<JWindowControlsInsets::javaobject> fromCpp(const WindowControlsInsets& value) {
|
|
56
|
+
using JSignature = JWindowControlsInsets(double, double, double, double);
|
|
57
|
+
static const auto clazz = javaClassStatic();
|
|
58
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
59
|
+
return create(
|
|
60
|
+
clazz,
|
|
61
|
+
value.top,
|
|
62
|
+
value.left,
|
|
63
|
+
value.bottom,
|
|
64
|
+
value.right
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_MainMenuCommand.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.reactnativedeviceutils
|
|
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 `(command: enum) => 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_MainMenuCommand: (MainMenuCommand) -> 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(command: MainMenuCommand): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(command: enum) => 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_MainMenuCommand_cxx: Func_void_MainMenuCommand {
|
|
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(command: MainMenuCommand): Unit
|
|
59
|
+
= invoke_cxx(command)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(command: MainMenuCommand): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(command: enum) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(MainMenuCommand) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_MainMenuCommand_java(private val function: (MainMenuCommand) -> Unit): Func_void_MainMenuCommand {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(command: MainMenuCommand): Unit {
|
|
76
|
+
return this.function(command)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_WindowControlsInsets.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.reactnativedeviceutils
|
|
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 `(insets: 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_WindowControlsInsets: (WindowControlsInsets) -> 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(insets: WindowControlsInsets): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(insets: 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_WindowControlsInsets_cxx: Func_void_WindowControlsInsets {
|
|
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(insets: WindowControlsInsets): Unit
|
|
59
|
+
= invoke_cxx(insets)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(insets: WindowControlsInsets): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(insets: struct) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(WindowControlsInsets) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_WindowControlsInsets_java(private val function: (WindowControlsInsets) -> Unit): Func_void_WindowControlsInsets {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(insets: WindowControlsInsets): Unit {
|
|
76
|
+
return this.function(insets)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -75,6 +75,40 @@ abstract class HybridReactNativeDeviceUtilsSpec: HybridObject() {
|
|
|
75
75
|
@Keep
|
|
76
76
|
abstract fun setUserInterfaceStyle(style: UserInterfaceStyle): Unit
|
|
77
77
|
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
abstract fun getWindowControlsInsets(): WindowControlsInsets
|
|
81
|
+
|
|
82
|
+
abstract fun addWindowControlsInsetsChangedListener(callback: (insets: WindowControlsInsets) -> Unit): Double
|
|
83
|
+
|
|
84
|
+
@DoNotStrip
|
|
85
|
+
@Keep
|
|
86
|
+
private fun addWindowControlsInsetsChangedListener_cxx(callback: Func_void_WindowControlsInsets): Double {
|
|
87
|
+
val __result = addWindowControlsInsetsChangedListener(callback)
|
|
88
|
+
return __result
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@DoNotStrip
|
|
92
|
+
@Keep
|
|
93
|
+
abstract fun removeWindowControlsInsetsChangedListener(id: Double): Unit
|
|
94
|
+
|
|
95
|
+
@DoNotStrip
|
|
96
|
+
@Keep
|
|
97
|
+
abstract fun setMainMenuConfig(config: MainMenuConfig): Unit
|
|
98
|
+
|
|
99
|
+
abstract fun addMainMenuCommandListener(callback: (command: MainMenuCommand) -> Unit): Double
|
|
100
|
+
|
|
101
|
+
@DoNotStrip
|
|
102
|
+
@Keep
|
|
103
|
+
private fun addMainMenuCommandListener_cxx(callback: Func_void_MainMenuCommand): Double {
|
|
104
|
+
val __result = addMainMenuCommandListener(callback)
|
|
105
|
+
return __result
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@DoNotStrip
|
|
109
|
+
@Keep
|
|
110
|
+
abstract fun removeMainMenuCommandListener(id: Double): Unit
|
|
111
|
+
|
|
78
112
|
@DoNotStrip
|
|
79
113
|
@Keep
|
|
80
114
|
abstract fun getLaunchOptions(): Promise<LaunchOptions>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuCommand.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.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "MainMenuCommand".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class MainMenuCommand(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
ABOUT(0),
|
|
20
|
+
PREFERENCES(1),
|
|
21
|
+
LOCKNOW(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuConfig.kt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuConfig.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.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "MainMenuConfig".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class MainMenuConfig(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val aboutTitle: String,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val preferencesTitle: String,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val lockNowTitle: String,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val helpLinks: Array<MainMenuLink>
|
|
33
|
+
) {
|
|
34
|
+
/* primary constructor */
|
|
35
|
+
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is MainMenuConfig) return false
|
|
39
|
+
return Objects.deepEquals(this.aboutTitle, other.aboutTitle)
|
|
40
|
+
&& Objects.deepEquals(this.preferencesTitle, other.preferencesTitle)
|
|
41
|
+
&& Objects.deepEquals(this.lockNowTitle, other.lockNowTitle)
|
|
42
|
+
&& Objects.deepEquals(this.helpLinks, other.helpLinks)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun hashCode(): Int {
|
|
46
|
+
return arrayOf<Any?>(
|
|
47
|
+
aboutTitle,
|
|
48
|
+
preferencesTitle,
|
|
49
|
+
lockNowTitle,
|
|
50
|
+
helpLinks
|
|
51
|
+
).contentDeepHashCode()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
/**
|
|
56
|
+
* Constructor called from C++
|
|
57
|
+
*/
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
@Suppress("unused")
|
|
61
|
+
@JvmStatic
|
|
62
|
+
private fun fromCpp(aboutTitle: String, preferencesTitle: String, lockNowTitle: String, helpLinks: Array<MainMenuLink>): MainMenuConfig {
|
|
63
|
+
return MainMenuConfig(aboutTitle, preferencesTitle, lockNowTitle, helpLinks)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuLink.kt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuLink.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.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "MainMenuLink".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class MainMenuLink(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val title: String,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val url: String
|
|
27
|
+
) {
|
|
28
|
+
/* primary constructor */
|
|
29
|
+
|
|
30
|
+
override fun equals(other: Any?): Boolean {
|
|
31
|
+
if (this === other) return true
|
|
32
|
+
if (other !is MainMenuLink) return false
|
|
33
|
+
return Objects.deepEquals(this.title, other.title)
|
|
34
|
+
&& Objects.deepEquals(this.url, other.url)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun hashCode(): Int {
|
|
38
|
+
return arrayOf<Any?>(
|
|
39
|
+
title,
|
|
40
|
+
url
|
|
41
|
+
).contentDeepHashCode()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(title: String, url: String): MainMenuLink {
|
|
53
|
+
return MainMenuLink(title, url)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WindowControlsInsets.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.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "WindowControlsInsets".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class WindowControlsInsets(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val top: Double,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val left: Double,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val bottom: Double,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val right: Double
|
|
33
|
+
) {
|
|
34
|
+
/* primary constructor */
|
|
35
|
+
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is WindowControlsInsets) return false
|
|
39
|
+
return Objects.deepEquals(this.top, other.top)
|
|
40
|
+
&& Objects.deepEquals(this.left, other.left)
|
|
41
|
+
&& Objects.deepEquals(this.bottom, other.bottom)
|
|
42
|
+
&& Objects.deepEquals(this.right, other.right)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun hashCode(): Int {
|
|
46
|
+
return arrayOf<Any?>(
|
|
47
|
+
top,
|
|
48
|
+
left,
|
|
49
|
+
bottom,
|
|
50
|
+
right
|
|
51
|
+
).contentDeepHashCode()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
/**
|
|
56
|
+
* Constructor called from C++
|
|
57
|
+
*/
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
@Suppress("unused")
|
|
61
|
+
@JvmStatic
|
|
62
|
+
private fun fromCpp(top: Double, left: Double, bottom: Double, right: Double): WindowControlsInsets {
|
|
63
|
+
return WindowControlsInsets(top, left, bottom, right)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|