Skip to content
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

On Rate, browser opens localhost/null #295

Closed
pedrumgolriz opened this issue Nov 19, 2020 · 7 comments
Closed

On Rate, browser opens localhost/null #295

pedrumgolriz opened this issue Nov 19, 2020 · 7 comments

Comments

@pedrumgolriz
Copy link

pedrumgolriz commented Nov 19, 2020

I'm not sure where I'm going wrong, I've used this plugin before without issue. Now with ionic 5 anytime a user clicks on the rate now button on the dialog, on android, the user ends up on a blank website with localhost/null in the address bar. On iOS the popped up dialog just spins then says could not connect.

Config:
"@ionic/angular": "^5.0.0",
"@ionic-native/app-rate": "^5.29.0",
"cordova-plugin-apprate": "1.7.1",

I've tried all configurations as seen below to no avail:

this.appRate.preferences = {
          simpleMode: true,
          storeAppURL: {
            ios: '123234',
            android: 'market://details?id=com.example.myapp'
          }
        };
        this.appRate.promptForRating(true);
this.appRate.preferences = {
          openUrl: function(url) {
            window.open(url, '_blank', 'location=yes');
          },
          simpleMode: true,
          storeAppURL: {
            ios: '123234',
            android: 'market://details?id=com.x.myapp'
          }
        };
        this.appRate.promptForRating(true);
this.appRate.preferences = {
          ...this.appRate.preferences,
          simpleMode: true,
          storeAppURL: {
            ios: '123234',
            android: 'market://details?id=com.example.myapp'
          }
        };
        this.appRate.promptForRating(true);
@simonramosb
Copy link

Hello! Having the same exact issue, same code as you. Tried everything, lets hope somebody cand help us!

Config:
Ionic CLI: 6.11.0
cordova-plugin-apprate: 1.7.1

@akash-sr12
Copy link

Same issue 😕

@wnabil
Copy link

wnabil commented Nov 22, 2020

i confirm the plugin works fine and its @ionic-native/app-rate issue
use the AppRate object from window and it should work as expected

    // tslint:disable-next-line: no-string-literal
    const appRate: any = window['AppRate'];
    const preferences = appRate.getPreferences();
    preferences.simpleMode = true;
    preferences.storeAppURL = {
      ios: 'id123456789',
      android: 'market://details?id=com.example.app',
      windows: 'ms-windows-store://review/?ProductId=XXXXXXXX',
    };
    appRate.setPreferences(preferences);
    appRate.promptForRating(true);

possible reference #291

@pedrumgolriz
Copy link
Author

i confirm the plugin works fine and its @ionic-native/app-rate issue
use the AppRate object from window and it should work as expected

    // tslint:disable-next-line: no-string-literal
    const appRate: any = window['AppRate'];
    const preferences = appRate.getPreferences();
    preferences.simpleMode = true;
    preferences.storeAppURL = {
      ios: 'id123456789',
      android: 'market://details?id=com.example.app',
      windows: 'ms-windows-store://review/?ProductId=XXXXXXXX',
    };
    appRate.setPreferences(preferences);
    appRate.promptForRating(true);

possible reference #291

Awesome! Confirmed working for android, will test on iOS when I can. I'm going to leave this issue open as it should be fixed by the dev

@wnabil
Copy link

wnabil commented Nov 22, 2020

@pedrumgolriz
Glad it works.
its not going to be fixed here there is nothing to do with the current repo, better to report it in ionic native repo
https://github.com/ionic-team/ionic-native

@simonramosb
Copy link

i confirm the plugin works fine and its @ionic-native/app-rate issue
use the AppRate object from window and it should work as expected

    // tslint:disable-next-line: no-string-literal
    const appRate: any = window['AppRate'];
    const preferences = appRate.getPreferences();
    preferences.simpleMode = true;
    preferences.storeAppURL = {
      ios: 'id123456789',
      android: 'market://details?id=com.example.app',
      windows: 'ms-windows-store://review/?ProductId=XXXXXXXX',
    };
    appRate.setPreferences(preferences);
    appRate.promptForRating(true);

possible reference #291

Thanks a lot! Worked for me too!

@lucasramosdev
Copy link

i confirm the plugin works fine and its @ionic-native/app-rate issue
use the AppRate object from window and it should work as expected

    // tslint:disable-next-line: no-string-literal
    const appRate: any = window['AppRate'];
    const preferences = appRate.getPreferences();
    preferences.simpleMode = true;
    preferences.storeAppURL = {
      ios: 'id123456789',
      android: 'market://details?id=com.example.app',
      windows: 'ms-windows-store://review/?ProductId=XXXXXXXX',
    };
    appRate.setPreferences(preferences);
    appRate.promptForRating(true);

possible reference #291

I tried this way and response:
ERROR TypeError: Cannot read property 'getPreferences' of undefined
at AppComponent.rateMe (app.component.ts:47)
at AppComponent_Template_ion_item_click_15_listener (template.html:31)
at executeListenerWithErrorHandling (core.js:14316)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:14351)
at HTMLElement. (platform-browser.js:582)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Object.onInvokeTask (core.js:27425)
at ZoneDelegate.invokeTask (zone-evergreen.js:398)
at Zone.runTask (zone-evergreen.js:167)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:480)

Config:
"@ionic/angular": "5.5.2",
"@ionic-native/app-rate": "5.31.1",
"cordova-plugin-apprate": "^1.7.2",

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

5 participants