initialxy / cordova-plugin-themeablebrowser

Fork of org.apache.cordova.inappbrowser in an attempt to make it a bit more themeable and configurable to add some custom actions.
Apache License 2.0
294 stars 221 forks source link

Custom button Themeable Browser not worikng IOS #183

Open manhlh opened 5 years ago

manhlh commented 5 years ago

I use Ionic 3 and Themeable Browser library, I custom button in toolbar Themeable Browser and first time click SitePointSitePressed() not run BUT click second time then run 2 event. My Code ` const me = this; this.ref = cordova.ThemeableBrowser.open(this.productUrl, '_blank', options) .addEventListener('loadstart', function () { console.log('loadstart') me.viewProduct = false; }).addEventListener('loadstop', function (event) { console.log('load done');
}).addEventListener('loaderror', function (event) { console.log('load error'); }).addEventListener('exit', function (x) { console.log('exit app'); me.clear(); }) .addEventListener('SitePointSitePressed', function (x) { me.dialogs.confirm( "", // title me.transText['addOrder'], // message
['OK', me.transText['quit']] // buttonLabels, ).then(onConfirm);

    function onConfirm(buttonIndex) {
      me.categoryService.getAllUsingGET().subscribe(data => {
        me.categorys = data;
      })
      if (buttonIndex == 1) {
        me.showloading(null)
        const link_product = x.url + '';
        me.productController.getProductionInfomationUsingPOST(link_product.replace('m.1688.com', 'detail.1688.com')).subscribe(data => {
          console.log('data form link: ', data)
          me.hideLoading();
          me.product = data;
          if (me.product.shopConfig.max == 0) {
            navigator.notification.alert("Sản phẩm đã hết hàng", null, me.transText['notiTitle']);
          } else {
            me.getProductColor(me.product)
            me.ref.hide();
          }
        }, error => {
          alert(me.transText['getInfoProductError']);
          me.hideLoading();
          if (me.viewProduct == false) {
            me.ref.show();
          }
        })
      }
    }
  });`
jinshuokang commented 4 years ago

I also met, did you solve it?

manhlh commented 4 years ago

I also met, did you solve it?

Yep, i can fix it. You download and replace "cordova-plugin-themeablebrowser" plugin in plugin folder. step: remove plugin themeable > remove platform > add platform > replace themeable > build

Download here: https://drive.google.com/file/d/1SMC9-xggI1gA-Z9reHE2nnfnVdrrfFUm/view?usp=sharing