2017-11-06 23:45:48 +00:00
|
|
|
package chat.rocket.reactnative;
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2018-07-10 13:40:32 +00:00
|
|
|
import android.content.Context;
|
|
|
|
import android.os.Bundle;
|
2017-08-03 18:23:43 +00:00
|
|
|
|
2018-07-10 13:40:32 +00:00
|
|
|
import com.AlexanderZaytsev.RNI18n.RNI18nPackage;
|
2018-07-17 19:10:27 +00:00
|
|
|
import com.reactnative.ivpusic.imagepicker.PickerPackage;
|
2017-08-09 19:02:09 +00:00
|
|
|
import com.RNFetchBlob.RNFetchBlobPackage;
|
2017-08-07 00:34:35 +00:00
|
|
|
import com.balthazargronon.RCTZeroconf.ZeroconfReactPackage;
|
2018-07-10 13:40:32 +00:00
|
|
|
import com.brentvatne.react.ReactVideoPackage;
|
|
|
|
import com.crashlytics.android.Crashlytics;
|
|
|
|
import com.dylanvann.fastimage.FastImageViewPackage;
|
2017-08-03 18:23:43 +00:00
|
|
|
import com.facebook.react.ReactPackage;
|
|
|
|
import com.facebook.react.shell.MainReactPackage;
|
2018-07-10 13:40:32 +00:00
|
|
|
import com.horcrux.svg.SvgPackage;
|
|
|
|
import com.oblador.vectoricons.VectorIconsPackage;
|
|
|
|
import com.reactnativenavigation.NavigationApplication;
|
2018-01-15 20:43:52 +00:00
|
|
|
import com.remobile.toast.RCTToastPackage;
|
2018-03-07 00:17:20 +00:00
|
|
|
import com.rnim.rn.audio.ReactNativeAudioPackage;
|
2018-04-03 16:24:59 +00:00
|
|
|
import com.smixx.fabric.FabricPackage;
|
2018-07-10 13:40:32 +00:00
|
|
|
import com.wix.reactnativekeyboardinput.KeyboardInputPackage;
|
|
|
|
import com.wix.reactnativenotifications.RNNotificationsPackage;
|
|
|
|
import com.wix.reactnativenotifications.core.AppLaunchHelper;
|
|
|
|
import com.wix.reactnativenotifications.core.AppLifecycleFacade;
|
|
|
|
import com.wix.reactnativenotifications.core.JsIOHelper;
|
|
|
|
import com.wix.reactnativenotifications.core.notification.INotificationsApplication;
|
|
|
|
import com.wix.reactnativenotifications.core.notification.IPushNotification;
|
2018-01-15 20:43:52 +00:00
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
2018-07-10 13:40:32 +00:00
|
|
|
import io.fabric.sdk.android.Fabric;
|
|
|
|
import io.realm.react.RealmReactPackage;
|
|
|
|
|
|
|
|
public class MainApplication extends NavigationApplication implements INotificationsApplication {
|
|
|
|
|
|
|
|
private NotificationsLifecycleFacade notificationsLifecycleFacade;
|
2017-09-21 17:08:00 +00:00
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
@Override
|
2018-07-10 13:40:32 +00:00
|
|
|
public boolean isDebug() {
|
|
|
|
return BuildConfig.DEBUG;
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
|
|
|
|
2017-09-21 17:08:00 +00:00
|
|
|
@Override
|
2018-07-10 13:40:32 +00:00
|
|
|
public String getJSMainModuleName() {
|
2018-08-01 19:35:06 +00:00
|
|
|
return "index.android";
|
2018-07-10 13:40:32 +00:00
|
|
|
}
|
|
|
|
|
2017-08-03 18:23:43 +00:00
|
|
|
protected List<ReactPackage> getPackages() {
|
2018-07-10 13:40:32 +00:00
|
|
|
// Add additional packages you require here
|
|
|
|
// No need to add RnnPackage and MainReactPackage
|
|
|
|
return Arrays.<ReactPackage>asList(
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public List<ReactPackage> createAdditionalReactPackages() {
|
|
|
|
return Arrays.<ReactPackage>asList(
|
|
|
|
new MainReactPackage(),
|
2018-07-17 19:10:27 +00:00
|
|
|
new PickerPackage(),
|
2018-07-10 13:40:32 +00:00
|
|
|
new SvgPackage(),
|
|
|
|
new VectorIconsPackage(),
|
|
|
|
new RNFetchBlobPackage(),
|
|
|
|
new ZeroconfReactPackage(),
|
|
|
|
new RealmReactPackage(),
|
|
|
|
new ReactVideoPackage(),
|
|
|
|
new RCTToastPackage(),
|
|
|
|
new ReactNativeAudioPackage(),
|
|
|
|
new KeyboardInputPackage(MainApplication.this),
|
|
|
|
new RocketChatNativePackage(),
|
|
|
|
new FabricPackage(),
|
|
|
|
new FastImageViewPackage(),
|
|
|
|
new RNI18nPackage(),
|
|
|
|
new RNNotificationsPackage(MainApplication.this)
|
|
|
|
);
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|
|
|
|
|
2018-07-10 13:40:32 +00:00
|
|
|
@Override
|
|
|
|
public void onCreate() {
|
|
|
|
super.onCreate();
|
|
|
|
Fabric.with(this, new Crashlytics());
|
2017-09-21 17:08:00 +00:00
|
|
|
|
2018-07-10 13:40:32 +00:00
|
|
|
// Create an object of the custom facade impl
|
|
|
|
notificationsLifecycleFacade = new NotificationsLifecycleFacade();
|
|
|
|
// Attach it to react-native-navigation
|
|
|
|
setActivityCallbacks(notificationsLifecycleFacade);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IPushNotification getPushNotification(Context context, Bundle bundle, AppLifecycleFacade defaultFacade, AppLaunchHelper defaultAppLaunchHelper) {
|
|
|
|
return new CustomPushNotification(
|
|
|
|
context,
|
|
|
|
bundle,
|
|
|
|
notificationsLifecycleFacade, // Instead of defaultFacade!!!
|
|
|
|
defaultAppLaunchHelper,
|
|
|
|
new JsIOHelper()
|
|
|
|
);
|
|
|
|
}
|
2017-08-03 18:23:43 +00:00
|
|
|
}
|