We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Migrate to react-native-community AsyncStorage and StatusBar

parent 50ed3223
export default from '@react-native-community/async-storage/jest/async-storage-mock';
......@@ -2,7 +2,7 @@ import { expectSaga } from 'redux-saga-test-plan';
import * as matchers from 'redux-saga-test-plan/matchers';
import { throwError } from 'redux-saga-test-plan/providers';
import Snackbar from 'react-native-snackbar';
import { AsyncStorage } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { Sentry } from 'react-native-sentry';
import sessionSaga, {
......@@ -19,14 +19,6 @@ jest.mock('react-native-snackbar', () => ({
dismiss: jest.fn(),
}));
jest.mock('react-native', () => ({
AsyncStorage: {
multiSet: jest.fn(),
multiRemove: jest.fn(),
clear: jest.fn(),
},
}));
jest.mock('../../app/utils/url', () => ({
apiRequest: jest.fn(() => {}),
}));
......
......@@ -3,7 +3,7 @@ import * as matchers from 'redux-saga-test-plan/matchers';
import { throwError } from 'redux-saga-test-plan/providers';
import { select } from 'redux-saga/effects';
import { AsyncStorage } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { Sentry } from 'react-native-sentry';
import settingsSaga from '../../app/sagas/settings';
......@@ -13,13 +13,6 @@ import * as pushNotificationActions from '../../app/actions/pushNotifications';
import { tokenSelector } from '../../app/selectors/session';
import { apiRequest } from '../../app/utils/url';
jest.mock('react-native', () => ({
AsyncStorage: {
getItem: jest.fn(),
setItem: jest.fn(),
},
}));
jest.mock('react-native-sentry', () => ({
Sentry: {
captureException: jest.fn(),
......
......@@ -7,3 +7,13 @@ NativeModules.RNFirebase = {
NativeModules.RNShare = {
};
NativeModules.RNCStatusBarManager = {
HEIGHT: 42,
setColor: jest.fn(),
setStyle: jest.fn(),
setHidden: jest.fn(),
setNetworkActivityIndicatorVisible: jest.fn(),
setBackgroundColor: jest.fn(),
setTranslucent: jest.fn(),
};
......@@ -76,6 +76,8 @@ android {
}
dependencies {
implementation project(':@react-native-community_status-bar')
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-device-info')
implementation project(':react-native-screens')
implementation project(':react-native-gesture-handler')
......
......@@ -3,6 +3,8 @@ package com.thaliapp;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.reactnativecommunity.statusbar.RNCStatusBarPackage;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.swmansion.rnscreens.RNScreensPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
......@@ -37,6 +39,8 @@ public class MainApplication extends Application implements ShareApplication, Re
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new RNCStatusBarPackage(),
new AsyncStoragePackage(),
new RNDeviceInfo(),
new RNScreensPackage(),
new RNGestureHandlerPackage(),
......
......@@ -30,7 +30,7 @@ allprojects {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
minSdkVersion = 18
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
......
rootProject.name = 'ThaliApp'
include ':@react-native-community_status-bar'
project(':@react-native-community_status-bar').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/status-bar/android')
include ':@react-native-community_async-storage'
project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':react-native-screens'
......
......@@ -2,7 +2,7 @@ import {
call, put, takeEvery, select,
} from 'redux-saga/effects';
import { delay } from 'redux-saga';
import { AsyncStorage } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import Snackbar from 'react-native-snackbar';
import { Sentry } from 'react-native-sentry';
import i18next from '../utils/i18n';
......
import { AsyncStorage } from 'react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { Sentry } from 'react-native-sentry';
import {
all, call, put, select, takeEvery,
......
......@@ -4,7 +4,6 @@ import {
BackHandler,
Easing,
Platform,
StatusBar,
Text,
TextInput,
TouchableOpacity,
......@@ -12,6 +11,7 @@ import {
SafeAreaView,
} from 'react-native';
import PropTypes from 'prop-types';
import StatusBar from '@react-native-community/status-bar';
import Icon from 'react-native-vector-icons/MaterialIcons';
......
import React from 'react';
import {
StatusBar, Text, TouchableOpacity, View, SafeAreaView,
Text, TouchableOpacity, View, SafeAreaView,
} from 'react-native';
import StatusBar from '@react-native-community/status-bar';
import { withTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
import Icon from 'react-native-vector-icons/MaterialIcons';
......
import { Platform, StatusBar } from 'react-native';
import { Platform } from 'react-native';
import StatusBar from '@react-native-community/status-bar';
import DeviceInfo from 'react-native-device-info';
import StyleSheet from '../../../style/StyleSheet';
......
......@@ -5,10 +5,10 @@ import {
ImageBackground,
Platform,
ScrollView,
StatusBar,
TouchableOpacity,
View,
} from 'react-native';
import StatusBar from '@react-native-community/status-bar';
import { withTranslation } from 'react-i18next';
import LinearGradient from 'react-native-linear-gradient';
import Icon from 'react-native-vector-icons/MaterialIcons';
......
......@@ -39,6 +39,8 @@
2DF0FFEE2056DD460020B375 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
2F6E0641344C43BD8556F071 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DCCD2767C1244F58838A52AC /* Ionicons.ttf */; };
3238F61D229F16FE00BEB7F8 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3238F61A229F16F400BEB7F8 /* libRNDeviceInfo.a */; };
32472E7522A00BB7002A0BC5 /* libRNCAsyncStorage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 32472E6822A00BB1002A0BC5 /* libRNCAsyncStorage.a */; };
32472E7E22A00FBC002A0BC5 /* libRNCStatusBar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 32472E7D22A00FB4002A0BC5 /* libRNCStatusBar.a */; };
327DC4A2229EB48000DE29E9 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 327DC4A1229EB48000DE29E9 /* GoogleService-Info.plist */; };
327DC54B229EB8E100DE29E9 /* libBVLinearGradient.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 327DC537229EB6C300DE29E9 /* libBVLinearGradient.a */; };
327DC54C229EB8E100DE29E9 /* libRNScreens.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 327DC527229EB68D00DE29E9 /* libRNScreens.a */; };
......@@ -210,6 +212,20 @@
remoteGlobalIDString = E72EC1401F7ABB5A0001BC90;
remoteInfo = "RNDeviceInfo-tvOS";
};
32472E6722A00BB1002A0BC5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 32472E3B22A00BB1002A0BC5 /* RNCAsyncStorage.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNCAsyncStorage;
};
32472E7C22A00FB4002A0BC5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 32472E7822A00FB4002A0BC5 /* RNCStatusBar.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNCStatusBar;
};
327DC48C229EB42900DE29E9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
......@@ -467,6 +483,8 @@
2D16E6891FA4F8E400B85C8A /* libReact.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libReact.a; sourceTree = BUILT_PRODUCTS_DIR; };
2F20D59838BD63F955316D16 /* Pods-ThaliAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ThaliAppTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-ThaliAppTests/Pods-ThaliAppTests.release.xcconfig"; sourceTree = "<group>"; };
3238F614229F16F300BEB7F8 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNDeviceInfo.xcodeproj; path = "../node_modules/react-native-device-info/ios/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; };
32472E3B22A00BB1002A0BC5 /* RNCAsyncStorage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCAsyncStorage.xcodeproj; path = "../node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.xcodeproj"; sourceTree = "<group>"; };
32472E7822A00FB4002A0BC5 /* RNCStatusBar.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNCStatusBar.xcodeproj; path = "../node_modules/@react-native-community/status-bar/ios/RNCStatusBar.xcodeproj"; sourceTree = "<group>"; };
327DC4A1229EB48000DE29E9 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
327DC4A3229EB53A00DE29E9 /* ThaliApp.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; name = ThaliApp.entitlements; path = ThaliApp/ThaliApp.entitlements; sourceTree = "<group>"; };
327DC4B2229EB5A700DE29E9 /* RNSentry.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNSentry.xcodeproj; path = "../node_modules/react-native-sentry/ios/RNSentry.xcodeproj"; sourceTree = "<group>"; };
......@@ -517,6 +535,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32472E7E22A00FBC002A0BC5 /* libRNCStatusBar.a in Frameworks */,
32472E7522A00BB7002A0BC5 /* libRNCAsyncStorage.a in Frameworks */,
3238F61D229F16FE00BEB7F8 /* libRNDeviceInfo.a in Frameworks */,
327DC59C229EBC1500DE29E9 /* libRNGestureHandler.a in Frameworks */,
327DC54B229EB8E100DE29E9 /* libBVLinearGradient.a in Frameworks */,
......@@ -725,6 +745,22 @@
name = Products;
sourceTree = "<group>";
};
32472E3C22A00BB1002A0BC5 /* Products */ = {
isa = PBXGroup;
children = (
32472E6822A00BB1002A0BC5 /* libRNCAsyncStorage.a */,
);
name = Products;
sourceTree = "<group>";
};
32472E7922A00FB4002A0BC5 /* Products */ = {
isa = PBXGroup;
children = (
32472E7D22A00FB4002A0BC5 /* libRNCStatusBar.a */,
);
name = Products;
sourceTree = "<group>";
};
327DC466229EB42900DE29E9 /* Recovered References */ = {
isa = PBXGroup;
children = (
......@@ -835,6 +871,8 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
32472E7822A00FB4002A0BC5 /* RNCStatusBar.xcodeproj */,
32472E3B22A00BB1002A0BC5 /* RNCAsyncStorage.xcodeproj */,
3238F614229F16F300BEB7F8 /* RNDeviceInfo.xcodeproj */,
327DC542229EB76A00DE29E9 /* RNGestureHandler.xcodeproj */,
327DC522229EB68D00DE29E9 /* RNScreens.xcodeproj */,
......@@ -1071,6 +1109,14 @@
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 32472E3C22A00BB1002A0BC5 /* Products */;
ProjectRef = 32472E3B22A00BB1002A0BC5 /* RNCAsyncStorage.xcodeproj */;
},
{
ProductGroup = 32472E7922A00FB4002A0BC5 /* Products */;
ProjectRef = 32472E7822A00FB4002A0BC5 /* RNCStatusBar.xcodeproj */;
},
{
ProductGroup = 3238F615229F16F300BEB7F8 /* Products */;
ProjectRef = 3238F614229F16F300BEB7F8 /* RNDeviceInfo.xcodeproj */;
......@@ -1241,6 +1287,20 @@
remoteRef = 3238F61B229F16F400BEB7F8 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
32472E6822A00BB1002A0BC5 /* libRNCAsyncStorage.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNCAsyncStorage.a;
remoteRef = 32472E6722A00BB1002A0BC5 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
32472E7D22A00FB4002A0BC5 /* libRNCStatusBar.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNCStatusBar.a;
remoteRef = 32472E7C22A00FB4002A0BC5 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
327DC48D229EB42900DE29E9 /* libjsi.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
......
......@@ -38,14 +38,16 @@
"<rootDir>/__tests__/setup.js"
],
"transformIgnorePatterns": [
"node_modules/(?!react-native|@react-navigation|i18next-react-native-language-detector|react-navigation-drawer|react-navigation-stack/)"
"node_modules/(?!react-native|@react-native-community|@react-navigation|react-navigation-drawer|react-navigation-stack/)"
],
"moduleNameMapper": {
"react-i18next": "<rootDir>/__mocks__/react-i18next-mock.js"
}
},
"dependencies": {
"@react-native-community/async-storage": "1.4.2",
"@react-native-community/cli": "1.9.7",
"@react-native-community/status-bar": "1.0.3",
"i18next": "15.1.3",
"metro-config": "0.54.1",
"metro-core": "0.54.1",
......
......@@ -982,6 +982,11 @@
"@types/istanbul-reports" "^1.1.1"
"@types/yargs" "^12.0.9"
"@react-native-community/async-storage@^1.4.2":
version "1.4.2"
resolved "https://registry.yarnpkg.com/@react-native-community/async-storage/-/async-storage-1.4.2.tgz#b29d2fa1b294fec8526f69b852a3deda248c8d81"
integrity sha512-gDQENh7uPLGPKbRFI07GiUXZPhm2j17K4FT308OwAmIiOKbfO/cxy0sCWB0YzD/SLw9F3D9tLBRPJY6GG9YZLw==
"@react-native-community/cli@1.9.7":
version "1.9.7"
resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-1.9.7.tgz#1d0aad150a83f8ee06410c216b1b37e8861aa59f"
......@@ -1062,6 +1067,11 @@
xcode "^2.0.0"
xmldoc "^0.4.0"
"@react-native-community/status-bar@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@react-native-community/status-bar/-/status-bar-1.0.3.tgz#e90ba515adb97dcffd956f90e965d5e7e2de95b8"
integrity sha512-5gwhG1gBTXqgSi/e9DbraBQBCtUtTCSrI9kuwEpwLOCa/pKLIyxQG/HM96ZjvytbZOTZXeaTiKtqLFvYNYSx3A==
"@react-navigation/core@~3.4.1":
version "3.4.2"
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-3.4.2.tgz#bec563e94fde40fbab3730cdc97f22afbb2a1498"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment