forked from compelling/cordova-plugin-geofence
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request cowbell#226 from cowbell/error_codes
Error codes
- Loading branch information
Showing
15 changed files
with
584 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
] | ||
}, | ||
"scripts": { | ||
"test:ios": "FIX_PARAMEDIC=true cordova-paramedic --platform ios --plugin . --verbose", | ||
"pretest": "sed -i 's/play-services-location:+/play-services-location:9.8.0/g' plugin.xml", | ||
"test": "cordova-paramedic --platform [email protected] --plugin . --verbose", | ||
"posttest": "sed -i 's/play-services-location:9.8.0/play-services-location:+/g' plugin.xml" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.cowbell.cordova.geofence; | ||
|
||
import org.apache.cordova.CallbackContext; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public class CommandExecutionHandler implements IGoogleServiceCommandListener { | ||
private CallbackContext callbackContext; | ||
|
||
public CommandExecutionHandler(CallbackContext callbackContext) { | ||
this.callbackContext = callbackContext; | ||
} | ||
|
||
@Override | ||
public void onCommandExecuted(Object error) { | ||
if (error != null) try { | ||
if (error instanceof Throwable) { | ||
JSONObject errorObject = new JSONObject(); | ||
errorObject.put("message", ((Throwable) error).getMessage()); | ||
if (error instanceof SecurityException) { | ||
errorObject.put("code", GeofencePlugin.ERROR_PERMISSION_DENIED); | ||
} else { | ||
errorObject.put("code", GeofencePlugin.ERROR_UNKNOWN); | ||
} | ||
callbackContext.error(errorObject); | ||
} else if (error instanceof JSONObject) { | ||
callbackContext.error((JSONObject) error); | ||
} else { | ||
JSONObject errorObject = new JSONObject(); | ||
errorObject.put("message", "Unknown error"); | ||
errorObject.put("code", GeofencePlugin.ERROR_UNKNOWN); | ||
callbackContext.error(errorObject); | ||
} | ||
} catch (JSONException exception) { | ||
callbackContext.error(exception.getMessage()); | ||
exception.printStackTrace(); | ||
} | ||
else { | ||
callbackContext.success(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package com.cowbell.cordova.geofence; | ||
|
||
public interface IGoogleServiceCommandListener { | ||
void onCommandExecuted(); | ||
void onCommandExecuted(Object error); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.