* Remove fix for MM-9233 * MM-15774 Add native code to support RNN v2 on iOS * Android changes for RNN v2 upgrade The activity visibility handling of NotificationsLifecycleFacade is no longer needed in RNN v2. I've moved the lifecycle callbacks we use for handling managed config into ManagedActivityLifecycleCallbacks.java and registered them in MainApplication's onCreate. Also, I've moved and updated the loading and getting of the managed config into MainApplication * Update moduleNames and modulePaths * Use TAG in restrictionsReceiver * Set launch screen onCreate * Comment out registerActivityLifecycleCallbacks for now * Remove setSoftInputMode call as it's handled in the manifest * Remove clearHostOnActivityDestroy as that fix is no longer needed * Rename to canLaunchEntry * Remove replacement of super.onBackPressed() * Remove react-navigation from packager files
81 lines
2.3 KiB
Java
81 lines
2.3 KiB
Java
package com.mattermost.rnbeta;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Application;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
import com.facebook.react.bridge.Arguments;
|
|
import com.facebook.react.bridge.NativeModule;
|
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
import com.facebook.react.bridge.ReactContext;
|
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
import com.facebook.react.bridge.ReactMethod;
|
|
import com.facebook.react.bridge.Promise;
|
|
|
|
public class MattermostManagedModule extends ReactContextBaseJavaModule {
|
|
private static MattermostManagedModule instance;
|
|
|
|
private boolean shouldBlurAppScreen = false;
|
|
|
|
private MattermostManagedModule(ReactApplicationContext reactContext) {
|
|
super(reactContext);
|
|
}
|
|
|
|
public static MattermostManagedModule getInstance(ReactApplicationContext reactContext) {
|
|
if (instance == null) {
|
|
instance = new MattermostManagedModule(reactContext);
|
|
}
|
|
|
|
return instance;
|
|
}
|
|
|
|
public static MattermostManagedModule getInstance() {
|
|
return instance;
|
|
}
|
|
|
|
@Override
|
|
public String getName() {
|
|
return "MattermostManaged";
|
|
}
|
|
|
|
@ReactMethod
|
|
public void blurAppScreen(boolean enabled) {
|
|
shouldBlurAppScreen = enabled;
|
|
}
|
|
|
|
public boolean isBlurAppScreenEnabled() {
|
|
return shouldBlurAppScreen;
|
|
}
|
|
|
|
@ReactMethod
|
|
public void getConfig(final Promise promise) {
|
|
try {
|
|
Bundle config = MainApplication.instance.getManagedConfig();
|
|
|
|
if (config != null) {
|
|
Object result = Arguments.fromBundle(config);
|
|
promise.resolve(result);
|
|
} else {
|
|
promise.resolve(Arguments.createMap());
|
|
}
|
|
} catch (Exception e) {
|
|
promise.resolve(Arguments.createMap());
|
|
}
|
|
}
|
|
|
|
@ReactMethod
|
|
// Close the current activity and open the security settings.
|
|
public void goToSecuritySettings() {
|
|
getReactApplicationContext().startActivity(new Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS));
|
|
getCurrentActivity().finish();
|
|
System.exit(0);
|
|
}
|
|
|
|
@ReactMethod
|
|
public void quitApp() {
|
|
getCurrentActivity().finish();
|
|
System.exit(0);
|
|
}
|
|
}
|