Skip to content

Commit

Permalink
Merge pull request #477 from Psychedelic/0.3.0
Browse files Browse the repository at this point in the history
v0.3.0
  • Loading branch information
ignaciosantise authored Nov 7, 2022
2 parents 84d1149 + 50b6273 commit 5cf1e0c
Show file tree
Hide file tree
Showing 330 changed files with 8,920 additions and 6,050 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
3 changes: 0 additions & 3 deletions .editorconfig

This file was deleted.

7 changes: 5 additions & 2 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ node_modules/react-native/Libraries/polyfills/.*
; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

Expand All @@ -25,6 +27,8 @@ emoji=true

exact_by_default=true

format.bracket_spacing=false

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js
Expand All @@ -48,7 +52,6 @@ nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn

[strict]
deprecated-type
Expand All @@ -60,4 +63,4 @@ untyped-import
untyped-type-import

[version]
^0.149.0
^0.182.0
3 changes: 0 additions & 3 deletions .gitattributes

This file was deleted.

21 changes: 14 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
Expand All @@ -28,6 +29,8 @@ build/
.gradle
local.properties
*.iml
*.hprof
.cxx/

# node.js
#
Expand All @@ -48,15 +51,17 @@ buck-out/
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# CocoaPods
# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# IC
rust/.cargo/mobile_app/target
Expand All @@ -67,15 +72,17 @@ rust/.cargo/config.toml
/*.env

# Android
android/*.hprof
android/app/src/main/jniLibs

# Sentry
android/sentry.properties
ios/sentry.properties

# react-native-config codegen
ios/envfile

# Visual Studio Code
/.vscode

# Custom Patches
patches/@dfinity+agent+0.9.3.patch
patches/@dfinity+candid+0.9.3.patch
patches/@dfinity+agent+0.9.3.patch
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
6 changes: 3 additions & 3 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: true,
jsxBracketSameLine: true,
singleQuote: true,
arrowParens: 'avoid',
};
};
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.2
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.5
27 changes: 16 additions & 11 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ import {
getVersion,
} from 'react-native-device-info';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { Provider, useDispatch } from 'react-redux';
import { ToastProvider } from 'react-native-toast-notifications';
import { Provider } from 'react-redux';
import Reactotron from 'reactotron-react-native';
import { PersistGate } from 'redux-persist/integration/react';

import ErrorBoundary from '@/commonComponents/ErrorBoundary';
import { ErrorBoundary } from '@/components/common';
import { toastProviderProps } from '@/components/common/Toast';
import { isIos } from '@/constants/platform';
import Routes from '@/navigation';
import { useAppDispatch } from '@/redux/hooks';
import { initKeyring } from '@/redux/slices/keyring';
import { persistor, store } from '@/redux/store';
import { TopLevelNavigationRef } from '@/utils/navigation';
import { navigationRef } from '@/utils/navigation';

const routingInstrumentation = new Sentry.ReactNavigationInstrumentation();
const baseDist = getBuildNumber();
Expand All @@ -49,7 +52,7 @@ Sentry.init({
const PersistedApp = () => {
const appState = useRef(AppState.currentState);
const [showRoutes, setShowRoutes] = useState(false);
const dispatch = useDispatch();
const dispatch = useAppDispatch();

useEffect(() => {
const event = AppState.addEventListener('change', handleAppStateChange);
Expand Down Expand Up @@ -92,13 +95,15 @@ const PersistedApp = () => {
<PersistGate loading={null} persistor={persistor}>
<ErrorBoundary>
<SafeAreaProvider>
<StatusBar barStyle="light-content" backgroundColor="black" />
{showRoutes && (
<Routes
routingInstrumentation={routingInstrumentation}
ref={TopLevelNavigationRef}
/>
)}
<ToastProvider {...toastProviderProps}>
<StatusBar barStyle="light-content" backgroundColor="black" />
{showRoutes && (
<Routes
routingInstrumentation={routingInstrumentation}
ref={navigationRef}
/>
)}
</ToastProvider>
</SafeAreaProvider>
</ErrorBoundary>
</PersistGate>
Expand Down
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '2.7.5'
gem 'cocoapods', '~> 1.11', '>= 1.11.2'
125 changes: 116 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: "com.android.application"

import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os

project.ext.envConfigFiles = [
devdebug: ".dev.env",
Expand Down Expand Up @@ -110,7 +111,7 @@ def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
def enableProguardInReleaseBuilds = true

/**
* The preferred build flavor of JavaScriptCore.
Expand All @@ -128,12 +129,20 @@ 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
* This should be set on project.ext.react and that value will be read 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", true);

/**
* Architectures to build native code for.
*/
def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

