Skip to content

Commit

Permalink
move mock implementation to class so we only need 1 shared context im…
Browse files Browse the repository at this point in the history
…plementation

add README section about mock module

Note mock differences in README

README format

test mock module on iOS; add comments

NativeEventEmitter will always be defined in mock

run ios
  • Loading branch information
tmgrask committed Sep 25, 2024
1 parent 4570dc6 commit d5062d6
Show file tree
Hide file tree
Showing 8 changed files with 657 additions and 548 deletions.
100 changes: 100 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
PODS:
- boost (1.83.0)
- DoubleConversion (1.1.6)
- EXApplication (5.9.1):
- ExpoModulesCore
- EXConstants (16.0.2):
- ExpoModulesCore
- EXNotifications (0.28.16):
- ExpoModulesCore
- Expo (51.0.32):
- ExpoModulesCore
- ExpoAsset (10.0.10):
- ExpoModulesCore
- ExpoClipboard (6.0.3):
- ExpoModulesCore
- ExpoCrypto (13.0.2):
- ExpoModulesCore
- ExpoFileSystem (17.0.1):
- ExpoModulesCore
- ExpoFont (12.0.10):
Expand Down Expand Up @@ -38,8 +46,12 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ExpoSecureStore (13.0.2):
- ExpoModulesCore
- ExpoSystemUI (3.0.7):
- ExpoModulesCore
- ExpoVideo (1.2.6):
- ExpoModulesCore
- EXSplashScreen (0.27.5):
- DoubleConversion
- ExpoModulesCore
Expand Down Expand Up @@ -998,6 +1010,50 @@ PODS:
- React-debug
- react-native-safe-area-context (4.10.5):
- React-Core
- react-native-skia (1.3.13):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React
- React-callinvoker
- React-Codegen
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- react-native-slider (4.5.3):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Codegen
- React-Core
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- React-nativeconfig (0.74.5)
- React-NativeModulesApple (0.74.5):
- glog
Expand Down Expand Up @@ -1227,6 +1283,8 @@ PODS:
- React-logger (= 0.74.5)
- React-perflogger (= 0.74.5)
- React-utils (= 0.74.5)
- RNCAsyncStorage (2.0.0):
- React-Core
- RNGestureHandler (2.16.2):
- DoubleConversion
- glog
Expand All @@ -1248,6 +1306,8 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNLocalize (3.2.1):
- React-Core
- RNReanimated (3.10.1):
- DoubleConversion
- glog
Expand Down Expand Up @@ -1297,15 +1357,21 @@ PODS:
DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- EXApplication (from `../node_modules/expo-application/ios`)
- EXConstants (from `../node_modules/expo-constants/ios`)
- EXNotifications (from `../node_modules/expo-notifications/ios`)
- Expo (from `../node_modules/expo`)
- ExpoAsset (from `../node_modules/expo-asset/ios`)
- ExpoClipboard (from `../node_modules/expo-clipboard/ios`)
- ExpoCrypto (from `../node_modules/expo-crypto/ios`)
- ExpoFileSystem (from `../node_modules/expo-file-system/ios`)
- ExpoFont (from `../node_modules/expo-font/ios`)
- ExpoHead (from `../node_modules/expo-router/ios`)
- ExpoKeepAwake (from `../node_modules/expo-keep-awake/ios`)
- ExpoModulesCore (from `../node_modules/expo-modules-core`)
- ExpoSecureStore (from `../node_modules/expo-secure-store/ios`)
- ExpoSystemUI (from `../node_modules/expo-system-ui/ios`)
- ExpoVideo (from `../node_modules/expo-video/ios`)
- EXSplashScreen (from `../node_modules/expo-splash-screen/ios`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- fmt (from `../node_modules/react-native/third-party-podspecs/fmt.podspec`)
Expand Down Expand Up @@ -1338,6 +1404,8 @@ DEPENDENCIES:
- React-logger (from `../node_modules/react-native/ReactCommon/logger`)
- React-Mapbuffer (from `../node_modules/react-native/ReactCommon`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- "react-native-skia (from `../node_modules/@shopify/react-native-skia`)"
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
- React-nativeconfig (from `../node_modules/react-native/ReactCommon`)
- React-NativeModulesApple (from `../node_modules/react-native/ReactCommon/react/nativemodule/core/platform/ios`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
Expand All @@ -1361,7 +1429,9 @@ DEPENDENCIES:
- React-runtimescheduler (from `../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNLocalize (from `../node_modules/react-native-localize`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
Expand All @@ -1375,12 +1445,20 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
EXApplication:
:path: "../node_modules/expo-application/ios"
EXConstants:
:path: "../node_modules/expo-constants/ios"
EXNotifications:
:path: "../node_modules/expo-notifications/ios"
Expo:
:path: "../node_modules/expo"
ExpoAsset:
:path: "../node_modules/expo-asset/ios"
ExpoClipboard:
:path: "../node_modules/expo-clipboard/ios"
ExpoCrypto:
:path: "../node_modules/expo-crypto/ios"
ExpoFileSystem:
:path: "../node_modules/expo-file-system/ios"
ExpoFont:
Expand All @@ -1391,8 +1469,12 @@ EXTERNAL SOURCES:
:path: "../node_modules/expo-keep-awake/ios"
ExpoModulesCore:
:path: "../node_modules/expo-modules-core"
ExpoSecureStore:
:path: "../node_modules/expo-secure-store/ios"
ExpoSystemUI:
:path: "../node_modules/expo-system-ui/ios"
ExpoVideo:
:path: "../node_modules/expo-video/ios"
EXSplashScreen:
:path: "../node_modules/expo-splash-screen/ios"
FBLazyVector:
Expand Down Expand Up @@ -1454,6 +1536,10 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-skia:
:path: "../node_modules/@shopify/react-native-skia"
react-native-slider:
:path: "../node_modules/@react-native-community/slider"
React-nativeconfig:
:path: "../node_modules/react-native/ReactCommon"
React-NativeModulesApple:
Expand Down Expand Up @@ -1500,8 +1586,12 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/react/utils"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNLocalize:
:path: "../node_modules/react-native-localize"
RNReanimated:
:path: "../node_modules/react-native-reanimated"
RNScreens:
Expand All @@ -1512,15 +1602,21 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
EXApplication: c08200c34daca7af7fd76ac4b9d606077410e8ad
EXConstants: 409690fbfd5afea964e5e9d6c4eb2c2b59222c59
EXNotifications: b1b174716b287e161350a18de1d253aabceeea2d
Expo: 33132a667698a3259a4e6c0af1b4936388e5fa33
ExpoAsset: 323700f291684f110fb55f0d4022a3362ea9f875
ExpoClipboard: 23d203f5d4843699fbc45be1cc4fe1fbd811a6fa
ExpoCrypto: 156078f266bf28f80ecf5e2a9c3a0d6ffce07a1c
ExpoFileSystem: 80bfe850b1f9922c16905822ecbf97acd711dc51
ExpoFont: 00756e6c796d8f7ee8d211e29c8b619e75cbf238
ExpoHead: fcb28a68ed4ba28f177394d2dfb8a0a8824cd103
ExpoKeepAwake: 3b8815d9dd1d419ee474df004021c69fdd316d08
ExpoModulesCore: f30a203ff1863bab3dd9f4421e7fc1564797f18a
ExpoSecureStore: 060cebcb956b80ddae09821610ac1aa9e1ac74cd
ExpoSystemUI: d4f065a016cae6721b324eb659cdee4d4cf0cb26
ExpoVideo: 671f05cad34c01e3cb033319149e8bc40876c6cb
EXSplashScreen: fbf0ec78e9cee911df188bf17b4fe51d15a84b87
FBLazyVector: ac12dc084d1c8ec4cc4d7b3cf1b0ebda6dab85af
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
Expand Down Expand Up @@ -1551,6 +1647,8 @@ SPEC CHECKSUMS:
React-logger: 257858bd55f3a4e1bc0cf07ddc8fb9faba6f8c7c
React-Mapbuffer: 6c1cacdbf40b531f549eba249e531a7d0bfd8e7f
react-native-safe-area-context: a240ad4b683349e48b1d51fed1611138d1bdad97
react-native-skia: dca6ed315f74bd4ae2b26368f7029dc8d17ba7e7
react-native-slider: 4f44dba40a5e9defebedabf290e07e985d731923
React-nativeconfig: ba9a2e54e2f0882cf7882698825052793ed4c851
React-NativeModulesApple: 8d11ff8955181540585c944cf48e9e7236952697
React-perflogger: ed4e0c65781521e0424f2e5e40b40cc7879d737e
Expand All @@ -1574,7 +1672,9 @@ SPEC CHECKSUMS:
React-runtimescheduler: cfbe85c3510c541ec6dc815c7729b41304b67961
React-utils: f242eb7e7889419d979ca0e1c02ccc0ea6e43b29
ReactCommon: f7da14a8827b72704169a48c929bcde802698361
RNCAsyncStorage: d35c79ffba52c1013013e16b1fc295aec2feabb6
RNGestureHandler: 2282cfbcf86c360d29f44ace393203afd5c6cff7
RNLocalize: 4f22418187ecd5ca693231093ff1d912d1b3c9bc
RNReanimated: 35f9ac9c3ac42d0497ebd1cce5c39d7687a8493e
RNScreens: b32a9ff15bea7fcdbe5dff6477bc503f792b1208
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Expand Down
10 changes: 8 additions & 2 deletions ios/conduit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,24 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-conduit/Pods-conduit-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/EXApplication/ExpoApplication_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/EXConstants.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXConstants/ExpoConstants_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/EXNotifications/ExpoNotifications_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/ExpoFileSystem/ExpoFileSystem_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/ExpoSystemUI/ExpoSystemUI_privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/RNCAsyncStorage/RNCAsyncStorage_resources.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Core/RCTI18nStrings.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoApplication_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/EXConstants.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoConstants_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoNotifications_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoFileSystem_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ExpoSystemUI_privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RNCAsyncStorage_resources.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/RCTI18nStrings.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -351,7 +357,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = ca.psiphon.conduit;
PRODUCT_NAME = "conduit";
PRODUCT_NAME = conduit;
SWIFT_OBJC_BRIDGING_HEADER = "conduit/conduit-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -379,7 +385,7 @@
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = ca.psiphon.conduit;
PRODUCT_NAME = "conduit";
PRODUCT_NAME = conduit;
SWIFT_OBJC_BRIDGING_HEADER = "conduit/conduit-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
12 changes: 6 additions & 6 deletions ios/conduit/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
<string>C617.1</string>
<string>0A2A.1</string>
<string>3B52.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>0A2A.1</string>
<string>3B52.1</string>
<string>C617.1</string>
<string>CA92.1</string>
</array>
</dict>
<dict>
Expand Down
19 changes: 19 additions & 0 deletions src/inproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,22 @@ emitter.addListener("ConduitEvent", (event) => {
}
});
```

## Mock Module

To help with developing and testing the UI, there is a mocked implementation of
the module available in `mockModule.ts`. To use this, replace the import in the
`context.tsx` file:

```
- import { ConduitModule } from "@/src/inproxy/module";
+ import { ConduitModule } from "@/src/inproxy/mockModule";
```

The mock simulates inproxy activity and emits events like the real module, but
without actual users connecting to an InProxy (and without running any native
code). The mock does have some different behaviours:

- The data generation process resets on app reload, since the underlying data
generating process is not being persisted anywhere.
- The mock module does not invoke any notifications
Loading

0 comments on commit d5062d6

Please sign in to comment.