Skip to content

LiveQuery stop working when InAppBrowser is launched? #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
magickaito opened this issue Jun 27, 2017 · 1 comment
Closed

LiveQuery stop working when InAppBrowser is launched? #449

magickaito opened this issue Jun 27, 2017 · 1 comment

Comments

@magickaito
Copy link

magickaito commented Jun 27, 2017

I want to continue monitor events using ParseLiveQuery even if an InAppBrowser is launched. But I couldn't.

I noticed all events from Parse server appears to be paused/suspended, when an InAppBrowser is launched.

Here is a simplified code to demonstrate the problem:

export interface PageInterface {
  title: string;
  name: string;
  component: any;
  icon: string;
  logsOut?: boolean;
  index?: number;
  tabName?: string;
  tabComponent?: any;
}    
@Component({
  templateUrl: 'app.template.html'
})
export class ConferenceApp {
  @ViewChild(Nav) nav: Nav;
  appPages: PageInterface[] = [...];
  loggedInPages: PageInterface[] = [...];
  rootPage: any;
  browser: any;

  constructor(
    public events: Events,
    public userData: UserData,
    public menu: MenuController,
    public platform: Platform,
    public confData: ConferenceData,
    public parseData: ParseData,
    public storage: Storage,
    public splashScreen: SplashScreen,
    private iab: InAppBrowser
  ) {

    this.rootPage = TabsPage;
    this.platformReady();

  }

  listenToParse(){
    this.parseData.subscribe().then(
      (subscription)=> {
        subscription.on('open', () => {
          console.log('subscription opened');
        });
        subscription.on('update', (object:any) => {
          console.log('object updated');
        });
      },
      (error)=>{
        console.log(error);
      }
    );
  }

  openPage(page: PageInterface) {
    ...
  }


  enableMenu(loggedIn: boolean) {
    this.menu.enable(loggedIn, 'loggedInMenu');
    this.menu.enable(!loggedIn, 'loggedOutMenu');
  }

  platformReady() {
    // Call any initial plugins when ready
    this.platform.ready().then(() => {
      this.splashScreen.hide();

      this.listenToParse();
      
      setTimeout(() => {
        console.log("time out fired, launch iab!");
        this.browser = this.iab.create("https://www.google.com","_blank");
      },60000);

    });
  }

  isActive(page: PageInterface) {
    ...
  }
}

In the demo code above, we listen to changes of data from Parse server. It works until the InAppBrowser is launched, 60 seconds later. This is the log output:

2017-06-27 16:36:56.522724+0800 My App[2006:312223] subscription opened
2017-06-27 16:37:24.459593+0800 My App[2006:312223] object updated
2017-06-27 16:37:26.982129+0800 My App[2006:312223] object updated
2017-06-27 16:37:30.032242+0800 My App[2006:312223] object updated
2017-06-27 16:37:32.757926+0800 My App[2006:312223] object updated
2017-06-27 16:37:34.658421+0800 My App[2006:312223] object updated
2017-06-27 16:37:36.531520+0800 My App[2006:312223] object updated
2017-06-27 16:37:38.509784+0800 My App[2006:312223] object updated
2017-06-27 16:37:41.072448+0800 My App[2006:312223] object updated
2017-06-27 16:37:42.989296+0800 My App[2006:312223] object updated
2017-06-27 16:37:44.706035+0800 My App[2006:312223] object updated
2017-06-27 16:37:46.826566+0800 My App[2006:312223] object updated
2017-06-27 16:37:49.347574+0800 My App[2006:312223] object updated
2017-06-27 16:37:51.268267+0800 My App[2006:312223] object updated
2017-06-27 16:37:53.182077+0800 My App[2006:312223] time out fired, launch iab!
2017-06-27 16:37:53.621465+0800 My App[2006:312223] THREAD WARNING: ['InAppBrowser'] took '420.479980' ms. Plugin should use a background thread.
2017-06-27 16:37:53.623936+0800 My App[2006:312223] object updated
2017-06-27 16:37:53.862435+0800 My App[2006:312379] libMobileGestalt MobileGestaltSupport.m:153: pid 2006 (My App) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-06-27 16:37:53.862619+0800 My App[2006:312379] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-06-27 16:37:57.409094+0800 My App[2006:312223] object updated
2017-06-27 16:37:59.316170+0800 My App[2006:312712] WF: === Starting WebFilter logging for process My App
2017-06-27 16:37:59.316283+0800 My App[2006:312712] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2017-06-27 16:37:59.316718+0800 My App[2006:312712] WF: _WebFilterIsActive returning: NO

//InAppBrowser launched. 

No more object updated event after InAppBrowser launched. Why?

My dependencies:

  "dependencies": {
    "@angular/common": "4.1.2",
    "@angular/compiler": "4.1.2",
    "@angular/compiler-cli": "4.1.2",
    "@angular/core": "4.1.2",
    "@angular/forms": "4.1.2",
    "@angular/http": "4.1.2",
    "@angular/platform-browser": "4.1.2",
    "@angular/platform-browser-dynamic": "4.1.2",
    "@ionic-native/core": "3.10.2",
    "@ionic-native/in-app-browser": "3.10.2",
    "@ionic-native/splash-screen": "3.10.2",
    "@ionic-native/status-bar": "3.10.2",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.3.0",
    "ionicons": "3.0.0",
    "parse": "1.9.2",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.4.0",
    "zone.js": "0.8.11"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.7",
    "@ionic/cli-plugin-ionic-angular": "1.2.0",
    "typescript": "2.3.3"
  }
@stale
Copy link

stale bot commented Feb 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant