Skip to content

Commit

Permalink
App development work
Browse files Browse the repository at this point in the history
  • Loading branch information
audaciouscode committed May 12, 2017
1 parent f2782ad commit 009b15b
Show file tree
Hide file tree
Showing 184 changed files with 22,860 additions and 5,463 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -44,4 +44,6 @@ Thumbs.db
bower_components/
cordova/
dist/
node_modules/
node_modules/

platforms/
7 changes: 6 additions & 1 deletion config.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="edu.northwestern.cbits.livewell" version="3.3.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="edu.northwestern.cbits.livewell" version="3.3.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>LiveWell</name>
<description>
An application for bipolar disorder
Expand All @@ -16,4 +16,9 @@
<allow-navigation href="https://*/*" />
<allow-navigation href="data:*" />
<icon src="icon.png" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.1" />
<plugin name="cordova-plugin-device" spec="~1.1.4" />
<plugin name="phonegap-plugin-push" spec="~1.9.2">
<param name="SENDER_ID" value="XXXXXXX" />
</plugin>
</widget>
5 changes: 4 additions & 1 deletion plugins/android.json
Expand Up @@ -10,11 +10,14 @@
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
},
"phonegap-plugin-push": {
"SENDER_ID": "334078391843",
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
},
"cordova-plugin-device": {
"cordova-plugin-app-version": {
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
}
},
Expand Down
20 changes: 8 additions & 12 deletions plugins/browser.json
Expand Up @@ -4,25 +4,21 @@
"uninstalled": []
},
"config_munge": {
"files": {
"config.xml": {
"parents": {
"/*": [
{
"xml": "<feature name=\"Device\"><param name=\"browser-package\" value=\"Device\" /></feature>",
"count": 1
}
]
}
}
}
"files": {}
},
"installed_plugins": {
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
},
"phonegap-plugin-push": {
"SENDER_ID": "85075801930",
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
},
"cordova-plugin-app-version": {
"PACKAGE_NAME": "edu.northwestern.cbits.livewell"
}
},
"dependent_plugins": {}
Expand Down
42 changes: 42 additions & 0 deletions plugins/cordova-plugin-app-version/CHANGELOG.md
@@ -0,0 +1,42 @@
### 0.1.9
* Renamed Windows8 platform to Windows

### 0.1.7

* Add getPackageName feature (thanks to @gprasanth)
* Add getAppName feature (thanks to @mirko77)
* Fix for windows 8 (thanks to @deliriousrhino)
* Fix version number in plugin.xml file

### 0.1.6

* Split into two functions getAppVersion.getVersionNumber() and getAppVersion.getVersionCode() to return build number
* Fix a deprecation warning in iOS version

### 0.1.5

