Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoLegends committed Jun 29, 2017
2 parents eaf8d11 + 34c018b commit 386aed7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-spotify",
"version": "0.3.1",
"version": "0.4.0",
"description": "Spotify SDK bindings for Cordova Applications",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-spotify" version="0.3.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<plugin id="cordova-spotify" version="0.4.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-spotify</name>

<hook type="before_plugin_install" src="package.sh" />
Expand Down
8 changes: 4 additions & 4 deletions src/android/CordovaSpotify.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public class CordovaSpotify extends CordovaPlugin {
public boolean execute(String action, JSONArray args, CallbackContext callbackContext)
throws JSONException {
if ("authenticate".equals(action)) {
String urlScheme = args.getString(0);
String redirectUrl = args.getString(0);
String clientId = args.getString(1);
JSONArray scopes = args.getJSONArray(2);
this.authenticate(callbackContext, clientId, urlScheme, scopes);
this.authenticate(callbackContext, clientId, redirectUrl, scopes);
return true;
} else if ("initSession".equals(action)) {
String clientId = args.getString(0);
Expand Down Expand Up @@ -82,11 +82,11 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
* API Functions
*/

private void authenticate(CallbackContext callbackContext, String clientId, String urlScheme, JSONArray jsonScopes) {
private void authenticate(CallbackContext callbackContext, String clientId, String redirectUrl, JSONArray jsonScopes) {
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(
clientId,
AuthenticationResponse.Type.CODE,
urlScheme + "://callback"
redirectUrl
);
String[] scopes = new String[jsonScopes.length()];
for (int i = 0; i < jsonScopes.length(); i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/ios/CordovaSpotify.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ - (void)pluginInitialize {
}

- (void) authenticate:(CDVInvokedUrlCommand*)command {
NSString* urlScheme = [command.arguments objectAtIndex:0];
NSString* redirectUrl = [command.arguments objectAtIndex:0];
NSString* clientId = [command.arguments objectAtIndex:1];
NSArray* scopes = [command.arguments objectAtIndex:2];

Expand All @@ -53,7 +53,7 @@ - (void) authenticate:(CDVInvokedUrlCommand*)command {

SPTAuth* auth = [SPTAuth defaultInstance];
auth.clientID = clientId;
auth.redirectURL = [NSURL URLWithString: [NSString stringWithFormat:@"%@://callback", urlScheme]];
auth.redirectURL = [NSURL URLWithString: redirectUrl];
auth.requestedScopes = scopes;

if ([command.arguments count] >= 5 &&
Expand Down
4 changes: 2 additions & 2 deletions www/platforms/android.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ function initSession(clientId, authData) {

module.exports = {
authenticate: function (options) {
if (!options.urlScheme || !options.clientId || !options.scopes ||
if (!options.redirectUrl || !options.clientId || !options.scopes ||
!options.tokenSwapUrl || !options.tokenRefreshUrl) {
return Promise.reject(conf.MISSING_PARAMETERS_ERROR);
}

return exec('authenticate', [
options.urlScheme,
options.redirectUrl,
options.clientId,
options.scopes
])
Expand Down
4 changes: 2 additions & 2 deletions www/platforms/ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ const exec = require('../lib/execPromise.js');

module.exports = {
authenticate: function (options) {
if (!options.urlScheme || !options.clientId || !options.scopes ||
if (!options.redirectUrl || !options.clientId || !options.scopes ||
!options.tokenSwapUrl || !options.tokenRefreshUrl) {
return Promise.reject(conf.MISSING_PARAMETERS_ERROR);
}

return exec('authenticate', [
options.urlScheme,
options.redirectUrl,
options.clientId,
options.scopes,
options.tokenSwapUrl,
Expand Down

0 comments on commit 386aed7

Please sign in to comment.