@@ -167,19 +167,9 @@ public void onCreate(Bundle savedInstanceState) {
167167 return ;
168168 }
169169
170- if (!flutterView .getFlutterNativeView ().isApplicationRunning ()) {
171- String appBundlePath = FlutterMain .findAppBundlePath (activity .getApplicationContext ());
172- if (appBundlePath != null ) {
173- FlutterRunArguments arguments = new FlutterRunArguments ();
174- ArrayList <String > bundlePaths = new ArrayList <>();
175- if (FlutterMain .getUpdateInstallationPath () != null ) {
176- bundlePaths .add (FlutterMain .getUpdateInstallationPath ());
177- }
178- bundlePaths .add (appBundlePath );
179- arguments .bundlePaths = bundlePaths .toArray (new String [0 ]);
180- arguments .entrypoint = "main" ;
181- flutterView .runFromBundle (arguments );
182- }
170+ String appBundlePath = FlutterMain .findAppBundlePath (activity .getApplicationContext ());
171+ if (appBundlePath != null ) {
172+ runBundle (appBundlePath );
183173 }
184174 }
185175
@@ -335,30 +325,34 @@ private boolean loadIntent(Intent intent) {
335325 String route = intent .getStringExtra ("route" );
336326 String appBundlePath = intent .getDataString ();
337327 if (appBundlePath == null ) {
338- // Fall back to the installation path if no bundle path
339- // was specified.
328+ // Fall back to the installation path if no bundle path was specified.
340329 appBundlePath = FlutterMain .findAppBundlePath (activity .getApplicationContext ());
341330 }
342331 if (route != null ) {
343332 flutterView .setInitialRoute (route );
344333 }
345- if (!flutterView .getFlutterNativeView ().isApplicationRunning ()) {
346- FlutterRunArguments args = new FlutterRunArguments ();
347- ArrayList <String > bundlePaths = new ArrayList <>();
348- if (FlutterMain .getUpdateInstallationPath () != null ) {
349- bundlePaths .add (FlutterMain .getUpdateInstallationPath ());
350- }
351- bundlePaths .add (appBundlePath );
352- args .bundlePaths = bundlePaths .toArray (new String [0 ]);
353- args .entrypoint = "main" ;
354- flutterView .runFromBundle (args );
355- }
334+
335+ runBundle (appBundlePath );
356336 return true ;
357337 }
358338
359339 return false ;
360340 }
361341
342+ private void runBundle (String appBundlePath ) {
343+ if (!flutterView .getFlutterNativeView ().isApplicationRunning ()) {
344+ FlutterRunArguments args = new FlutterRunArguments ();
345+ ArrayList <String > bundlePaths = new ArrayList <>();
346+ if (FlutterMain .getUpdateInstallationPath () != null ) {
347+ bundlePaths .add (FlutterMain .getUpdateInstallationPath ());
348+ }
349+ bundlePaths .add (appBundlePath );
350+ args .bundlePaths = bundlePaths .toArray (new String [0 ]);
351+ args .entrypoint = "main" ;
352+ flutterView .runFromBundle (args );
353+ }
354+ }
355+
362356 /**
363357 * Creates a {@link View} containing the same {@link Drawable} as the one set as the
364358 * {@code windowBackground} of the parent activity for use as a launch splash view.
0 commit comments