* iOS: Return version number but log and fall back to build number if it is nil (thanks to [Eddy Verbruggen](https://github.com/EddyVerbruggen))

### 0.1.4

* Return version number, not build number on iOS (thanks to http://www.humancopy.net)
* Support for Windows phone 8 (thanks to Cristi Badila / Gediminas Šaltenis)
* Support for AngularJS as well as jQuery (thanks to Matias Singers, [Red Ape Solutions](http://www.redapesolutions.com/))

### 0.1.3

* Fixes to Android for Corova 3 and above (thanks to AxoInsanit)

### 0.1.2

* Updated for Cordova 3 and above (thanks to Russell Keith-Magee [freakboy3742](https://github.com/freakboy3742)

### 0.1.1

* Improved README
* Bug fix for non-jQuery use
* Tidy plugin.xml

### 0.1.0

* First release
20 changes: 20 additions & 0 deletions plugins/cordova-plugin-app-version/LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2013 White October

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
71 changes: 71 additions & 0 deletions plugins/cordova-plugin-app-version/README.md
@@ -0,0 +1,71 @@
# Cordova AppVersion plugin

Reads the version of your app from the target build settings.

## Installation

### With cordova-cli

If you are using [cordova-cli](https://github.com/apache/cordova-cli), install
with:

cordova plugin add cordova-plugin-app-version

### With plugman

With a plain [plugman](https://github.com/apache/cordova-plugman), you should be
able to install with something like:

plugman --platform <ios|android> --project <directory> --plugin https://github.com/whiteoctober/cordova-plugin-app-version.git

### Manually in iOS

TODO: Write these instructions

### Manually in Android

TODO: Write these instructions

## Use from Javascript

If you are using jQuery, AngularJS, WinJS or any Promise/A library (Bluebird), promise style is supported. Use something like:

cordova.getAppVersion.getVersionNumber().then(function (version) {
$('.version').text(version);
});

If not, pass a callback function:

cordova.getAppVersion.getVersionNumber(function (version) {
alert(version);
});

In addition to the version number you can also retrieve other details about your application:

### getAppName

Returns the name of the app. E.g. "My Awesome App"

### getPackageName

Returns the package name of the app - the reversed domain name app identifier like com.example.myawesomeapp

### getVersionCode

Returns the build identifier of the app

### getVersionNumber

Returns the version number of the app

## Credits

Written by [Robert (Jamie) Munro](http://twitter.com/rjmunro) at
[White October](http://whiteoctober.co.uk/)

Various others have contributed fixes and new features. See the CHANGELOG.md for details.

Original code based on the following Stack Overflow posts:

* [iOS](http://stackoverflow.com/a/14713364/3408)
* [Android](http://stackoverflow.com/a/3637686/3408)
1 change: 1 addition & 0 deletions plugins/cordova-plugin-app-version/VERSION
@@ -0,0 +1 @@
0.1.9
26 changes: 26 additions & 0 deletions plugins/cordova-plugin-app-version/package.json
@@ -0,0 +1,26 @@
{
"name": "cordova-plugin-app-version",
"version": "0.1.9",
"description": "Cordova plugin to return the version number of the current app",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/whiteoctober/cordova-plugin-app-version.git"
},
"keywords": [
"cordova",
"ecosystem:cordova",
"app",
"version",
"appversion",
"plugin"
],
"author": "whiteoctober",
"license": "MIT",
"bugs": {
"url": "https://github.com/whiteoctober/cordova-plugin-app-version/issues"
},
"homepage": "https://github.com/whiteoctober/cordova-plugin-app-version#readme"
}
79 changes: 79 additions & 0 deletions plugins/cordova-plugin-app-version/plugin.xml
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-app-version"
version="0.1.9">

<name>AppVersion</name>
<description>
This plugin will return the version of your App that you have set in
packaging it. I.e. it will always match the version in the app store.
</description>
<license>MIT</license>

<engines>
<!--
Cordova 2.8.0 is all I have tested on - it should work fine with earlier versions.
Please modify the below line, test, and submit a PR if it works for you.
-->
<engine name="cordova" version=">=3.0.0" />
</engines>

<js-module src="www/AppVersionPlugin.js">
<clobbers target="cordova.getAppVersion" />
</js-module>

<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="AppVersion">
<param name="android-package" value="uk.co.whiteoctober.cordova.AppVersion"/>
</feature>
</config-file>
<source-file src="src/android/AppVersion.java" target-dir="src/uk/co/whiteoctober/cordova" />
</platform>

<!-- blackberry10 -->
<platform name="blackberry10">
<dependency id="cordova-plugin-bb-app" />

<config-file target="www/config.xml" parent="/widget">
<feature name="AppVersion" value="AppVersion" />
</config-file>
<js-module src="www/blackberry10/AppVersionProxy.js" name="AppVersionProxy.js" >
<runs />
</js-module>
</platform>

<!-- ios -->
<platform name="ios">
<plugins-plist key="AppVersion" string="AppVersion" />

<config-file target="config.xml" parent="/*">
<feature name="AppVersion">
<param name="ios-package" value="AppVersion" />
</feature>
</config-file>

<header-file src="src/ios/AppVersion.h" />
<source-file src="src/ios/AppVersion.m" />
</platform>

<!-- windows8 -->
<platform name="windows">
<js-module src="src/windows/AppVersionProxy.js" name="AppVersionProxy">
<merges target=""/>
</js-module>
</platform>

<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="AppVersion">
<param name="wp-package" value="AppVersion"/>
</feature>
</config-file>

<source-file src="src/wp8/AppVersion.cs" />
</platform>
</plugin>
45 changes: 45 additions & 0 deletions plugins/cordova-plugin-app-version/src/android/AppVersion.java
@@ -0,0 +1,45 @@
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;
}
}

}
13 changes: 13 additions & 0 deletions plugins/cordova-plugin-app-version/src/ios/AppVersion.h
@@ -0,0 +1,13 @@
#import <Cordova/CDVPlugin.h>

@interface AppVersion : CDVPlugin

- (void)getAppName:(CDVInvokedUrlCommand*)command;

- (void)getPackageName:(CDVInvokedUrlCommand*)command;

- (void)getVersionNumber:(CDVInvokedUrlCommand*)command;

- (void)getVersionCode:(CDVInvokedUrlCommand*)command;

@end

0 comments on commit 009b15b

Please sign in to comment.