Skip to content

Commit

Permalink
RN 0.60.5 (#18251)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnojima authored Sep 20, 2019
1 parent c9d2621 commit 5e30296
Show file tree
Hide file tree
Showing 1,450 changed files with 101,656 additions and 18,140 deletions.
1 change: 1 addition & 0 deletions shared/__mocks__/react-spring.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const Spring = () => null
1 change: 1 addition & 0 deletions shared/actions/__tests__/wallets.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ it('build and send payment', () => {

const sendRPC = jest.spyOn(RPCStellarTypes, 'localSendPaymentLocalRpcPromise')
const sendPaymentResult = {
jumpToChat: '',
kbTxID: 'fake transaction id',
pending: false,
}
Expand Down
5 changes: 2 additions & 3 deletions shared/actions/platform-specific/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
PermissionsAndroid,
Clipboard,
} from 'react-native'
// eslint-ignore-next-line messed up export in module. fixed in the next update
import NetInfo from '@react-native-community/netinfo'
import RNFetchBlob from 'rn-fetch-blob'
import * as PushNotifications from 'react-native-push-notification'
Expand Down Expand Up @@ -286,13 +285,13 @@ const updateMobileNetState = async (
}

const initOsNetworkStatus = async () => {
const {type} = await NetInfo.getConnectionInfo()
const {type} = await NetInfo.fetch()
return ConfigGen.createOsNetworkStatusChanged({isInit: true, online: type !== 'none', type})
}

function* setupNetInfoWatcher() {
const channel = Saga.eventChannel(emitter => {
NetInfo.addEventListener('connectionChange', ({type}) => emitter(type))
NetInfo.addEventListener(({type}) => emitter(type))
return () => {}
}, Saga.buffers.sliding(1))

Expand Down
66 changes: 49 additions & 17 deletions shared/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def VERSION_NAME = "4.6.0"
* // 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,
*
Expand Down Expand Up @@ -82,6 +85,7 @@ def VERSION_NAME = "4.6.0"
project.ext.react = [
// the root of your project, i.e. where "package.json" lives
root: "../../",
enableHermes: false, // clean and rebuild if changing
]


Expand All @@ -103,6 +107,26 @@ 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);

// KB: Returns minutes from January 1 2016
def Integer timestamp() {
def minutesSinceEpoch = (new Date()).getTime()/(1000 * 60)
Expand Down Expand Up @@ -176,7 +200,7 @@ android {
// KB:
storyBook {
applicationIdSuffix ".storybook"
matchingFallbacks = ['release']
matchingFallbacks = ['debug']
}
release {
// KB:
Expand All @@ -197,15 +221,24 @@ 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 =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}

packagingOptions {
pickFirst '**/armeabi-v7a/libc++_shared.so'
pickFirst '**/x86/libc++_shared.so'
pickFirst '**/arm64-v8a/libc++_shared.so'
pickFirst '**/x86_64/libc++_shared.so'
pickFirst '**/x86/libjsc.so'
pickFirst '**/armeabi-v7a/libjsc.so'
}
}

// KB:
Expand All @@ -216,26 +249,23 @@ play {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:multidex:1.0.3"
implementation "com.google.firebase:firebase-messaging:17.3.0" // sync with firebaseVersion in gradle.properties
implementation "com.facebook.react:react-native:+" // From node_modules

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

implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.google.firebase:firebase-messaging:17.3.0" // sync with firebaseVersion in gradle.properties
implementation "com.facebook.fresco:animated-gif:1.13.0"
implementation "com.facebook.fresco:fresco:1.13.0"
implementation "com.evernote:android-job:1.2.6"
implementation 'org.msgpack:msgpack:0.6.12'
implementation project(':keybaselib')
implementation project(':react-native-push-notification')
implementation project(':react-native-fetch-blob')
implementation project(':react-native-contacts')
implementation project(':react-native-fast-image')
implementation project(':lottie-react-native')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-screens')
implementation project(':react-native-webview')
implementation project(':react-native-community-netinfo')
implementation project(':react-native-reanimated')
implementation project(':react-native-video')

addUnimodulesDependencies([modulesPaths: ['../../node_modules']])
}
Expand All @@ -246,3 +276,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)
9 changes: 0 additions & 9 deletions shared/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,3 @@
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:
-keep public class com.dylanvann.fastimage.* {*;}
-keep public class com.dylanvann.fastimage.** {*;}

# 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 *;
#}
2 changes: 0 additions & 2 deletions shared/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.keybase.ossifrage">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Expand All @@ -10,7 +9,6 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".MainApplication"
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.util.Log;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;

import io.keybase.ossifrage.modules.NativeLogger;
import keybase.Keybase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
import android.graphics.Rect;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.MessagingStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.Person;
import android.support.v4.app.RemoteInput;
import android.support.v4.graphics.drawable.IconCompat;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationCompat.MessagingStyle;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.app.Person;
import androidx.core.app.RemoteInput;
import androidx.core.graphics.drawable.IconCompat;

import java.io.BufferedInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -246,4 +247,3 @@ public void localNotification(String ident, String msg, long badgeCount, String
}

}

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.MessagingStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.Person;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationCompat.MessagingStyle;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.app.Person;

import com.dieam.reactnativepushnotification.helpers.ApplicationBadgeHelper;
import com.google.firebase.messaging.FirebaseMessagingService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,50 @@

import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;

import com.reactnativecommunity.netinfo.NetInfoPackage;
import androidx.multidex.MultiDex;

import com.evernote.android.job.JobManager;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.shell.MainPackageConfig;
import com.facebook.react.shell.MainReactPackage;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.facebook.soloader.SoLoader;
import com.RNFetchBlob.RNFetchBlobPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;
import com.rt2zz.reactnativecontacts.ReactNativeContacts;
import com.dylanvann.fastimage.FastImageViewPackage;

import com.airbnb.android.react.lottie.LottiePackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import com.swmansion.reanimated.ReanimatedPackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.brentvatne.react.ReactVideoPackage;

import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactAdapterPackage;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.Package;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import io.keybase.ossifrage.modules.StorybookConstants;
import expo.modules.barcodescanner.BarCodeScannerPackage;
import expo.modules.constants.ConstantsPackage;
import expo.modules.contacts.ContactsPackage;
import expo.modules.imagepicker.ImagePickerPackage;
import expo.modules.permissions.PermissionsPackage;
import expo.modules.sms.SMSPackage;
import io.keybase.ossifrage.modules.BackgroundJobCreator;
import io.keybase.ossifrage.modules.BackgroundSyncJob;
import io.keybase.ossifrage.modules.NativeLogger;
import io.keybase.ossifrage.generated.BasePackageList;

import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.SingletonModule;
import io.keybase.ossifrage.modules.StorybookConstants;

public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), Arrays.<SingletonModule>asList());
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(Arrays.<Package>asList(
new ReactAdapterPackage(),
new ConstantsPackage(),
// Same order as package.json
new BarCodeScannerPackage(),
new ContactsPackage(),
new ImagePickerPackage(),
new PermissionsPackage(),
new SMSPackage()
), null);


