summaryrefslogtreecommitdiff
path: root/plugins/uk.co.whiteoctober.cordova.appversion/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uk.co.whiteoctober.cordova.appversion/src')
-rw-r--r--plugins/uk.co.whiteoctober.cordova.appversion/src/android/AppVersion.java45
-rw-r--r--plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.h13
-rw-r--r--plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.m47
-rw-r--r--plugins/uk.co.whiteoctober.cordova.appversion/src/windows8/AppVersionProxy.js7
-rw-r--r--plugins/uk.co.whiteoctober.cordova.appversion/src/wp8/AppVersion.cs24
5 files changed, 0 insertions, 136 deletions
diff --git a/plugins/uk.co.whiteoctober.cordova.appversion/src/android/AppVersion.java b/plugins/uk.co.whiteoctober.cordova.appversion/src/android/AppVersion.java
deleted file mode 100644
index 204ed7e8..00000000
--- a/plugins/uk.co.whiteoctober.cordova.appversion/src/android/AppVersion.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package uk.co.whiteoctober.cordova;
-
-import org.apache.cordova.CordovaPlugin;
-import org.apache.cordova.CallbackContext;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.PackageManager;
-
-public class AppVersion extends CordovaPlugin {
- @Override
- public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
-
- try {
- if (action.equals("getAppName")) {
- PackageManager packageManager = this.cordova.getActivity().getPackageManager();
- ApplicationInfo app = packageManager.getApplicationInfo(this.cordova.getActivity().getPackageName(), 0);
- callbackContext.success((String)packageManager.getApplicationLabel(app));
- return true;
- }
- if (action.equals("getPackageName")) {
- callbackContext.success(this.cordova.getActivity().getPackageName());
- return true;
- }
- if (action.equals("getVersionNumber")) {
- PackageManager packageManager = this.cordova.getActivity().getPackageManager();
- callbackContext.success(packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionName);
- return true;
- }
- if (action.equals("getVersionCode")) {
- PackageManager packageManager = this.cordova.getActivity().getPackageManager();
- callbackContext.success(packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionCode);
- return true;
- }
- return false;
- } catch (NameNotFoundException e) {
- callbackContext.success("N/A");
- return true;
- }
- }
-
-}
diff --git a/plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.h b/plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.h
deleted file mode 100644
index 87c0330b..00000000
--- a/plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#import <Cordova/CDVPlugin.h>
-
-@interface AppVersion : CDVPlugin
-
-- (void)getAppName:(CDVInvokedUrlCommand*)command;
-
-- (void)getPackageName:(CDVInvokedUrlCommand*)command;
-
-- (void)getVersionNumber:(CDVInvokedUrlCommand*)command;
-
-- (void)getVersionCode:(CDVInvokedUrlCommand*)command;
-
-@end
diff --git a/plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.m b/plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.m
deleted file mode 100644
index a73c78f9..00000000
--- a/plugins/uk.co.whiteoctober.cordova.appversion/src/ios/AppVersion.m
+++ /dev/null
@@ -1,47 +0,0 @@
-#import "AppVersion.h"
-#import <Cordova/CDVPluginResult.h>
-
-@implementation AppVersion
-
-- (void)getAppName : (CDVInvokedUrlCommand *)command
-{
- NSString * callbackId = command.callbackId;
- NSString * version =[[[NSBundle mainBundle]infoDictionary]objectForKey :@"CFBundleDisplayName"];
- CDVPluginResult * pluginResult =[CDVPluginResult resultWithStatus : CDVCommandStatus_OK messageAsString : version];
- [self.commandDelegate sendPluginResult : pluginResult callbackId : callbackId];
-}
-
-- (void)getPackageName:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* packageName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:packageName];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
-}
-
-- (void)getVersionNumber:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
- if (version == nil) {
- NSLog(@"CFBundleShortVersionString was nil, attempting CFBundleVersion");
- version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
- if (version == nil) {
- NSLog(@"CFBundleVersion was also nil, giving up");
- // not calling error callback here to maintain backward compatibility
- }
- }
-
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:version];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
-}
-
-- (void)getVersionCode:(CDVInvokedUrlCommand*)command
-{
- NSString* callbackId = command.callbackId;
- NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:version];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
-}
-
-@end
diff --git a/plugins/uk.co.whiteoctober.cordova.appversion/src/windows8/AppVersionProxy.js b/plugins/uk.co.whiteoctober.cordova.appversion/src/windows8/AppVersionProxy.js
deleted file mode 100644
index 3b4c50ee..00000000
--- a/plugins/uk.co.whiteoctober.cordova.appversion/src/windows8/AppVersionProxy.js
+++ /dev/null
@@ -1,7 +0,0 @@
-AppVersionProxy = {
- getVersionNumber: function (successCallback, failCallback, args) {
- var version = Windows.ApplicationModel.Package.current.id.version;
- successCallback([version.major, version.minor, version.build, version.revision].join('.'));
- }
-};
-cordova.commandProxy.add("AppVersion", AppVersionProxy);
diff --git a/plugins/uk.co.whiteoctober.cordova.appversion/src/wp8/AppVersion.cs b/plugins/uk.co.whiteoctober.cordova.appversion/src/wp8/AppVersion.cs
deleted file mode 100644
index 2f3d2c95..00000000
--- a/plugins/uk.co.whiteoctober.cordova.appversion/src/wp8/AppVersion.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Windows;
-using System.Windows.Navigation;
-using Microsoft.Phone.Controls;
-using WPCordovaClassLib.Cordova;
-using WPCordovaClassLib.Cordova.Commands;
-using WPCordovaClassLib.Cordova.JSON;
-using Windows.ApplicationModel;
-using System.Xml.Linq;
-
-namespace Cordova.Extension.Commands
-{
- public class AppVersion : BaseCommand
- {
- public void getVersionNumber(string empty)
- {
- //Windows.ApplicationModel.Package.current.id.version is NOT working in Windows Phone 8
- //Workaround based on http://stackoverflow.com/questions/14371275/how-can-i-get-my-windows-store-apps-title-and-version-info
- String version= XDocument.Load("WMAppManifest.xml").Root.Element("App").Attribute("Version").Value;
-
- this.DispatchCommandResult(new PluginResult(PluginResult.Status.OK, version));
- }
- }
-}