android {
ndkVersion rootProject.ext.ndkVersion

Expand All @@ -143,16 +152,86 @@ android {
applicationId "co.psychedelic.plug"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 18
versionName "0.2.1"
versionCode 24
versionName "0.3.0"
resValue "string", "build_config_package", "co.psychedelic.plug"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {
// We configure the CMake build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
cmake {
arguments "-DPROJECT_BUILD_DIR=$buildDir",
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
"-DANDROID_STL=c++_shared"
}
}
if (!enableSeparateBuildPerCPUArchitecture) {
ndk {
abiFilters (*reactNativeArchitectures())
}
}
}
}

if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
cmake {
path "$projectDir/src/main/jni/CMakeLists.txt"
}
}
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
into("$buildDir/react-ndk/exported")
}
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
into("$buildDir/react-ndk/exported")
}
afterEvaluate {
// If you wish to add a custom TurboModule or component locally,
// you should uncomment this line.
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
android.applicationVariants.all { def variant ->
def variantName = variant.name.capitalize()
def preVariantBuildTask = tasks.findByName("pre${variantName}Build")

// Due to a bug inside AGP, we have to explicitly set a dependency
// between configureCMakeDebug* tasks and the preBuild tasks.
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
if (variantName.endsWith("Debug")) {
preVariantBuildTask.dependsOn(packageReactNdkDebugLibs)
configureCMakeDebug.dependsOn(preVariantBuildTask)
reactNativeArchitectures().each { architecture ->
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
dependsOn(preVariantBuildTask.name)
}
}
}
if (variantName.endsWith("Release")) {
preVariantBuildTask.dependsOn(packageReactNdkReleaseLibs)
configureCMakeRelWithDebInfo.dependsOn(preVariantBuildTask)
reactNativeArchitectures().each { architecture ->
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
dependsOn(preVariantBuildTask.name)
}
}
}
}
}
}

splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
include (*reactNativeArchitectures())
}
}
signingConfigs {
Expand All @@ -175,6 +254,8 @@ android {
debug {
signingConfig signingConfigs.debug
matchingFallbacks = ['debug', 'release']
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro", "proguard-rules-dev.pro"
}
release {
// Caution! In production, you need to generate your own keystore file.
Expand Down Expand Up @@ -217,13 +298,14 @@ android {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])

//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

//react-native-bootsplash
implementation "androidx.core:core-splashscreen:1.0.0-beta01"
implementation "androidx.core:core-splashscreen:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
Expand All @@ -239,14 +321,31 @@ dependencies {
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
//noinspection GradleDynamicVersion
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group:'com.facebook.fbjni'
}
} else {
implementation jscFlavor
}
}

if (isNewArchitectureEnabled()) {
// If new architecture is enabled, we let you build RN from source
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
// This will be applied to all the imported transtitive dependency.
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.facebook.react:react-native"))
.using(project(":ReactAndroid"))
.because("On New Architecture we're building React Native from source")
substitute(module("com.facebook.react:hermes-engine"))
.using(project(":ReactAndroid:hermes-engine"))
.because("On New Architecture we're building Hermes from source")
}
}
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
Expand All @@ -255,3 +354,11 @@ task copyDownloadableDepsToLibs(type: Copy) {
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either:
// - Set `newArchEnabled` to true inside the `gradle.properties` file
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
6 changes: 6 additions & 0 deletions android/app/proguard-rules-dev.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Facebook
-keep class com.facebook.react.devsupport.** { *; }
-keep class com.facebook.flipper.** { *; }

-dontwarn com.facebook.react.devsupport.**
-dontwarn com.facebook.flipper.**
Loading

0 comments on commit 5cf1e0c

Please sign in to comment.