react-native-nitro-simple-toast 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/NitroSimpleToast.podspec +30 -0
- package/README.md +81 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +118 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/nitrosimpletoast/NitroSimpleToast.kt +66 -0
- package/android/src/main/java/com/margelo/nitro/nitrosimpletoast/NitroSimpleToastPackage.kt +26 -0
- package/ios/NitroSimpleToast.swift +60 -0
- package/lib/module/NitroSimpleToast.nitro.js +4 -0
- package/lib/module/NitroSimpleToast.nitro.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NitroSimpleToast.nitro.d.ts +33 -0
- package/lib/typescript/src/NitroSimpleToast.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JHybridNitroSimpleToastSpec.cpp +68 -0
- package/nitrogen/generated/android/c++/JHybridNitroSimpleToastSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JToastFrom.hpp +58 -0
- package/nitrogen/generated/android/c++/JToastHaptic.hpp +64 -0
- package/nitrogen/generated/android/c++/JToastOptions.hpp +88 -0
- package/nitrogen/generated/android/c++/JToastPreset.hpp +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/HybridNitroSimpleToastSpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastFrom.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastHaptic.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastOptions.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/ToastPreset.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrosimpletoast/nitrosimpletoastOnLoad.kt +35 -0
- package/nitrogen/generated/android/nitrosimpletoast+autolinking.cmake +81 -0
- package/nitrogen/generated/android/nitrosimpletoast+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitrosimpletoastOnLoad.cpp +54 -0
- package/nitrogen/generated/android/nitrosimpletoastOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroSimpleToast+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Bridge.hpp +152 -0
- package/nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Umbrella.hpp +57 -0
- package/nitrogen/generated/ios/NitroSimpleToastAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroSimpleToastAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroSimpleToastSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroSimpleToastSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/swift/HybridNitroSimpleToastSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNitroSimpleToastSpec_cxx.swift +137 -0
- package/nitrogen/generated/ios/swift/ToastFrom.swift +40 -0
- package/nitrogen/generated/ios/swift/ToastHaptic.swift +48 -0
- package/nitrogen/generated/ios/swift/ToastOptions.swift +116 -0
- package/nitrogen/generated/ios/swift/ToastPreset.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNitroSimpleToastSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNitroSimpleToastSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/ToastFrom.hpp +76 -0
- package/nitrogen/generated/shared/c++/ToastHaptic.hpp +84 -0
- package/nitrogen/generated/shared/c++/ToastOptions.hpp +116 -0
- package/nitrogen/generated/shared/c++/ToastPreset.hpp +80 -0
- package/package.json +174 -0
- package/src/NitroSimpleToast.nitro.ts +35 -0
- package/src/index.tsx +16 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// nitrosimpletoastOnLoad.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
|
+
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::nitrosimpletoast {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of nitrosimpletoast, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
|
+
* Example:
|
|
22
|
+
* ```cpp (cpp-adapter.cpp)
|
|
23
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all nitrosimpletoast HybridObjects
|
|
26
|
+
* margelo::nitro::nitrosimpletoast::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::nitrosimpletoast
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroSimpleToast+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroSimpleToast+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroSimpleToast is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroSimpleToast-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimpleToast-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "NitroSimpleToast-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridNitroSimpleToastSpecSwift.hpp"
|
|
12
|
+
#include "NitroSimpleToast-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitrosimpletoast::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::shared_ptr<HybridNitroSimpleToastSpec>
|
|
18
|
+
std::shared_ptr<HybridNitroSimpleToastSpec> create_std__shared_ptr_HybridNitroSimpleToastSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
19
|
+
NitroSimpleToast::HybridNitroSimpleToastSpec_cxx swiftPart = NitroSimpleToast::HybridNitroSimpleToastSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
20
|
+
return std::make_shared<margelo::nitro::nitrosimpletoast::HybridNitroSimpleToastSpecSwift>(swiftPart);
|
|
21
|
+
}
|
|
22
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroSimpleToastSpec_(std__shared_ptr_HybridNitroSimpleToastSpec_ cppType) {
|
|
23
|
+
std::shared_ptr<margelo::nitro::nitrosimpletoast::HybridNitroSimpleToastSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nitrosimpletoast::HybridNitroSimpleToastSpecSwift>(cppType);
|
|
24
|
+
#ifdef NITRO_DEBUG
|
|
25
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("Class \"HybridNitroSimpleToastSpec\" is not implemented in Swift!");
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
NitroSimpleToast::HybridNitroSimpleToastSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
30
|
+
return swiftPart.toUnsafe();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::nitrosimpletoast::bridge::swift
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimpleToast-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridNitroSimpleToastSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitrosimpletoast { class HybridNitroSimpleToastSpec; }
|
|
13
|
+
// Forward declaration of `ToastFrom` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastFrom; }
|
|
15
|
+
// Forward declaration of `ToastHaptic` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastHaptic; }
|
|
17
|
+
// Forward declaration of `ToastPreset` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastPreset; }
|
|
19
|
+
|
|
20
|
+
// Forward declarations of Swift defined types
|
|
21
|
+
// Forward declaration of `HybridNitroSimpleToastSpec_cxx` to properly resolve imports.
|
|
22
|
+
namespace NitroSimpleToast { class HybridNitroSimpleToastSpec_cxx; }
|
|
23
|
+
|
|
24
|
+
// Include C++ defined types
|
|
25
|
+
#include "HybridNitroSimpleToastSpec.hpp"
|
|
26
|
+
#include "ToastFrom.hpp"
|
|
27
|
+
#include "ToastHaptic.hpp"
|
|
28
|
+
#include "ToastPreset.hpp"
|
|
29
|
+
#include <NitroModules/Result.hpp>
|
|
30
|
+
#include <exception>
|
|
31
|
+
#include <memory>
|
|
32
|
+
#include <optional>
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
37
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
38
|
+
*/
|
|
39
|
+
namespace margelo::nitro::nitrosimpletoast::bridge::swift {
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::optional<std::string>
|
|
42
|
+
/**
|
|
43
|
+
* Specialized version of `std::optional<std::string>`.
|
|
44
|
+
*/
|
|
45
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
46
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
47
|
+
return std::optional<std::string>(value);
|
|
48
|
+
}
|
|
49
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
50
|
+
return optional.has_value();
|
|
51
|
+
}
|
|
52
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
53
|
+
return optional.value();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// pragma MARK: std::optional<ToastPreset>
|
|
57
|
+
/**
|
|
58
|
+
* Specialized version of `std::optional<ToastPreset>`.
|
|
59
|
+
*/
|
|
60
|
+
using std__optional_ToastPreset_ = std::optional<ToastPreset>;
|
|
61
|
+
inline std::optional<ToastPreset> create_std__optional_ToastPreset_(const ToastPreset& value) noexcept {
|
|
62
|
+
return std::optional<ToastPreset>(value);
|
|
63
|
+
}
|
|
64
|
+
inline bool has_value_std__optional_ToastPreset_(const std::optional<ToastPreset>& optional) noexcept {
|
|
65
|
+
return optional.has_value();
|
|
66
|
+
}
|
|
67
|
+
inline ToastPreset get_std__optional_ToastPreset_(const std::optional<ToastPreset>& optional) noexcept {
|
|
68
|
+
return optional.value();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::optional<double>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::optional<double>`.
|
|
74
|
+
*/
|
|
75
|
+
using std__optional_double_ = std::optional<double>;
|
|
76
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
77
|
+
return std::optional<double>(value);
|
|
78
|
+
}
|
|
79
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
80
|
+
return optional.has_value();
|
|
81
|
+
}
|
|
82
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
83
|
+
return optional.value();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// pragma MARK: std::optional<ToastHaptic>
|
|
87
|
+
/**
|
|
88
|
+
* Specialized version of `std::optional<ToastHaptic>`.
|
|
89
|
+
*/
|
|
90
|
+
using std__optional_ToastHaptic_ = std::optional<ToastHaptic>;
|
|
91
|
+
inline std::optional<ToastHaptic> create_std__optional_ToastHaptic_(const ToastHaptic& value) noexcept {
|
|
92
|
+
return std::optional<ToastHaptic>(value);
|
|
93
|
+
}
|
|
94
|
+
inline bool has_value_std__optional_ToastHaptic_(const std::optional<ToastHaptic>& optional) noexcept {
|
|
95
|
+
return optional.has_value();
|
|
96
|
+
}
|
|
97
|
+
inline ToastHaptic get_std__optional_ToastHaptic_(const std::optional<ToastHaptic>& optional) noexcept {
|
|
98
|
+
return optional.value();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// pragma MARK: std::optional<bool>
|
|
102
|
+
/**
|
|
103
|
+
* Specialized version of `std::optional<bool>`.
|
|
104
|
+
*/
|
|
105
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
106
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
107
|
+
return std::optional<bool>(value);
|
|
108
|
+
}
|
|
109
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
110
|
+
return optional.has_value();
|
|
111
|
+
}
|
|
112
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
113
|
+
return optional.value();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// pragma MARK: std::optional<ToastFrom>
|
|
117
|
+
/**
|
|
118
|
+
* Specialized version of `std::optional<ToastFrom>`.
|
|
119
|
+
*/
|
|
120
|
+
using std__optional_ToastFrom_ = std::optional<ToastFrom>;
|
|
121
|
+
inline std::optional<ToastFrom> create_std__optional_ToastFrom_(const ToastFrom& value) noexcept {
|
|
122
|
+
return std::optional<ToastFrom>(value);
|
|
123
|
+
}
|
|
124
|
+
inline bool has_value_std__optional_ToastFrom_(const std::optional<ToastFrom>& optional) noexcept {
|
|
125
|
+
return optional.has_value();
|
|
126
|
+
}
|
|
127
|
+
inline ToastFrom get_std__optional_ToastFrom_(const std::optional<ToastFrom>& optional) noexcept {
|
|
128
|
+
return optional.value();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// pragma MARK: std::shared_ptr<HybridNitroSimpleToastSpec>
|
|
132
|
+
/**
|
|
133
|
+
* Specialized version of `std::shared_ptr<HybridNitroSimpleToastSpec>`.
|
|
134
|
+
*/
|
|
135
|
+
using std__shared_ptr_HybridNitroSimpleToastSpec_ = std::shared_ptr<HybridNitroSimpleToastSpec>;
|
|
136
|
+
std::shared_ptr<HybridNitroSimpleToastSpec> create_std__shared_ptr_HybridNitroSimpleToastSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
137
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroSimpleToastSpec_(std__shared_ptr_HybridNitroSimpleToastSpec_ cppType);
|
|
138
|
+
|
|
139
|
+
// pragma MARK: std::weak_ptr<HybridNitroSimpleToastSpec>
|
|
140
|
+
using std__weak_ptr_HybridNitroSimpleToastSpec_ = std::weak_ptr<HybridNitroSimpleToastSpec>;
|
|
141
|
+
inline std__weak_ptr_HybridNitroSimpleToastSpec_ weakify_std__shared_ptr_HybridNitroSimpleToastSpec_(const std::shared_ptr<HybridNitroSimpleToastSpec>& strong) noexcept { return strong; }
|
|
142
|
+
|
|
143
|
+
// pragma MARK: Result<void>
|
|
144
|
+
using Result_void_ = Result<void>;
|
|
145
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
146
|
+
return Result<void>::withValue();
|
|
147
|
+
}
|
|
148
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
149
|
+
return Result<void>::withError(error);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
} // namespace margelo::nitro::nitrosimpletoast::bridge::swift
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimpleToast-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridNitroSimpleToastSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitrosimpletoast { class HybridNitroSimpleToastSpec; }
|
|
13
|
+
// Forward declaration of `ToastFrom` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastFrom; }
|
|
15
|
+
// Forward declaration of `ToastHaptic` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastHaptic; }
|
|
17
|
+
// Forward declaration of `ToastOptions` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrosimpletoast { struct ToastOptions; }
|
|
19
|
+
// Forward declaration of `ToastPreset` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastPreset; }
|
|
21
|
+
|
|
22
|
+
// Include C++ defined types
|
|
23
|
+
#include "HybridNitroSimpleToastSpec.hpp"
|
|
24
|
+
#include "ToastFrom.hpp"
|
|
25
|
+
#include "ToastHaptic.hpp"
|
|
26
|
+
#include "ToastOptions.hpp"
|
|
27
|
+
#include "ToastPreset.hpp"
|
|
28
|
+
#include <NitroModules/Result.hpp>
|
|
29
|
+
#include <exception>
|
|
30
|
+
#include <memory>
|
|
31
|
+
#include <optional>
|
|
32
|
+
#include <string>
|
|
33
|
+
|
|
34
|
+
// C++ helpers for Swift
|
|
35
|
+
#include "NitroSimpleToast-Swift-Cxx-Bridge.hpp"
|
|
36
|
+
|
|
37
|
+
// Common C++ types used in Swift
|
|
38
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
39
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
40
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
41
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
42
|
+
|
|
43
|
+
// Forward declarations of Swift defined types
|
|
44
|
+
// Forward declaration of `HybridNitroSimpleToastSpec_cxx` to properly resolve imports.
|
|
45
|
+
namespace NitroSimpleToast { class HybridNitroSimpleToastSpec_cxx; }
|
|
46
|
+
|
|
47
|
+
// Include Swift defined types
|
|
48
|
+
#if __has_include("NitroSimpleToast-Swift.h")
|
|
49
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
50
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroSimpleToast".
|
|
51
|
+
#include "NitroSimpleToast-Swift.h"
|
|
52
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
53
|
+
#elif __has_include(<NitroSimpleToast/NitroSimpleToast-Swift.h>)
|
|
54
|
+
#include <NitroSimpleToast/NitroSimpleToast-Swift.h>
|
|
55
|
+
#else
|
|
56
|
+
#error NitroSimpleToast's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroSimpleToast", and try building the app first.
|
|
57
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimpleToastAutolinking.mm
|
|
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
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NitroSimpleToast-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridNitroSimpleToastSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroSimpleToastAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroSimpleToastAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::nitrosimpletoast;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NitroSimpleToast",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridNitroSimpleToastSpec> hybridObject = NitroSimpleToast::NitroSimpleToastAutolinking::createNitroSimpleToast();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimpleToastAutolinking.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroSimpleToastAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.nitrosimpletoast.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createNitroSimpleToast() -> bridge.std__shared_ptr_HybridNitroSimpleToastSpec_ {
|
|
16
|
+
let hybridObject = NitroSimpleToast()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridNitroSimpleToastSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isNitroSimpleToastRecyclable() -> Bool {
|
|
24
|
+
return NitroSimpleToast.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroSimpleToastSpecSwift.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 "HybridNitroSimpleToastSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrosimpletoast {
|
|
11
|
+
} // namespace margelo::nitro::nitrosimpletoast
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroSimpleToastSpecSwift.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 "HybridNitroSimpleToastSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNitroSimpleToastSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroSimpleToast { class HybridNitroSimpleToastSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `ToastOptions` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrosimpletoast { struct ToastOptions; }
|
|
17
|
+
// Forward declaration of `ToastPreset` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastPreset; }
|
|
19
|
+
// Forward declaration of `ToastHaptic` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastHaptic; }
|
|
21
|
+
// Forward declaration of `ToastFrom` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrosimpletoast { enum class ToastFrom; }
|
|
23
|
+
|
|
24
|
+
#include "ToastOptions.hpp"
|
|
25
|
+
#include <string>
|
|
26
|
+
#include <optional>
|
|
27
|
+
#include "ToastPreset.hpp"
|
|
28
|
+
#include "ToastHaptic.hpp"
|
|
29
|
+
#include "ToastFrom.hpp"
|
|
30
|
+
|
|
31
|
+
#include "NitroSimpleToast-Swift-Cxx-Umbrella.hpp"
|
|
32
|
+
|
|
33
|
+
namespace margelo::nitro::nitrosimpletoast {
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The C++ part of HybridNitroSimpleToastSpec_cxx.swift.
|
|
37
|
+
*
|
|
38
|
+
* HybridNitroSimpleToastSpecSwift (C++) accesses HybridNitroSimpleToastSpec_cxx (Swift), and might
|
|
39
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
40
|
+
*
|
|
41
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
42
|
+
* the future, HybridNitroSimpleToastSpec_cxx can directly inherit from the C++ class HybridNitroSimpleToastSpec
|
|
43
|
+
* to simplify the whole structure and memory management.
|
|
44
|
+
*/
|
|
45
|
+
class HybridNitroSimpleToastSpecSwift: public virtual HybridNitroSimpleToastSpec {
|
|
46
|
+
public:
|
|
47
|
+
// Constructor from a Swift instance
|
|
48
|
+
explicit HybridNitroSimpleToastSpecSwift(const NitroSimpleToast::HybridNitroSimpleToastSpec_cxx& swiftPart):
|
|
49
|
+
HybridObject(HybridNitroSimpleToastSpec::TAG),
|
|
50
|
+
_swiftPart(swiftPart) { }
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Get the Swift part
|
|
54
|
+
inline NitroSimpleToast::HybridNitroSimpleToastSpec_cxx& getSwiftPart() noexcept {
|
|
55
|
+
return _swiftPart;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
60
|
+
return _swiftPart.getMemorySize();
|
|
61
|
+
}
|
|
62
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
63
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroSimpleToastSpecSwift>(other)) {
|
|
64
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
void dispose() noexcept override {
|
|
69
|
+
_swiftPart.dispose();
|
|
70
|
+
}
|
|
71
|
+
std::string toString() override {
|
|
72
|
+
return _swiftPart.toString();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public:
|
|
76
|
+
// Properties
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
public:
|
|
80
|
+
// Methods
|
|
81
|
+
inline void show(const ToastOptions& options) override {
|
|
82
|
+
auto __result = _swiftPart.show(std::forward<decltype(options)>(options));
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private:
|
|
89
|
+
NitroSimpleToast::HybridNitroSimpleToastSpec_cxx _swiftPart;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro::nitrosimpletoast
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroSimpleToastSpec.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridNitroSimpleToastSpec``
|
|
11
|
+
public protocol HybridNitroSimpleToastSpec_protocol: HybridObject {
|
|
12
|
+
// Properties
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
func show(options: ToastOptions) throws -> Void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public extension HybridNitroSimpleToastSpec_protocol {
|
|
20
|
+
/// Default implementation of ``HybridObject.toString``
|
|
21
|
+
func toString() -> String {
|
|
22
|
+
return "[HybridObject NitroSimpleToast]"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// See ``HybridNitroSimpleToastSpec``
|
|
27
|
+
open class HybridNitroSimpleToastSpec_base {
|
|
28
|
+
private weak var cxxWrapper: HybridNitroSimpleToastSpec_cxx? = nil
|
|
29
|
+
public init() { }
|
|
30
|
+
public func getCxxWrapper() -> HybridNitroSimpleToastSpec_cxx {
|
|
31
|
+
#if DEBUG
|
|
32
|
+
guard self is any HybridNitroSimpleToastSpec else {
|
|
33
|
+
fatalError("`self` is not a `HybridNitroSimpleToastSpec`! Did you accidentally inherit from `HybridNitroSimpleToastSpec_base` instead of `HybridNitroSimpleToastSpec`?")
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
37
|
+
return cxxWrapper
|
|
38
|
+
} else {
|
|
39
|
+
let cxxWrapper = HybridNitroSimpleToastSpec_cxx(self as! any HybridNitroSimpleToastSpec)
|
|
40
|
+
self.cxxWrapper = cxxWrapper
|
|
41
|
+
return cxxWrapper
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A Swift base-protocol representing the NitroSimpleToast HybridObject.
|
|
48
|
+
* Implement this protocol to create Swift-based instances of NitroSimpleToast.
|
|
49
|
+
* ```swift
|
|
50
|
+
* class HybridNitroSimpleToast : HybridNitroSimpleToastSpec {
|
|
51
|
+
* // ...
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
public typealias HybridNitroSimpleToastSpec = HybridNitroSimpleToastSpec_protocol & HybridNitroSimpleToastSpec_base
|