@magicred-1/react-native-lxmf 0.2.15 → 0.2.16
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/jniLibs/arm64-v8a/liblxmf_rn.so +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/liblxmf_rn.so +0 -0
- package/android/src/main/jniLibs/x86_64/liblxmf_rn.so +0 -0
- package/android/src/main/kotlin/expo/modules/lxmf/LxmfModule.kt +6 -4
- package/build/LxmfModule.d.ts +1 -1
- package/build/useLxmf.d.ts +3 -0
- package/build/useLxmf.js +3 -1
- package/ios/LxmfModule.swift +6 -3
- package/ios/RustCore/liblxmf_rn.xcframework/Info.plist +5 -5
- package/ios/RustCore/liblxmf_rn.xcframework/ios-arm64/liblxmf_rn.a +0 -0
- package/ios/RustCore/liblxmf_rn.xcframework/ios-arm64_x86_64-simulator/liblxmf_rn.a +0 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -66,8 +66,9 @@ class LxmfModule : Module() {
|
|
|
66
66
|
|
|
67
67
|
AsyncFunction("start") { identityHex: String, lxmfAddressHex: String, mode: Int,
|
|
68
68
|
announceIntervalMs: Double, bleMtuHint: Int,
|
|
69
|
-
tcpInterfaces: List<Map<String, Any>>, displayName: String
|
|
70
|
-
|
|
69
|
+
tcpInterfaces: List<Map<String, Any>>, displayName: String,
|
|
70
|
+
isBeacon: Boolean ->
|
|
71
|
+
Log.d(TAG, "start() mode=$mode interfaces=$tcpInterfaces name=$displayName beacon=$isBeacon")
|
|
71
72
|
val interfacesJson = org.json.JSONArray(tcpInterfaces.map { iface ->
|
|
72
73
|
org.json.JSONObject().apply {
|
|
73
74
|
put("host", iface["host"] ?: "")
|
|
@@ -75,7 +76,7 @@ class LxmfModule : Module() {
|
|
|
75
76
|
}
|
|
76
77
|
}).toString()
|
|
77
78
|
val rc = nativeStart(identityHex, lxmfAddressHex, mode, announceIntervalMs.toLong(),
|
|
78
|
-
bleMtuHint.toShort(), interfacesJson, displayName)
|
|
79
|
+
bleMtuHint.toShort(), interfacesJson, displayName, isBeacon)
|
|
79
80
|
if (rc != 0) throw RuntimeException("nativeStart returned $rc")
|
|
80
81
|
true
|
|
81
82
|
}
|
|
@@ -195,7 +196,8 @@ class LxmfModule : Module() {
|
|
|
195
196
|
announceIntervalMs: Long,
|
|
196
197
|
bleMtuHint: Short,
|
|
197
198
|
tcpInterfacesJson: String,
|
|
198
|
-
displayName: String
|
|
199
|
+
displayName: String,
|
|
200
|
+
isBeacon: Boolean
|
|
199
201
|
): Int
|
|
200
202
|
private external fun nativeStop(): Int
|
|
201
203
|
private external fun nativeIsRunning(): Boolean
|
package/build/LxmfModule.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type NativeModuleType = {
|
|
|
3
3
|
start(identityHex: string, lxmfAddressHex: string, mode: number, announceIntervalMs: number, bleMtuHint: number, tcpInterfaces: {
|
|
4
4
|
host: string;
|
|
5
5
|
port: number;
|
|
6
|
-
}[], displayName: string): Promise<boolean>;
|
|
6
|
+
}[], displayName: string, isBeacon: boolean): Promise<boolean>;
|
|
7
7
|
stop(): Promise<boolean>;
|
|
8
8
|
isRunning(): boolean;
|
|
9
9
|
send(destHex: string, bodyBase64: string): Promise<number>;
|
package/build/useLxmf.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export interface UseLxmfOptions {
|
|
|
55
55
|
bleMtuHint?: number;
|
|
56
56
|
/** Display name broadcast in LXMF announces. Default: "lxmf-mobile" */
|
|
57
57
|
displayName?: string;
|
|
58
|
+
/** Advertise this node as an anonmesh beacon (app_data = "anonmesh::beacon::v1\0<name>"). Default: false */
|
|
59
|
+
isBeacon?: boolean;
|
|
58
60
|
}
|
|
59
61
|
export declare function useLxmf(options?: UseLxmfOptions): {
|
|
60
62
|
status: LxmfNodeStatus | null;
|
|
@@ -69,6 +71,7 @@ export declare function useLxmf(options?: UseLxmfOptions): {
|
|
|
69
71
|
mode?: LxmfNodeMode;
|
|
70
72
|
tcpInterfaces?: TcpInterface[];
|
|
71
73
|
displayName?: string;
|
|
74
|
+
isBeacon?: boolean;
|
|
72
75
|
}) => Promise<boolean>;
|
|
73
76
|
stop: () => Promise<void>;
|
|
74
77
|
send: (destHex: string, bodyBase64: string) => Promise<number>;
|
package/build/useLxmf.js
CHANGED
|
@@ -131,11 +131,12 @@ function useLxmf(options = {}) {
|
|
|
131
131
|
const announceMs = options.announceIntervalMs ?? 5000;
|
|
132
132
|
const bleMtu = options.bleMtuHint ?? 255;
|
|
133
133
|
const displayName = overrides?.displayName ?? options.displayName ?? '';
|
|
134
|
+
const isBeacon = overrides?.isBeacon ?? options.isBeacon ?? false;
|
|
134
135
|
if (mode !== LxmfNodeMode.BleOnly && tcpInterfaces.length === 0) {
|
|
135
136
|
setError(`Mode ${mode} requires at least one TCP interface.`);
|
|
136
137
|
return false;
|
|
137
138
|
}
|
|
138
|
-
await LxmfModule_1.LxmfModule.start(resolvedIdentityHex, resolvedLxmfAddressHex, mode, announceMs, bleMtu, tcpInterfaces, displayName);
|
|
139
|
+
await LxmfModule_1.LxmfModule.start(resolvedIdentityHex, resolvedLxmfAddressHex, mode, announceMs, bleMtu, tcpInterfaces, displayName, isBeacon);
|
|
139
140
|
setRunning(true);
|
|
140
141
|
syncStatus();
|
|
141
142
|
setError(null);
|
|
@@ -153,6 +154,7 @@ function useLxmf(options = {}) {
|
|
|
153
154
|
options.announceIntervalMs,
|
|
154
155
|
options.bleMtuHint,
|
|
155
156
|
options.displayName,
|
|
157
|
+
options.isBeacon,
|
|
156
158
|
syncStatus,
|
|
157
159
|
]);
|
|
158
160
|
(0, react_1.useEffect)(() => {
|
package/ios/LxmfModule.swift
CHANGED
|
@@ -13,7 +13,8 @@ func lxmf_start(
|
|
|
13
13
|
_ announceIntervalMs: UInt64,
|
|
14
14
|
_ bleMtuHint: UInt16,
|
|
15
15
|
_ tcpInterfacesJson: UnsafePointer<CChar>?,
|
|
16
|
-
_ displayName: UnsafePointer<CChar
|
|
16
|
+
_ displayName: UnsafePointer<CChar>?,
|
|
17
|
+
_ isBeacon: UInt8
|
|
17
18
|
) -> Int32
|
|
18
19
|
|
|
19
20
|
@_silgen_name("lxmf_stop")
|
|
@@ -182,7 +183,8 @@ public class LxmfModule: Module {
|
|
|
182
183
|
announceIntervalMs: Double,
|
|
183
184
|
bleMtuHint: Int,
|
|
184
185
|
tcpInterfaces: [[String: Any]],
|
|
185
|
-
displayName: String
|
|
186
|
+
displayName: String,
|
|
187
|
+
isBeacon: Bool
|
|
186
188
|
) -> Bool in
|
|
187
189
|
// Serialize TCP interfaces to JSON (matches Android pattern)
|
|
188
190
|
let interfacesJson: String
|
|
@@ -200,7 +202,8 @@ public class LxmfModule: Module {
|
|
|
200
202
|
lxmf_start(
|
|
201
203
|
idPtr, addrPtr,
|
|
202
204
|
UInt32(mode), UInt64(announceIntervalMs),
|
|
203
|
-
UInt16(bleMtuHint), ifacesPtr, namePtr
|
|
205
|
+
UInt16(bleMtuHint), ifacesPtr, namePtr,
|
|
206
|
+
isBeacon ? 1 : 0
|
|
204
207
|
)
|
|
205
208
|
}
|
|
206
209
|
}
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>liblxmf_rn.a</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64</string>
|
|
12
12
|
<key>LibraryPath</key>
|
|
13
13
|
<string>liblxmf_rn.a</string>
|
|
14
14
|
<key>SupportedArchitectures</key>
|
|
15
15
|
<array>
|
|
16
16
|
<string>arm64</string>
|
|
17
|
-
<string>x86_64</string>
|
|
18
17
|
</array>
|
|
19
18
|
<key>SupportedPlatform</key>
|
|
20
19
|
<string>ios</string>
|
|
21
|
-
<key>SupportedPlatformVariant</key>
|
|
22
|
-
<string>simulator</string>
|
|
23
20
|
</dict>
|
|
24
21
|
<dict>
|
|
25
22
|
<key>BinaryPath</key>
|
|
26
23
|
<string>liblxmf_rn.a</string>
|
|
27
24
|
<key>LibraryIdentifier</key>
|
|
28
|
-
<string>ios-
|
|
25
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
29
26
|
<key>LibraryPath</key>
|
|
30
27
|
<string>liblxmf_rn.a</string>
|
|
31
28
|
<key>SupportedArchitectures</key>
|
|
32
29
|
<array>
|
|
33
30
|
<string>arm64</string>
|
|
31
|
+
<string>x86_64</string>
|
|
34
32
|
</array>
|
|
35
33
|
<key>SupportedPlatform</key>
|
|
36
34
|
<string>ios</string>
|
|
35
|
+
<key>SupportedPlatformVariant</key>
|
|
36
|
+
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|