Skip to content

Commit

Permalink
Refactor networking layer (thisisqubika#94)
Browse files Browse the repository at this point in the history
* Maintenance & refactor

* Address code review comments
  • Loading branch information
donatoaguirre24 authored Dec 7, 2021
1 parent 3298e60 commit 20eb673
Show file tree
Hide file tree
Showing 30 changed files with 2,658 additions and 2,109 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
'testing-library/await-async-utils': 'error',
'testing-library/no-await-sync-events': 'error',
'testing-library/no-await-sync-query': 'error',
'testing-library/no-unnecessary-act': 'error',
'testing-library/no-wait-for-empty-callback': 'error',
'testing-library/no-wait-for-multiple-assertions': 'error',
'testing-library/no-wait-for-snapshot': 'error',
Expand Down
17 changes: 9 additions & 8 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const alias = { '^@/(.+)': './src/\\1' }; // @/folder will be an alias to <root>/src/folder
const extensions = ['.android.js', '.ios.js', '.js', '.json', '.native'];

const presets = ['module:metro-react-native-babel-preset'];
const plugins = [['module-resolver', { alias, extensions }], 'react-native-reanimated/plugin'];

if (process.env.NODE_ENV === 'production') {
plugins.unshift('transform-remove-console'); // reanimated plugin has to be listed last
}

module.exports = { presets, plugins };
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [['module-resolver', { alias, extensions }], 'react-native-reanimated/plugin'],
env: {
production: {
plugins: ['transform-remove-console'],
},
},
};
47 changes: 20 additions & 27 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ PODS:
- FlipperKit/FlipperKitNetworkPlugin
- glog (0.3.5)
- libevent (2.1.12)
- MMKV (1.2.7):
- MMKVCore (~> 1.2.7)
- MMKVCore (1.2.7)
- OpenSSL-Universal (1.1.180)
- RCT-Folly (2020.01.13.00):
- boost-for-react-native
Expand Down Expand Up @@ -266,14 +263,11 @@ PODS:
- React-jsi (= 0.64.1)
- React-perflogger (= 0.64.1)
- React-jsinspector (0.64.1)
- react-native-config (1.4.2):
- react-native-config/App (= 1.4.2)
- react-native-config/App (1.4.2):
- react-native-config (1.4.5):
- react-native-config/App (= 1.4.5)
- react-native-config/App (1.4.5):
- React-Core
- react-native-mmkv-storage (0.5.3):
- MMKV (= 1.2.7)
- React-Core
- react-native-safe-area-context (3.2.0):
- react-native-safe-area-context (3.3.2):
- React-Core
- React-perflogger (0.64.1)
- React-RCTActionSheet (0.64.1):
Expand Down Expand Up @@ -341,13 +335,15 @@ PODS:
- React-perflogger (= 0.64.1)
- ReactNativeLocalization (2.1.7):
- React-Core
- RNBootSplash (3.2.3):
- RNBootSplash (3.2.6):
- React-Core
- RNCAsyncStorage (1.15.14):
- React-Core
- RNCMaskedView (0.1.11):
- React
- RNGestureHandler (1.10.3):
- React-Core
- RNReanimated (2.1.0):
- RNReanimated (2.2.4):
- DoubleConversion
- FBLazyVector
- FBReactNativeSpec
Expand Down Expand Up @@ -376,8 +372,9 @@ PODS:
- React-RCTVibration
- ReactCommon/turbomodule/core
- Yoga
- RNScreens (3.2.0):
- RNScreens (3.10.0):
- React-Core
- React-RCTImage
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -420,7 +417,6 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-config (from `../node_modules/react-native-config`)
- react-native-mmkv-storage (from `../node_modules/react-native-mmkv-storage`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
Expand All @@ -436,6 +432,7 @@ DEPENDENCIES:
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- ReactNativeLocalization (from `../node_modules/react-native-localization`)
- RNBootSplash (from `../node_modules/react-native-bootsplash`)
- "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)"
- "RNCMaskedView (from `../node_modules/@react-native-community/masked-view`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
Expand All @@ -454,8 +451,6 @@ SPEC REPOS:
- Flipper-RSocket
- FlipperKit
- libevent
- MMKV
- MMKVCore
- OpenSSL-Universal
- YogaKit

Expand Down Expand Up @@ -492,8 +487,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-config:
:path: "../node_modules/react-native-config"
react-native-mmkv-storage:
:path: "../node_modules/react-native-mmkv-storage"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
React-perflogger:
Expand Down Expand Up @@ -524,6 +517,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-localization"
RNBootSplash:
:path: "../node_modules/react-native-bootsplash"
RNCAsyncStorage:
:path: "../node_modules/@react-native-async-storage/async-storage"
RNCMaskedView:
:path: "../node_modules/@react-native-community/masked-view"
RNGestureHandler:
Expand All @@ -550,8 +545,6 @@ SPEC CHECKSUMS:
FlipperKit: 651f50a42eb95c01b3e89a60996dd6aded529eeb
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
MMKV: 22e5136f7d00197bc0fc9694b7f71519f0d1ca12
MMKVCore: 607b7b05f2c2140056b5d338e45f2c14bf3f4232
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c
RCTRequired: ec2ebc96b7bfba3ca5c32740f5a0c6a014a274d2
Expand All @@ -564,9 +557,8 @@ SPEC CHECKSUMS:
React-jsi: 5de8204706bd872b78ea646aee5d2561ca1214b6
React-jsiexecutor: 124e8f99992490d0d13e0649d950d3e1aae06fe9
React-jsinspector: 500a59626037be5b3b3d89c5151bc3baa9abf1a9
react-native-config: c98128a72bc2c3a1ca72caec0b021f0fa944aa29
react-native-mmkv-storage: 21a24b5439231dad4f360713954ea22b566d990a
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
react-native-config: 6502b1879f97ed5ac570a029961fc35ea606cd14
react-native-safe-area-context: 584dc04881deb49474363f3be89e4ca0e854c057
React-perflogger: aad6d4b4a267936b3667260d1f649b6f6069a675
React-RCTActionSheet: fc376be462c9c8d6ad82c0905442fd77f82a9d2a
React-RCTAnimation: ba0a1c3a2738be224a08092fa7f1b444ab77d309
Expand All @@ -580,14 +572,15 @@ SPEC CHECKSUMS:
React-runtimeexecutor: ff951a0c241bfaefc4940a3f1f1a229e7cb32fa6
ReactCommon: bedc99ed4dae329c4fcf128d0c31b9115e5365ca
ReactNativeLocalization: 90a1181b7672309701dd7e5364fbf587319d41c6
RNBootSplash: 8ef5ffa03dadd35f66510b42960ce40f397c98bf
RNBootSplash: 51eef7e143faeab63f81ddbb7c1de38b8fba66ed
RNCAsyncStorage: ea6b5c280997b2b32a587793163b1f10e580c4f7
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
RNReanimated: b8c8004b43446e3c2709fe64b2b41072f87428ad
RNScreens: c277bfc4b5bb7c2fe977d19635df6f974f95dfd6
RNReanimated: 024eff8202342abf4b24e11575a16afc441dabfe
RNScreens: 03ba504f8c98607ad1f07808e71040e0afa335ec
Yoga: a7de31c64fe738607e7a3803e3f591a4b1df7393
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 9eb4275481b39e732a9dce1baa348e766232f727

COCOAPODS: 1.10.1
COCOAPODS: 1.11.2
22 changes: 4 additions & 18 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
import { NativeModules } from 'react-native';

NativeModules.ReactLocalization = {
language: 'en',
};
NativeModules.ReactLocalization = { language: 'en' };

global.__reanimatedWorkletInit = jest.fn();
require('react-native-reanimated/lib/reanimated2/jestUtils').setUpTests();

jest.mock('react-native-reanimated', () => ({
...jest.requireActual('react-native-reanimated/mock'),
useSharedValue: jest.fn,
useAnimatedStyle: jest.fn,
withTiming: jest.fn,
withSpring: jest.fn,
withRepeat: jest.fn,
withSequence: jest.fn,
useAnimatedProps: jest.fn,
Easing: {
linear: jest.fn,
elastic: jest.fn,
},
}));
jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage);

jest.mock('react-native-bootsplash', () => ({
hide: jest.fn().mockResolvedValueOnce(),
Expand Down
Loading

0 comments on commit 20eb673

Please sign in to comment.