Skip to content

Commit

Permalink
Merge pull request #12 from AndyMDoyle/master
Browse files Browse the repository at this point in the history
Support setUserEmail and setUserName
  • Loading branch information
gregfrasco authored Nov 7, 2017
2 parents e233a9d + 9c2717a commit 907439c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/hockey-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,52 @@ export class HockeyApp {
}
});
}

/**
* Set the user's e-mail address.
* @param userEmail The user's e-mail address.
*/
public setUserEmail(userEmail: string): Promise<any> {
return new Promise((resolve, reject) => {
if (this.window[<any>'hockeyapp']) {
this.window[<any>'hockeyapp'].setUserEmail((success: any) => {
resolve(success);
}, (err: any) => {
reject(err);
}, userEmail);
} else {
if (this.platform.is('core') || this.platform.is('mobileweb')) {
console.warn('HockeyApp unable to set the users e-mail address on this platform')
resolve();
} else {
reject('HockeyApp is not found, please make sure the cordova-hockeyapp-plugin is installed and on a supported platform');
}
}
});

}

/**
* Set the user's name.
* @param userName The user's name.
*/
public setUserName(userName: string): Promise<any> {
return new Promise((resolve, reject) => {
if (this.window[<any>'hockeyapp']) {
this.window[<any>'hockeyapp'].setUserName((success: any) => {
resolve(success);
}, (err: any) => {
reject(err);
}, userName);
} else {
if (this.platform.is('core') || this.platform.is('mobileweb')) {
console.warn('HockeyApp unable to set the users name on this platform')
resolve();
} else {
reject('HockeyApp is not found, please make sure the cordova-hockeyapp-plugin is installed and on a supported platform');
}
}
});

}
}

0 comments on commit 907439c

Please sign in to comment.