mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Trying out expo 43
This commit is contained in:
		@@ -78,13 +78,11 @@ import com.android.build.OutputFile
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
project.ext.react = [
 | 
			
		||||
    enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes"
 | 
			
		||||
    enableHermes: (findProperty('expo.jsEngine') ?: "jsc") == "hermes",
 | 
			
		||||
    cliPath: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../cli.js")
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
 | 
			
		||||
apply from: "../../node_modules/react-native/react.gradle"
 | 
			
		||||
apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle"
 | 
			
		||||
apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"
 | 
			
		||||
apply from: new File(["node", "--print", "require.resolve('react-native/package.json')"].execute().text.trim(), "../react.gradle")
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set this to true to create two separate APKs instead of one:
 | 
			
		||||
@@ -193,6 +191,32 @@ dependencies {
 | 
			
		||||
    implementation fileTree(dir: "libs", include: ["*.jar"])
 | 
			
		||||
    //noinspection GradleDynamicVersion
 | 
			
		||||
    implementation "com.facebook.react:react-native:+"  // From node_modules
 | 
			
		||||
 | 
			
		||||
    def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
 | 
			
		||||
    def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
 | 
			
		||||
    def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
 | 
			
		||||
 | 
			
		||||
    // If your app supports Android versions before Ice Cream Sandwich (API level 14)
 | 
			
		||||
    // All fresco packages should use the same version
 | 
			
		||||
    if (isGifEnabled || isWebpEnabled) {
 | 
			
		||||
        implementation 'com.facebook.fresco:fresco:2.0.0'
 | 
			
		||||
        implementation 'com.facebook.fresco:imagepipeline-okhttp3:2.0.0'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (isGifEnabled) {
 | 
			
		||||
        // For animated gif support
 | 
			
		||||
        implementation 'com.facebook.fresco:animated-gif:2.0.0'
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (isWebpEnabled) {
 | 
			
		||||
        // For webp support
 | 
			
		||||
        implementation 'com.facebook.fresco:webpsupport:2.0.0'
 | 
			
		||||
        if (isWebpAnimatedEnabled) {
 | 
			
		||||
            // Animated webp support
 | 
			
		||||
            implementation 'com.facebook.fresco:animated-webp:2.0.0'
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
 | 
			
		||||
    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
 | 
			
		||||
      exclude group:'com.facebook.fbjni'
 | 
			
		||||
@@ -204,12 +228,10 @@ dependencies {
 | 
			
		||||
    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
 | 
			
		||||
        exclude group:'com.facebook.flipper'
 | 
			
		||||
    }
 | 
			
		||||
    addUnimodulesDependencies()
 | 
			
		||||
 | 
			
		||||
    if (enableHermes) {
 | 
			
		||||
        def hermesPath = "../../node_modules/hermes-engine/android/";
 | 
			
		||||
        debugImplementation files(hermesPath + "hermes-debug.aar")
 | 
			
		||||
        releaseImplementation files(hermesPath + "hermes-release.aar")
 | 
			
		||||
        debugImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute().text.trim(), "../android/hermes-debug.aar"))
 | 
			
		||||
        releaseImplementation files(new File(["node", "--print", "require.resolve('hermes-engine/package.json')"].execute().text.trim(), "../android/hermes-release.aar"))
 | 
			
		||||
    } else {
 | 
			
		||||
        implementation jscFlavor
 | 
			
		||||
    }
 | 
			
		||||
@@ -222,6 +244,7 @@ task copyDownloadableDepsToLibs(type: Copy) {
 | 
			
		||||
    into 'libs'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
 | 
			
		||||
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute().text.trim(), "../native_modules.gradle");
 | 
			
		||||
applyNativeModulesAppBuildGradle(project)
 | 
			
		||||
 | 
			
		||||
apply plugin: 'com.google.gms.google-services'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,4 @@
 | 
			
		||||
package com.xmflsct.app.tooot;
 | 
			
		||||
import android.content.res.Configuration;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
 | 
			
		||||
import com.facebook.react.ReactActivity;
 | 
			
		||||
@@ -9,30 +6,14 @@ import com.facebook.react.ReactActivityDelegate;
 | 
			
		||||
import com.facebook.react.ReactRootView;
 | 
			
		||||
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
 | 
			
		||||
 | 
			
		||||
import expo.modules.splashscreen.singletons.SplashScreen;
 | 
			
		||||
import expo.modules.splashscreen.SplashScreenImageResizeMode;
 | 
			
		||||
 | 
			
		||||
import expo.modules.ReactActivityDelegateWrapper;
 | 
			
		||||
 | 
			
		||||
public class MainActivity extends ReactActivity {
 | 
			
		||||
 | 
			
		||||
    // Added automatically by Expo Config
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onConfigurationChanged(Configuration newConfig) {
 | 
			
		||||
        super.onConfigurationChanged(newConfig);
 | 
			
		||||
        Intent intent = new Intent("onConfigurationChanged");
 | 
			
		||||
        intent.putExtra("newConfig", newConfig);
 | 
			
		||||
        sendBroadcast(intent);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  protected void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
    super.onCreate(null);
 | 
			
		||||
    // SplashScreen.show(...) has to be called after super.onCreate(...)
 | 
			
		||||
    // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
 | 
			
		||||
    SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the name of the main component registered from JavaScript.
 | 
			
		||||
     * This is used to schedule rendering of the component.
 | 
			
		||||
@@ -44,11 +25,14 @@ public class MainActivity extends ReactActivity {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected ReactActivityDelegate createReactActivityDelegate() {
 | 
			
		||||
        return new ReactActivityDelegate(this, getMainComponentName()) {
 | 
			
		||||
            @Override
 | 
			
		||||
            protected ReactRootView createRootView() {
 | 
			
		||||
                return new RNGestureHandlerEnabledRootView(MainActivity.this);
 | 
			
		||||
        return new ReactActivityDelegateWrapper(
 | 
			
		||||
            this,
 | 
			
		||||
            new ReactActivityDelegate(this, getMainComponentName()) {
 | 
			
		||||
                @Override
 | 
			
		||||
                protected ReactRootView createRootView() {
 | 
			
		||||
                    return new RNGestureHandlerEnabledRootView(MainActivity.this);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,8 @@ package com.xmflsct.app.tooot;
 | 
			
		||||
 | 
			
		||||
import android.app.Application;
 | 
			
		||||
import android.content.Context;
 | 
			
		||||
import android.net.Uri;
 | 
			
		||||
import android.content.res.Configuration;
 | 
			
		||||
import androidx.annotation.NonNull;
 | 
			
		||||
 | 
			
		||||
import com.facebook.react.PackageList;
 | 
			
		||||
import com.facebook.react.ReactApplication;
 | 
			
		||||
@@ -13,30 +14,26 @@ import com.facebook.react.shell.MainReactPackage;
 | 
			
		||||
import com.facebook.soloader.SoLoader;
 | 
			
		||||
import com.xmflsct.app.tooot.generated.BasePackageList;
 | 
			
		||||
 | 
			
		||||
import org.unimodules.adapters.react.ReactAdapterPackage;
 | 
			
		||||
import org.unimodules.adapters.react.ModuleRegistryAdapter;
 | 
			
		||||
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
 | 
			
		||||
import org.unimodules.core.interfaces.Package;
 | 
			
		||||
import org.unimodules.core.interfaces.SingletonModule;
 | 
			
		||||
import expo.modules.constants.ConstantsPackage;
 | 
			
		||||
import expo.modules.ApplicationLifecycleDispatcher;
 | 
			
		||||
import expo.modules.ReactNativeHostWrapper;
 | 
			
		||||
import expo.modules.permissions.PermissionsPackage;
 | 
			
		||||
import expo.modules.filesystem.FileSystemPackage;
 | 
			
		||||
import expo.modules.updates.UpdatesController;
 | 
			
		||||
 | 
			
		||||
import java.lang.reflect.InvocationTargetException;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import javax.annotation.Nullable;
 | 
			
		||||
 | 
			
		||||
  import com.facebook.react.bridge.JSIModulePackage; // <- react-native-reanimated-v2
 | 
			
		||||
  import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- react-native-reanimated-v2
 | 
			
		||||
import com.facebook.react.bridge.JSIModulePackage; // <- react-native-reanimated-v2
 | 
			
		||||
import com.swmansion.reanimated.ReanimatedJSIModulePackage; // <- react-native-reanimated-v2
 | 
			
		||||
 | 
			
		||||
public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
  private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
 | 
			
		||||
    new BasePackageList().getPackageList()
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
 | 
			
		||||
  private final ReactNativeHost mReactNativeHost = new ReactNativeHostWrapper(
 | 
			
		||||
    this,
 | 
			
		||||
    new ReactNativeHost(this) {
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean getUseDeveloperSupport() {
 | 
			
		||||
      return BuildConfig.DEBUG;
 | 
			
		||||
@@ -44,8 +41,10 @@ public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected List<ReactPackage> getPackages() {
 | 
			
		||||
      @SuppressWarnings("UnnecessaryLocalVariable")
 | 
			
		||||
      List<ReactPackage> packages = new PackageList(this).getPackages();
 | 
			
		||||
      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
 | 
			
		||||
      // Packages that cannot be autolinked yet can be added manually here, for example:
 | 
			
		||||
      // packages.add(new MyReactNativePackage());
 | 
			
		||||
      return packages;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -58,24 +57,6 @@ public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
    protected JSIModulePackage getJSIModulePackage() {
 | 
			
		||||
      return new ReanimatedJSIModulePackage();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected @Nullable String getJSBundleFile() {
 | 
			
		||||
      if (BuildConfig.DEBUG) {
 | 
			
		||||
        return super.getJSBundleFile();
 | 
			
		||||
      } else {
 | 
			
		||||
        return UpdatesController.getInstance().getLaunchAssetFile();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected @Nullable String getBundleAssetName() {
 | 
			
		||||
      if (BuildConfig.DEBUG) {
 | 
			
		||||
        return super.getBundleAssetName();
 | 
			
		||||
      } else {
 | 
			
		||||
        return UpdatesController.getInstance().getBundleAssetName();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
@@ -88,11 +69,14 @@ public class MainApplication extends Application implements ReactApplication {
 | 
			
		||||
    super.onCreate();
 | 
			
		||||
    SoLoader.init(this, /* native exopackage */ false);
 | 
			
		||||
 | 
			
		||||
    if (!BuildConfig.DEBUG) {
 | 
			
		||||
      UpdatesController.initialize(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
 | 
			
		||||
    ApplicationLifecycleDispatcher.onApplicationCreate(this);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Override
 | 
			
		||||
  public void onConfigurationChanged(@NonNull Configuration newConfig) {
 | 
			
		||||
    super.onConfigurationChanged(newConfig);
 | 
			
		||||
    ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user