aix 0.6.0 → 0.6.2
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 +269 -70
- package/ios/EditMenuDefaultActions.swift +70 -0
- package/ios/HybridAix.swift +28 -3
- package/ios/HybridAixCellView.swift +1 -1
- package/ios/HybridAixComposer.swift +82 -0
- package/ios/HybridAixDropzone.swift +104 -0
- package/ios/HybridAixInputWrapper.swift +447 -0
- package/ios/InputType.swift +40 -0
- package/ios/PasteFileManager.swift +92 -0
- package/nitro.json +8 -0
- package/nitrogen/generated/android/Aix+autolinking.cmake +8 -0
- package/nitrogen/generated/android/AixOnLoad.cpp +26 -0
- package/nitrogen/generated/android/c++/JAixInputWrapperOnPasteEvent.hpp +70 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp +98 -0
- package/nitrogen/generated/android/c++/JHybridAixComposerSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridAixComposerSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridAixDropzoneSpec.cpp +72 -0
- package/nitrogen/generated/android/c++/JHybridAixDropzoneSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.cpp +144 -0
- package/nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.hpp +74 -0
- package/nitrogen/generated/android/c++/views/JHybridAixComposerStateUpdater.cpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.cpp +56 -0
- package/nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.cpp +72 -0
- package/nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/AixInputWrapperOnPasteEvent.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/Func_void_std__vector_AixInputWrapperOnPasteEvent_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixComposerSpec.kt +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixDropzoneSpec.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixInputWrapperSpec.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixDropzoneManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixDropzoneStateUpdater.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixInputWrapperManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixInputWrapperStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.cpp +42 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.hpp +112 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Umbrella.hpp +14 -0
- package/nitrogen/generated/ios/AixAutolinking.mm +16 -0
- package/nitrogen/generated/ios/AixAutolinking.swift +30 -0
- package/nitrogen/generated/ios/c++/HybridAixComposerSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/HybridAixDropzoneSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAixDropzoneSpecSwift.hpp +80 -0
- package/nitrogen/generated/ios/c++/HybridAixInputWrapperSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAixInputWrapperSpecSwift.hpp +108 -0
- package/nitrogen/generated/ios/c++/views/HybridAixComposerComponent.mm +5 -0
- package/nitrogen/generated/ios/c++/views/HybridAixDropzoneComponent.mm +96 -0
- package/nitrogen/generated/ios/c++/views/HybridAixInputWrapperComponent.mm +116 -0
- package/nitrogen/generated/ios/swift/AixInputWrapperOnPasteEvent.swift +107 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_AixInputWrapperOnPasteEvent_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridAixComposerSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridAixComposerSpec_cxx.swift +24 -0
- package/nitrogen/generated/ios/swift/HybridAixDropzoneSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridAixDropzoneSpec_cxx.swift +167 -0
- package/nitrogen/generated/ios/swift/HybridAixInputWrapperSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridAixInputWrapperSpec_cxx.swift +261 -0
- package/nitrogen/generated/shared/c++/AixInputWrapperOnPasteEvent.hpp +88 -0
- package/nitrogen/generated/shared/c++/HybridAixComposerSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixComposerSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixDropzoneSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridAixDropzoneSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComposerComponent.cpp +12 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComposerComponent.hpp +1 -0
- package/nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.cpp +87 -0
- package/nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.hpp +109 -0
- package/nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.cpp +135 -0
- package/nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.hpp +114 -0
- package/nitrogen/generated/shared/json/AixComposerConfig.json +1 -0
- package/nitrogen/generated/shared/json/AixDropzoneConfig.json +10 -0
- package/nitrogen/generated/shared/json/AixInputWrapperConfig.json +14 -0
- package/package.json +1 -1
- package/src/dropzone.ios.tsx +27 -0
- package/src/dropzone.tsx +10 -0
- package/src/index.ts +3 -0
- package/src/input-wrapper.ios.tsx +30 -0
- package/src/input-wrapper.tsx +17 -0
- package/src/views/aix.nitro.ts +33 -19
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
enum PasteFileManager {
|
|
4
|
+
|
|
5
|
+
private static let pasteDir: URL = {
|
|
6
|
+
let tmp = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
|
|
7
|
+
return tmp.appendingPathComponent("paste", isDirectory: true)
|
|
8
|
+
}()
|
|
9
|
+
|
|
10
|
+
/// Maximum age for paste files before cleanup (1 hour).
|
|
11
|
+
private static let maxFileAge: TimeInterval = 3600
|
|
12
|
+
|
|
13
|
+
static func save(image: UIImage) throws -> String {
|
|
14
|
+
let data: Data
|
|
15
|
+
let ext: String
|
|
16
|
+
if let png = image.pngData() {
|
|
17
|
+
data = png
|
|
18
|
+
ext = "png"
|
|
19
|
+
} else if let jpg = image.jpegData(compressionQuality: 0.9) {
|
|
20
|
+
data = jpg
|
|
21
|
+
ext = "jpg"
|
|
22
|
+
} else {
|
|
23
|
+
throw NSError(
|
|
24
|
+
domain: "SaveImageError",
|
|
25
|
+
code: 3,
|
|
26
|
+
userInfo: [NSLocalizedDescriptionKey: "Failed to encode image as PNG or JPEG"]
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return try writeToDir(data: data, fileExtension: ext)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static func save(text: String) throws -> String {
|
|
34
|
+
guard let data = text.data(using: .utf8) else {
|
|
35
|
+
throw NSError(
|
|
36
|
+
domain: "SaveTextError",
|
|
37
|
+
code: 1,
|
|
38
|
+
userInfo: [NSLocalizedDescriptionKey: "Failed to encode text as UTF-8"]
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return try writeToDir(data: data, fileExtension: "txt")
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static func save(data: Data, fileExtension: String) throws -> String {
|
|
46
|
+
let sanitizedExt = fileExtension.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
47
|
+
return try writeToDir(data: data, fileExtension: sanitizedExt)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// MARK: - Cleanup
|
|
51
|
+
|
|
52
|
+
/// Removes paste files older than `maxFileAge`.
|
|
53
|
+
static func cleanupOldFiles() {
|
|
54
|
+
let fileManager = FileManager.default
|
|
55
|
+
guard let contents = try? fileManager.contentsOfDirectory(
|
|
56
|
+
at: pasteDir,
|
|
57
|
+
includingPropertiesForKeys: [.creationDateKey],
|
|
58
|
+
options: .skipsHiddenFiles
|
|
59
|
+
) else { return }
|
|
60
|
+
|
|
61
|
+
let cutoff = Date().addingTimeInterval(-maxFileAge)
|
|
62
|
+
var removed = 0
|
|
63
|
+
|
|
64
|
+
for fileURL in contents {
|
|
65
|
+
guard let attrs = try? fileURL.resourceValues(forKeys: [.creationDateKey]),
|
|
66
|
+
let created = attrs.creationDate,
|
|
67
|
+
created < cutoff else { continue }
|
|
68
|
+
try? fileManager.removeItem(at: fileURL)
|
|
69
|
+
removed += 1
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if removed > 0 {
|
|
73
|
+
print("[PasteFileManager] Cleaned up \(removed) old paste file(s)")
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// MARK: - Private
|
|
78
|
+
private static func writeToDir(data: Data, fileExtension: String) throws -> String {
|
|
79
|
+
let fileManager = FileManager.default
|
|
80
|
+
|
|
81
|
+
if !fileManager.fileExists(atPath: pasteDir.path) {
|
|
82
|
+
try fileManager.createDirectory(at: pasteDir, withIntermediateDirectories: true, attributes: nil)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let fileName = UUID().uuidString + "." + fileExtension
|
|
86
|
+
let fileURL = pasteDir.appendingPathComponent(fileName)
|
|
87
|
+
|
|
88
|
+
try data.write(to: fileURL, options: .atomic)
|
|
89
|
+
|
|
90
|
+
return fileURL.path
|
|
91
|
+
}
|
|
92
|
+
}
|
package/nitro.json
CHANGED
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
"AixComposer": {
|
|
21
21
|
"swift": "HybridAixComposer",
|
|
22
22
|
"kotlin": "HybridAixComposer"
|
|
23
|
+
},
|
|
24
|
+
"AixInputWrapper": {
|
|
25
|
+
"swift": "HybridAixInputWrapper",
|
|
26
|
+
"kotlin": "HybridAixInputWrapper"
|
|
27
|
+
},
|
|
28
|
+
"AixDropzone": {
|
|
29
|
+
"swift": "HybridAixDropzone",
|
|
30
|
+
"kotlin": "HybridAixDropzone"
|
|
23
31
|
}
|
|
24
32
|
},
|
|
25
33
|
"ignorePaths": ["**/node_modules"]
|
|
@@ -39,6 +39,10 @@ target_sources(
|
|
|
39
39
|
../nitrogen/generated/shared/c++/views/HybridAixCellViewComponent.cpp
|
|
40
40
|
../nitrogen/generated/shared/c++/HybridAixComposerSpec.cpp
|
|
41
41
|
../nitrogen/generated/shared/c++/views/HybridAixComposerComponent.cpp
|
|
42
|
+
../nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.cpp
|
|
43
|
+
../nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.cpp
|
|
44
|
+
../nitrogen/generated/shared/c++/HybridAixDropzoneSpec.cpp
|
|
45
|
+
../nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.cpp
|
|
42
46
|
# Android-specific Nitrogen C++ sources
|
|
43
47
|
../nitrogen/generated/android/c++/JHybridAixSpec.cpp
|
|
44
48
|
../nitrogen/generated/android/c++/views/JHybridAixStateUpdater.cpp
|
|
@@ -46,6 +50,10 @@ target_sources(
|
|
|
46
50
|
../nitrogen/generated/android/c++/views/JHybridAixCellViewStateUpdater.cpp
|
|
47
51
|
../nitrogen/generated/android/c++/JHybridAixComposerSpec.cpp
|
|
48
52
|
../nitrogen/generated/android/c++/views/JHybridAixComposerStateUpdater.cpp
|
|
53
|
+
../nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.cpp
|
|
54
|
+
../nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.cpp
|
|
55
|
+
../nitrogen/generated/android/c++/JHybridAixDropzoneSpec.cpp
|
|
56
|
+
../nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.cpp
|
|
49
57
|
)
|
|
50
58
|
|
|
51
59
|
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
#include "views/JHybridAixCellViewStateUpdater.hpp"
|
|
24
24
|
#include "JHybridAixComposerSpec.hpp"
|
|
25
25
|
#include "views/JHybridAixComposerStateUpdater.hpp"
|
|
26
|
+
#include "JHybridAixInputWrapperSpec.hpp"
|
|
27
|
+
#include "JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp"
|
|
28
|
+
#include "views/JHybridAixInputWrapperStateUpdater.hpp"
|
|
29
|
+
#include "JHybridAixDropzoneSpec.hpp"
|
|
30
|
+
#include "views/JHybridAixDropzoneStateUpdater.hpp"
|
|
26
31
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
27
32
|
|
|
28
33
|
namespace margelo::nitro::aix {
|
|
@@ -42,6 +47,11 @@ int initialize(JavaVM* vm) {
|
|
|
42
47
|
margelo::nitro::aix::views::JHybridAixCellViewStateUpdater::registerNatives();
|
|
43
48
|
margelo::nitro::aix::JHybridAixComposerSpec::registerNatives();
|
|
44
49
|
margelo::nitro::aix::views::JHybridAixComposerStateUpdater::registerNatives();
|
|
50
|
+
margelo::nitro::aix::JHybridAixInputWrapperSpec::registerNatives();
|
|
51
|
+
margelo::nitro::aix::JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::registerNatives();
|
|
52
|
+
margelo::nitro::aix::views::JHybridAixInputWrapperStateUpdater::registerNatives();
|
|
53
|
+
margelo::nitro::aix::JHybridAixDropzoneSpec::registerNatives();
|
|
54
|
+
margelo::nitro::aix::views::JHybridAixDropzoneStateUpdater::registerNatives();
|
|
45
55
|
|
|
46
56
|
// Register Nitro Hybrid Objects
|
|
47
57
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
@@ -68,6 +78,22 @@ int initialize(JavaVM* vm) {
|
|
|
68
78
|
return instance->cthis()->shared();
|
|
69
79
|
}
|
|
70
80
|
);
|
|
81
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
82
|
+
"AixInputWrapper",
|
|
83
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
84
|
+
static DefaultConstructableObject<JHybridAixInputWrapperSpec::javaobject> object("com/aix/HybridAixInputWrapper");
|
|
85
|
+
auto instance = object.create();
|
|
86
|
+
return instance->cthis()->shared();
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
90
|
+
"AixDropzone",
|
|
91
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
92
|
+
static DefaultConstructableObject<JHybridAixDropzoneSpec::javaobject> object("com/aix/HybridAixDropzone");
|
|
93
|
+
auto instance = object.create();
|
|
94
|
+
return instance->cthis()->shared();
|
|
95
|
+
}
|
|
96
|
+
);
|
|
71
97
|
});
|
|
72
98
|
}
|
|
73
99
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JAixInputWrapperOnPasteEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "AixInputWrapperOnPasteEvent.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::aix {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "AixInputWrapperOnPasteEvent" and the the Kotlin data class "AixInputWrapperOnPasteEvent".
|
|
22
|
+
*/
|
|
23
|
+
struct JAixInputWrapperOnPasteEvent final: public jni::JavaClass<JAixInputWrapperOnPasteEvent> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/aix/AixInputWrapperOnPasteEvent;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct AixInputWrapperOnPasteEvent by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
AixInputWrapperOnPasteEvent toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldType = clazz->getField<jni::JString>("type");
|
|
36
|
+
jni::local_ref<jni::JString> type = this->getFieldValue(fieldType);
|
|
37
|
+
static const auto fieldFilePath = clazz->getField<jni::JString>("filePath");
|
|
38
|
+
jni::local_ref<jni::JString> filePath = this->getFieldValue(fieldFilePath);
|
|
39
|
+
static const auto fieldFileExtension = clazz->getField<jni::JString>("fileExtension");
|
|
40
|
+
jni::local_ref<jni::JString> fileExtension = this->getFieldValue(fieldFileExtension);
|
|
41
|
+
static const auto fieldFileName = clazz->getField<jni::JString>("fileName");
|
|
42
|
+
jni::local_ref<jni::JString> fileName = this->getFieldValue(fieldFileName);
|
|
43
|
+
return AixInputWrapperOnPasteEvent(
|
|
44
|
+
type->toStdString(),
|
|
45
|
+
filePath->toStdString(),
|
|
46
|
+
fileExtension != nullptr ? std::make_optional(fileExtension->toStdString()) : std::nullopt,
|
|
47
|
+
fileName != nullptr ? std::make_optional(fileName->toStdString()) : std::nullopt
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
/**
|
|
53
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
54
|
+
*/
|
|
55
|
+
[[maybe_unused]]
|
|
56
|
+
static jni::local_ref<JAixInputWrapperOnPasteEvent::javaobject> fromCpp(const AixInputWrapperOnPasteEvent& value) {
|
|
57
|
+
using JSignature = JAixInputWrapperOnPasteEvent(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>);
|
|
58
|
+
static const auto clazz = javaClassStatic();
|
|
59
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
60
|
+
return create(
|
|
61
|
+
clazz,
|
|
62
|
+
jni::make_jstring(value.type),
|
|
63
|
+
jni::make_jstring(value.filePath),
|
|
64
|
+
value.fileExtension.has_value() ? jni::make_jstring(value.fileExtension.value()) : nullptr,
|
|
65
|
+
value.fileName.has_value() ? jni::make_jstring(value.fileName.value()) : nullptr
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::aix
|
package/nitrogen/generated/android/c++/JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include "AixInputWrapperOnPasteEvent.hpp"
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
|
+
#include "JAixInputWrapperOnPasteEvent.hpp"
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <optional>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::aix {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Represents the Java/Kotlin callback `(events: Array<AixInputWrapperOnPasteEvent>) -> Unit`.
|
|
27
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
28
|
+
*/
|
|
29
|
+
struct JFunc_void_std__vector_AixInputWrapperOnPasteEvent_: public jni::JavaClass<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_> {
|
|
30
|
+
public:
|
|
31
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/aix/Func_void_std__vector_AixInputWrapperOnPasteEvent_;";
|
|
32
|
+
|
|
33
|
+
public:
|
|
34
|
+
/**
|
|
35
|
+
* Invokes the function this `JFunc_void_std__vector_AixInputWrapperOnPasteEvent_` instance holds through JNI.
|
|
36
|
+
*/
|
|
37
|
+
void invoke(const std::vector<AixInputWrapperOnPasteEvent>& events) const {
|
|
38
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JAixInputWrapperOnPasteEvent>> /* events */)>("invoke");
|
|
39
|
+
method(self(), [&]() {
|
|
40
|
+
size_t __size = events.size();
|
|
41
|
+
jni::local_ref<jni::JArrayClass<JAixInputWrapperOnPasteEvent>> __array = jni::JArrayClass<JAixInputWrapperOnPasteEvent>::newArray(__size);
|
|
42
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
43
|
+
const auto& __element = events[__i];
|
|
44
|
+
auto __elementJni = JAixInputWrapperOnPasteEvent::fromCpp(__element);
|
|
45
|
+
__array->setElement(__i, *__elementJni);
|
|
46
|
+
}
|
|
47
|
+
return __array;
|
|
48
|
+
}());
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An implementation of Func_void_std__vector_AixInputWrapperOnPasteEvent_ that is backed by a C++ implementation (using `std::function<...>`)
|
|
54
|
+
*/
|
|
55
|
+
class JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx final: public jni::HybridClass<JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx, JFunc_void_std__vector_AixInputWrapperOnPasteEvent_> {
|
|
56
|
+
public:
|
|
57
|
+
static jni::local_ref<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_::javaobject> fromCpp(const std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>& func) {
|
|
58
|
+
return JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::newObjectCxxArgs(func);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
/**
|
|
63
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx` instance holds.
|
|
64
|
+
*/
|
|
65
|
+
void invoke_cxx(jni::alias_ref<jni::JArrayClass<JAixInputWrapperOnPasteEvent>> events) {
|
|
66
|
+
_func([&]() {
|
|
67
|
+
size_t __size = events->size();
|
|
68
|
+
std::vector<AixInputWrapperOnPasteEvent> __vector;
|
|
69
|
+
__vector.reserve(__size);
|
|
70
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
71
|
+
auto __element = events->getElement(__i);
|
|
72
|
+
__vector.push_back(__element->toCpp());
|
|
73
|
+
}
|
|
74
|
+
return __vector;
|
|
75
|
+
}());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
[[nodiscard]]
|
|
80
|
+
inline const std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>& getFunction() const {
|
|
81
|
+
return _func;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public:
|
|
85
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/aix/Func_void_std__vector_AixInputWrapperOnPasteEvent__cxx;";
|
|
86
|
+
static void registerNatives() {
|
|
87
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::invoke_cxx)});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
explicit JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx(const std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>& func): _func(func) { }
|
|
92
|
+
|
|
93
|
+
private:
|
|
94
|
+
friend HybridBase;
|
|
95
|
+
std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)> _func;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
} // namespace margelo::nitro::aix
|
|
@@ -56,6 +56,15 @@ namespace margelo::nitro::aix {
|
|
|
56
56
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JAixStickToKeyboard> /* stickToKeyboard */)>("setStickToKeyboard");
|
|
57
57
|
method(_javaPart, stickToKeyboard.has_value() ? JAixStickToKeyboard::fromCpp(stickToKeyboard.value()) : nullptr);
|
|
58
58
|
}
|
|
59
|
+
std::optional<bool> JHybridAixComposerSpec::getFixInput() {
|
|
60
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getFixInput");
|
|
61
|
+
auto __result = method(_javaPart);
|
|
62
|
+
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
|
|
63
|
+
}
|
|
64
|
+
void JHybridAixComposerSpec::setFixInput(std::optional<bool> fixInput) {
|
|
65
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* fixInput */)>("setFixInput");
|
|
66
|
+
method(_javaPart, fixInput.has_value() ? jni::JBoolean::valueOf(fixInput.value()) : nullptr);
|
|
67
|
+
}
|
|
59
68
|
|
|
60
69
|
// Methods
|
|
61
70
|
|
|
@@ -52,6 +52,8 @@ namespace margelo::nitro::aix {
|
|
|
52
52
|
// Properties
|
|
53
53
|
std::optional<AixStickToKeyboard> getStickToKeyboard() override;
|
|
54
54
|
void setStickToKeyboard(const std::optional<AixStickToKeyboard>& stickToKeyboard) override;
|
|
55
|
+
std::optional<bool> getFixInput() override;
|
|
56
|
+
void setFixInput(std::optional<bool> fixInput) override;
|
|
55
57
|
|
|
56
58
|
public:
|
|
57
59
|
// Methods
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridAixDropzoneSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridAixDropzoneSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `AixInputWrapperOnPasteEvent` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::aix { struct AixInputWrapperOnPasteEvent; }
|
|
12
|
+
|
|
13
|
+
#include "AixInputWrapperOnPasteEvent.hpp"
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include <functional>
|
|
16
|
+
#include <optional>
|
|
17
|
+
#include "JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp"
|
|
18
|
+
#include <NitroModules/JNICallable.hpp>
|
|
19
|
+
#include "JAixInputWrapperOnPasteEvent.hpp"
|
|
20
|
+
#include <string>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::aix {
|
|
23
|
+
|
|
24
|
+
jni::local_ref<JHybridAixDropzoneSpec::jhybriddata> JHybridAixDropzoneSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
25
|
+
return makeCxxInstance(jThis);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void JHybridAixDropzoneSpec::registerNatives() {
|
|
29
|
+
registerHybrid({
|
|
30
|
+
makeNativeMethod("initHybrid", JHybridAixDropzoneSpec::initHybrid),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
size_t JHybridAixDropzoneSpec::getExternalMemorySize() noexcept {
|
|
35
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
36
|
+
return method(_javaPart);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void JHybridAixDropzoneSpec::dispose() noexcept {
|
|
40
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
41
|
+
method(_javaPart);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
std::string JHybridAixDropzoneSpec::toString() {
|
|
45
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
46
|
+
auto javaString = method(_javaPart);
|
|
47
|
+
return javaString->toStdString();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Properties
|
|
51
|
+
std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>> JHybridAixDropzoneSpec::getOnDrop() {
|
|
52
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_::javaobject>()>("getOnDrop_cxx");
|
|
53
|
+
auto __result = method(_javaPart);
|
|
54
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)> {
|
|
55
|
+
if (__result->isInstanceOf(JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::javaClassStatic())) [[likely]] {
|
|
56
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::javaobject>(__result);
|
|
57
|
+
return downcast->cthis()->getFunction();
|
|
58
|
+
} else {
|
|
59
|
+
auto __resultRef = jni::make_global(__result);
|
|
60
|
+
return JNICallable<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_, void(std::vector<AixInputWrapperOnPasteEvent>)>(std::move(__resultRef));
|
|
61
|
+
}
|
|
62
|
+
}()) : std::nullopt;
|
|
63
|
+
}
|
|
64
|
+
void JHybridAixDropzoneSpec::setOnDrop(const std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>& onDrop) {
|
|
65
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_::javaobject> /* onDrop */)>("setOnDrop_cxx");
|
|
66
|
+
method(_javaPart, onDrop.has_value() ? JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::fromCpp(onDrop.value()) : nullptr);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Methods
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
} // namespace margelo::nitro::aix
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixDropzoneSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridAixDropzoneSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::aix {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridAixDropzoneSpec: public jni::HybridClass<JHybridAixDropzoneSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridAixDropzoneSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/aix/HybridAixDropzoneSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridAixDropzoneSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridAixDropzoneSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridAixDropzoneSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
void dispose() noexcept override;
|
|
44
|
+
std::string toString() override;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridAixDropzoneSpec::javaobject>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>> getOnDrop() override;
|
|
54
|
+
void setOnDrop(const std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>& onDrop) override;
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
private:
|
|
61
|
+
friend HybridBase;
|
|
62
|
+
using HybridBase::HybridBase;
|
|
63
|
+
jni::global_ref<JHybridAixDropzoneSpec::javaobject> _javaPart;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::aix
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridAixInputWrapperSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridAixInputWrapperSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `AixInputWrapperOnPasteEvent` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::aix { struct AixInputWrapperOnPasteEvent; }
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <vector>
|
|
15
|
+
#include <optional>
|
|
16
|
+
#include "AixInputWrapperOnPasteEvent.hpp"
|
|
17
|
+
#include <functional>
|
|
18
|
+
#include "JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp"
|
|
19
|
+
#include <NitroModules/JNICallable.hpp>
|
|
20
|
+
#include "JAixInputWrapperOnPasteEvent.hpp"
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::aix {
|
|
23
|
+
|
|
24
|
+
jni::local_ref<JHybridAixInputWrapperSpec::jhybriddata> JHybridAixInputWrapperSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
25
|
+
return makeCxxInstance(jThis);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void JHybridAixInputWrapperSpec::registerNatives() {
|
|
29
|
+
registerHybrid({
|
|
30
|
+
makeNativeMethod("initHybrid", JHybridAixInputWrapperSpec::initHybrid),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
size_t JHybridAixInputWrapperSpec::getExternalMemorySize() noexcept {
|
|
35
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
36
|
+
return method(_javaPart);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void JHybridAixInputWrapperSpec::dispose() noexcept {
|
|
40
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
41
|
+
method(_javaPart);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
std::string JHybridAixInputWrapperSpec::toString() {
|
|
45
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
46
|
+
auto javaString = method(_javaPart);
|
|
47
|
+
return javaString->toStdString();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Properties
|
|
51
|
+
std::optional<std::vector<std::string>> JHybridAixInputWrapperSpec::getPasteConfiguration() {
|
|
52
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getPasteConfiguration");
|
|
53
|
+
auto __result = method(_javaPart);
|
|
54
|
+
return __result != nullptr ? std::make_optional([&]() {
|
|
55
|
+
size_t __size = __result->size();
|
|
56
|
+
std::vector<std::string> __vector;
|
|
57
|
+
__vector.reserve(__size);
|
|
58
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
59
|
+
auto __element = __result->getElement(__i);
|
|
60
|
+
__vector.push_back(__element->toStdString());
|
|
61
|
+
}
|
|
62
|
+
return __vector;
|
|
63
|
+
}()) : std::nullopt;
|
|
64
|
+
}
|
|
65
|
+
void JHybridAixInputWrapperSpec::setPasteConfiguration(const std::optional<std::vector<std::string>>& pasteConfiguration) {
|
|
66
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* pasteConfiguration */)>("setPasteConfiguration");
|
|
67
|
+
method(_javaPart, pasteConfiguration.has_value() ? [&]() {
|
|
68
|
+
size_t __size = pasteConfiguration.value().size();
|
|
69
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
70
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
71
|
+
const auto& __element = pasteConfiguration.value()[__i];
|
|
72
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
73
|
+
__array->setElement(__i, *__elementJni);
|
|
74
|
+
}
|
|
75
|
+
return __array;
|
|
76
|
+
}() : nullptr);
|
|
77
|
+
}
|
|
78
|
+
std::optional<std::vector<std::string>> JHybridAixInputWrapperSpec::getEditMenuDefaultActions() {
|
|
79
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getEditMenuDefaultActions");
|
|
80
|
+
auto __result = method(_javaPart);
|
|
81
|
+
return __result != nullptr ? std::make_optional([&]() {
|
|
82
|
+
size_t __size = __result->size();
|
|
83
|
+
std::vector<std::string> __vector;
|
|
84
|
+
__vector.reserve(__size);
|
|
85
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
86
|
+
auto __element = __result->getElement(__i);
|
|
87
|
+
__vector.push_back(__element->toStdString());
|
|
88
|
+
}
|
|
89
|
+
return __vector;
|
|
90
|
+
}()) : std::nullopt;
|
|
91
|
+
}
|
|
92
|
+
void JHybridAixInputWrapperSpec::setEditMenuDefaultActions(const std::optional<std::vector<std::string>>& editMenuDefaultActions) {
|
|
93
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* editMenuDefaultActions */)>("setEditMenuDefaultActions");
|
|
94
|
+
method(_javaPart, editMenuDefaultActions.has_value() ? [&]() {
|
|
95
|
+
size_t __size = editMenuDefaultActions.value().size();
|
|
96
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
97
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
98
|
+
const auto& __element = editMenuDefaultActions.value()[__i];
|
|
99
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
100
|
+
__array->setElement(__i, *__elementJni);
|
|
101
|
+
}
|
|
102
|
+
return __array;
|
|
103
|
+
}() : nullptr);
|
|
104
|
+
}
|
|
105
|
+
std::optional<double> JHybridAixInputWrapperSpec::getMaxLines() {
|
|
106
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMaxLines");
|
|
107
|
+
auto __result = method(_javaPart);
|
|
108
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
109
|
+
}
|
|
110
|
+
void JHybridAixInputWrapperSpec::setMaxLines(std::optional<double> maxLines) {
|
|
111
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* maxLines */)>("setMaxLines");
|
|
112
|
+
method(_javaPart, maxLines.has_value() ? jni::JDouble::valueOf(maxLines.value()) : nullptr);
|
|
113
|
+
}
|
|
114
|
+
std::optional<double> JHybridAixInputWrapperSpec::getMaxChars() {
|
|
115
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMaxChars");
|
|
116
|
+
auto __result = method(_javaPart);
|
|
117
|
+
return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
|
|
118
|
+
}
|
|
119
|
+
void JHybridAixInputWrapperSpec::setMaxChars(std::optional<double> maxChars) {
|
|
120
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* maxChars */)>("setMaxChars");
|
|
121
|
+
method(_javaPart, maxChars.has_value() ? jni::JDouble::valueOf(maxChars.value()) : nullptr);
|
|
122
|
+
}
|
|
123
|
+
std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>> JHybridAixInputWrapperSpec::getOnPaste() {
|
|
124
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_::javaobject>()>("getOnPaste_cxx");
|
|
125
|
+
auto __result = method(_javaPart);
|
|
126
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)> {
|
|
127
|
+
if (__result->isInstanceOf(JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::javaClassStatic())) [[likely]] {
|
|
128
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::javaobject>(__result);
|
|
129
|
+
return downcast->cthis()->getFunction();
|
|
130
|
+
} else {
|
|
131
|
+
auto __resultRef = jni::make_global(__result);
|
|
132
|
+
return JNICallable<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_, void(std::vector<AixInputWrapperOnPasteEvent>)>(std::move(__resultRef));
|
|
133
|
+
}
|
|
134
|
+
}()) : std::nullopt;
|
|
135
|
+
}
|
|
136
|
+
void JHybridAixInputWrapperSpec::setOnPaste(const std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>& onPaste) {
|
|
137
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__vector_AixInputWrapperOnPasteEvent_::javaobject> /* onPaste */)>("setOnPaste_cxx");
|
|
138
|
+
method(_javaPart, onPaste.has_value() ? JFunc_void_std__vector_AixInputWrapperOnPasteEvent__cxx::fromCpp(onPaste.value()) : nullptr);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Methods
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
} // namespace margelo::nitro::aix
|