Skip to content

Commit 51a6d31

Browse files
committedMay 28, 2019
[MM-10281] Restart whole applicaiton when context is weird
1 parent b912f61 commit 51a6d31

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
 

‎mattermost-mobile/android/app/src/main/java/com/mattermost/rnbeta/MainActivity.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
import android.os.Bundle;
44
import android.support.annotation.Nullable;
5+
import com.facebook.react.common.LifecycleState;
56
import com.reactnativenavigation.controllers.SplashActivity;
7+
import com.reactnativenavigation.NavigationApplication;
8+
import com.reactnativenavigation.react.ReactGateway;
69

710
public class MainActivity extends SplashActivity {
811
@Override
@@ -24,8 +27,20 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
2427
}
2528
}
2629

30+
@Override
31+
protected void onResume() {
32+
ReactGateway reactGateway = NavigationApplication.instance.getReactGateway();
33+
if (reactGateway.hasStartedCreatingContext()
34+
&& reactGateway.getReactInstanceManager().getLifecycleState() == LifecycleState.BEFORE_CREATE) {
35+
System.exit(0);
36+
return;
37+
}
38+
39+
super.onResume();
40+
}
41+
2742
@Override
2843
public int getSplashLayout() {
2944
return R.layout.launch_screen;
3045
}
31-
}
46+
}

0 commit comments

Comments
 (0)
Please sign in to comment.