Skip to content
This repository was archived by the owner on Mar 14, 2019. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
ihadeed committed Jan 2, 2017
0 parents commit 1853064
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.DS_STORE
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "cordova-plugin-linkedin",
"version": "0.0.1",
"description": "Cordova plugin for LinkedIn",
"cordova": {
"id": "cordova-plugin-linkedin",
"platforms": [
"android",
"ios"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/zyramedia/cordova-plugin-linkedin.git"
},
"keywords": [
"ecosystem:cordova",
"cordova-android",
"cordova-ios"
],
"author": "Ibby Hadeed <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/zyramedia/cordova-plugin-linkedin/issues"
},
"homepage": "https://github.com/zyramedia/cordova-plugin-linkedin#readme"
}
2 changes: 2 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version='1.0' encoding='utf-8'?>
<plugin id="cordova-plugin-linkedin" version="0.0.1" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android"><name>LinkedIn</name><js-module name="LinkedIn" src="www/LinkedIn.js"><clobbers target="cordova.plugins.LinkedIn" /></js-module><platform name="android"><config-file parent="/*" target="res/xml/config.xml"><feature name="LinkedIn"><param name="android-package" value="cordova-plugin-linkedin.LinkedIn" /></feature></config-file><config-file parent="/*" target="AndroidManifest.xml" /><source-file src="src/android/LinkedIn.java" target-dir="src/cordova-plugin-linkedin/LinkedIn" /></platform><platform name="ios"><config-file parent="/*" target="config.xml"><feature name="LinkedIn"><param name="ios-package" value="LinkedIn" /></feature></config-file><source-file src="src/ios/LinkedIn.m" /></platform></plugin>
32 changes: 32 additions & 0 deletions src/android/LinkedIn.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package cordova-plugin-linkedin;

import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
* This class echoes a string called from JavaScript.
*/
public class LinkedIn extends CordovaPlugin {

@Override
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (action.equals("coolMethod")) {
String message = args.getString(0);
this.coolMethod(message, callbackContext);
return true;
}
return false;
}

private void coolMethod(String message, CallbackContext callbackContext) {
if (message != null && message.length() > 0) {
callbackContext.success(message);
} else {
callbackContext.error("Expected one non-empty string argument.");
}
}
}
28 changes: 28 additions & 0 deletions src/ios/LinkedIn.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/********* LinkedIn.m Cordova Plugin Implementation *******/

#import <Cordova/CDV.h>

@interface LinkedIn : CDVPlugin {
// Member variables go here.
}

- (void)coolMethod:(CDVInvokedUrlCommand*)command;
@end

@implementation LinkedIn

- (void)coolMethod:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* echo = [command.arguments objectAtIndex:0];

if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}

[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

@end
5 changes: 5 additions & 0 deletions www/LinkedIn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var exec = require('cordova/exec');

exports.coolMethod = function(arg0, success, error) {
exec(success, error, "LinkedIn", "coolMethod", [arg0]);
};

0 comments on commit 1853064

Please sign in to comment.