Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11422

ios SplashScreen plugin may make webview disabled by not calling destroyView method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 3.5.0
    • None
    • None
    • ios

    Description

      When using ios splash screen, it is noticed sometimes, after the splash screen is dimissed, the ios main uiwebview is disabled. So even if the content in the webview shows properly, but user cannot click on any items on the screen.

      The project adds the splash screen plugin, and use all default settings.

      The debug shows, when the page loaded is finished, it calls pageDidLoad method, which calls setVisible to NO. Inside the setVisible method, in the dispatch_after block, the completion block will only call destroyViews method if the screen transition is finished at below code block
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (uint64_t) effectiveSplashDuration * NSEC_PER_SEC), dispatch_get_main_queue(), CFBridgingRelease(CFBridgingRetain(^(void) {
      NSLog(@"splash screen: block %@", NSStringFromSelector(_cmd));
      [UIView transitionWithView:self.viewController.view
      duration:(fadeDuration / 1000)
      options:UIViewAnimationOptionTransitionNone
      animations:^(void)

      { [weakSelf hideViews]; }

      completion:^(BOOL finished) {
      NSLog(@"splash screen: %@ finished %d", NSStringFromSelector(_cmd), finished);
      if (finished)

      { [weakSelf destroyViews]; // TODO: It might also be nice to have a js event happen here -jm }

      }
      ];
      })));
      }
      }

      The problem is if the webview is busy to handle other events (in the testing project, there are several update on frame and bounds, so it calls updateImage few times), then the transition will not be finished when completion block is called. As a result, the destroyView will not be called and the userInteractionEnabled is not set to true after the splash screen is dismissed.

      One possible solution is removing the observer and also enable user interaction within setVisible method, as there is no point to continue observer the frame and bound change when splash screen starts to fade out. And it can also be sure the user interaction is always enabled again after dismissing the splash screen.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jonathanli Jonathan Li
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: