Skip to content

Commit

Permalink
Update v2 dependencies (mattermost#5312)
Browse files Browse the repository at this point in the history
  • Loading branch information
enahum authored Apr 14, 2021
1 parent 661904f commit 9a4a93a
Show file tree
Hide file tree
Showing 60 changed files with 9,928 additions and 14,471 deletions.
10 changes: 7 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": [
"plugin:mattermost/react",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:mattermost/react"
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
Expand All @@ -12,7 +12,7 @@
"settings": {
"react": {
"pragma": "React",
"version": "16.5"
"version": "17.0"
}
},
"env": {
Expand All @@ -22,8 +22,10 @@
"__DEV__": true
},
"rules": {
"eol-last": ["error", "always"],
"global-require": 0,
"no-undefined": 0,
"no-shadow": "off",
"react/display-name": [2, { "ignoreTranspilerName": false }],
"react/jsx-filename-extension": 0,
"camelcase": [
Expand All @@ -41,7 +43,9 @@
"args": "after-used"
}
],
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-explicit-any": "warn",
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/no-var-requires": 0,
"@typescript-eslint/explicit-function-return-type": 0,
Expand Down
13 changes: 3 additions & 10 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; These should not be required directly
; require from fbjs/lib instead: require('fbjs/lib/warning')
node_modules/warning/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

Expand All @@ -30,6 +26,8 @@ emoji=true
esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

exact_by_default=true

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
Expand All @@ -44,10 +42,6 @@ suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
Expand All @@ -59,7 +53,6 @@ unsafe-getters-setters=warn
inexact-spread=warn
unnecessary-invariant=warn
signature-verification-failure=warn
deprecated-utility=error

[strict]
deprecated-type
Expand All @@ -71,4 +64,4 @@ untyped-import
untyped-type-import

[version]
^0.122.0
^0.137.0
7 changes: 3 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.pbxproj -text

# specific for windows script files
*.bat text eol=crlf
# Windows files should use crlf line endings
# https://help.github.com/articles/dealing-with-line-endings/
*.bat text eol=crlf
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

sh ./scripts/pre-commit.sh
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def jscFlavor = 'org.webkit:android-jsc-intl:+'
def enableHermes = project.ext.react.get("enableHermes", false);

android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
Expand Down
7 changes: 6 additions & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
<application
android:usesCleartextTraffic="true"
tools:targetApi="28"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
<data android:scheme="mattermost" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service android:name=".NotificationDismissService"
android:enabled="true"
android:exported="false" />
Expand Down
13 changes: 10 additions & 3 deletions android/app/src/main/java/com/mattermost/helpers/Credentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Credentials {

public static void getCredentialsForCurrentServer(ReactApplicationContext context, ResolvePromise promise) {
final KeychainModule keychainModule = new KeychainModule(context);
final AsyncStorage asyncStorage = new AsyncStorage(context);
final AsyncStorageHelper asyncStorage = new AsyncStorageHelper(context);
final ArrayList<String> keys = new ArrayList<String>(1);
keys.add(CURRENT_SERVER_URL);
KeysReadableArray asyncStorageKeys = new KeysReadableArray() {
Expand All @@ -29,7 +29,14 @@ public String getString(int index) {

HashMap<String, String> asyncStorageResults = asyncStorage.multiGet(asyncStorageKeys);
String serverUrl = asyncStorageResults.get(CURRENT_SERVER_URL);

keychainModule.getGenericPasswordForOptions(serverUrl, promise);
final WritableMap options = Arguments.createMap();
// KeyChain module fails if `authenticationPrompt` is not set
final WritableMap authPrompt = Arguments.createMap();
authPrompt.putString("title", "Authenticate to retrieve secret");
authPrompt.putString("cancel", "Cancel");
options.putMap("authenticationPrompt", authPrompt);
options.putString("service", serverUrl);

keychainModule.getGenericPasswordForOptions(options, promise);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactMarker;
import com.facebook.react.bridge.ReactMarkerConstants;
import com.facebook.react.bridge.JSIModulePackage;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;
Expand All @@ -48,6 +49,7 @@
import org.unimodules.core.interfaces.SingletonModule;

import com.nozbe.watermelondb.WatermelonDBPackage;
import com.swmansion.reanimated.ReanimatedJSIModulePackage;

public class MainApplication extends NavigationApplication implements INotificationsApplication, INotificationsDrawerApplication {
public static MainApplication instance;
Expand Down Expand Up @@ -123,6 +125,11 @@ public Map<String, ReactModuleInfo> getReactModuleInfos() {
return packages;
}

@Override
protected JSIModulePackage getJSIModulePackage() {
return new ReanimatedJSIModulePackage();
}

@Override
protected String getJSMainModuleName() {
return "index";
Expand Down
5 changes: 3 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

buildscript {
ext {
buildToolsVersion = "29.0.2"
buildToolsVersion = "29.0.3"
minSdkVersion = 24
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
supportLibVersion = "28.0.0"
kotlinVersion = "1.3.61"
kotlin_version = "1.3.61"
Expand All @@ -19,7 +20,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"

Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ android.useAndroidX=true
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.37.0
FLIPPER_VERSION=0.75.1
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
22 changes: 4 additions & 18 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand All @@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init
if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
Expand All @@ -64,28 +64,14 @@ echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
Expand Down
2 changes: 1 addition & 1 deletion app/constants/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,4 @@ const Preferences: Dictionary<any> = {
},
};

export default Preferences;
export default Preferences;
2 changes: 1 addition & 1 deletion app/database/admin/data_operator/handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class DataOperator {
}
}

if (operator && fieldName && findMatchingRecordBy) {
if (fieldName && findMatchingRecordBy) {
await this.handleEntityRecords({
findMatchingRecordBy,
fieldName,
Expand Down
5 changes: 4 additions & 1 deletion app/database/admin/database_manager/__mocks__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class DatabaseManager {
dbName: databaseName,
migrations,
schema,
useWebWorker: false,
useIncrementalIndexedDB: true,
});

// Registers the new server connection into the DEFAULT database
Expand All @@ -145,7 +147,8 @@ class DatabaseManager {
}
return new Database({adapter, actionsEnabled, modelClasses});
} catch (e) {
// console.log(e);
// eslint-disable-next-line no-console
console.log('ERROR ==========================\n', e);
}

return undefined;
Expand Down
2 changes: 1 addition & 1 deletion app/init/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import AsyncStorage from '@react-native-community/async-storage';
import * as KeyChain from 'react-native-keychain';

import * as analytics from '@init/analytics.ts';
import * as analytics from '@init/analytics';
import emmProvider from '@init/emm_provider';
import EphemeralStore from '@store/ephemeral_store';
import {getCSRFFromCookie} from '@utils/security';
Expand Down
2 changes: 1 addition & 1 deletion app/init/global_event_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import semver from 'semver';
import LocalConfig from '@assets/config.json';
import {Navigation} from '@constants';
import {DEFAULT_LOCALE, getTranslations, resetMomentLocale, t} from '@i18n';
import * as analytics from '@init/analytics.ts';
import * as analytics from '@init/analytics';
import {getAppCredentials, removeAppCredentials} from '@init/credentials';
import PushNotifications from '@init/push_notifications';
import {deleteFileCache} from '@utils/file';
Expand Down
2 changes: 1 addition & 1 deletion app/init/push_notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ class PushNotifications {
};
}

export default new PushNotifications();
export default new PushNotifications();
2 changes: 1 addition & 1 deletion app/utils/client_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ export class ClientError extends Error {
// copying the object by using `{...error}` would not include the message.
Object.defineProperty(this, 'message', {enumerable: true});
}
}
}
2 changes: 1 addition & 1 deletion app/utils/error_handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ class JavascriptAndNativeErrorHandler {
};
}

export default new JavascriptAndNativeErrorHandler();
export default new JavascriptAndNativeErrorHandler();
2 changes: 1 addition & 1 deletion app/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export async function deleteFileCache() {
}

return true;
}
}
2 changes: 1 addition & 1 deletion app/utils/font_family.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ const setFontFamily = () => {
};
};

export default setFontFamily;
export default setFontFamily;
2 changes: 1 addition & 1 deletion app/utils/key_mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export default function keyMirror<T extends {}>(obj: T): { [K in keyof T]: K } {
ret[key] = key;
}
return ret;
}
}
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = {
safe: false,
allowUndefined: true,
}],
'react-native-reanimated/plugin',
],
exclude: ['**/*.png', '**/*.jpg', '**/*.gif'],
};
Loading

0 comments on commit 9a4a93a

Please sign in to comment.