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

Pro: Reversed return types for "check" and "extract" #2127

Closed
DavidTalamona opened this issue Nov 16, 2017 · 4 comments
Closed

Pro: Reversed return types for "check" and "extract" #2127

DavidTalamona opened this issue Nov 16, 2017 · 4 comments

Comments

@DavidTalamona
Copy link

DavidTalamona commented Nov 16, 2017

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or https://ionicworldwide.herokuapp.com/

Current behavior:

  • pro.deploy.check returns Observable instead of Promise.
  • pro.deploy.extract causes "pluginObj.constructor.getPluginName is not a function" error because it's not an Observable, as it should be.

Expected behavior:
Returned values should be as documented.

Steps to reproduce:
Just implement the live update process with the native plugin wrapper.

Related code: (https://github.com/ionic-team/ionic-native/blob/master/src/%40ionic-native/plugins/pro/index.ts)

/**
   * Check a channel for an available update
   * @return {Promise<string>} Resolves with 'true' or 'false', or rejects with an error.
   */
  @CordovaInstance({
    observable: true
  })
  check(): Promise<string> { return; }

  /**
   * Download an available version
   * @return {Observable<any>} Updates with percent completion, or errors with a message.
   */
  @CordovaInstance({
    observable: true
  })
  download(): Observable<any> { return; }

  /**
   * Unzip the latest downloaded version
   * @return {Observable<any>} Updates with percent completion, or errors with a message.
   */
  @CordovaInstance()
extract(): Observable<any> { return; }

should be:

/**
   * Check a channel for an available update
   * @return {Promise<string>} Resolves with 'true' or 'false', or rejects with an error.
   */
  @CordovaInstance()
  check(): Promise<string> { return; }

  /**
   * Download an available version
   * @return {Observable<any>} Updates with percent completion, or errors with a message.
   */
  @CordovaInstance({
    observable: true
  })
  download(): Observable<any> { return; }

  /**
   * Unzip the latest downloaded version
   * @return {Observable<any>} Updates with percent completion, or errors with a message.
   */
  @CordovaInstance({
    observable: true
  })
extract(): Observable<any> { return; }

Note the {observable: true} that I moved from check to extract!

@DavidTalamona DavidTalamona changed the title Reversed return types for Ionic PRO native wrapper methods "check" and "extract" Pro: Reversed return types for "check" and "extract" Nov 16, 2017
@DavidTalamona
Copy link
Author

The error assigned to it is Error: Uncaught (in promise): TypeError: _this.pro.deploy.check(...).then is not a function.
Just for others to find this issue and not open another one.

@DavidTalamona
Copy link
Author

Everyone looking for a solutoin / manual fix, see #2136 (comment)

@timbru31
Copy link
Contributor

Can we have a fix for this? Seems like Ionic (again) is advertising a half baked/unfinished/buggy product called Ionic Pro 🙄

Thanks a lot @DavidTalamona for the fix though!

@mlynch
Copy link
Collaborator

mlynch commented Jan 25, 2018

Hi all, can you try version 4.5.3 of @ionic-native/pro? Both of these issues should be resolved.

@mlynch mlynch closed this as completed Jan 25, 2018
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

3 participants