Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add okhttp-urlconnection to prevent crashes when using cookies, minor Android native module tweaks #75

Merged
merged 4 commits into from
Aug 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/TesterApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
implementation project(path: ':callstackrepack')

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
packages.add(new ChunkManagerPackage());
return packages;
}

Expand Down
3 changes: 0 additions & 3 deletions packages/TesterApp/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
rootProject.name = 'TesterApp'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
//
include ':callstackrepack'
project(':callstackrepack').projectDir = new File(rootProject.projectDir, '../../../android')
6 changes: 5 additions & 1 deletion packages/TesterApp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
"name": "TesterApp",
"version": "0.0.1",
"private": true,
"workspaces": {
"nohoist": ["react-native", "react-native/**"]
},
"scripts": {
"prepare": "exit 0",
"test": "exit 0",
"lint": "exit 0",
"tsc": "exit 0",
"build": "exit 0",
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native webpack-start",
"build": "react-native webpack-bundle --entry-file index.js --bundle-output ./dist/index.bundle --dev=false",
"bundle": "react-native webpack-bundle --entry-file index.js --bundle-output ./dist/index.bundle --dev=false",
"webpack": "PLATFORM=ios webpack -c webpack.config.js"
},
"dependencies": {
Expand Down
9 changes: 5 additions & 4 deletions packages/repack/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['WebpackToolkit_kotlinVersion']
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['RePack_kotlinVersion']

repositories {
google()
Expand All @@ -18,11 +18,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['WebpackToolkit_' + name]
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['RePack_' + name]
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['WebpackToolkit_' + name]).toInteger()
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['RePack_' + name]).toInteger()
}

android {
Expand Down Expand Up @@ -126,6 +126,7 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
dependencies {
// noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
implementation "com.squareup.okhttp3:okhttp:4.9.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.squareup.okhttp3:okhttp:4.9.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.0"
}
8 changes: 4 additions & 4 deletions packages/repack/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WebpackToolkit_kotlinVersion=1.3.50
WebpackToolkit_compileSdkVersion=29
WebpackToolkit_buildToolsVersion=29.0.2
WebpackToolkit_targetSdkVersion=29
RePack_kotlinVersion=1.4.10
RePack_compileSdkVersion=29
RePack_buildToolsVersion=29.0.2
RePack_targetSdkVersion=29
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ class RemoteChunkLoader(private val reactContext: ReactContext) {
}, { code, message -> promise.reject(code, message) })
}

fun invalidate(chunkId: String) {
val file = File(reactContext.filesDir, getChunkFilePath(chunkId))
fun invalidate(chunkId: String?) {
if (chunkId != null) {
val file = File(reactContext.filesDir, getChunkFilePath(chunkId))

if(file.exists()) {
file.delete()
if (file.exists()) {
file.delete()
}
}
}

Expand Down