Skip to content

Commit

Permalink
Merge branch 'develop' into #507-badge-highlight-number-with-multi-row
Browse files Browse the repository at this point in the history
  • Loading branch information
Sworup Shakya committed Nov 4, 2019
2 parents 35fad82 + 0ab43ab commit 6541e71
Show file tree
Hide file tree
Showing 179 changed files with 11,293 additions and 6,586 deletions.
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
"objects": "always-multiline"
}
],
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
"function-paren-newline": "off",
"implicit-arrow-linebreak": "off",
"import/prefer-default-export": "off",
"indent": ["error", 2, { "SwitchCase": 1 }],
"max-len": ["error", { "code": 100, "ignoreTemplateLiterals": true }],
"no-confusing-arrow": "off",
Expand Down
6 changes: 5 additions & 1 deletion .github/ISSUE_TEMPLATE/design_discussion.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,22 @@ about: A template for how to discuss designing features/modules
title: Feature/module name and concise purpose if not conveyed in name
labels: Epic
assignees: ''

---

<!-- It's expected that this template be edited and kept up to date as discussion around the design unfolds -->

## Description

<!-- Summarise the related features/module that is needed -->

### Context

<!-- Describe what use case wasn't being satisfied in the current version of mSupply Mobile that the above is address -->

## Design discussion

<!-- Summarise the solution. Add child issues with checkboxes if created. Delete sub sections if not applicable -->

### Architecture

<!-- If any, describe design pattern decisions -->
9 changes: 4 additions & 5 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ about: Suggest an idea for this project
title: Concisely the feature I want
labels: Feature
assignees: ''

---

## Is your feature request related to a problem? Please describe.

__A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]__
**A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]**

## Describe the solution you'd like

__A clear and concise description of what you want to happen.__
**A clear and concise description of what you want to happen.**

## Describe alternatives you've considered

__A clear and concise description of any alternative solutions or features you've considered.__
**A clear and concise description of any alternative solutions or features you've considered.**

## Additional context

__Add any other context or screenshots about the feature request here.__
**Add any other context or screenshots about the feature request here.**
54 changes: 42 additions & 12 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ import groovy.json.JsonSlurper
*/

project.ext.react = [
entryFile: "index.js"
entryFile: "index.js",
enableHermes: false,
]

apply from: "../../node_modules/react-native/react.gradle"
Expand All @@ -94,6 +95,27 @@ def enableSeparateBuildPerCPUArchitecture = true
*/
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);

def getAppVersion() {
def inputFile = new File("../package.json")
def packageJson = new JsonSlurper().parseText(inputFile.text)
Expand Down Expand Up @@ -125,6 +147,12 @@ android {
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
Expand All @@ -141,6 +169,9 @@ android {
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
Expand All @@ -163,20 +194,16 @@ android {
}

dependencies {
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-screens')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-device-info')
implementation project(':realm')
implementation project(':react-native-vector-icons')
implementation project(':react-native-localization')
implementation project(':react-native-fs')
implementation project(':bugsnag-react-native')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation ("com.google.android.gms:play-services-gcm:16.1.0") {
force = true

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}

Expand All @@ -186,3 +213,6 @@ 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)
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
7 changes: 0 additions & 7 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,3 @@
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Binary file removed android/app/src/main/assets/fonts/AntDesign.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Entypo.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/EvilIcons.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Feather.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/FontAwesome.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Fontisto.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Foundation.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Ionicons.ttf
Binary file not shown.
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/MaterialIcons.ttf
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Octicons.ttf
Binary file not shown.
Binary file not shown.
Binary file removed android/app/src/main/assets/fonts/Zocial.ttf
Binary file not shown.
63 changes: 37 additions & 26 deletions android/app/src/main/java/com/msupplymobile/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@

import android.app.Application;

import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.react.ReactApplication;
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import io.realm.react.RealmReactPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.babisoft.ReactNativeLocalization.ReactNativeLocalizationPackage;
import com.rnfs.RNFSPackage;
import com.bugsnag.BugsnagReactNative;
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 {
Expand All @@ -30,20 +22,10 @@ public boolean getUseDeveloperSupport() {

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new RNDeviceInfo(),
new MainReactPackage(),
new AsyncStoragePackage(),
new RNScreensPackage(),
new RNGestureHandlerPackage(),
new RealmReactPackage(),
new VectorIconsPackage(),
new ReactNativeLocalizationPackage(),
new RNFSPackage(),
BugsnagReactNative.getPackage()
);
List<ReactPackage> packages = new PackageList(this).getPackages();
return packages;
}

@Override
protected String getJSMainModuleName() {
return "index";
Expand All @@ -58,6 +40,35 @@ public ReactNativeHost getReactNativeHost() {
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
SoLoader.init(this, false);

// Disabling Flipper until a point of higher understanding
// initializeFlipper(this);
}

/**
* 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();
}
}
}
}
15 changes: 11 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.5.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -27,13 +27,20 @@ allprojects {
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}


task wrapper(type: Wrapper) {
gradleVersion = '4.10.1'
wrapper {
gradleVersion = '5.6.2'
distributionUrl = distributionUrl.replace("bin", "all")
}
6 changes: 4 additions & 2 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

android.useDeprecatedNdk=true

MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=sussolpikelets
MYAPP_RELEASE_KEY_PASSWORD=sussolpikelets

android.useAndroidX=true
android.enableJetifier=true

org.gradle.jvmargs=-XX\:MaxHeapSize\=1024m -Xmx1024m
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
8 changes: 0 additions & 8 deletions android/keystores/BUCK

This file was deleted.

4 changes: 0 additions & 4 deletions android/keystores/debug.keystore.properties

This file was deleted.

19 changes: 1 addition & 18 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
rootProject.name = 'mSupplyMobile'
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-screens'
project(':react-native-screens').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-screens/android')
include ':app'
include ':realm'
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-localization'
project(':react-native-localization').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localization/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fs/android')
include ':bugsnag-react-native'
project(':bugsnag-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/bugsnag-react-native/android')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
18 changes: 18 additions & 0 deletions dev_scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# mSupply Mobile
# Sustainable Solutions (NZ) Ltd. 2019.
#
# Clean up react native caches.

TMPDIR_PACKAGER=$TMPDIR/react-native-packager-*
TMPDIR_METRO=$TMPDIR/metro-bundler-*

echo "Cleaning up temporary files..."
rm -rf $TMPDIR_PACKAGER $TMPDIR_METRO
echo "Cleaning up watchman files..."
npx watchman watch-del-all
echo "Reinstalling node modules..."
rm -rf node_modules/ &&
yarn cache clean &&
yarn install
17 changes: 17 additions & 0 deletions dev_scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

# mSupply Mobile
# Sustainable Solutions (NZ) Ltd. 2019.
#
# Deploy mobile app.

APK_DIR="android/app/build/outputs/apk/release"
APK_VERSION="mSupplyMobile-3_0_2-universal-release"
PACKAGE="com.msupplymobile"

echo "Rooting device..."
adb root > /dev/null
echo "Uninstalling mSupply mobile..."
adb uninstall $PACKAGE > /dev/null
echo "Installing latest .apk build..."
adb install $APK_DIR/$APK_VERSION.apk > /dev/null
Loading

0 comments on commit 6541e71

Please sign in to comment.