@iternio/react-native-auto-play 0.5.7 → 0.5.8
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/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +0 -1
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt +29 -116
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputManager.kt +17 -1
- package/ios/templates/MapTemplate.swift +14 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.js +1 -2
- package/lib/scenes/AutoPlayCluster.js +1 -6
- package/lib/templates/MapTemplate.js +1 -6
- package/lib/types/RootComponent.d.ts +0 -4
- package/nitro.json +0 -6
- package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +0 -2
- package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +0 -18
- package/package.json +1 -1
- package/src/index.ts +1 -2
- package/src/scenes/AutoPlayCluster.ts +1 -6
- package/src/templates/MapTemplate.ts +1 -6
- package/src/types/RootComponent.ts +0 -4
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidWindowInformation.kt +0 -49
- package/lib/HybridAutoPlay.d.ts +0 -2
- package/lib/HybridAutoPlay.js +0 -2
- package/lib/components/OnAppearedChildRenderer.d.ts +0 -10
- package/lib/components/OnAppearedChildRenderer.js +0 -26
- package/lib/components/WindowInformationWrapper.d.ts +0 -15
- package/lib/components/WindowInformationWrapper.js +0 -17
- package/lib/hooks/useIsAutoPlayFocused.d.ts +0 -7
- package/lib/hooks/useIsAutoPlayFocused.js +0 -20
- package/lib/hybrid/HybridAndroidWindowInformation.android.d.ts +0 -2
- package/lib/hybrid/HybridAndroidWindowInformation.android.js +0 -2
- package/lib/hybrid/HybridAndroidWindowInformation.d.ts +0 -2
- package/lib/hybrid/HybridAndroidWindowInformation.js +0 -1
- package/lib/hybrid.d.ts +0 -2
- package/lib/hybrid.js +0 -2
- package/lib/specs/AndroidWindowInformation.nitro.d.ts +0 -22
- package/lib/specs/AndroidWindowInformation.nitro.js +0 -1
- package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +0 -11
- package/lib/specs/AutomotivePermissionRequestTemplate.js +0 -1
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +0 -11
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +0 -1
- package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +0 -23
- package/lib/templates/AutomotivePermissionRequestTemplate.js +0 -18
- package/lib/types/Glyphmap.d.ts +0 -4105
- package/lib/types/Glyphmap.js +0 -4105
- package/lib/utils/NitroOptionsPanel.d.ts +0 -67
- package/lib/utils/NitroOptionsPanel.js +0 -48
- package/nitrogen/generated/android/c++/JFunc_void_WindowInformation.hpp +0 -77
- package/nitrogen/generated/android/c++/JHybridAndroidWindowInformationSpec.cpp +0 -68
- package/nitrogen/generated/android/c++/JHybridAndroidWindowInformationSpec.hpp +0 -63
- package/nitrogen/generated/android/c++/JWindowInformation.hpp +0 -65
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_WindowInformation.kt +0 -80
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidWindowInformationSpec.kt +0 -59
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/WindowInformation.kt +0 -61
- package/nitrogen/generated/shared/c++/HybridAndroidWindowInformationSpec.cpp +0 -21
- package/nitrogen/generated/shared/c++/HybridAndroidWindowInformationSpec.hpp +0 -65
- package/nitrogen/generated/shared/c++/WindowInformation.hpp +0 -91
- package/src/components/WindowInformationWrapper.tsx +0 -30
- package/src/hybrid/HybridAndroidWindowInformation.android.ts +0 -5
- package/src/hybrid/HybridAndroidWindowInformation.ts +0 -3
- package/src/specs/AndroidWindowInformation.nitro.ts +0 -24
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { ImageButton, TextButton } from '../types/Button';
|
|
2
|
-
import type { AutoText } from '../types/Text';
|
|
3
|
-
import { type NitroAction } from './NitroAction';
|
|
4
|
-
import { type GridButton, type NitroGridButton } from './NitroGrid';
|
|
5
|
-
import { type DefaultRow, type NitroSection, type RadioRow, type TextRow, type ToggleRow } from './NitroSection';
|
|
6
|
-
/** @namespace iOS a whole button grid, same as GridTemplate's own grid. */
|
|
7
|
-
export type OptionsPanelGridSection<T> = {
|
|
8
|
-
type: 'grid';
|
|
9
|
-
title?: string;
|
|
10
|
-
buttons: Array<GridButton<T>>;
|
|
11
|
-
};
|
|
12
|
-
export type ChargingConnector = 'ccs1' | 'ccs2' | 'j1772' | 'chaDeMo' | 'mennekes' | 'gbtDC' | 'gbtAC' | 'nacsDC' | 'nacsAC';
|
|
13
|
-
/** @namespace iOS one outlet (`CPChargingStationConnection`) on a charging station. */
|
|
14
|
-
export type ChargerOutlet<T> = {
|
|
15
|
-
connector: ChargingConnector;
|
|
16
|
-
/** volts */
|
|
17
|
-
voltage: number;
|
|
18
|
-
/** converted to megawatts on the native side above 1000 kW */
|
|
19
|
-
powerKw: number;
|
|
20
|
-
onPress?: (template: T) => void;
|
|
21
|
-
};
|
|
22
|
-
/** @namespace iOS a charging station's outlets — a station commonly has several (e.g. CCS2 + Type 2). */
|
|
23
|
-
export type OptionsPanelChargerSection<T> = {
|
|
24
|
-
type: 'charger';
|
|
25
|
-
title?: string;
|
|
26
|
-
outlets: Array<ChargerOutlet<T>>;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* @namespace iOS a full list: default/toggle/text rows mixed freely, or a mutually-exclusive
|
|
30
|
-
* radio group — the item array's own row types carry that distinction, not a section-level tag.
|
|
31
|
-
*/
|
|
32
|
-
export type OptionsPanelListSection<T> = {
|
|
33
|
-
type: 'list';
|
|
34
|
-
title?: string;
|
|
35
|
-
items: Array<DefaultRow<T> | ToggleRow<T> | TextRow> | Array<RadioRow<T>>;
|
|
36
|
-
};
|
|
37
|
-
/** one kind per section: list, grid, or charger outlet — CarPlay allows mixing kinds, but we don't need that yet. */
|
|
38
|
-
export type OptionsPanelSection<T> = OptionsPanelListSection<T> | OptionsPanelGridSection<T> | OptionsPanelChargerSection<T>;
|
|
39
|
-
export type OptionsPanelConfig<T> = {
|
|
40
|
-
title?: AutoText;
|
|
41
|
-
sections: Array<OptionsPanelSection<T>>;
|
|
42
|
-
/** @namespace iOS one primary `TextButton` plus one optional icon-only `ImageButton` — nothing more is supported. */
|
|
43
|
-
actions?: [TextButton<T>] | [TextButton<T>, ImageButton<T>];
|
|
44
|
-
};
|
|
45
|
-
export type NitroOptionsPanelGridSection = {
|
|
46
|
-
title?: string;
|
|
47
|
-
buttons: Array<NitroGridButton>;
|
|
48
|
-
};
|
|
49
|
-
export type NitroChargerOutlet = {
|
|
50
|
-
connector: ChargingConnector;
|
|
51
|
-
voltage: number;
|
|
52
|
-
powerKw: number;
|
|
53
|
-
onPress?: () => void;
|
|
54
|
-
};
|
|
55
|
-
export type NitroOptionsPanelChargerSection = {
|
|
56
|
-
title?: string;
|
|
57
|
-
outlets: Array<NitroChargerOutlet>;
|
|
58
|
-
};
|
|
59
|
-
export type NitroOptionsPanelSection = NitroSection | NitroOptionsPanelGridSection | NitroOptionsPanelChargerSection;
|
|
60
|
-
export type NitroOptionsPanelConfig = {
|
|
61
|
-
title?: AutoText;
|
|
62
|
-
sections: Array<NitroOptionsPanelSection>;
|
|
63
|
-
actions?: Array<NitroAction>;
|
|
64
|
-
};
|
|
65
|
-
export declare const NitroOptionsPanelUtil: {
|
|
66
|
-
convert: <T>(template: T, config?: OptionsPanelConfig<T>) => NitroOptionsPanelConfig | undefined;
|
|
67
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { NitroActionUtil } from './NitroAction';
|
|
2
|
-
import { NitroGridUtil } from './NitroGrid';
|
|
3
|
-
import { NitroSectionUtil, } from './NitroSection';
|
|
4
|
-
const convertSection = (template, section) => {
|
|
5
|
-
if (section.type === 'grid') {
|
|
6
|
-
return {
|
|
7
|
-
title: section.title,
|
|
8
|
-
buttons: NitroGridUtil.convert(template, section.buttons),
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
if (section.type === 'charger') {
|
|
12
|
-
return {
|
|
13
|
-
title: section.title,
|
|
14
|
-
outlets: section.outlets.map((outlet) => ({
|
|
15
|
-
connector: outlet.connector,
|
|
16
|
-
voltage: outlet.voltage,
|
|
17
|
-
powerKw: outlet.powerKw,
|
|
18
|
-
onPress: outlet.onPress ? () => outlet.onPress?.(template) : undefined,
|
|
19
|
-
})),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
// items is all-radio or all-default/toggle/text, never mixed — translate into MultiSection's
|
|
23
|
-
// default/radio shape to reuse NitroSectionUtil.convert's radio-validation logic as-is.
|
|
24
|
-
const isRadioGroup = section.items.length > 0 && section.items.every((item) => item.type === 'radio');
|
|
25
|
-
const multiSection = isRadioGroup
|
|
26
|
-
? { type: 'radio', title: section.title ?? '', items: section.items }
|
|
27
|
-
: {
|
|
28
|
-
type: 'default',
|
|
29
|
-
title: section.title ?? '',
|
|
30
|
-
items: section.items,
|
|
31
|
-
};
|
|
32
|
-
const [nitroSection] = NitroSectionUtil.convert(template, [multiSection]) ?? [];
|
|
33
|
-
if (nitroSection == null) {
|
|
34
|
-
throw new Error('converting sections failed');
|
|
35
|
-
}
|
|
36
|
-
return nitroSection;
|
|
37
|
-
};
|
|
38
|
-
const convert = (template, config) => {
|
|
39
|
-
if (config == null) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
title: config.title,
|
|
44
|
-
sections: config.sections.map((section) => convertSection(template, section)),
|
|
45
|
-
actions: NitroActionUtil.convert(template, config.actions),
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export const NitroOptionsPanelUtil = { convert };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JFunc_void_WindowInformation.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 <functional>
|
|
12
|
-
|
|
13
|
-
#include "WindowInformation.hpp"
|
|
14
|
-
#include <functional>
|
|
15
|
-
#include <NitroModules/JNICallable.hpp>
|
|
16
|
-
#include "JWindowInformation.hpp"
|
|
17
|
-
|
|
18
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
19
|
-
|
|
20
|
-
using namespace facebook;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Represents the Java/Kotlin callback `(window: WindowInformation) -> Unit`.
|
|
24
|
-
* This can be passed around between C++ and Java/Kotlin.
|
|
25
|
-
*/
|
|
26
|
-
struct JFunc_void_WindowInformation: public jni::JavaClass<JFunc_void_WindowInformation> {
|
|
27
|
-
public:
|
|
28
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_WindowInformation;";
|
|
29
|
-
|
|
30
|
-
public:
|
|
31
|
-
/**
|
|
32
|
-
* Invokes the function this `JFunc_void_WindowInformation` instance holds through JNI.
|
|
33
|
-
*/
|
|
34
|
-
void invoke(const WindowInformation& window) const {
|
|
35
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JWindowInformation> /* window */)>("invoke");
|
|
36
|
-
method(self(), JWindowInformation::fromCpp(window));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* An implementation of Func_void_WindowInformation that is backed by a C++ implementation (using `std::function<...>`)
|
|
42
|
-
*/
|
|
43
|
-
class JFunc_void_WindowInformation_cxx final: public jni::HybridClass<JFunc_void_WindowInformation_cxx, JFunc_void_WindowInformation> {
|
|
44
|
-
public:
|
|
45
|
-
static jni::local_ref<JFunc_void_WindowInformation::javaobject> fromCpp(const std::function<void(const WindowInformation& /* window */)>& func) {
|
|
46
|
-
return JFunc_void_WindowInformation_cxx::newObjectCxxArgs(func);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public:
|
|
50
|
-
/**
|
|
51
|
-
* Invokes the C++ `std::function<...>` this `JFunc_void_WindowInformation_cxx` instance holds.
|
|
52
|
-
*/
|
|
53
|
-
void invoke_cxx(jni::alias_ref<JWindowInformation> window) {
|
|
54
|
-
_func(window->toCpp());
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public:
|
|
58
|
-
[[nodiscard]]
|
|
59
|
-
inline const std::function<void(const WindowInformation& /* window */)>& getFunction() const {
|
|
60
|
-
return _func;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
public:
|
|
64
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_WindowInformation_cxx;";
|
|
65
|
-
static void registerNatives() {
|
|
66
|
-
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_WindowInformation_cxx::invoke_cxx)});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private:
|
|
70
|
-
explicit JFunc_void_WindowInformation_cxx(const std::function<void(const WindowInformation& /* window */)>& func): _func(func) { }
|
|
71
|
-
|
|
72
|
-
private:
|
|
73
|
-
friend HybridBase;
|
|
74
|
-
std::function<void(const WindowInformation& /* window */)> _func;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JHybridAndroidWindowInformationSpec.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 "JHybridAndroidWindowInformationSpec.hpp"
|
|
9
|
-
|
|
10
|
-
// Forward declaration of `WindowInformation` to properly resolve imports.
|
|
11
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WindowInformation; }
|
|
12
|
-
|
|
13
|
-
#include <functional>
|
|
14
|
-
#include "JFunc_void.hpp"
|
|
15
|
-
#include <NitroModules/JNICallable.hpp>
|
|
16
|
-
#include <string>
|
|
17
|
-
#include "WindowInformation.hpp"
|
|
18
|
-
#include "JFunc_void_WindowInformation.hpp"
|
|
19
|
-
#include "JWindowInformation.hpp"
|
|
20
|
-
|
|
21
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
22
|
-
|
|
23
|
-
std::shared_ptr<JHybridAndroidWindowInformationSpec> JHybridAndroidWindowInformationSpec::JavaPart::getJHybridAndroidWindowInformationSpec() {
|
|
24
|
-
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
25
|
-
auto castHybridObject = std::dynamic_pointer_cast<JHybridAndroidWindowInformationSpec>(hybridObject);
|
|
26
|
-
if (castHybridObject == nullptr) [[unlikely]] {
|
|
27
|
-
throw std::runtime_error("Failed to downcast JHybridObject to JHybridAndroidWindowInformationSpec!");
|
|
28
|
-
}
|
|
29
|
-
return castHybridObject;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
jni::local_ref<JHybridAndroidWindowInformationSpec::CxxPart::jhybriddata> JHybridAndroidWindowInformationSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
33
|
-
return makeCxxInstance(jThis);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
std::shared_ptr<JHybridObject> JHybridAndroidWindowInformationSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
37
|
-
auto castJavaPart = jni::dynamic_ref_cast<JHybridAndroidWindowInformationSpec::JavaPart>(javaPart);
|
|
38
|
-
if (castJavaPart == nullptr) [[unlikely]] {
|
|
39
|
-
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridAndroidWindowInformationSpec::JavaPart!");
|
|
40
|
-
}
|
|
41
|
-
return std::make_shared<JHybridAndroidWindowInformationSpec>(castJavaPart);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
void JHybridAndroidWindowInformationSpec::CxxPart::registerNatives() {
|
|
45
|
-
registerHybrid({
|
|
46
|
-
makeNativeMethod("initHybrid", JHybridAndroidWindowInformationSpec::CxxPart::initHybrid),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Properties
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Methods
|
|
54
|
-
std::function<void()> JHybridAndroidWindowInformationSpec::addWindowInformationListener(const std::string& moduleName, const std::function<void(const WindowInformation& /* window */)>& callback) {
|
|
55
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void::javaobject>(jni::alias_ref<jni::JString> /* moduleName */, jni::alias_ref<JFunc_void_WindowInformation::javaobject> /* callback */)>("addWindowInformationListener_cxx");
|
|
56
|
-
auto __result = method(_javaPart, jni::make_jstring(moduleName), JFunc_void_WindowInformation_cxx::fromCpp(callback));
|
|
57
|
-
return [&]() -> std::function<void()> {
|
|
58
|
-
if (__result->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
59
|
-
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(__result);
|
|
60
|
-
return downcast->cthis()->getFunction();
|
|
61
|
-
} else {
|
|
62
|
-
auto __resultRef = jni::make_global(__result);
|
|
63
|
-
return JNICallable<JFunc_void, void()>(std::move(__resultRef));
|
|
64
|
-
}
|
|
65
|
-
}();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAndroidWindowInformationSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
-
#include <fbjni/fbjni.h>
|
|
12
|
-
#include "HybridAndroidWindowInformationSpec.hpp"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
18
|
-
|
|
19
|
-
using namespace facebook;
|
|
20
|
-
|
|
21
|
-
class JHybridAndroidWindowInformationSpec: public virtual HybridAndroidWindowInformationSpec, public virtual JHybridObject {
|
|
22
|
-
public:
|
|
23
|
-
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidWindowInformationSpec;";
|
|
25
|
-
std::shared_ptr<JHybridAndroidWindowInformationSpec> getJHybridAndroidWindowInformationSpec();
|
|
26
|
-
};
|
|
27
|
-
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAndroidWindowInformationSpec$CxxPart;";
|
|
29
|
-
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
-
static void registerNatives();
|
|
31
|
-
using HybridBase::HybridBase;
|
|
32
|
-
protected:
|
|
33
|
-
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
public:
|
|
37
|
-
explicit JHybridAndroidWindowInformationSpec(const jni::local_ref<JHybridAndroidWindowInformationSpec::JavaPart>& javaPart):
|
|
38
|
-
HybridObject(HybridAndroidWindowInformationSpec::TAG),
|
|
39
|
-
JHybridObject(javaPart),
|
|
40
|
-
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
-
~JHybridAndroidWindowInformationSpec() override {
|
|
42
|
-
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
-
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public:
|
|
47
|
-
inline const jni::global_ref<JHybridAndroidWindowInformationSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
-
return _javaPart;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public:
|
|
52
|
-
// Properties
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
public:
|
|
56
|
-
// Methods
|
|
57
|
-
std::function<void()> addWindowInformationListener(const std::string& moduleName, const std::function<void(const WindowInformation& /* window */)>& callback) override;
|
|
58
|
-
|
|
59
|
-
private:
|
|
60
|
-
jni::global_ref<JHybridAndroidWindowInformationSpec::JavaPart> _javaPart;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JWindowInformation.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 "WindowInformation.hpp"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
16
|
-
|
|
17
|
-
using namespace facebook;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The C++ JNI bridge between the C++ struct "WindowInformation" and the the Kotlin data class "WindowInformation".
|
|
21
|
-
*/
|
|
22
|
-
struct JWindowInformation final: public jni::JavaClass<JWindowInformation> {
|
|
23
|
-
public:
|
|
24
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/WindowInformation;";
|
|
25
|
-
|
|
26
|
-
public:
|
|
27
|
-
/**
|
|
28
|
-
* Convert this Java/Kotlin-based struct to the C++ struct WindowInformation by copying all values to C++.
|
|
29
|
-
*/
|
|
30
|
-
[[maybe_unused]]
|
|
31
|
-
[[nodiscard]]
|
|
32
|
-
WindowInformation toCpp() const {
|
|
33
|
-
static const auto clazz = javaClassStatic();
|
|
34
|
-
static const auto fieldWidth = clazz->getField<double>("width");
|
|
35
|
-
double width = this->getFieldValue(fieldWidth);
|
|
36
|
-
static const auto fieldHeight = clazz->getField<double>("height");
|
|
37
|
-
double height = this->getFieldValue(fieldHeight);
|
|
38
|
-
static const auto fieldScale = clazz->getField<double>("scale");
|
|
39
|
-
double scale = this->getFieldValue(fieldScale);
|
|
40
|
-
return WindowInformation(
|
|
41
|
-
width,
|
|
42
|
-
height,
|
|
43
|
-
scale
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public:
|
|
48
|
-
/**
|
|
49
|
-
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
-
*/
|
|
51
|
-
[[maybe_unused]]
|
|
52
|
-
static jni::local_ref<JWindowInformation::javaobject> fromCpp(const WindowInformation& value) {
|
|
53
|
-
using JSignature = JWindowInformation(double, double, double);
|
|
54
|
-
static const auto clazz = javaClassStatic();
|
|
55
|
-
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
|
-
return create(
|
|
57
|
-
clazz,
|
|
58
|
-
value.width,
|
|
59
|
-
value.height,
|
|
60
|
-
value.scale
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// Func_void_WindowInformation.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.swe.iternio.reactnativeautoplay
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Represents the JavaScript callback `(window: struct) => void`.
|
|
18
|
-
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
-
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
-
*/
|
|
21
|
-
@DoNotStrip
|
|
22
|
-
@Keep
|
|
23
|
-
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
-
fun interface Func_void_WindowInformation: (WindowInformation) -> Unit {
|
|
25
|
-
/**
|
|
26
|
-
* Call the given JS callback.
|
|
27
|
-
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
-
*/
|
|
29
|
-
@DoNotStrip
|
|
30
|
-
@Keep
|
|
31
|
-
override fun invoke(window: WindowInformation): Unit
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Represents the JavaScript callback `(window: struct) => void`.
|
|
36
|
-
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
-
* The callback might be coming from JS.
|
|
38
|
-
*/
|
|
39
|
-
@DoNotStrip
|
|
40
|
-
@Keep
|
|
41
|
-
@Suppress(
|
|
42
|
-
"KotlinJniMissingFunction", "unused",
|
|
43
|
-
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
-
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
-
)
|
|
46
|
-
class Func_void_WindowInformation_cxx: Func_void_WindowInformation {
|
|
47
|
-
@DoNotStrip
|
|
48
|
-
@Keep
|
|
49
|
-
private val mHybridData: HybridData
|
|
50
|
-
|
|
51
|
-
@DoNotStrip
|
|
52
|
-
@Keep
|
|
53
|
-
private constructor(hybridData: HybridData) {
|
|
54
|
-
mHybridData = hybridData
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@DoNotStrip
|
|
58
|
-
@Keep
|
|
59
|
-
override fun invoke(window: WindowInformation): Unit
|
|
60
|
-
= invoke_cxx(window)
|
|
61
|
-
|
|
62
|
-
@FastNative
|
|
63
|
-
private external fun invoke_cxx(window: WindowInformation): Unit
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Represents the JavaScript callback `(window: struct) => void`.
|
|
68
|
-
* This is implemented in Java/Kotlin, via a `(WindowInformation) -> Unit`.
|
|
69
|
-
* The callback is always coming from native.
|
|
70
|
-
*/
|
|
71
|
-
@DoNotStrip
|
|
72
|
-
@Keep
|
|
73
|
-
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
-
class Func_void_WindowInformation_java(private val function: (WindowInformation) -> Unit): Func_void_WindowInformation {
|
|
75
|
-
@DoNotStrip
|
|
76
|
-
@Keep
|
|
77
|
-
override fun invoke(window: WindowInformation): Unit {
|
|
78
|
-
return this.function(window)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAndroidWindowInformationSpec.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.swe.iternio.reactnativeautoplay
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.jni.HybridData
|
|
12
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import com.margelo.nitro.core.HybridObject
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* A Kotlin class representing the AndroidWindowInformation HybridObject.
|
|
17
|
-
* Implement this abstract class to create Kotlin-based instances of AndroidWindowInformation.
|
|
18
|
-
*/
|
|
19
|
-
@DoNotStrip
|
|
20
|
-
@Keep
|
|
21
|
-
@Suppress(
|
|
22
|
-
"KotlinJniMissingFunction", "unused",
|
|
23
|
-
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
-
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
-
)
|
|
26
|
-
abstract class HybridAndroidWindowInformationSpec: HybridObject() {
|
|
27
|
-
// Properties
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Methods
|
|
31
|
-
abstract fun addWindowInformationListener(moduleName: String, callback: (window: WindowInformation) -> Unit): () -> Unit
|
|
32
|
-
|
|
33
|
-
@DoNotStrip
|
|
34
|
-
@Keep
|
|
35
|
-
private fun addWindowInformationListener_cxx(moduleName: String, callback: Func_void_WindowInformation): Func_void {
|
|
36
|
-
val __result = addWindowInformationListener(moduleName, callback)
|
|
37
|
-
return Func_void_java(__result)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Default implementation of `HybridObject.toString()`
|
|
41
|
-
override fun toString(): String {
|
|
42
|
-
return "[HybridObject AndroidWindowInformation]"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// C++ backing class
|
|
46
|
-
@DoNotStrip
|
|
47
|
-
@Keep
|
|
48
|
-
protected open class CxxPart(javaPart: HybridAndroidWindowInformationSpec): HybridObject.CxxPart(javaPart) {
|
|
49
|
-
// C++ JHybridAndroidWindowInformationSpec::CxxPart::initHybrid(...)
|
|
50
|
-
external override fun initHybrid(): HybridData
|
|
51
|
-
}
|
|
52
|
-
override fun createCxxPart(): CxxPart {
|
|
53
|
-
return CxxPart(this)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
companion object {
|
|
57
|
-
protected const val TAG = "HybridAndroidWindowInformationSpec"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// WindowInformation.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.swe.iternio.reactnativeautoplay
|
|
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 "WindowInformation".
|
|
17
|
-
*/
|
|
18
|
-
@DoNotStrip
|
|
19
|
-
@Keep
|
|
20
|
-
data class WindowInformation(
|
|
21
|
-
@DoNotStrip
|
|
22
|
-
@Keep
|
|
23
|
-
val width: Double,
|
|
24
|
-
@DoNotStrip
|
|
25
|
-
@Keep
|
|
26
|
-
val height: Double,
|
|
27
|
-
@DoNotStrip
|
|
28
|
-
@Keep
|
|
29
|
-
val scale: Double
|
|
30
|
-
) {
|
|
31
|
-
/* primary constructor */
|
|
32
|
-
|
|
33
|
-
override fun equals(other: Any?): Boolean {
|
|
34
|
-
if (this === other) return true
|
|
35
|
-
if (other !is WindowInformation) return false
|
|
36
|
-
return Objects.deepEquals(this.width, other.width)
|
|
37
|
-
&& Objects.deepEquals(this.height, other.height)
|
|
38
|
-
&& Objects.deepEquals(this.scale, other.scale)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
override fun hashCode(): Int {
|
|
42
|
-
return arrayOf<Any?>(
|
|
43
|
-
width,
|
|
44
|
-
height,
|
|
45
|
-
scale
|
|
46
|
-
).contentDeepHashCode()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
companion object {
|
|
50
|
-
/**
|
|
51
|
-
* Constructor called from C++
|
|
52
|
-
*/
|
|
53
|
-
@DoNotStrip
|
|
54
|
-
@Keep
|
|
55
|
-
@Suppress("unused")
|
|
56
|
-
@JvmStatic
|
|
57
|
-
private fun fromCpp(width: Double, height: Double, scale: Double): WindowInformation {
|
|
58
|
-
return WindowInformation(width, height, scale)
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAndroidWindowInformationSpec.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 "HybridAndroidWindowInformationSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
11
|
-
|
|
12
|
-
void HybridAndroidWindowInformationSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("addWindowInformationListener", &HybridAndroidWindowInformationSpec::addWindowInformationListener);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridAndroidWindowInformationSpec.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
|
-
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
-
#include <NitroModules/HybridObject.hpp>
|
|
12
|
-
#else
|
|
13
|
-
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
-
#endif
|
|
15
|
-
|
|
16
|
-
// Forward declaration of `WindowInformation` to properly resolve imports.
|
|
17
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WindowInformation; }
|
|
18
|
-
|
|
19
|
-
#include <functional>
|
|
20
|
-
#include <string>
|
|
21
|
-
#include "WindowInformation.hpp"
|
|
22
|
-
|
|
23
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
24
|
-
|
|
25
|
-
using namespace margelo::nitro;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* An abstract base class for `AndroidWindowInformation`
|
|
29
|
-
* Inherit this class to create instances of `HybridAndroidWindowInformationSpec` in C++.
|
|
30
|
-
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
31
|
-
* @example
|
|
32
|
-
* ```cpp
|
|
33
|
-
* class HybridAndroidWindowInformation: public HybridAndroidWindowInformationSpec {
|
|
34
|
-
* public:
|
|
35
|
-
* HybridAndroidWindowInformation(...): HybridObject(TAG) { ... }
|
|
36
|
-
* // ...
|
|
37
|
-
* };
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
class HybridAndroidWindowInformationSpec: public virtual HybridObject {
|
|
41
|
-
public:
|
|
42
|
-
// Constructor
|
|
43
|
-
explicit HybridAndroidWindowInformationSpec(): HybridObject(TAG) { }
|
|
44
|
-
|
|
45
|
-
// Destructor
|
|
46
|
-
~HybridAndroidWindowInformationSpec() override = default;
|
|
47
|
-
|
|
48
|
-
public:
|
|
49
|
-
// Properties
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
public:
|
|
53
|
-
// Methods
|
|
54
|
-
virtual std::function<void()> addWindowInformationListener(const std::string& moduleName, const std::function<void(const WindowInformation& /* window */)>& callback) = 0;
|
|
55
|
-
|
|
56
|
-
protected:
|
|
57
|
-
// Hybrid Setup
|
|
58
|
-
void loadHybridMethods() override;
|
|
59
|
-
|
|
60
|
-
protected:
|
|
61
|
-
// Tag for logging
|
|
62
|
-
static constexpr auto TAG = "AndroidWindowInformation";
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|