Skip to content

Conversation

@arthursp
Copy link
Contributor

@arthursp arthursp commented Oct 20, 2017

Add an option to use basic auth for config.xml and apk URI.

usage :

appUpdate.checkAppUpdate(onSuccess, onFail, updateUrl, {
    'authType' : 'basic',
    'username' : 'test',
    'password' : 'test'
})

Also need to update IONIC native wrapper ( work in progress )

@vaenow
Copy link
Owner

vaenow commented Oct 20, 2017

Hi @arthursp ,
If the Auth merged, what should the server side do?

@arthursp
Copy link
Contributor Author

arthursp commented Oct 20, 2017

Hi @vaenow,

on the server side, just need to add basic auth.

I tested with a simple htaccess and htpasswd with an apache server :

AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /var/www/apkmanager/.htpasswd
Require valid-user

and the htpasswd :

test:$apr1$XQ6wTvJB$rgTrtnB06BGyI3JXJlFjE.

test:test as user:password

@arthursp
Copy link
Contributor Author

arthursp commented Oct 20, 2017

For the ionic native plugin ( in case of ) :

export class AppUpdate extends IonicNativePlugin {
  /**
   * Check and update
   * @param updateUrl {string} update api url
   * @param options {json} options object
   * @return {Promise<any>} Returns a promise that resolves when something happens
   */
  @Cordova({
    callbackOrder: 'reverse'
  })
  checkAppUpdate(updateUrl: string, options?: any): Promise<any> { return; }
}

@vaenow vaenow merged commit 45c6a9a into vaenow:master Oct 20, 2017
vaenow added a commit that referenced this pull request Oct 20, 2017
Add auth download
vaenow added a commit that referenced this pull request Oct 20, 2017
@johnhtet691
Copy link

johnhtet691 commented Jan 18, 2018

I want to do like the following but i can't because appUpdate.checkAppUpdate in my code have one parameter.What do i need to do?please someone answer me........

appUpdate.checkAppUpdate(onSuccess, onFail, updateUrl, {
'authType' : 'basic',
'username' : 'test',
'password' : 'test'
})

@arthursp
Copy link
Contributor Author

@johnhtet691

in the ionic native plugin :

export class AppUpdate extends IonicNativePlugin {
  /**
   * Check and update
   * @param updateUrl {string} update api url
   * @param options {json} options object
   * @return {Promise<any>} Returns a promise that resolves when something happens
   */
  @Cordova({
    callbackOrder: 'reverse'
  })
  checkAppUpdate(updateUrl: string, options?: any): Promise<any> { return; }
}

@johnhtet691
Copy link

johnhtet691 commented Jan 19, 2018

Thank you for replying.You mean that you want to change AppUpdate class(index.d.ts) in my code situated node-modules as showing you.But I change the code as you show, I got the error like this 'An Implementation cannot be declared in ambient contexts ". I think that i need to do something .Please show the way. :) :)

My original code is the following like that.

export declare class AppUpdate extends IonicNativePlugin {
/**
* Check and update
* @param updateUrl {string} update api url
* @return {Promise} Returns a promise that resolves when something happens
*/
checkAppUpdate(updateUrl: string): Promise;
}

@arthursp
Copy link
Contributor Author

in /node_modules/@ionic-native/app-update/index.d.ts

Which version of typescript do you have ?

You may use : npm install --save typescript@latest

@TizioFittizio
Copy link

This hasn't been included in the ionic native plugin yet?

@arthursp
Copy link
Contributor Author

arthursp commented Feb 5, 2018

Nope, not yet :S

@danielsogl
Copy link

Hey all, I created a PR to add this feature. Wait for our next release

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

Successfully merging this pull request may close these issues.

6 participants