2017-11-06 23:45:48 +00:00
|
|
|
package chat.rocket.reactnative;
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
import android.app.Application;
|
2020-10-13 12:41:03 +00:00
|
|
|
|
2019-09-18 17:32:12 +00:00
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
2019-08-07 13:51:34 +00:00
|
|
|
import com.facebook.react.PackageList;
|
2019-03-12 16:23:06 +00:00
|
|
|
import com.facebook.react.ReactApplication;
|
|
|
|
import com.facebook.react.ReactNativeHost;
|
|
|
|
import com.facebook.react.ReactPackage;
|
|
|
|
import com.facebook.soloader.SoLoader;
|
2020-10-13 12:41:03 +00:00
|
|
|
import com.nozbe.watermelondb.WatermelonDBPackage;
|
|
|
|
import com.reactnativecommunity.viewpager.RNCViewPagerPackage;
|
2019-06-21 16:39:20 +00:00
|
|
|
|
2020-10-13 12:41:03 +00:00
|
|
|
import org.unimodules.adapters.react.ModuleRegistryAdapter;
|
|
|
|
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
|
2019-09-16 20:26:32 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2020-10-13 12:41:03 +00:00
|
|
|
import chat.rocket.reactnative.generated.BasePackageList;
|
|
|
|
|
2020-11-09 20:14:35 +00:00
|
|
|
public class MainApplication extends Application implements ReactApplication {
|
2018-10-23 21:39:48 +00:00
|
|
|
|
2020-05-08 16:37:49 +00:00
|
|
|
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(new BasePackageList().getPackageList(), null);
|
2019-06-21 16:39:20 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
|
|
|
@Override
|
|
|
|
public boolean getUseDeveloperSupport() {
|
|
|
|
return BuildConfig.DEBUG;
|
2018-07-10 13:40:32 +00:00
|
|
|
}
|
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
@Override
|
2017-08-03 18:23:43 +00:00
|
|
|
protected List<ReactPackage> getPackages() {
|
2019-08-07 13:51:34 +00:00
|
|
|
@SuppressWarnings("UnnecessaryLocalVariable")
|
|
|
|
List<ReactPackage> packages = new PackageList(this).getPackages();
|
2019-09-16 20:26:32 +00:00
|
|
|
packages.add(new WatermelonDBPackage());
|
2019-09-26 14:59:27 +00:00
|
|
|
packages.add(new RNCViewPagerPackage());
|
2020-11-30 17:00:06 +00:00
|
|
|
packages.add(new SSLPinningPackage());
|
2020-05-08 16:37:49 +00:00
|
|
|
List<ReactPackage> unimodules = Arrays.<ReactPackage>asList(
|
|
|
|
new ModuleRegistryAdapter(mModuleRegistryProvider)
|
|
|
|
);
|
|
|
|
packages.addAll(unimodules);
|
2020-10-13 12:41:03 +00:00
|
|
|
List<ReactPackage> additionalModules = new AdditionalModules().getAdditionalModules(MainApplication.this);
|
|
|
|
packages.addAll(additionalModules);
|
2019-08-07 13:51:34 +00:00
|
|
|
return packages;
|
2018-07-10 13:40:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-03-12 16:23:06 +00:00
|
|
|
protected String getJSMainModuleName() {
|
|
|
|
return "index";
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
2019-09-18 17:32:12 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected @Nullable String getBundleAssetName() {
|
|
|
|
return "app.bundle";
|
|
|
|
}
|
2019-03-12 16:23:06 +00:00
|
|
|
};
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
@Override
|
|
|
|
public ReactNativeHost getReactNativeHost() {
|
|
|
|
return mReactNativeHost;
|
|
|
|
}
|
2018-07-10 13:40:32 +00:00
|
|
|
|
2019-03-12 16:23:06 +00:00
|
|
|
@Override
|
|
|
|
public void onCreate() {
|
|
|
|
super.onCreate();
|
|
|
|
SoLoader.init(this, /* native exopackage */ false);
|
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|