Skip to content

Commit 729463a

Browse files
committed
[futurepress#95] iOS/macOS: Implements getActiveServerId()
1 parent 4b96940 commit 729463a

File tree

5 files changed

+50
-125
lines changed

5 files changed

+50
-125
lines changed

example/ios/Podfile.lock

Lines changed: 20 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,20 @@ PODS:
44
- DoubleConversion (1.1.6)
55
- dr-pogodin-react-native-fs (2.22.0-alpha.1):
66
- glog
7-
- hermes-engine
87
- RCT-Folly (= 2022.05.16.00)
9-
- RCTRequired
10-
- RCTTypeSafety
11-
- React-Codegen
128
- React-Core
13-
- React-debug
14-
- React-Fabric
15-
- React-graphics
16-
- React-ImageManager
17-
- React-NativeModulesApple
18-
- React-RCTFabric
19-
- React-rendererdebug
20-
- React-utils
21-
- ReactCommon/turbomodule/bridging
22-
- ReactCommon/turbomodule/core
23-
- Yoga
24-
- dr-pogodin-react-native-static-server (0.10.0):
9+
- dr-pogodin-react-native-static-server (0.10.1):
2510
- glog
26-
- hermes-engine
2711
- RCT-Folly (= 2022.05.16.00)
28-
- RCTRequired
29-
- RCTTypeSafety
30-
- React-Codegen
3112
- React-Core
32-
- React-debug
33-
- React-Fabric
34-
- React-graphics
35-
- React-ImageManager
36-
- React-NativeModulesApple
37-
- React-RCTFabric
38-
- React-rendererdebug
39-
- React-utils
40-
- ReactCommon/turbomodule/bridging
41-
- ReactCommon/turbomodule/core
42-
- Yoga
4313
- FBLazyVector (0.73.0)
14+
- FBReactNativeSpec (0.73.0):
15+
- RCT-Folly (= 2022.05.16.00)
16+
- RCTRequired (= 0.73.0)
17+
- RCTTypeSafety (= 0.73.0)
18+
- React-Core (= 0.73.0)
19+
- React-jsi (= 0.73.0)
20+
- ReactCommon/turbomodule/core (= 0.73.0)
4421
- Flipper (0.201.0):
4522
- Flipper-Folly (~> 2.6)
4623
- Flipper-Boost-iOSX (1.76.0.1.11)
@@ -147,21 +124,17 @@ PODS:
147124
- React-callinvoker (0.73.0)
148125
- React-Codegen (0.73.0):
149126
- DoubleConversion
127+
- FBReactNativeSpec
150128
- glog
151129
- hermes-engine
152130
- RCT-Folly
153131
- RCTRequired
154132
- RCTTypeSafety
155133
- React-Core
156-
- React-debug
157-
- React-Fabric
158-
- React-FabricImage
159-
- React-graphics
160134
- React-jsi
161135
- React-jsiexecutor
162136
- React-NativeModulesApple
163-
- React-rendererdebug
164-
- React-utils
137+
- React-rncore
165138
- ReactCommon/turbomodule/bridging
166139
- ReactCommon/turbomodule/core
167140
- React-Core (0.73.0):
@@ -974,21 +947,13 @@ PODS:
974947
- React-jsi (= 0.73.0)
975948
- React-perflogger (= 0.73.0)
976949
- React-jsinspector (0.73.0)
977-
- React-jsitracing (0.73.0):
978-
- React-jsi
979950
- React-logger (0.73.0):
980951
- glog
981952
- React-Mapbuffer (0.73.0):
982953
- glog
983954
- React-debug
984955
- react-native-webview (13.6.3):
985-
- RCT-Folly
986-
- RCTRequired
987-
- RCTTypeSafety
988-
- React-Codegen
989956
- React-Core
990-
- React-RCTFabric
991-
- ReactCommon/turbomodule/core
992957
- React-nativeconfig (0.73.0)
993958
- React-NativeModulesApple (0.73.0):
994959
- glog
@@ -1017,21 +982,13 @@ PODS:
1017982
- RCTTypeSafety
1018983
- React-Core
1019984
- React-CoreModules
1020-
- React-debug
1021-
- React-Fabric
1022-
- React-graphics
1023985
- React-hermes
1024986
- React-nativeconfig
1025987
- React-NativeModulesApple
1026988
- React-RCTFabric
1027989
- React-RCTImage
1028990
- React-RCTNetwork
1029-
- React-rendererdebug
1030-
- React-RuntimeApple
1031-
- React-RuntimeCore
1032-
- React-RuntimeHermes
1033991
- React-runtimescheduler
1034-
- React-utils
1035992
- ReactCommon
1036993
- React-RCTBlob (0.73.0):
1037994
- hermes-engine
@@ -1109,42 +1066,8 @@ PODS:
11091066
- RCT-Folly (= 2022.05.16.00)
11101067
- React-debug
11111068
- React-rncore (0.73.0)
1112-
- React-RuntimeApple (0.73.0):
1113-
- hermes-engine
1114-
- RCT-Folly/Fabric (= 2022.05.16.00)
1115-
- React-callinvoker
1116-
- React-Core/Default
1117-
- React-CoreModules
1118-
- React-cxxreact
1119-
- React-jserrorhandler
1120-
- React-jsi
1121-
- React-jsiexecutor
1122-
- React-Mapbuffer
1123-
- React-NativeModulesApple
1124-
- React-RCTFabric
1125-
- React-RuntimeCore
1126-
- React-runtimeexecutor
1127-
- React-RuntimeHermes
1128-
- React-utils
1129-
- React-RuntimeCore (0.73.0):
1130-
- glog
1131-
- hermes-engine
1132-
- RCT-Folly/Fabric (= 2022.05.16.00)
1133-
- React-cxxreact
1134-
- React-jserrorhandler
1135-
- React-jsi
1136-
- React-jsiexecutor
1137-
- React-runtimeexecutor
1138-
- React-runtimescheduler
11391069
- React-runtimeexecutor (0.73.0):
11401070
- React-jsi (= 0.73.0)
1141-
- React-RuntimeHermes (0.73.0):
1142-
- hermes-engine
1143-
- RCT-Folly/Fabric (= 2022.05.16.00)
1144-
- React-jsi
1145-
- React-jsitracing
1146-
- React-nativeconfig
1147-
- React-utils
11481071
- React-runtimescheduler (0.73.0):
11491072
- glog
11501073
- hermes-engine
@@ -1207,6 +1130,7 @@ DEPENDENCIES:
12071130
- "dr-pogodin-react-native-fs (from `../node_modules/@dr.pogodin/react-native-fs`)"
12081131
- dr-pogodin-react-native-static-server (from `../..`)
12091132
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
1133+
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
12101134
- Flipper (= 0.201.0)
12111135
- Flipper-Boost-iOSX (= 1.76.0.1.11)
12121136
- Flipper-DoubleConversion (= 3.2.0.1)
@@ -1253,7 +1177,6 @@ DEPENDENCIES:
12531177
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
12541178
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
12551179
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector-modern`)
1256-
- React-jsitracing (from `../node_modules/react-native/ReactCommon/hermes/executor/`)
12571180
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
12581181
- React-Mapbuffer (from `../node_modules/react-native/ReactCommon`)
12591182
- react-native-webview (from `../node_modules/react-native-webview`)
@@ -1273,10 +1196,7 @@ DEPENDENCIES:
12731196
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
12741197
- React-rendererdebug (from `../node_modules/react-native/ReactCommon/react/renderer/debug`)
12751198
- React-rncore (from `../node_modules/react-native/ReactCommon`)
1276-
- React-RuntimeApple (from `../node_modules/react-native/ReactCommon/react/runtime/platform/ios`)
1277-
- React-RuntimeCore (from `../node_modules/react-native/ReactCommon/react/runtime`)
12781199
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
1279-
- React-RuntimeHermes (from `../node_modules/react-native/ReactCommon/react/runtime`)
12801200
- React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
12811201
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
12821202
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
@@ -1309,6 +1229,8 @@ EXTERNAL SOURCES:
13091229
:path: "../.."
13101230
FBLazyVector:
13111231
:path: "../node_modules/react-native/Libraries/FBLazyVector"
1232+
FBReactNativeSpec:
1233+
:path: "../node_modules/react-native/React/FBReactNativeSpec"
13121234
glog:
13131235
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
13141236
hermes-engine:
@@ -1352,8 +1274,6 @@ EXTERNAL SOURCES:
13521274
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
13531275
React-jsinspector:
13541276
:path: "../node_modules/react-native/ReactCommon/jsinspector-modern"
1355-
React-jsitracing:
1356-
:path: "../node_modules/react-native/ReactCommon/hermes/executor/"
13571277
React-logger:
13581278
:path: "../node_modules/react-native/ReactCommon/logger"
13591279
React-Mapbuffer:
@@ -1392,14 +1312,8 @@ EXTERNAL SOURCES:
13921312
:path: "../node_modules/react-native/ReactCommon/react/renderer/debug"
13931313
React-rncore:
13941314
:path: "../node_modules/react-native/ReactCommon"
1395-
React-RuntimeApple:
1396-
:path: "../node_modules/react-native/ReactCommon/react/runtime/platform/ios"
1397-
React-RuntimeCore:
1398-
:path: "../node_modules/react-native/ReactCommon/react/runtime"
13991315
React-runtimeexecutor:
14001316
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
1401-
React-RuntimeHermes:
1402-
:path: "../node_modules/react-native/ReactCommon/react/runtime"
14031317
React-runtimescheduler:
14041318
:path: "../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler"
14051319
React-utils:
@@ -1413,9 +1327,10 @@ SPEC CHECKSUMS:
14131327
boost: 26fad476bfa736552bbfa698a06cc530475c1505
14141328
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
14151329
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
1416-
dr-pogodin-react-native-fs: 52866374a970121b32771500635aa0a8cbe816db
1417-
dr-pogodin-react-native-static-server: 25562e74c9b57b64222196c1aa327d2e6a0b8192
1330+
dr-pogodin-react-native-fs: 42fc8fc52391c5b8802bfaf33d7cd6bc4f550d67
1331+
dr-pogodin-react-native-static-server: 591b6b2969e0c40330e61fc33d9d7ce980e857a0
14181332
FBLazyVector: 39ba45baf4e398618f8b3a4bb6ba8fcdb7fc2133
1333+
FBReactNativeSpec: 20cfca68498e27879514790359289d1df2b52c56
14191334
Flipper: c7a0093234c4bdd456e363f2f19b2e4b27652d44
14201335
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
14211336
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
@@ -1434,7 +1349,7 @@ SPEC CHECKSUMS:
14341349
RCTTypeSafety: 02a64828b0b428eb4f63de1397d44fb2d0747e85
14351350
React: df5dbfbd10c5bd8d4bcb49bd9830551533e11c7e
14361351
React-callinvoker: dc0dff59e8d3d1fe4cd9fb5f120f82a775d2a325
1437-
React-Codegen: 739edb7e5721eb4331a0507b8db2914b95b84bd8
1352+
React-Codegen: 88bf5d1e29db28c1c9b88fe909f073be6c9f769d
14381353
React-Core: 276ccbbf282538138f4429313bb1200a15067c6e
14391354
React-CoreModules: 64747180c0329bebed8307ffdc97c331220277a6
14401355
React-cxxreact: 84d98283f701bae882dcd3ad7c573a02f4c9d5c0
@@ -1448,16 +1363,15 @@ SPEC CHECKSUMS:
14481363
React-jsi: 81b5fe94500e69051c2f3a775308afaa53e2608b
14491364
React-jsiexecutor: 4f790f865ad23fa949396c1a103d06867c0047ed
14501365
React-jsinspector: 9f6fb9ed9f03a0fb961ab8dc2e0e0ee0dc729e77
1451-
React-jsitracing: c4f0d56beda781bc3ce6e3594c9f7117f04b37a1
14521366
React-logger: 008caec0d6a587abc1e71be21bfac5ba1662fe6a
14531367
React-Mapbuffer: 58fe558faf52ecde6705376700f848d0293d1cef
1454-
react-native-webview: 3749c2a7c79c237415d52f60d0ab7d2d499bf38e
1368+
react-native-webview: 88293a0f23eca8465c0433c023ec632930e644d0
14551369
React-nativeconfig: a063483672b8add47a4875b0281e202908ff6747
14561370
React-NativeModulesApple: 169506a5fd708ab22811f76ee06a976595c367a1
14571371
React-perflogger: b61e5db8e5167f5e70366e820766c492847c082e
14581372
React-RCTActionSheet: dcaecff7ffc1888972cd1c1935751ff3bce1e0c1
14591373
React-RCTAnimation: 24b8ae7ebc897ba3f33a93a020bbc66ab7863f5d
1460-
React-RCTAppDelegate: a6de16b274cb25098a5960cc5e21a5bb4ff07a8b
1374+
React-RCTAppDelegate: 661fc59d833e6727cc8c7e36bf8664215e5c277f
14611375
React-RCTBlob: 112880abc731c5a0d8eefb5919a591ad30f630e8
14621376
React-RCTFabric: a0289e3bf73da8c03b68b4e9733ba497b021de45
14631377
React-RCTImage: b8065c1b51cc6c2ff58ad81001619352518dd793
@@ -1467,11 +1381,8 @@ SPEC CHECKSUMS:
14671381
React-RCTText: 671518da40bd548943ec12ee6a60f733a751e2e9
14681382
React-RCTVibration: 60bc4d01d7d8ab7cff14852a195a7fa93b38e1f3
14691383
React-rendererdebug: 6aaab394c9fefe395ef61809580a9bf63b98fd3e
1470-
React-rncore: 89dce547cdf87ba254d9c45b91ca4bba481de383
1471-
React-RuntimeApple: e16e0101da3586958bb6be48940f43211ae9eb0b
1472-
React-RuntimeCore: fce65e9a37b1e5b9b59ab2f72ce8cb82ddbaf69d
1384+
React-rncore: 6680f0ebb941e256af7dc92c6a512356e77bfea7
14731385
React-runtimeexecutor: 2ca6f02d3fd6eea5b9575eb30720cf12c5d89906
1474-
React-RuntimeHermes: f730d6ac60dee9de505cdd25572f132d93d24fb0
14751386
React-runtimescheduler: 77543c74df984ce56c09d49d427149c53784aaf6
14761387
React-utils: 42708ea436853045ef1eaff29996813d9fbbe209
14771388
ReactCommon: 851280fb976399ca1aabc74cc2c3612069ea70a2

example/ios/ReactNativeStaticServerExample.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -588,14 +588,14 @@
588588
MTL_ENABLE_DEBUG_INFO = NO;
589589
OTHER_CFLAGS = (
590590
"$(inherited)",
591-
"-DRN_FABRIC_ENABLED",
591+
" ",
592592
);
593593
OTHER_CPLUSPLUSFLAGS = (
594594
"$(OTHER_CFLAGS)",
595595
"-DFOLLY_NO_CONFIG",
596596
"-DFOLLY_MOBILE=1",
597597
"-DFOLLY_USE_LIBCPP=1",
598-
"-DRN_FABRIC_ENABLED",
598+
" ",
599599
);
600600
OTHER_LDFLAGS = (
601601
"$(inherited)",
@@ -743,15 +743,15 @@
743743
ONLY_ACTIVE_ARCH = YES;
744744
OTHER_CFLAGS = (
745745
"$(inherited)",
746-
"-DRN_FABRIC_ENABLED",
746+
" ",
747747
);
748748
OTHER_CPLUSPLUSFLAGS = (
749749
"$(OTHER_CFLAGS)",
750750
"-DFOLLY_NO_CONFIG",
751751
"-DFOLLY_MOBILE=1",
752752
"-DFOLLY_USE_LIBCPP=1",
753753
"-DFOLLY_CFG_NO_COROUTINES=1",
754-
"-DRN_FABRIC_ENABLED",
754+
" ",
755755
);
756756
OTHER_LDFLAGS = (
757757
"$(inherited)",
@@ -819,15 +819,15 @@
819819
MTL_ENABLE_DEBUG_INFO = NO;
820820
OTHER_CFLAGS = (
821821
"$(inherited)",
822-
"-DRN_FABRIC_ENABLED",
822+
" ",
823823
);
824824
OTHER_CPLUSPLUSFLAGS = (
825825
"$(OTHER_CFLAGS)",
826826
"-DFOLLY_NO_CONFIG",
827827
"-DFOLLY_MOBILE=1",
828828
"-DFOLLY_USE_LIBCPP=1",
829829
"-DFOLLY_CFG_NO_COROUTINES=1",
830-
"-DRN_FABRIC_ENABLED",
830+
" ",
831831
);
832832
OTHER_LDFLAGS = (
833833
"$(inherited)",

ios/ReactNativeStaticServer.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ - (NSDictionary*) getConstants {
4040
return [self constantsToExport];
4141
}
4242

43+
RCT_REMAP_METHOD(getActiveServerId,
44+
getActiveServerId:(RCTPromiseResolveBlock) resolve
45+
rejecter:(RCTPromiseRejectBlock)reject
46+
) {
47+
resolve(self->server ? self->server.serverId : nil);
48+
}
49+
4350
RCT_REMAP_METHOD(getLocalIpAddress,
4451
getLocalIpAddress:(RCTPromiseResolveBlock)resolve
4552
rejecter:(RCTPromiseRejectBlock)reject
@@ -132,7 +139,8 @@ - (NSDictionary*) getConstants {
132139
};
133140

134141
self->server = [Server
135-
serverWithConfig:configPath
142+
serverWithId:serverId
143+
configPath:configPath
136144
errlogPath:errlogPath
137145
signalConsumer:signalConsumer
138146
];

ios/Server.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ typedef void (^SignalConsumer)(NSString * const signal, NSString * const details
88
- (void) cancel;
99
- (void) main;
1010

11-
+ (Server*) serverWithConfig:(NSString*)configPath
11+
+ (Server*) serverWithId:(NSNumber*)serverId
12+
configPath:(NSString*)configPath
1213
errlogPath:(NSString*)errlogPath
1314
signalConsumer:(SignalConsumer)signalConsumer;
1415

16+
@property (readonly) NSNumber *serverId;
1517
@property SignalConsumer signalConsumer;
1618
@end

0 commit comments

Comments
 (0)