Skip to content

Commit

Permalink
fix: rn example app
Browse files Browse the repository at this point in the history
  • Loading branch information
BasileiosKal committed Aug 7, 2024
1 parent ed5477f commit ddd4766
Show file tree
Hide file tree
Showing 31 changed files with 6,827 additions and 4,695 deletions.
2 changes: 1 addition & 1 deletion wrappers/java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 4 additions & 3 deletions wrappers/react-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath("com.android.tools.build:gradle:8.5.1")
// noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand All @@ -34,6 +34,7 @@ def getExtOrIntegerDefault(name) {
}

android {
namespace = "com.mattrglobalpairingcryptorn"
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')

defaultConfig {
Expand All @@ -53,8 +54,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

packagingOptions {
Expand Down
10 changes: 7 additions & 3 deletions wrappers/react-native/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
PairingCryptoRn_kotlinVersion=1.9.0
PairingCryptoRn_minSdkVersion=24
PairingCryptoRn_kotlinVersion=1.9.22
PairingCryptoRn_minSdkVersion=23
PairingCryptoRn_targetSdkVersion=34
PairingCryptoRn_compileSdkVersion=34
PairingCryptoRn_ndkversion=23.1.7779620
PairingCryptoRn_ndkversion=26.1.10909125

android.useAndroidX=true
android.buildFeatures.buildConfig=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 1 addition & 2 deletions wrappers/react-native/android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mattrglobalpairingcryptorn">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
2 changes: 1 addition & 1 deletion wrappers/react-native/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:@react-native/babel-preset'],
};
1 change: 1 addition & 0 deletions wrappers/react-native/example/__tests__/keyGen.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* limitations under the License.
*/
import { by, device, expect, element } from 'detox';
import {it} from '@jest/globals';

describe('keyGen', () => {
beforeAll(async () => {
Expand Down
1 change: 1 addition & 0 deletions wrappers/react-native/example/__tests__/signature.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
import R from 'ramda';
import { by, device, expect, element } from 'detox';
import {it} from '@jest/globals';

import { FixtureItem, fixtures } from '../__fixtures__';

Expand Down
19 changes: 10 additions & 9 deletions wrappers/react-native/example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os
Expand Down Expand Up @@ -83,7 +85,7 @@ project.ext.react = [
enableHermes: true, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
// apply from: "../../node_modules/react-native/react.gradle"

/**
* Set this to true to create two separate APKs instead of one:
Expand Down Expand Up @@ -250,8 +252,9 @@ android {
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
}
}
namespace 'com.example.mattrglobalpairingcryptorn'

// applicationVariants are e.g. debug, release
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
Expand All @@ -270,14 +273,14 @@ android {

dependencies {
// https://github.com/wix/Detox/blob/master/examples/demo-react-native/android/app/build.gradle
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"

androidTestImplementation('com.wix:detox:+')

implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation("com.facebook.react:react-android") // From node_modules

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
Expand All @@ -288,14 +291,12 @@ dependencies {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:0.182.0") {
exclude group:'com.facebook.flipper'
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mattrglobalpairingcryptorn">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

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

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.mattrglobalpairingcryptorn;

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate

class MainActivity : ReactActivity() {

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "PairingCryptoRnExample"

/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.example.mattrglobalpairingcryptorn;


import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {

override val reactNativeHost: ReactNativeHost =
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
}

override fun getJSMainModuleName(): String = "index"

override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}

override val reactHost: ReactHost
get() = getDefaultReactHost(applicationContext, reactNativeHost)

override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
}
}
Loading

0 comments on commit ddd4766

Please sign in to comment.