diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 29c077b..0000000 --- a/.eslintrc +++ /dev/null @@ -1,42 +0,0 @@ -{ - "env": { - "node": true, - "mocha": true, - "es6": true - }, - "extends": ["eslint:recommended", "plugin:react/recommended"], - "parser": "babel-eslint", - "parserOptions": { - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - }, - "ecmaVersion": 2018 - }, - "plugins": ["react"], - "settings": { - "react": { - "version": require("./package.json").dependencies.react - } - }, - "rules": { - "indent": ["error", 2], - "no-console": ["error", { "allow": ["warn", "error"] }], - "space-before-function-paren": 0, - "semi": ["warn", "never"], - "space-infix-ops": ["warn"], - "no-var": "error", - "prefer-const": "error", - "no-trailing-spaces": "error", - "react/prop-types": 2, - "max-len": [ - 1, - { - "ignoreStrings": true, - "ignoreComments": true, - "ignoreTemplateLiterals": true - } - ], - "no-multi-spaces": 2 - } -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..614a09b --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,46 @@ +module.exports = { + root: true, + extends: [ + 'eslint:recommended', + 'plugin:react/recommended', + ], + env: { + node: true, + mocha: true, + es6: true, + }, + parser: 'babel-eslint', + parserOptions: { + sourceType: 'module', + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 2018, + }, + plugins: ['react'], + settings: { + react: { + version: require('./package.json').dependencies.react, + }, + }, + rules: { + indent: ['error', 2], + 'no-console': ['error', { 'allow': ['warn', 'error'] }], + 'space-before-function-paren': 0, + semi: ['warn', 'never'], + 'space-infix-ops': ['warn'], + 'no-var': 'error', + 'prefer-const': 'error', + 'no-trailing-spaces': 'error', + 'react/prop-types': 2, + 'max-len': [ + 1, + { + 'ignoreStrings': true, + 'ignoreComments': true, + 'ignoreTemplateLiterals': true + } + ], + 'no-multi-spaces': 2, + }, +}; diff --git a/.flowconfig b/.flowconfig new file mode 100644 index 0000000..acb89d4 --- /dev/null +++ b/.flowconfig @@ -0,0 +1,50 @@ +; Ignore "BUCK" generated dirs +/\.buckd/ +; 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 +[untyped] +.*/node_modules/@react-native-community/cli/.*/.* +[include] +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable +module.file_ext=.js +module.file_ext=.json +module.file_ext=.ios.js +munge_underscores=true +module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation' +module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(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 +sketchy-number=warn +untyped-type-import=warn +nonstrict-import=warn +deprecated-type=warn +unsafe-getters-setters=warn +inexact-spread=warn +unnecessary-invariant=warn +signature-verification-failure=warn +deprecated-utility=error +[strict] +deprecated-type +nonstrict-import +sketchy-null +unclear-type +unsafe-getters-setters +untyped-import +untyped-type-import +[version] +^0.105.0 diff --git a/.gitignore b/.gitignore index 2266a24..cb13b90 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,7 @@ DerivedData *.hmap *.ipa *.xcuserstate -project.xcworkspace +xcshareddata ios/Index/DataStore # Android/IntelliJ @@ -44,6 +44,7 @@ yarn-error.log buck-out/ \.buckd/ *.keystore +!debug.keystore # fastlane # @@ -59,6 +60,9 @@ buck-out/ # Bundle artifact *.jsbundle +# CocoaPods +/ios/Pods/ + # RN android release android/app/bin/ android/app/release/ diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..5c4de1a --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,6 @@ +module.exports = { + bracketSpacing: false, + jsxBracketSameLine: true, + singleQuote: true, + trailingComma: 'all', +}; diff --git a/android/app/build.gradle b/android/app/build.gradle index ec0933a..2033649 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -18,6 +18,9 @@ import com.android.build.OutputFile * // the entry file for bundle generation * entryFile: "index.android.js", * +* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format + * bundleCommand: "ram-bundle", + * * // whether to bundle JS and assets in debug mode * bundleInDebug: false, * @@ -73,7 +76,8 @@ import com.android.build.OutputFile */ project.ext.react = [ - entryFile: "index.js" + entryFile: "index.js", + enableHermes: false, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" @@ -94,6 +98,27 @@ def enableSeparateBuildPerCPUArchitecture = false */ def enableProguardInReleaseBuilds = false +/** + * The preferred build flavor of JavaScriptCore. + * + * For example, to use the international variant, you can use: + * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` + * + * The international variant includes ICU i18n library and necessary data + * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that + * give correct results when using with locales other than en-US. Note that + * this variant is about 6MiB larger per architecture than default. + */ +def jscFlavor = 'org.webkit:android-jsc:+' +/** + * Whether to enable the Hermes VM. + * + * This should be set on project.ext.react and mirrored here. If it is not set + * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode + * and the benefits of using Hermes will therefore be sharply reduced. + */ +def enableHermes = project.ext.react.get("enableHermes", false); + android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion @@ -116,6 +141,12 @@ android { testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' } signingConfigs { + debug { + storeFile file('debug.keystore') + storePassword 'android' + keyAlias 'androiddebugkey' + keyPassword 'android' + } release { if (project.hasProperty('DRIP_RELEASE_STORE_FILE')) { storeFile file(DRIP_RELEASE_STORE_FILE) @@ -134,7 +165,13 @@ android { } } buildTypes { + debug { + signingConfig signingConfigs.debug + } release { + // Caution! In production, you need to generate your own keystore file. + // see https://facebook.github.io/react-native/docs/signed-apk-android. + signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" signingConfig signingConfigs.release @@ -144,8 +181,8 @@ android { applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: - // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a":3, "x86_64":4] + // https://developer.android.com/studio/build/configure-apk-splits.html + def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = @@ -156,18 +193,19 @@ android { } dependencies { - implementation project(':realm') - implementation project(':react-native-vector-icons') - implementation project(':react-native-share') - implementation project(':react-native-restart') - implementation project(':react-native-push-notification') - implementation project(':react-native-fs') - implementation project(':react-native-document-picker') - implementation project(':nodejs-mobile-react-native') implementation fileTree(dir: "libs", include: ["*.jar"]) implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.annotation:annotation:1.1.0' implementation "com.facebook.react:react-native:+" // From node_modules + + if (enableHermes) { + def hermesPath = "../../node_modules/hermes-engine/android/"; + debugImplementation files(hermesPath + "hermes-debug.aar") + releaseImplementation files(hermesPath + "hermes-release.aar") + } else { + implementation jscFlavor + } + androidTestImplementation('com.wix:detox:+') { transitive = true } androidTestImplementation 'junit:junit:4.12' } @@ -178,3 +216,5 @@ task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } + +apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) diff --git a/android/app/debug.keystore b/android/app/debug.keystore new file mode 100644 index 0000000..364e105 Binary files /dev/null and b/android/app/debug.keystore differ diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index c5d85cf..e0ebb3b 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -10,6 +10,8 @@ + + - - + + android:resource="@android:color/white"/> + + + + + + + + + diff --git a/android/app/src/main/assets/fonts/AntDesign.ttf b/android/app/src/main/assets/fonts/AntDesign.ttf deleted file mode 100644 index 2abf035..0000000 Binary files a/android/app/src/main/assets/fonts/AntDesign.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Entypo.ttf b/android/app/src/main/assets/fonts/Entypo.ttf deleted file mode 100644 index 1c8f5e9..0000000 Binary files a/android/app/src/main/assets/fonts/Entypo.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/EvilIcons.ttf b/android/app/src/main/assets/fonts/EvilIcons.ttf deleted file mode 100644 index 6868f7b..0000000 Binary files a/android/app/src/main/assets/fonts/EvilIcons.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Feather.ttf b/android/app/src/main/assets/fonts/Feather.ttf deleted file mode 100755 index fc963df..0000000 Binary files a/android/app/src/main/assets/fonts/Feather.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/FontAwesome.ttf b/android/app/src/main/assets/fonts/FontAwesome.ttf deleted file mode 100644 index 35acda2..0000000 Binary files a/android/app/src/main/assets/fonts/FontAwesome.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf b/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf deleted file mode 100644 index 5f72e91..0000000 Binary files a/android/app/src/main/assets/fonts/FontAwesome5_Brands.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf b/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf deleted file mode 100644 index a309313..0000000 Binary files a/android/app/src/main/assets/fonts/FontAwesome5_Regular.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf b/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf deleted file mode 100644 index 7ece328..0000000 Binary files a/android/app/src/main/assets/fonts/FontAwesome5_Solid.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Fontisto.ttf b/android/app/src/main/assets/fonts/Fontisto.ttf deleted file mode 100755 index 96e2e81..0000000 Binary files a/android/app/src/main/assets/fonts/Fontisto.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Foundation.ttf b/android/app/src/main/assets/fonts/Foundation.ttf deleted file mode 100644 index 6cce217..0000000 Binary files a/android/app/src/main/assets/fonts/Foundation.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Ionicons.ttf b/android/app/src/main/assets/fonts/Ionicons.ttf deleted file mode 100644 index 67bd842..0000000 Binary files a/android/app/src/main/assets/fonts/Ionicons.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf b/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf deleted file mode 100644 index 3219fca..0000000 Binary files a/android/app/src/main/assets/fonts/MaterialCommunityIcons.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/MaterialIcons.ttf b/android/app/src/main/assets/fonts/MaterialIcons.ttf deleted file mode 100644 index 7015564..0000000 Binary files a/android/app/src/main/assets/fonts/MaterialIcons.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Octicons.ttf b/android/app/src/main/assets/fonts/Octicons.ttf deleted file mode 100644 index ceac75d..0000000 Binary files a/android/app/src/main/assets/fonts/Octicons.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/SimpleLineIcons.ttf b/android/app/src/main/assets/fonts/SimpleLineIcons.ttf deleted file mode 100644 index 6ecb686..0000000 Binary files a/android/app/src/main/assets/fonts/SimpleLineIcons.ttf and /dev/null differ diff --git a/android/app/src/main/assets/fonts/Zocial.ttf b/android/app/src/main/assets/fonts/Zocial.ttf deleted file mode 100644 index e4ae46c..0000000 Binary files a/android/app/src/main/assets/fonts/Zocial.ttf and /dev/null differ diff --git a/android/app/src/main/java/com/drip/MainActivity.java b/android/app/src/main/java/com/drip/MainActivity.java index 4f3b961..2de6d9e 100644 --- a/android/app/src/main/java/com/drip/MainActivity.java +++ b/android/app/src/main/java/com/drip/MainActivity.java @@ -4,12 +4,12 @@ import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "drip"; - } + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + @Override + protected String getMainComponentName() { + return "drip"; + } } diff --git a/android/app/src/main/java/com/drip/MainApplication.java b/android/app/src/main/java/com/drip/MainApplication.java index dc83fe7..99642fe 100644 --- a/android/app/src/main/java/com/drip/MainApplication.java +++ b/android/app/src/main/java/com/drip/MainApplication.java @@ -1,53 +1,39 @@ package com.drip; import android.app.Application; - +import android.content.Context; +import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; -import com.janeasystems.rn_nodejs_mobile.RNNodeJsMobilePackage; -import com.avishayil.rnrestart.ReactNativeRestartPackage; -import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage; -import com.oblador.vectoricons.VectorIconsPackage; -import com.rnfs.RNFSPackage; -import com.reactnativedocumentpicker.ReactNativeDocumentPicker; -import cl.json.RNSharePackage; import cl.json.ShareApplication; -import io.realm.react.RealmReactPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; - -import java.util.Arrays; +import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication, ShareApplication { - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { - @Override - public boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } + private final ReactNativeHost mReactNativeHost = + new ReactNativeHost(this) { + @Override + public boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new RNNodeJsMobilePackage(), - new ReactNativeRestartPackage(), - new ReactNativePushNotificationPackage(), - new VectorIconsPackage(), - new RNFSPackage(), - new ReactNativeDocumentPicker(), - new RNSharePackage(), - new RealmReactPackage() - ); - } + @Override + protected List getPackages() { + @SuppressWarnings("UnnecessaryLocalVariable") + List packages = new PackageList(this).getPackages(); + // Packages that cannot be autolinked yet can be added manually here, for example: + // packages.add(new MyReactNativePackage()); + return packages; + } - @Override - protected String getJSMainModuleName() { - return "index"; - } - }; + @Override + protected String getJSMainModuleName() { + return "index"; + } + }; @Override public ReactNativeHost getReactNativeHost() { @@ -58,6 +44,32 @@ public class MainApplication extends Application implements ReactApplication, Sh public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); + initializeFlipper(this); // Remove this line if you don't want Flipper enabled + } + /** + * Loads Flipper in React Native templates. + * + * @param context + */ + private static void initializeFlipper(Context context) { + if (BuildConfig.DEBUG) { + try { + /* + We use reflection here to pick up the class that initializes Flipper, + since Flipper library is not available in release mode + */ + Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); + aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } + } } @Override diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 97b7d4f..7f5bcbe 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -3,6 +3,7 @@