@amazon-devices/expo-network 2.0.9000000000 → 2.0.9000000001
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/CMakeLists.txt +3 -3
- package/README.kepler.md +1 -0
- package/kepler/ExpoNetwork.cpp +13 -13
- package/kepler/ExpoNetwork.h +11 -7
- package/kepler/KeplerInit.cpp +5 -10
- package/kepler/NetworkInterfaces.cpp +4 -3
- package/kepler-compatibility.json +7 -0
- package/package.json +1 -1
- package/react-native.config.js +1 -0
package/CMakeLists.txt
CHANGED
|
@@ -23,7 +23,7 @@ add_library(${PACKAGE_NAME} STATIC ${SOURCES_KEPLER})
|
|
|
23
23
|
target_link_libraries(
|
|
24
24
|
${PACKAGE_NAME}
|
|
25
25
|
PUBLIC
|
|
26
|
-
|
|
26
|
+
turbomoduleAPI::turbomoduleAPI
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
add_library(${AUTO_LINK_PACKAGE_NAME} SHARED kepler/KeplerInit.cpp)
|
|
@@ -33,7 +33,7 @@ set_target_properties(${AUTO_LINK_PACKAGE_NAME} PROPERTIES SOVERSION ${KEPLER_RE
|
|
|
33
33
|
target_link_libraries(
|
|
34
34
|
${AUTO_LINK_PACKAGE_NAME}
|
|
35
35
|
PRIVATE
|
|
36
|
-
|
|
36
|
+
turbomoduleAPI::turbomoduleAPI
|
|
37
37
|
${PACKAGE_NAME}
|
|
38
38
|
)
|
|
39
39
|
|
|
@@ -42,7 +42,7 @@ add_executable(${AUTO_LINK_PACKAGE_NAME}_exe kepler/KeplerInit.cpp)
|
|
|
42
42
|
target_link_libraries(${AUTO_LINK_PACKAGE_NAME}_exe
|
|
43
43
|
PRIVATE
|
|
44
44
|
${AUTO_LINK_PACKAGE_NAME}
|
|
45
|
-
|
|
45
|
+
turbomoduleAPI::turbomoduleAPI
|
|
46
46
|
)
|
|
47
47
|
|
|
48
48
|
install(TARGETS ${AUTO_LINK_PACKAGE_NAME}
|
package/README.kepler.md
CHANGED
|
@@ -102,3 +102,4 @@ Check out the dedicated documentation page for info about this library, API refe
|
|
|
102
102
|
| Package version | Based on | @amazon-devices/react-native-kepler version |
|
|
103
103
|
| ---------------- | -------- | --------------------------------- |
|
|
104
104
|
| 2.0.x | expo-network v5.7.0 | 2.0.x |
|
|
105
|
+
| 2.0.x | expo-network v5.7.0 | 4.0.x+rn0.83.0 |
|
package/kepler/ExpoNetwork.cpp
CHANGED
|
@@ -8,23 +8,24 @@
|
|
|
8
8
|
|
|
9
9
|
#include "ExpoNetwork.h"
|
|
10
10
|
|
|
11
|
-
#include <
|
|
11
|
+
#include <Kepler/turbomodule/TMLog.h>
|
|
12
|
+
#include <fmt/core.h>
|
|
12
13
|
|
|
13
14
|
#include "NetworkInterfaces.h"
|
|
14
15
|
|
|
15
|
-
ExpoNetwork::ExpoNetwork() :
|
|
16
|
-
|
|
16
|
+
ExpoNetwork::ExpoNetwork() : tbm::KeplerTurboModule("ExpoNetwork") {
|
|
17
|
+
TMDEBUG(fmt::format("ExpoNetwork constructor {}", name()));
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
return
|
|
20
|
+
tbm::Promise ExpoNetwork::getIpAddressAsync() {
|
|
21
|
+
return tbm::Promise([](std::shared_ptr<tbm::Promise> promise) {
|
|
21
22
|
auto interfaces = NetworkInterfaces();
|
|
22
23
|
promise->resolve(interfaces.wlanInterfaceAddress());
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
return
|
|
27
|
+
tbm::Promise ExpoNetwork::getNetworkStateAsync() {
|
|
28
|
+
return tbm::Promise([](std::shared_ptr<tbm::Promise> promise) {
|
|
28
29
|
try {
|
|
29
30
|
auto interfaces = NetworkInterfaces();
|
|
30
31
|
bool isConnected = interfaces.isNetworkConnected();
|
|
@@ -35,19 +36,18 @@ volta::react::Promise ExpoNetwork::getNetworkStateAsync() {
|
|
|
35
36
|
|
|
36
37
|
promise->resolve(networkState);
|
|
37
38
|
} catch (std::exception& e) {
|
|
38
|
-
|
|
39
|
+
TMDEBUG(fmt::format("Can't get network state: {}", std::string(e.what())));
|
|
39
40
|
promise->reject(std::string{"Can't get network state: " + std::string(e.what())});
|
|
40
41
|
}
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
return
|
|
45
|
+
tbm::Promise ExpoNetwork::isAirplaneModeEnabledAsync() {
|
|
46
|
+
return tbm::Promise([](std::shared_ptr<tbm::Promise> promise) { promise->resolve(false); });
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
void ExpoNetwork::aggregateMethods(
|
|
49
|
-
|
|
50
|
-
volta::react::KPLog.debug("methodAggregator");
|
|
49
|
+
void ExpoNetwork::aggregateMethods(tbm::MethodAggregator<tbm::KeplerTurboModule>& methodAggregator) const noexcept {
|
|
50
|
+
TMDEBUG("methodAggregator");
|
|
51
51
|
|
|
52
52
|
methodAggregator.addMethod("getNetworkStateAsync", 0, &ExpoNetwork::getNetworkStateAsync);
|
|
53
53
|
methodAggregator.addMethod("getIpAddressAsync", 0, &ExpoNetwork::getIpAddressAsync);
|
package/kepler/ExpoNetwork.h
CHANGED
|
@@ -6,19 +6,23 @@
|
|
|
6
6
|
* Use is subject to license terms.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
#include <
|
|
9
|
+
#include <Kepler/turbomodule/KeplerTurboModule.h>
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
#include "expo-export.h"
|
|
12
|
+
|
|
13
|
+
namespace tbm = com::amazon::kepler::turbomodule;
|
|
14
|
+
|
|
15
|
+
class EXPO_EXPORT ExpoNetwork : public tbm::KeplerTurboModule {
|
|
12
16
|
public:
|
|
13
17
|
ExpoNetwork();
|
|
18
|
+
|
|
19
|
+
void aggregateMethods(tbm::MethodAggregator<tbm::KeplerTurboModule>& methodAggregator) const noexcept override;
|
|
14
20
|
|
|
15
21
|
#ifndef UNIT_TEST
|
|
16
22
|
protected:
|
|
17
23
|
#endif
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
tbm::Promise getIpAddressAsync();
|
|
25
|
+
tbm::Promise getNetworkStateAsync();
|
|
26
|
+
tbm::Promise isAirplaneModeEnabledAsync();
|
|
21
27
|
|
|
22
|
-
void aggregateMethods(
|
|
23
|
-
volta::react::MethodAggregator<volta::react::KeplerTurboModule>& methodAggregator) const noexcept override;
|
|
24
28
|
};
|
package/kepler/KeplerInit.cpp
CHANGED
|
@@ -6,20 +6,15 @@
|
|
|
6
6
|
* Use is subject to license terms.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
#include <
|
|
10
|
-
#include <
|
|
11
|
-
#include <keplerui-072/keplerscript-export.h>
|
|
9
|
+
#include <Kepler/turbomodule/KeplerTurboModuleRegistration.h>
|
|
10
|
+
#include <Kepler/turbomodule/TMLog.h>
|
|
12
11
|
|
|
13
12
|
#include "ExpoNetwork.h"
|
|
14
|
-
#include "RegisterModule.h"
|
|
15
13
|
|
|
16
14
|
extern "C" {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
REGISTER_MODULE(autoLinkInfo, ExpoNetwork, "ExpoNetwork");
|
|
21
|
-
|
|
22
|
-
volta::react::KPLog.debug("after registering module");
|
|
15
|
+
__attribute__((visibility("default"))) void autoLinkKeplerTurboModulesV1() noexcept {
|
|
16
|
+
TMDEBUG("keplerAutoLinkInitV1 for ExpoNetwork");
|
|
17
|
+
KEPLER_REGISTER_TURBO_MODULE_WITH_NAME("ExpoNetwork", ExpoNetwork);
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
20
|
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
#include "NetworkInterfaces.h"
|
|
10
10
|
|
|
11
|
-
#include <
|
|
11
|
+
#include <Kepler/turbomodule/TMLog.h>
|
|
12
12
|
#include <arpa/inet.h>
|
|
13
|
+
#include <fmt/core.h>
|
|
13
14
|
#include <ifaddrs.h>
|
|
14
15
|
#include <linux/if_link.h>
|
|
15
16
|
#include <netdb.h>
|
|
@@ -61,9 +62,9 @@ std::string NetworkInterfaces::wlanInterfaceAddress() {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
TMDEBUG("No wlan interface found.");
|
|
65
66
|
} catch (std::exception& e) {
|
|
66
|
-
|
|
67
|
+
TMDEBUG(fmt::format("Can't get ip address: {}", std::string(e.what())));
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
return unresolvedAddress;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@amazon-devices/expo-network", "version": "2.0.
|
|
1
|
+
{"name": "@amazon-devices/expo-network", "version": "2.0.9000000001+5.7.0", "description": "Provides useful information about the device's network such as its IP address, MAC address, and airplane mode status", "main": "build/Network.js", "types": "build/Network.d.ts", "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "kepler": {"temporary-alias-for-package": {"name": "expo-network", "version": "5.7.0"}}, "keywords": ["react-native", "expo", "expo-network"], "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-network"}, "bugs": {"url": "https://github.com/expo/expo/issues"}, "author": "650 Industries, Inc.", "license": "See license in LICENSE", "homepage": "https://docs.expo.dev/versions/latest/sdk/network/", "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "^50.0.0-alpha.1"}, "jest": {"preset": "expo-module-scripts"}}
|