@Override
protected void attachBaseContext(Context base) {
Expand Down Expand Up @@ -82,40 +82,32 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
Context context = getApplicationContext();
// limit fresco memory
ImagePipelineConfig frescoConfig = ImagePipelineConfig
.newBuilder(context)
.setBitmapMemoryCacheParamsSupplier(new CustomBitmapMemoryCacheParamsSupplier(context))
.build();

MainPackageConfig appConfig = new MainPackageConfig.Builder().setFrescoConfig(frescoConfig).build();

return Arrays.<ReactPackage>asList(
new MainReactPackage(appConfig),
new KBReactPackage() {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactApplicationContext) {
if (BuildConfig.BUILD_TYPE == "storyBook") {
List<NativeModule> modules = new ArrayList<>();
modules.add(new StorybookConstants(reactApplicationContext));
return modules;
} else {
return super.createNativeModules(reactApplicationContext);
}
}
},
new ReactNativePushNotificationPackage(),
new RNFetchBlobPackage(),
new ReactNativeContacts(),
new FastImageViewPackage(),
new LottiePackage(),
new RNGestureHandlerPackage(),
new RNScreensPackage(),
new NetInfoPackage(),
new RNCWebViewPackage(),
new ReactVideoPackage(),
new ReanimatedPackage(),
new ModuleRegistryAdapter(mModuleRegistryProvider)
);
// ImagePipelineConfig frescoConfig = ImagePipelineConfig
// .newBuilder(context)
// .setBitmapMemoryCacheParamsSupplier(new CustomBitmapMemoryCacheParamsSupplier(context))
// .build();
//
// MainPackageConfig appConfig = new MainPackageConfig.Builder().setFrescoConfig(frescoConfig).build();

@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// new MainReactPackage(appConfig),// removed from rn-diff but maybe we need it for fresco config?
packages.add(new KBReactPackage() {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactApplicationContext) {
if (BuildConfig.BUILD_TYPE == "storyBook") {
List<NativeModule> modules = new ArrayList<>();
modules.add(new StorybookConstants(reactApplicationContext));
return modules;
} else {
return super.createNativeModules(reactApplicationContext);
}
}
});

packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));

return packages;
}
@Override
protected String getJSMainModuleName() {
Expand Down
Loading

0 comments on commit 5e30296

Please sign in to comment.