mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	Update example to 0.63
This commit is contained in:
		| @@ -15,10 +15,12 @@ import com.android.build.OutputFile | ||||
|  *   // the name of the generated asset file containing your JS bundle | ||||
|  *   bundleAssetName: "index.android.bundle", | ||||
|  * | ||||
|  *   // the entry file for bundle generation | ||||
|  *   // the entry file for bundle generation. If none specified and | ||||
|  *   // "index.android.js" exists, it will be used. Otherwise "index.js" is | ||||
|  *   // default. Can be overridden with ENTRY_FILE environment variable. | ||||
|  *   entryFile: "index.android.js", | ||||
|  * | ||||
|  *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format | ||||
|  *   // https://reactnative.dev/docs/performance#enable-the-ram-format | ||||
|  *   bundleCommand: "ram-bundle", | ||||
|  * | ||||
|  *   // whether to bundle JS and assets in debug mode | ||||
| @@ -76,7 +78,6 @@ import com.android.build.OutputFile | ||||
|  */ | ||||
|  | ||||
| project.ext.react = [ | ||||
|     entryFile: "index.js", | ||||
|     enableHermes: false,  // clean and rebuild if changing | ||||
| ] | ||||
|  | ||||
| @@ -156,12 +157,13 @@ android { | ||||
|         } | ||||
|         release { | ||||
|             // Caution! In production, you need to generate your own keystore file. | ||||
|             // see https://facebook.github.io/react-native/docs/signed-apk-android. | ||||
|             // see https://reactnative.dev/docs/signed-apk-android. | ||||
|             signingConfig signingConfigs.debug | ||||
|             minifyEnabled enableProguardInReleaseBuilds | ||||
|             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     // applicationVariants are e.g. debug, release | ||||
|     applicationVariants.all { variant -> | ||||
|         variant.outputs.each { output -> | ||||
| @@ -180,8 +182,24 @@ 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" | ||||
|  | ||||
|     debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { | ||||
|       exclude group:'com.facebook.fbjni' | ||||
|     } | ||||
|  | ||||
|     debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { | ||||
|         exclude group:'com.facebook.flipper' | ||||
|         exclude group:'com.squareup.okhttp3', module:'okhttp' | ||||
|     } | ||||
|  | ||||
|     debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { | ||||
|         exclude group:'com.facebook.flipper' | ||||
|     } | ||||
|  | ||||
|     if (enableHermes) { | ||||
|         def hermesPath = "../../node_modules/hermes-engine/android/"; | ||||
|         debugImplementation files(hermesPath + "hermes-debug.aar") | ||||
| @@ -198,4 +216,4 @@ task copyDownloadableDepsToLibs(type: Copy) { | ||||
|     into 'libs' | ||||
| } | ||||
|  | ||||
| apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) | ||||
| apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) | ||||
| @@ -0,0 +1,72 @@ | ||||
| /** | ||||
|  * Copyright (c) Facebook, Inc. and its affiliates. | ||||
|  * | ||||
|  * <p>This source code is licensed under the MIT license found in the LICENSE file in the root | ||||
|  * directory of this source tree. | ||||
|  */ | ||||
| package com.testhotupdate; | ||||
|  | ||||
| import android.content.Context; | ||||
| import com.facebook.flipper.android.AndroidFlipperClient; | ||||
| import com.facebook.flipper.android.utils.FlipperUtils; | ||||
| import com.facebook.flipper.core.FlipperClient; | ||||
| import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; | ||||
| import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; | ||||
| import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; | ||||
| import com.facebook.flipper.plugins.inspector.DescriptorMapping; | ||||
| import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; | ||||
| import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; | ||||
| import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; | ||||
| import com.facebook.flipper.plugins.react.ReactFlipperPlugin; | ||||
| import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; | ||||
| import com.facebook.react.ReactInstanceManager; | ||||
| import com.facebook.react.bridge.ReactContext; | ||||
| import com.facebook.react.modules.network.NetworkingModule; | ||||
| import okhttp3.OkHttpClient; | ||||
|  | ||||
| public class ReactNativeFlipper { | ||||
|   public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { | ||||
|     if (FlipperUtils.shouldEnableFlipper(context)) { | ||||
|       final FlipperClient client = AndroidFlipperClient.getInstance(context); | ||||
|  | ||||
|       client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); | ||||
|       client.addPlugin(new ReactFlipperPlugin()); | ||||
|       client.addPlugin(new DatabasesFlipperPlugin(context)); | ||||
|       client.addPlugin(new SharedPreferencesFlipperPlugin(context)); | ||||
|       client.addPlugin(CrashReporterPlugin.getInstance()); | ||||
|  | ||||
|       NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); | ||||
|       NetworkingModule.setCustomClientBuilder( | ||||
|           new NetworkingModule.CustomClientBuilder() { | ||||
|             @Override | ||||
|             public void apply(OkHttpClient.Builder builder) { | ||||
|               builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); | ||||
|             } | ||||
|           }); | ||||
|       client.addPlugin(networkFlipperPlugin); | ||||
|       client.start(); | ||||
|  | ||||
|       // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized | ||||
|       // Hence we run if after all native modules have been initialized | ||||
|       ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); | ||||
|       if (reactContext == null) { | ||||
|         reactInstanceManager.addReactInstanceEventListener( | ||||
|             new ReactInstanceManager.ReactInstanceEventListener() { | ||||
|               @Override | ||||
|               public void onReactContextInitialized(ReactContext reactContext) { | ||||
|                 reactInstanceManager.removeReactInstanceEventListener(this); | ||||
|                 reactContext.runOnNativeModulesQueueThread( | ||||
|                     new Runnable() { | ||||
|                       @Override | ||||
|                       public void run() { | ||||
|                         client.addPlugin(new FrescoFlipperPlugin()); | ||||
|                       } | ||||
|                     }); | ||||
|               } | ||||
|             }); | ||||
|       } else { | ||||
|         client.addPlugin(new FrescoFlipperPlugin()); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -14,7 +14,8 @@ | ||||
|       <activity | ||||
|         android:name=".MainActivity" | ||||
|         android:label="@string/app_name" | ||||
|         android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | ||||
|         android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" | ||||
|         android:launchMode="singleTask" | ||||
|         android:windowSoftInputMode="adjustResize"> | ||||
|         <intent-filter> | ||||
|             <action android:name="android.intent.action.MAIN" /> | ||||
|   | ||||
| @@ -4,6 +4,7 @@ import android.app.Application; | ||||
| import android.content.Context; | ||||
| import com.facebook.react.PackageList; | ||||
| import com.facebook.react.ReactApplication; | ||||
| import com.facebook.react.ReactInstanceManager; | ||||
| import com.facebook.react.ReactNativeHost; | ||||
| import com.facebook.react.ReactPackage; | ||||
| import com.facebook.soloader.SoLoader; | ||||
| @@ -50,23 +51,28 @@ public class MainApplication extends Application implements ReactApplication { | ||||
|   public void onCreate() { | ||||
|     super.onCreate(); | ||||
|     SoLoader.init(this, /* native exopackage */ false); | ||||
|     initializeFlipper(this); // Remove this line if you don't want Flipper enabled | ||||
|     initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); | ||||
|   } | ||||
|  | ||||
|   /** | ||||
|    * Loads Flipper in React Native templates. | ||||
|    /** | ||||
|    * Loads Flipper in React Native templates. Call this in the onCreate method with something like | ||||
|    * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); | ||||
|    * | ||||
|    * @param context | ||||
|    * @param reactInstanceManager | ||||
|    */ | ||||
|   private static void initializeFlipper(Context context) { | ||||
|   private static void initializeFlipper( | ||||
|       Context context, ReactInstanceManager reactInstanceManager) { | ||||
|     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); | ||||
|         Class<?> aClass = Class.forName("com.testhotupdate.ReactNativeFlipper"); | ||||
|         aClass | ||||
|             .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) | ||||
|             .invoke(null, context, reactInstanceManager); | ||||
|       } catch (ClassNotFoundException e) { | ||||
|         e.printStackTrace(); | ||||
|       } catch (NoSuchMethodException e) { | ||||
|   | ||||
| @@ -2,17 +2,17 @@ | ||||
|  | ||||
| buildscript { | ||||
|     ext { | ||||
|         buildToolsVersion = "28.0.3" | ||||
|         minSdkVersion = 16 | ||||
|         compileSdkVersion = 28 | ||||
|         targetSdkVersion = 28 | ||||
|         buildToolsVersion = "29.0.2" | ||||
|         minSdkVersion = 21 | ||||
|         compileSdkVersion = 29 | ||||
|         targetSdkVersion = 29 | ||||
|     } | ||||
|     repositories { | ||||
|         google() | ||||
|         jcenter() | ||||
|     } | ||||
|     dependencies { | ||||
|         classpath('com.android.tools.build:gradle:3.5.1') | ||||
|         classpath('com.android.tools.build:gradle:3.5.3') | ||||
|  | ||||
|         // NOTE: Do not place your application dependencies here; they belong | ||||
|         // in the individual module build.gradle files | ||||
| @@ -33,6 +33,6 @@ allprojects { | ||||
|  | ||||
|         google() | ||||
|         jcenter() | ||||
|         maven { url 'https://jitpack.io' } | ||||
|         maven { url 'https://www.jitpack.io' } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -17,5 +17,12 @@ | ||||
| # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects | ||||
| # org.gradle.parallel=true | ||||
|  | ||||
| # AndroidX package structure to make it clearer which packages are bundled with the | ||||
| # Android operating system, and which are packaged with your app's APK | ||||
| # https://developer.android.com/topic/libraries/support-library/androidx-rn | ||||
| android.useAndroidX=true | ||||
| # Automatically convert third-party libraries to use AndroidX | ||||
| android.enableJetifier=true | ||||
|  | ||||
| # Version of flipper SDK to use with React Native | ||||
| FLIPPER_VERSION=0.54.0 | ||||
| @@ -1,5 +1,5 @@ | ||||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-all.zip | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
|   | ||||
							
								
								
									
										37
									
								
								Example/testHotUpdate/android/gradlew
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										37
									
								
								Example/testHotUpdate/android/gradlew
									
									
									
									
										vendored
									
									
								
							| @@ -7,7 +7,7 @@ | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| # | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| #      https://www.apache.org/licenses/LICENSE-2.0 | ||||
| # | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| @@ -125,8 +125,8 @@ if $darwin; then | ||||
|     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | ||||
| fi | ||||
|  | ||||
| # For Cygwin, switch paths to Windows format before running java | ||||
| if $cygwin ; then | ||||
| # For Cygwin or MSYS, switch paths to Windows format before running java | ||||
| if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then | ||||
|     APP_HOME=`cygpath --path --mixed "$APP_HOME"` | ||||
|     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | ||||
|     JAVACMD=`cygpath --unix "$JAVACMD"` | ||||
| @@ -154,19 +154,19 @@ if $cygwin ; then | ||||
|         else | ||||
|             eval `echo args$i`="\"$arg\"" | ||||
|         fi | ||||
|         i=$((i+1)) | ||||
|         i=`expr $i + 1` | ||||
|     done | ||||
|     case $i in | ||||
|         (0) set -- ;; | ||||
|         (1) set -- "$args0" ;; | ||||
|         (2) set -- "$args0" "$args1" ;; | ||||
|         (3) set -- "$args0" "$args1" "$args2" ;; | ||||
|         (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||||
|         (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||||
|         (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||||
|         (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||||
|         (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||||
|         (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||||
|         0) set -- ;; | ||||
|         1) set -- "$args0" ;; | ||||
|         2) set -- "$args0" "$args1" ;; | ||||
|         3) set -- "$args0" "$args1" "$args2" ;; | ||||
|         4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||||
|         5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||||
|         6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||||
|         7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||||
|         8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||||
|         9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||||
|     esac | ||||
| fi | ||||
|  | ||||
| @@ -175,14 +175,9 @@ save () { | ||||
|     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | ||||
|     echo " " | ||||
| } | ||||
| APP_ARGS=$(save "$@") | ||||
| APP_ARGS=`save "$@"` | ||||
|  | ||||
| # Collect all arguments for the java command, following the shell quoting and substitution rules | ||||
| eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | ||||
|  | ||||
| # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | ||||
| if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | ||||
|   cd "$(dirname "$0")" | ||||
| fi | ||||
|  | ||||
| exec "$JAVACMD" "$@" | ||||
| exec "$JAVACMD" "$@" | ||||
							
								
								
									
										7
									
								
								Example/testHotUpdate/android/gradlew.bat
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								Example/testHotUpdate/android/gradlew.bat
									
									
									
									
										vendored
									
									
								
							| @@ -5,7 +5,7 @@ | ||||
| @rem you may not use this file except in compliance with the License. | ||||
| @rem You may obtain a copy of the License at | ||||
| @rem | ||||
| @rem      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| @rem      https://www.apache.org/licenses/LICENSE-2.0 | ||||
| @rem | ||||
| @rem Unless required by applicable law or agreed to in writing, software | ||||
| @rem distributed under the License is distributed on an "AS IS" BASIS, | ||||
| @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. | ||||
| set APP_BASE_NAME=%~n0 | ||||
| set APP_HOME=%DIRNAME% | ||||
|  | ||||
| @rem Resolve any "." and ".." in APP_HOME to make it shorter. | ||||
| for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | ||||
|  | ||||
| @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||||
| set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | ||||
|  | ||||
| @@ -97,4 +100,4 @@ exit /b 1 | ||||
| :mainEnd | ||||
| if "%OS%"=="Windows_NT" endlocal | ||||
|  | ||||
| :omega | ||||
| :omega | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm