Neues Initialrelease mit IonicMaterial

This commit is contained in:
Carsten Hilmer
2016-08-22 12:55:52 +02:00
parent 30a5df79aa
commit 45e482b14d
1249 changed files with 305225 additions and 68794 deletions

View File

@@ -0,0 +1,3 @@
{
"directory": "www/lib"
}

View File

@@ -0,0 +1,13 @@
ngCordova Demo App
=====================
This is a demo app for ngCordova to show how to use each plugin. Still a WIP
## Using this app:
Start off by adding a cordova platform:
```
cordova platform add ios / android
```

View File

@@ -0,0 +1,10 @@
{
"name": "HelloIonic",
"private": "true",
"devDependencies": {
"ionic": "driftyco/ionic-bower#1.0.0-beta.14"
},
"dependencies": {
"ngCordova": "~0.1.9-alpha"
}
}

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.ngCordova" version="0.1.12" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ngCordova Demo</name>
<description>
A demo app for ngCordova
</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">
Ionic Framework Team
</author>
<author email="paolo.enrico.bernasconi@gmail.com" href="http://paolobernasconi.com">
Paolo Bernasconi
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="fullscreen" value="true"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
<platform name="ios">
<icon src="resources/ios/icon/icon.png" width="57" height="57"/>
<icon src="resources/ios/icon/icon@2x.png" width="114" height="114"/>
<icon src="resources/ios/icon/icon-40.png" width="40" height="40"/>
<icon src="resources/ios/icon/icon-40@2x.png" width="80" height="80"/>
<icon src="resources/ios/icon/icon-50.png" width="50" height="50"/>
<icon src="resources/ios/icon/icon-50@2x.png" width="100" height="100"/>
<icon src="resources/ios/icon/icon-60.png" width="60" height="60"/>
<icon src="resources/ios/icon/icon-60@2x.png" width="120" height="120"/>
<icon src="resources/ios/icon/icon-60@3x.png" width="180" height="180"/>
<icon src="resources/ios/icon/icon-72.png" width="72" height="72"/>
<icon src="resources/ios/icon/icon-72@2x.png" width="144" height="144"/>
<icon src="resources/ios/icon/icon-76.png" width="76" height="76"/>
<icon src="resources/ios/icon/icon-76@2x.png" width="152" height="152"/>
<icon src="resources/ios/icon/icon-small.png" width="29" height="29"/>
<icon src="resources/ios/icon/icon-small@2x.png" width="58" height="58"/>
<splash src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
<splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/>
<splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/>
<splash src="resources/ios/splash/Default-Landscape-736h.png" width="2208" height="1242"/>
<splash src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
<splash src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" height="768"/>
<splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
<splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
<splash src="resources/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
<splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/>
</platform>
<icon src="resources/ios/icon/icon-40@2x.png"/>
</widget>

View File

@@ -0,0 +1,50 @@
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var paths = {
sass: ['./scss/**/*.scss']
};
gulp.task('default', ['sass']);
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass())
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
});
gulp.task('install', ['git-check'], function() {
return bower.commands.install()
.on('log', function(data) {
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
});
});
gulp.task('git-check', function(done) {
if (!sh.which('git')) {
console.log(
' ' + gutil.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
);
process.exit(1);
}
done();
});

View File

View File

@@ -0,0 +1,83 @@
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks
This directory may contain scripts used to customize cordova commands. This
directory used to exist at `.cordova/hooks`, but has now been moved to the
project root. Any scripts you add to these directories will be executed before
and after the commands corresponding to the directory name. Useful for
integrating your own build systems or integrating with version control systems.
__Remember__: Make your scripts executable.
## Hook Directories
The following subdirectories will be used for hooks:
after_build/
after_compile/
after_docs/
after_emulate/
after_platform_add/
after_platform_rm/
after_platform_ls/
after_plugin_add/
after_plugin_ls/
after_plugin_rm/
after_plugin_search/
after_prepare/
after_run/
after_serve/
before_build/
before_compile/
before_docs/
before_emulate/
before_platform_add/
before_platform_rm/
before_platform_ls/
before_plugin_add/
before_plugin_ls/
before_plugin_rm/
before_plugin_search/
before_prepare/
before_run/
before_serve/
pre_package/ <-- Windows 8 and Windows Phone only.
## Script Interface
All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:
* CORDOVA_VERSION - The version of the Cordova-CLI.
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
* CORDOVA_HOOK - Path to the hook that is being executed.
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
If a script returns a non-zero exit code, then the parent cordova command will be aborted.
## Writing hooks
We highly recommend writing your hooks using Node.js so that they are
cross-platform. Some good examples are shown here:
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env node
/**
* Install all plugins listed in package.json
* https://raw.githubusercontent.com/diegonetto/generator-ionic/master/templates/hooks/after_platform_add/install_plugins.js
*/
var exec = require('child_process').exec;
var path = require('path');
var sys = require('sys');
var packageJSON = require('../../package.json');
var cmd = process.platform === 'win32' ? 'cordova.cmd' : 'cordova';
// var script = path.resolve(__dirname, '../../node_modules/cordova/bin', cmd);
packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
packageJSON.cordovaPlugins.forEach(function (plugin) {
exec('cordova plugin add ' + plugin, function (error, stdout, stderr) {
sys.puts(stdout);
});
});

View File

@@ -0,0 +1,16 @@
#!/usr/bin/env node
/**
* Push plugins to cordovaPlugins array after_plugin_add
*/
var fs = require('fs');
var packageJSON = require('../../package.json');
packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
if(packageJSON.cordovaPlugins.indexOf(plugin) == -1) {
packageJSON.cordovaPlugins.push(plugin);
}
});
fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2));

View File

@@ -0,0 +1,18 @@
#!/usr/bin/env node
/**
* Remove plugins from cordovaPlugins array after_plugin_rm
*/
var fs = require('fs');
var packageJSON = require('../../package.json');
packageJSON.cordovaPlugins = packageJSON.cordovaPlugins || [];
process.env.CORDOVA_PLUGINS.split(',').forEach(function (plugin) {
var index = packageJSON.cordovaPlugins.indexOf(plugin);
if (index > -1) {
packageJSON.cordovaPlugins.splice(index, 1);
}
});
fs.writeFile('package.json', JSON.stringify(packageJSON, null, 2));

View File

@@ -0,0 +1,94 @@
#!/usr/bin/env node
// Add Platform Class
// v1.0
// Automatically adds the platform class to the body tag
// after the `prepare` command. By placing the platform CSS classes
// directly in the HTML built for the platform, it speeds up
// rendering the correct layout/style for the specific platform
// instead of waiting for the JS to figure out the correct classes.
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
function addPlatformBodyTag(indexPath, platform) {
// add the platform class to the body tag
try {
var platformClass = 'platform-' + platform;
var cordovaClass = 'platform-cordova platform-webview';
var html = fs.readFileSync(indexPath, 'utf8');
var bodyTag = findBodyTag(html);
if(!bodyTag) return; // no opening body tag, something's wrong
if(bodyTag.indexOf(platformClass) > -1) return; // already added
var newBodyTag = bodyTag;
var classAttr = findClassAttr(bodyTag);
if(classAttr) {
// body tag has existing class attribute, add the classname
var endingQuote = classAttr.substring(classAttr.length-1);
var newClassAttr = classAttr.substring(0, classAttr.length-1);
newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote;
newBodyTag = bodyTag.replace(classAttr, newClassAttr);
} else {
// add class attribute to the body tag
newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">');
}
html = html.replace(bodyTag, newBodyTag);
fs.writeFileSync(indexPath, html, 'utf8');
process.stdout.write('add to body class: ' + platformClass + '\n');
} catch(e) {
process.stdout.write(e);
}
}
function findBodyTag(html) {
// get the body tag
try{
return html.match(/<body(?=[\s>])(.*?)>/gi)[0];
}catch(e){}
}
function findClassAttr(bodyTag) {
// get the body tag's class attribute
try{
return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0];
}catch(e){}
}
if (rootdir) {
// go through each of the platform directories that have been prepared
var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
for(var x=0; x<platforms.length; x++) {
// open up the index.html file at the www root
try {
var platform = platforms[x].trim().toLowerCase();
var indexPath;
if(platform == 'android') {
indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html');
} else {
indexPath = path.join('platforms', platform, 'www', 'index.html');
}
if(fs.existsSync(indexPath)) {
addPlatformBodyTag(indexPath, platform);
}
} catch(e) {
process.stdout.write(e);
}
}
}

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env node
/**
* After prepare, files are copied to the platforms/ios and platforms/android folders.
* Lets clean up some of those files that arent needed with this hook.
*/
var fs = require('fs');
var path = require('path');
var deleteFolderRecursive = function(removePath) {
if( fs.existsSync(removePath) ) {
fs.readdirSync(removePath).forEach(function(file,index){
var curPath = path.join(removePath, file);
if(fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(removePath);
}
};
var iosPlatformsDir = path.resolve(__dirname, '../../platforms/ios/www/lib/ionic/scss');
var androidPlatformsDir = path.resolve(__dirname, '../../platforms/android/assets/www/lib/ionic/scss');
deleteFolderRecursive(iosPlatformsDir);
deleteFolderRecursive(androidPlatformsDir);

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env node
/**
* On a fresh clone, the local platforms/ and plugins/ directories will be
* missing, so ensure they get created before the first platform is added.
*/
var fs = require('fs');
var path = require('path');
var platformsDir = path.resolve(__dirname, '../../platforms');
var pluginsDir = path.resolve(__dirname, '../../plugins');
try {
fs.mkdirSync(platformsDir, function (err) {
if (err) { console.error(err); }
});
} catch(ex) {}
try {
fs.mkdirSync(pluginsDir, function (err) {
if (err) { console.error(err); }
});
} catch(ex) {}

View File

@@ -0,0 +1,42 @@
#!/bin/bash
function ap {
cordova plugin add org.apache.cordova.$1
}
ap camera
ap console
ap contacts
ap device
ap dialogs
ap device-motion
ap device-orientation
ap network-information
ap geolocation
ap globalization
ap file
ap file-transfer
ap splashscreen
ap statusbar
ap vibration
ap media
ap inappbrowser
ap battery-status
cordova plugin add https://github.com/Wizcorp/phonegap-facebook-plugin.git --variable APP_ID="12345678" --variable APP_NAME="Name"
cordova plugin add https://github.com/driftyco/ionic-plugins-keyboard # keyboard
cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git # date-picker
cordova plugin add https://github.com/wildabeast/BarcodeScanner.git # barcode scanner
cordova plugin add https://github.com/chrisekelley/AppPreferences # app preferences
cordova plugin add https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git # flashlight
cordova plugin add https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git # toast
cordova plugin add uk.co.ilee.touchid # touchID
cordova plugin add https://github.com/pushandplay/cordova-plugin-apprate.git # AppRate
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git
cordova plugin add https://github.com/phonegap-build/PushPlugin.git
cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git
cordova plugin add https://github.com/Telerik-Verified-Plugins/HealthKit
cordova plugin add de.appplant.cordova.plugin.badge
cordova plugin add aerogear-cordova-push
cordova plugin add com.unarin.cordova.beacon

View File

@@ -0,0 +1,6 @@
{
"name": "ngcordemo",
"email": "",
"app_id": "",
"package_name": ""
}

Binary file not shown.

View File

@@ -0,0 +1,54 @@
{
"name": "ionic-project",
"version": "1.0.0",
"description": "An Ionic project",
"dependencies": {
"gulp": "^3.5.6",
"gulp-sass": "^0.7.1",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0"
},
"devDependencies": {
"bower": "^1.3.3",
"gulp-util": "^2.2.14",
"shelljs": "^0.3.0"
},
"cordovaPlugins": [
"org.apache.cordova.camera",
"org.apache.cordova.console",
"org.apache.cordova.contacts",
"org.apache.cordova.device",
"org.apache.cordova.dialogs",
"org.apache.cordova.device-motion",
"org.apache.cordova.device-orientation",
"org.apache.cordova.network-information",
"org.apache.cordova.geolocation",
"org.apache.cordova.globalization",
"org.apache.cordova.file",
"org.apache.cordova.file-transfer",
"org.apache.cordova.splashscreen",
"org.apache.cordova.statusbar",
"org.apache.cordova.vibration",
"org.apache.cordova.media",
"org.apache.cordova.inappbrowser",
"org.apache.cordova.battery-status",
"https://github.com/Wizcorp/phonegap-facebook-plugin.git",
"https://github.com/driftyco/ionic-plugins-keyboard",
"https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git",
"https://github.com/wildabeast/BarcodeScanner.git",
"https://github.com/chrisekelley/AppPreferences",
"https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin.git",
"https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git",
"uk.co.ilee.touchid",
"https://github.com/pushandplay/cordova-plugin-apprate.git",
"https://github.com/katzer/cordova-plugin-local-notifications.git",
"https://github.com/katzer/cordova-plugin-email-composer.git",
"https://github.com/phonegap-build/PushPlugin.git",
"https://github.com/EddyVerbruggen/cordova-plugin-actionsheet.git",
"https://github.com/Telerik-Verified-Plugins/HealthKit",
"de.appplant.cordova.plugin.badge",
"aerogear-cordova-push",
"com.unarin.cordova.beacon"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

0
www/lib/ngCordova/demo/www/.gitignore vendored Normal file
View File

View File

@@ -0,0 +1,32 @@
This is an addon starter template for the [Ionic Framework](http://ionicframework.com/).
## How to use this template
*This template does not work on its own*. It is missing the Ionic library, and AngularJS.
To use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately.
### With the Ionic tool:
Take the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below:
```bash
$ sudo npm install -g ionic cordova
$ ionic start myApp blank
```
Then, to run it, cd into `myApp` and run:
```bash
$ ionic platform add ios
$ ionic build ios
$ ionic emulate ios
```
Substitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android.
## Demo
http://plnkr.co/edit/tpl:IUU30p?p=preview
## Issues
Issues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/). Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here!

View File

@@ -0,0 +1,8 @@
<ion-view title="About">
<ion-content padding="true">
<h1>ABOUT</h1>
<p>This is a demo application for <a href="http://ngcordova.com">ngCordova</a>.</p>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.adMob.ctrl', [])
.controller('AdMobCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="adMob">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,378 @@
angular.module('demo', [
'ionic',
'ngCordova',
// modules
// 'demo.adMob.ctrl', -- not functioning right now
'demo.appAvailability.ctrl',
'demo.appRate.ctrl',
'demo.barcodeScanner.ctrl',
'demo.batteryStatus.ctrl',
'demo.beacon.ctrl',
'demo.camera.ctrl',
'demo.clipboard.ctrl',
'demo.contacts.ctrl',
'demo.datePicker.ctrl',
'demo.device.ctrl',
'demo.deviceMotion.ctrl',
'demo.deviceOrientation.ctrl',
'demo.dialogs.ctrl',
'demo.emailComposer.ctrl',
'demo.facebook.ctrl',
'demo.file.ctrl',
'demo.fileOpener2.ctrl',
'demo.fileTransfer.ctrl',
'demo.flashlight.ctrl',
'demo.geolocation.ctrl',
'demo.globalization.ctrl',
'demo.googleAnalytics.ctrl',
'demo.healthkit.ctrl',
'demo.inAppBrowser.ctrl',
'demo.localNotification.ctrl',
'demo.media.ctrl',
'demo.network.ctrl',
'demo.oauth.ctrl',
'demo.preferences.ctrl',
'demo.printer.ctrl',
'demo.pushNotifications.ctrl',
'demo.socialSharing.ctrl',
'demo.sqlite.ctrl',
'demo.statusbar.ctrl',
'demo.toast.ctrl',
'demo.touchid.ctrl',
'demo.vibration.ctrl',
'demo.upsPushNotifications.ctrl'
])
.run(function ($rootScope, $ionicPlatform, $cordovaNetwork, $cordovaBatteryStatus, $cordovaLocalNotification, $cordovaPush) {
$ionicPlatform.ready(function () {
if (window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
StatusBar.styleDefault();
}
$cordovaLocalNotification.registerPermission().then(function () {
//alert("registered");
}, function () {
//alert("denied registration");
});
var iosConfig = {
"badge": true,
"sound": true,
"alert": true
};
$cordovaPush.register(iosConfig).then(function (result) {
//alert("device token: " + result.deviceToken);
}, function (error) {
//alert("error " + error);
});
$rootScope.$on('$cordovaPush:notificationReceived', function (event, notification) {
if (notification.alert) {
navigator.notification.alert(notification.alert);
}
if (notification.sound) {
var snd = new Media(event.sound);
snd.play();
}
if (notification.badge) {
$cordovaPush.setBadgeNumber(notification.badge).then(function (result) {
// Success!
}, function (err) {
// An error occurred. Show a message to the user
});
}
});
$rootScope.$on("$cordovaNetwork:offline", function (event, result) {
alert("Device is now Offline!");
});
$rootScope.$on("$cordovaNetwork:online", function (event, result) {
alert("Device is Online!");
});
$rootScope.$on("$cordovaBatteryStatus:status", function (event, status) {
//alert("status: " + status);
})
})
})
.config(function ($stateProvider, $urlRouterProvider, $cordovaFacebookProvider, $cordovaAppRateProvider, $cordovaInAppBrowserProvider) {
if (!window.cordova) {
var appID = 1234567890;
var version = "v2.0"; // or leave blank and default is v2.0
//$cordovaFacebookProvider.browserInit(appID, version);
}
var browserOptions = {
location: "yes",
toolbar: "yes"
};
document.addEventListener("deviceready", function () {
var preferences = {
iosURL: "some URL",
appName: 'APP NAME',
language: 'fr'
};
$cordovaAppRateProvider.setPreferences(preferences);
}, false);
$cordovaInAppBrowserProvider.setDefaultOptions(browserOptions);
$stateProvider
.state('menu', {
url: "/menu",
templateUrl: "app/menu.html"
})
.state('about', {
url: "/about",
templateUrl: "app/about.html"
})
.state('appAvailability', {
url: '/appAvailability',
templateUrl: 'app/appAvailability/appAvailability.html',
controller: "AppAvailabilityCtrl"
})
.state('appRate', {
url: '/appRate',
templateUrl: 'app/appRate/appRate.html',
controller: "AppRateCtrl"
})
.state('barcodeScanner', {
url: '/barcodeScanner',
templateUrl: 'app/barcodeScanner/barcodeScanner.html',
controller: "BarcodeScannerCtrl"
})
.state('batteryStatus', {
url: '/batteryStatus',
templateUrl: 'app/batteryStatus/batteryStatus.html',
controller: "BatteryStatusCtrl"
})
.state('beacon', {
url: '/beacon',
templateUrl: 'app/beacon/beacon.html',
controller: "BeaconCtrl"
})
.state('camera', {
url: '/camera',
templateUrl: 'app/camera/camera.html',
controller: "CameraCtrl"
})
.state('clipboard', {
url: '/clipboard',
templateUrl: 'app/clipboard/clipboard.html',
controller: "ClipboardCtrl"
})
.state('contacts', {
url: '/contacts',
templateUrl: 'app/contacts/contacts.html',
controller: "ContactsCtrl"
})
.state('datePicker', {
url: '/datePicker',
templateUrl: 'app/datePicker/datePicker.html',
controller: "DatePickerCtrl"
})
.state('device', {
url: '/device',
templateUrl: 'app/device/device.html',
controller: "DeviceCtrl"
})
.state('deviceMotion', {
url: '/deviceMotion',
templateUrl: 'app/deviceMotion/deviceMotion.html',
controller: "DeviceMotionCtrl"
})
.state('deviceOrientation', {
url: '/deviceOrientation',
templateUrl: 'app/deviceOrientation/deviceOrientation.html',
controller: "DeviceOrientationCtrl"
})
.state('dialogs', {
url: '/dialogs',
templateUrl: 'app/dialogs/dialogs.html',
controller: "DialogsCtrl"
})
.state('emailComposer', {
url: '/emailComposer',
templateUrl: 'app/emailComposer/emailComposer.html',
controller: "EmailComposerCtrl"
})
.state('facebook', {
url: '/facebook',
templateUrl: 'app/facebook/facebook.html',
controller: "FacebookCtrl"
})
.state('file', {
url: '/file',
templateUrl: 'app/file/file.html',
controller: "FileCtrl"
})
.state('fileTransfer', {
url: '/fileTransfer',
templateUrl: 'app/fileTransfer/fileTransfer.html',
controller: "FileTransferCtrl"
})
.state('fileOpener2', {
url: '/fileOpener2',
templateUrl: 'app/fileOpener2/fileOpener2.html',
controller: "FileOpener2Ctrl"
})
.state('flashlight', {
url: '/flashlight',
templateUrl: 'app/flashlight/flashlight.html',
controller: "FlashlightCtrl"
})
.state('geolocation', {
url: '/geolocation',
templateUrl: 'app/geolocation/geolocation.html',
controller: "GeolocationCtrl"
})
.state('globalization', {
url: '/global',
templateUrl: 'app/globalization/globalization.html',
controller: "GlobalizationCtrl"
})
.state('googleAnalytics', {
url: '/googleAnalytics',
templateUrl: 'app/googleAnalytics/googleAnalytics.html',
controller: "GoogleAnalyticsCtrl"
})
.state('healthkit', {
url: '/healthkit',
templateUrl: 'app/healthkit/healthkit.html',
controller: "HealthKitCtrl"
})
.state('inAppBrowser', {
url: '/inAppBrowser',
templateUrl: 'app/inAppBrowser/inAppBrowser.html',
controller: "InAppBrowserCtrl"
})
.state('localNotification', {
url: '/localNotification',
templateUrl: 'app/localNotification/localNotification.html',
controller: "LocalNotificationCtrl"
})
.state('media', {
url: '/media',
templateUrl: 'app/media/media.html',
controller: "MediaCtrl"
})
.state('network', {
url: '/network',
templateUrl: 'app/network/network.html',
controller: "NetworkCtrl"
})
.state('oauth', {
url: '/oauth',
templateUrl: 'app/oauth/oauth.html',
controller: "OauthCtrl"
})
.state('preferences', {
url: '/preferences',
templateUrl: 'app/preferences/preferences.html',
controller: "PreferencesCtrl"
})
.state('printer', {
url: '/printer',
templateUrl: 'app/printer/printer.html',
controller: "PrinterCtrl"
})
.state('pushNotifications', {
url: '/pushNotifications',
templateUrl: 'app/pushNotifications/pushNotifications.html',
controller: "PushNotificationsCtrl"
})
.state('socialSharing', {
url: '/socialSharing',
templateUrl: 'app/socialSharing/socialSharing.html',
controller: "SocialSharingCtrl"
})
.state('sqlite', {
url: '/sqlite',
templateUrl: 'app/sqlite/sqlite.html',
controller: "SqliteCtrl"
})
.state('statusbar', {
url: '/statusbar',
templateUrl: 'app/statusbar/statusbar.html',
controller: "StatusbarCtrl"
})
.state('toast', {
url: '/toast',
templateUrl: 'app/toast/toast.html',
controller: "ToastCtrl"
})
.state('touchid', {
url: '/touchid',
templateUrl: 'app/touchid/touchid.html',
controller: "TouchIDCtrl"
})
.state('vibration', {
url: '/vibration',
templateUrl: 'app/vibration/vibration.html',
controller: "VibrationCtrl"
})
.state('upsPushNotifications', {
url: '/upsPushNotifications',
templateUrl: 'app/upsPushNotifications/pushNotifications.html',
controller: "UpsPushNotificationsCtrl"
});
$urlRouterProvider.otherwise('/menu');
});

View File

@@ -0,0 +1,5 @@
angular.module('demo.appAvailability.ctrl', [])
.controller('AppAvailabilityCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="appAvailability">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,12 @@
angular.module('demo.appRate.ctrl', [])
.controller('AppRateCtrl', function ($scope, $log, $cordovaAppRate) {
$scope.promptRating = function () {
$cordovaAppRate.promptForRating(true).then(function (result) {
console.log("result: " + result);
}, function (error) {
console.log("ERROR: " + error);
})
};
});

View File

@@ -0,0 +1,15 @@
<ion-view title="App Rate">
<ion-nav-buttons side="right">
<button class="button button-primary button-clear icon-right ion-code" ng-click="showSource()"></button>
</ion-nav-buttons>
<ion-content>
<div class="card">
<div class="item">
<button class="button button-block button-positive" ng-click="promptRating()">
Show rating reminder
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,15 @@
angular.module('demo.barcodeScanner.ctrl', [])
.controller('BarcodeScannerCtrl', function ($scope, $cordovaBarcodeScanner) {
$scope.scan = function () {
$cordovaBarcodeScanner
.scan()
.then(function (result) {
$scope.scanResult = result;
}, function (err) {
$scope.scanResult = 'SCAN ERROR (see console)';
console.error(err);
});
};
});

View File

@@ -0,0 +1,12 @@
<ion-view title="Barcode">
<ion-content scroll="false" padding="true">
<button ng-click="scan()" class="button button-block button-primary">Scan</button>
<div class="card">
<div class="item item-divider">Barcode Results</div>
<div class="item">Text: {{scanResult.text}}</div>
<div class="item">Format: {{scanResult.format}}</div>
<div class="item">Cancelled: {{scanResult.cancelled}}</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,32 @@
angular.module('demo.batteryStatus.ctrl', [])
.controller('BatteryStatusCtrl', function ($scope, $timeout, $cordovaBatteryStatus) {
console.log("battery status init");
document.addEventListener("deviceready", function () {
$scope.watch = function () {
console.log("watching battery");
$cordovaBatteryStatus.$on('batterystatus', function (result, info) {
$timeout(function () {
$scope.batteryLevel = info.level; // (0 - 100)
$scope.isPluggedIn = info.isPlugged; // bool
});
alert("Info " + info.level + " " + info.isPlugged);
});
};
}, false);
/*
$cordovaBatteryStatus.$on('batterycritical', function (result) {
$scope.batteryLevel = result.level; // (0 - 100)
$scope.isPluggedIn = result.isPlugged; // bool
});
$cordovaBatteryStatus.$on('batterylow', function (result) {
$scope.batteryLevel = result.level; // (0 - 100)
$scope.isPluggedIn = result.isPlugged; // bool
});
*/
});

View File

@@ -0,0 +1,23 @@
<ion-view title="Battery Status">
<ion-content scroll="false" padding="true">
<button ng-click="watch()" class="button button-block button-primary">Start Watch</button>
<div class="card">
<div class="item item-divider">
Battery Level
</div>
<div class="item item-body">
{{batteryLevel}}
</div>
</div>
<div class="card">
<div class="item item-divider">
is Plugged in
</div>
<div class="item item-body">
{{isPluggedIn}}
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,63 @@
angular.module('demo.beacon.ctrl', [])
.controller('BeaconCtrl', function($window, $scope, $rootScope, $timeout, $cordovaBeacon) {
var brIdentifier = 'estimote';
var brUuid = 'b9407f30-f5f8-466e-aff9-25556b57fe6d';
var brMajor = null;
var brMinor = null;
var brNotifyEntryStateOnDisplay = true;
$scope.didStartMonitoringForRegionLog = '';
$scope.didDetermineStateForRegionLog = '';
$scope.didRangeBeaconsInRegionLog = '';
$scope.requestAlwaysAuthorization = function() {
$cordovaBeacon.requestAlwaysAuthorization();
};
$scope.startMonitoringForRegion = function() {
$cordovaBeacon.startMonitoringForRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.startRangingBeaconsInRegion = function() {
$cordovaBeacon.startRangingBeaconsInRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.stopMonitoringForRegion = function() {
$cordovaBeacon.stopMonitoringForRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.stopRangingBeaconsInRegion = function() {
$cordovaBeacon.stopRangingBeaconsInRegion($cordovaBeacon.createBeaconRegion(
brIdentifier, brUuid, brMajor, brMinor, brNotifyEntryStateOnDisplay
));
};
$scope.clearLogs = function() {
$scope.didStartMonitoringForRegionLog = '';
$scope.didDetermineStateForRegionLog = '';
$scope.didRangeBeaconsInRegionLog = '';
};
document.addEventListener("deviceready", function () {
$rootScope.$on("$cordovaBeacon:didStartMonitoringForRegion", function (event, pluginResult) {
$scope.didStartMonitoringForRegionLog += '-----' + '\n';
$scope.didStartMonitoringForRegionLog += JSON.stringify(pluginResult) + '\n';
});
$rootScope.$on("$cordovaBeacon:didDetermineStateForRegion", function (event, pluginResult) {
$scope.didDetermineStateForRegionLog += '-----' + '\n';
$scope.didDetermineStateForRegionLog += JSON.stringify(pluginResult) + '\n';
});
$rootScope.$on("$cordovaBeacon:didRangeBeaconsInRegion", function (event, pluginResult) {
$scope.didRangeBeaconsInRegionLog += '-----' + '\n';
$scope.didRangeBeaconsInRegionLog += JSON.stringify(pluginResult) + '\n';
});
}, false);
});

View File

@@ -0,0 +1,46 @@
<ion-view title="Beacon">
<ion-content padding="false" has-bouncing="false">
<div class="list card">
<div class="item item-text-wrap">
<button class="button button-block button-stable" ng-click="clearLogs()">
Clear logs
</button>
</div>
<div class="item item-text-wrap">
<strong>Permission</strong>
<button class="button button-block button-stable" ng-click="requestAlwaysAuthorization()">
Request Always Authorization (iOS only)
</button>
</div>
<div class="item item-text-wrap">
<strong>Start</strong>
<button class="button button-block button-stable" ng-click="startMonitoringForRegion()">
Start Monitoring for region
</button>
<button class="button button-block button-stable" ng-click="startRangingBeaconsInRegion()">
Start Ranging beacons in region
</button>
</div>
<div class="item item-text-wrap">
<strong>Stop</strong>
<button class="button button-block button-stable" ng-click="stopMonitoringForRegion()">
Stop Monitoring for region
</button>
<button class="button button-block button-stable" ng-click="stopRangingBeaconsInRegion()">
Stop Ranging beacons in region
</button>
</div>
<div class="item item-divider item-text-wrap">
Events
</div>
<div class="item item-text-wrap">
<strong>didStartMonitoringForRegion</strong><br />
<pre>{{didStartMonitoringForRegionLog}}</pre>
<strong>didDetermineStateForRegion</strong><br />
<pre>{{didDetermineStateForRegionLog}}</pre>
<strong>didRangeBeaconsInRegion</strong><br />
<pre>{{didRangeBeaconsInRegionLog}}</pre>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,19 @@
angular.module('demo.camera.ctrl', [])
.controller('CameraCtrl', function ($scope, $cordovaCamera) {
$scope.takePicture = function () {
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.CAMERA
};
// udpate camera image directive
$cordovaCamera.getPicture(options).then(function (imageData) {
$scope.cameraimage = "data:image/jpeg;base64," + imageData;
}, function (err) {
console.log('Failed because: ');
console.log(err);
});
};
});

View File

@@ -0,0 +1,21 @@
<ion-view title="Camera">
<ion-content>
<div class="card">
<div class="item item-divider">
Take a picture
</div>
<div class="item item-image">
<img class="item" ng-src="{{cameraimage}}" style="height: 350px;"/>
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="takePicture()">
Take Photo
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.clipboard.ctrl', [])
.controller('ClipboardCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,30 @@
<ion-view title="Clipboard">
<ion-content>
<div class="card">
<div class="item">
<p>This is some text to be copied</p>
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="copy()">
Copy!
</button>
</div>
<div class="list">
<label class="item item-input">
<input type="text"
ng-model="data.value"
placeholder="Paste the text here">
</label>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="copy()">
Paste!
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,31 @@
angular.module('demo.contacts.ctrl', [])
.controller('ContactsCtrl', function ($scope, $log, $cordovaContacts) {
$scope.pickContact = function () {
document.addEventListener("deviceready", function () {
$cordovaContacts.pickContact().then(function (result) {
console.log(JSON.stringify(result));
$scope.selectedContact = result;
})
}, false);
};
$scope.saveContact = function (contact) {
document.addEventListener("deviceready", function () {
$cordovaContacts.save(contact).then(function (result) {
console.log(JSON.stringify(result));
})
}, false);
};
$scope.removeContact = function (contact) {
document.addEventListener("deviceready", function () {
$cordovaContacts.remove(contact).then(function (result) {
console.log(JSON.stringify(result));
})
}, false);
};
});

View File

@@ -0,0 +1,53 @@
<!--
- save(contact)
- remove(contact)
- clone(contact)
- find(options)
-->
<ion-view title="Contacts">
<ion-content>
<div class="padding-horizontal">
<button class="button button-block button-balanced" ng-click="pickContact()">
Pick a Contact from Phone
</button>
</div>
<div class="card" ng-if="selectedContact != undefined">
<div class="item">
<h3>NAME: {{selectedContact.name.givenName}} {{selectedContact.name.familyName}}</h3>
</div>
</div>
<div class="list">
<label class="item item-input item-floating-label">
<span class="input-label">Create new Contact</span>
<input type="text" placeholder="Create new Contact" ng-model="newContact">
</label>
</div>
<div class="padding-horizontal">
<button class="button button-block button-positive" ng-click="saveContact(newContact)">
Create new Contact
</button>
</div>
<br>
<div class="list">
<label class="item item-input item-floating-label">
<span class="input-label">Remove a Contact</span>
<input type="text" placeholder="Remove a Contact" ng-model="oldContact">
</label>
</div>
<div class="padding-horizontal">
<button class="button button-block button-assertive" ng-click="removeContact(contact)">
Remove Contact
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,27 @@
angular.module('demo.datePicker.ctrl', [])
.controller('DatePickerCtrl', function ($scope, $cordovaDatePicker) {
var options,
dateType,
msg = 'not picked yet',
handleDatePicker = function (date) {
$scope.data[dateType] = date;
$scope.$apply();
};
$scope.data = {
date: msg,
time: msg
};
$scope.pick = function (type) {
options = {
date: new Date(),
mode: type
};
dateType = type;
$cordovaDatePicker.show(options, handleDatePicker);
};
});

View File

@@ -0,0 +1,26 @@
<ion-view title="Date picker">
<ion-content>
<div class="list">
<div class="item">
{{ data.date }} <br>
<button class="button button-block button-positive"
ng-click="pick('date')">pick date</button>
</div>
<div class="item">
{{ data.time }} <br>
<button class="button button-block button-positive"
ng-click="pick('time')">pick time</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,24 @@
angular.module('demo.device.ctrl', [])
.controller('DeviceCtrl', function ($scope, $state, $cordovaDevice) {
var init = function () {
console.log("initializing device");
try {
document.addEventListener("deviceready", function () {
$scope.available = $cordovaDevice.getDevice().available;
$scope.cordova = $cordovaDevice.getCordova();
$scope.model = $cordovaDevice.getModel();
$scope.platform = $cordovaDevice.getPlatform();
$scope.uuid = $cordovaDevice.getUUID();
$scope.version = $cordovaDevice.getVersion();
}, false);
}
catch (err) {
console.log("Error " + err.message);
alert("error " + err.$$failure.message);
}
};
init();
});

View File

@@ -0,0 +1,38 @@
<ion-view title="Device Info">
<ion-content>
<div class="list card">
<div class="item item-text-wrap">
<h2>Available</h2>
<p>{{available}}</p>
</div>
<div class="item item-text-wrap">
<h2>Model</h2>
<p>{{model}}</p>
</div>
<div class="item item-text-wrap">
<h2>Platform</h2>
<p>{{platform}}</p>
</div>
<div class="item item-text-wrap">
<h2>Version</h2>
<p>{{version}}</p>
</div>
<div class="item item-text-wrap">
<h2>UUID</h2>
<p>{{uuid}}</p>
</div>
<div class="item item-text-wrap">
<h2>Cordova Version</h2>
<p>{{cordova}}</p>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,38 @@
angular.module('demo.deviceMotion.ctrl', [])
.controller('DeviceMotionCtrl', function ($scope, $cordovaDeviceMotion) {
var watchID;
$cordovaDeviceMotion
.getCurrentAcceleration()
.then(function (motion) {
$scope.motion = motion;
console.log(motion);
}, function (err) {
$scope.msg = err.message;
console.log(err);
});
$scope.watchAcceleration = function () {
var options = { frequency: 3000 }; // Update every 3 seconds
$scope.this_watch = $cordovaDeviceMotion.watchAcceleration(options);
$scope.this_watch.promise.then(
function () { /* unused */
},
function (err) {
$scope.msg = err.message;
},
function (motion) {
$scope.motion = motion;
});
};
$scope.clearWatch = function () {
// use watchID from watchAccelaration()
$cordovaDeviceMotion.clearWatch($scope.this_watch.watchId);
};
});

View File

@@ -0,0 +1,43 @@
<ion-view title="Device Motion">
<ion-content>
<div class="card">
<div class="item item-divider">
Acceleration
</div>
<div class="item item-text-wrap" ng-show="msg">
{{msg}}
</div>
<div class="item">
<strong>X</strong> &nbsp {{motion.x}}
</div>
<div class="item">
<strong>Y</strong> &nbsp {{motion.y}}
</div>
<div class="item">
<strong>Z</strong> &nbsp {{motion.z}}
</div>
<div class="item">
<strong>Time</strong> &nbsp {{motion.timestamp}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="getAcceleration()">
Get Device Motion
</button>
<div class="button-bar">
<button class="button button-stable" ng-click="watchAcceleration()">
Watch
</button>
<button class="button button-assertive" ng-click="clearWatch()">
Clear
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,41 @@
angular.module('demo.deviceOrientation.ctrl', [])
.controller('DeviceOrientationCtrl', function ($scope, $timeout, $cordovaDeviceOrientation) {
var options = {frequency: 1000}; // Update every 1 seconds
$scope.getHeading = function () {
$cordovaDeviceOrientation
.getCurrentHeading()
.then(function (position) {
$scope.heading = position;
}, function (err) {
$scope.msg = err.message;
});
};
$scope.watchHeading = function () {
$scope.this_watch = $cordovaDeviceOrientation.watchHeading(options);
$scope.this_watch.then(
function () {
/* unused */
},
function (err) {
$scope.msg = err.message;
},
function (position) {
$timeout(function () {
$scope.heading = position;
});
}
);
};
$scope.clearWatch = function () {
$cordovaDeviceOrientation.clearWatch($scope.this_watch.watchID);
};
});

View File

@@ -0,0 +1,40 @@
<ion-view title="Device Orientation">
<ion-content>
<div class="card">
<div class="item item-divider">
Compass Tool
</div>
<div class="item item-body">
<strong>Magnetic Heading</strong> &nbsp {{heading.magneticHeading}}
</div>
<div class="item item-body">
<strong>True Heading</strong> &nbsp {{heading.trueHeading}}
</div>
<div class="item item-body">
<strong>Accuracy </strong> &nbsp {{heading.headingAccuracy}}
</div>
<div class="item item-body">
<strong>Timestamp </strong> &nbsp {{heading.timestamp}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="getHeading()">
Get Current Heading
</button>
<div class="button-bar">
<button class="button button-stable" ng-click="watchHeading()">
Watch
</button>
<button class="button button-assertive" ng-click="clearWatch()">
Clear
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,33 @@
angular.module('demo.dialogs.ctrl', [])
.controller('DialogsCtrl', function ($scope, $cordovaDialogs) {
$scope.action = "Press any button";
$scope.alert = function () {
$scope.action = "Alert";
$cordovaDialogs.alert('Wow!');
};
$scope.confirm = function () {
$scope.action = "Confirm";
$cordovaDialogs.confirm('Are you sure?', "Custom title").then(function (buttonIndex) {
$cordovaDialogs.alert("Button index : " + buttonIndex);
});
};
$scope.prompt = function () {
$scope.action = "Prompt";
$cordovaDialogs.prompt('Please Login', "Custom title").then(function (result) {
$cordovaDialogs.alert("Input: " + result.input1 + "\n Button index : " + result.buttonIndex);
});
};
$scope.beep = function () {
$scope.action = "Beep";
$cordovaDialogs.beep(3);
};
});

View File

@@ -0,0 +1,32 @@
<ion-view title="Dialogs">
<ion-content>
<div class="card">
<div class="item item-text-wrap text-center">
<strong>{{action}}</strong>
</div>
<div class="item">
<button class="button button-block button-assertive" ng-click="alert()">
Alert
</button>
<br>
<button class="button button-block button-balanced" ng-click="confirm()">
Confirm
</button>
<br>
<button class="button button-block button-energized" ng-click="prompt()">
Prompt
</button>
<br>
<button class="button button-block button-royal" ng-click="beep()">
Beep
</button>
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,41 @@
angular.module('demo.emailComposer.ctrl', [])
.controller('EmailComposerCtrl', function ($scope, $cordovaEmailComposer) {
document.addEventListener("deviceready", function () {
$cordovaEmailComposer.isAvailable().then(function () {
alert("Email composer is available")
}, function () {
alert("Email composer is NOT available")
});
}, false);
$cordovaEmailComposer.isAvailable().then(function () {
// is available
}, function () {
// not available
});
var email = {
to: 'max@mustermann.de',
cc: 'erika@mustermann.de',
bcc: ['john@doe.com', 'jane@doe.com'],
attachments: [
'file://img/logo.png',
'res://icon.png',
'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
'file://README.pdf'
],
subject: 'Cordova Icons',
body: 'How are you? Nice greetings from Leipzig',
isHtml: true
};
$cordovaEmailComposer.open(email).then(null, function () {
// user cancelled email
});
});

View File

@@ -0,0 +1,7 @@
<ion-view title="Email Composer">
<ion-content>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,42 @@
angular.module('demo.facebook.ctrl', [])
.controller('FacebookCtrl', function ($scope, $log, $cordovaFacebook) {
$scope.getLoginStatus = function () {
$cordovaFacebook.getLoginStatus().then(function (status) {
$scope.status = status;
}, function (error) {
$scope.status = error;
})
};
$scope.login = function () {
$cordovaFacebook.login(["public_profile"]).then(function (success) {
$scope.loginInfo = success;
}, function (error) {
$scope.error = error;
alert(error);
})
};
$scope.logout = function () {
$cordovaFacebook.logout().then(function (success) {
console.log(success);
}, function (error) {
$scope.error = error;
alert(error);
})
};
$scope.getMe = function () {
$scope.me = ["refreshing..."];
$cordovaFacebook.api("me", null).then(function (success) {
$scope.me = success;
}, function (error) {
$scope.error = error;
})
};
});

View File

@@ -0,0 +1,36 @@
<ion-view title="Facebook">
<ion-content padding="true">
<button class="button button-block button-positive" ng-click="login()">Login</button>
<h5>Login info</h5>
<div ng-repeat="info in loginInfo">{{info}}</div>
<div class="card">
<div class="item item-divider">Login Info</div>
<div class="item" ng-repeat="info in loginInfo">{{info}}</div>
</div>
<button class="button button-block button-dark" ng-click="getLoginStatus()">Check Login Status</button>
<div class="card">
<div class="item item-divider">Login Status</div>
<div class="item" ng-repeat="info in status">{{info}}</div>
</div>
<button class="button button-block button-energized" ng-click="getMe()">API - get Me</button>
<h5>Api Me info</h5>
<div class="card">
<div class="item item-divider">Api Me info</div>
<div class="item" ng-repeat="info in me">{{info}}</div>
</div>
<button class="button button-block button-assertive" ng-click="logout()">Logout</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,234 @@
angular.module('demo.file.ctrl', [])
.controller('FileCtrl', function ($scope, $log, $cordovaFile, $window, $q, $cordovaFileError) {
$scope.inputs = {
checkDir: "test_directory",
checkFile: "test_file.txt",
createDirectory: "test_directory",
createFile: "test_file.txt",
removeDirectory: "test_directory",
removeFile: "test_file.txt",
removeRecursively: "test_directory/test_file.txt",
writeText: "THIS TEXT IS WRITTEN TO THIS FILE",
writeFile: "test_file.txt",
writeExistingText: "Write this text to an existing file",
writeExistingFile: "test_file.txt",
readFile: "test_file.txt",
moveDirectory: "test_directory",
moveFile: "test_file.txt",
copyDirectory: "test_directory",
copyFile: "test_file.txt"
};
$scope.test = function () {
document.addEventListener('deviceready', function () {
var newPath = cordova.file.applicationDirectory;
var test = DirectoryEntry(newPath);
console.log(test);
console.log(DirectoryEntry);
/*
try {
var path = cordova.file.applicationDirectory;
var newFileName;
var fileName = newFileName = "test_file.txt";
var newPath = cordova.file.tempDirectory;
var q = $q.defer();
$window.resolveLocalFileSystemURL(path, function (fileSystem) {
fileSystem.getFile(fileName, {create: false}, function (fileEntry) {
var newPathName = newPath.substring(newPath.lastIndexOf('/'));
console.log(newPathName);
//var parentEntry = new DirectoryEntry(newPathName, newPath);
fileEntry.moveTo(newPath, newFileName, function (result) {
console.log(result)
}, function (error) {
console.log(error)
});
}, function (err) {
console.log(err);
});
}, function (er) {
console.log(er);
});
} catch (e) {
console.log(e);
}
*/
});
};
$scope.checkDir = function () {
document.addEventListener('deviceready', function () {
// path, directory
$cordovaFile.checkDir(cordova.file.dataDirectory, $scope.inputs.checkDir).then(function (success) {
$scope.checkDirResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.checkDirResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.checkFile = function () {
document.addEventListener('deviceready', function () {
// path, file
$cordovaFile.checkFile(cordova.file.dataDirectory, $scope.inputs.checkFile).then(function (success) {
$scope.checkFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.checkFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.createDirectory = function () {
document.addEventListener('deviceready', function () {
// path, dirName, replace?
$cordovaFile.createDir(cordova.file.dataDirectory, $scope.inputs.createDirectory, false).then(function (success) {
$scope.createDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.createDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.createFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, replace?
$cordovaFile.createFile(cordova.file.dataDirectory, $scope.inputs.createFile, true).then(function (success) {
$scope.createFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.createFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.removeFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName
$cordovaFile.removeFile(cordova.file.dataDirectory, $scope.inputs.removeFile).then(function (success) {
$scope.removeFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.removeFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.removeDirectory = function () {
document.addEventListener('deviceready', function () {
// path, dirName
$cordovaFile.removeDir(cordova.file.dataDirectory, $scope.inputs.removeDirectory).then(function (success) {
$scope.removeDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.removeDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.removeRecursively = function () {
document.addEventListener('deviceready', function () {
// path, dirName
$cordovaFile.removeRecursively(cordova.file.dataDirectory, $scope.inputs.removeDirectory).then(function (success) {
$scope.removeRecursivelyResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.removeRecursivelyResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.writeFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, text, replace?
$cordovaFile.writeFile(cordova.file.dataDirectory, $scope.inputs.writeFile, $scope.inputs.writeText, true).then(function (success) {
$scope.writeFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.writeFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.writeExistingFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, text
$cordovaFile.writeExistingFile(cordova.file.dataDirectory, $scope.inputs.writeExistingFile, $scope.inputs.writeExistingText).then(function (success) {
$scope.writeExistingFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.writeExistingFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.readFileAsText = function () {
document.addEventListener('deviceready', function () {
// path, fileName
$cordovaFile.readAsText(cordova.file.dataDirectory, $scope.inputs.readFile).then(function (success) {
$scope.readFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.readFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.moveDir = function () {
document.addEventListener('deviceready', function () {
// path, DirName, newPath, newDirName
$cordovaFile.moveDir(cordova.file.dataDirectory, $scope.inputs.moveDirectory, cordova.file.tempDirectory, "new_directory").then(function (success) {
$scope.moveDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.moveDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.moveFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, newPath, newFileName
$cordovaFile.moveFile(cordova.file.dataDirectory, $scope.inputs.moveFile, cordova.file.tempDirectory, "new_file.txt").then(function (success) {
$scope.moveFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.moveFileResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.copyDir = function () {
document.addEventListener('deviceready', function () {
// path, dirName, newPath, dirFileName
$cordovaFile.copyDir(cordova.file.dataDirectory, $scope.inputs.copyDirectory, cordova.file.tempDirectory, "new_directory").then(function (success) {
$scope.copyDirectoryResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.copyDirectoryResult = 'error ' + JSON.stringify(error);
});
});
};
$scope.copyFile = function () {
document.addEventListener('deviceready', function () {
// path, fileName, newPath, newFileName
$cordovaFile.copyFile(cordova.file.dataDirectory, $scope.inputs.copyFile, cordova.file.tempDirectory, "new_file.txt").then(function (success) {
$scope.copyFileResult = 'success ' + JSON.stringify(success);
}, function (error) {
$scope.copyFileResult = 'error ' + JSON.stringify(error);
});
});
};
});

View File

@@ -0,0 +1,283 @@
<ion-view title="File">
<ion-content padding="false">
<button class="button button-full button-assertive" ng-click="test()">test</button>
<h4 class="padding-horizontal">CHECK</h4>
<div class="card">
<div class="item item-divider-ios">
Check Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Directory" ng-model="inputs.checkDir">
</label>
<button class="button button-small button-positive button-outline" ng-click="checkDir()">
Check Directory
</button>
</div>
<div class="item" ng-if="checkDirResult">
{{checkDirResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Check File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.checkFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="checkFile()">
Check File
</button>
</div>
<div class="item" ng-if="checkFileResult">
{{checkFileResult}}
</div>
</div>
<h4 class="padding-horizontal">CREATE</h4>
<div class="card">
<div class="item item-divider-ios">
Create Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.createDirectory">
</label>
<button class="button button-small button-balanced button-outline" ng-click="createDirectory()">
Create Directory
</button>
</div>
<div class="item" ng-if="createDirectoryResult">
{{createDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Create File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.createFile">
</label>
<button class="button button-small button-balanced button-outline" ng-click="createFile()">
Create File
</button>
</div>
<div class="item" ng-if="createFileResult">
{{createFileResult}}
</div>
</div>
<h4 class="padding-horizontal">REMOVE</h4>
<div class="card">
<div class="item item-divider-ios">
Remove File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.removeFile">
</label>
<button class="button button-small button-assertive button-outline" ng-click="removeFile()">
Remove File
</button>
</div>
<div class="item" ng-if="removeFileResult">
{{removeFileResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Remove Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.removeDirectory">
</label>
<button class="button button-small button-assertive button-outline" ng-click="removeDirectory()">
Remove Directory
</button>
</div>
<div class="item" ng-if="removeDirectoryResult">
{{removeDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Remove Recursively
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="File" ng-model="inputs.removeRecursively">
</label>
<button class="button button-small button-assertive button-outline" ng-click="removeRecursively()">
Remove Recursive
</button>
</div>
<div class="item" ng-if="removeRecursivelyResult">
{{removeRecursivelyResult}}
</div>
</div>
<h4 class="padding-horizontal">WRITE</h4>
<div class="card">
<div class="item item-divider-ios">
Write File
</div>
<div class="item">
<label class="item item-input">
<input type="text" placeholder="text" ng-model="inputs.writeText">
</label>
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.writeFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="writeFile()">
Write File
</button>
</div>
<div class="item" ng-if="writeFileResult">
{{writeFileResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Write Existing File
</div>
<div class="item">
<label class="item item-input">
<input type="text" placeholder="text" ng-model="inputs.writeExistingText">
</label>
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.writeExistingFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="writeExistingFile()">
Write Existing File
</button>
</div>
<div class="item item-text-wrap" ng-if="writeExistingFileResult">
{{writeExistingFileResult}}
</div>
</div>
<h4 class="padding-horizontal">READ</h4>
<div class="card">
<div class="item item-divider-ios">
Read File As Text
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.readFile">
</label>
<button class="button button-small button-positive button-outline" ng-click="readFileAsText()">
Read File
</button>
</div>
<div class="item item-text-wrap" ng-if="readFileResult">
{{readFileResult}}
</div>
</div>
<h4 class="padding-horizontal">MOVE</h4>
<div class="card">
<div class="item item-divider-ios">
Move Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.moveDirectory">
</label>
<button class="button button-small button-royal button-outline" ng-click="moveDir()">
Move File
</button>
</div>
<div class="item" ng-if="moveDirectoryResult">
{{moveDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Move File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.moveFile">
</label>
<button class="button button-small button-royal button-outline" ng-click="moveFile()">
Move File
</button>
</div>
<div class="item" ng-if="moveFileResult">
{{moveFileResult}}
</div>
</div>
<h4 class="padding-horizontal">COPY</h4>
<div class="card">
<div class="item item-divider-ios">
Copy Directory
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.copyDirectory">
</label>
<button class="button button-small button-energized button-outline" ng-click="copyDir()">
Copy Directory
</button>
</div>
<div class="item" ng-if="copyDirectoryResult">
{{copyDirectoryResult}}
</div>
</div>
<div class="card">
<div class="item item-divider-ios">
Copy File
</div>
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" placeholder="Write File Name" ng-model="inputs.copyFile">
</label>
<button class="button button-small button-energized button-outline" ng-click="copyFile()">
Copy File
</button>
</div>
<div class="item" ng-if="copyFileResult">
{{copyFileResult}}
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,25 @@
angular.module('demo.fileOpener2.ctrl', [])
.controller('FileOpener2Ctrl', function ($scope, $log, $cordovaFileOpener2) {
$scope.packageId = '';
$scope.type = '';
$scope.logs = '';
$scope.open = function() {
$cordovaFileOpener2.open(
$scope.packageId,
$scope.type
).then(
function(){
$scope.logs = 'Success';
},
function(error) {
alert('error code: '+error.code+' , message: '+error.message);
$scope.logs = 'error code: '+error.code+' , message: '+error.message;
}
);
};
});

View File

@@ -0,0 +1,19 @@
<ion-view title="FileOpener2">
<ion-content padding="true">
<div class="list">
<label class="item item-input">
<input type="text" placeholder="packageID" ng-model="packageId">
</label>
<label class="item item-input">
<input type="text" placeholder="type" ng-model="type">
</label>
<button class="button button-block button-positive" ng-click="open()">
Open
</button>
</div>
{{ logs }}
</ion-content>
</ion-view>

View File

@@ -0,0 +1,32 @@
angular.module('demo.fileTransfer.ctrl', [])
.controller('FileTransferCtrl', function ($scope, $rootScope, $cordovaFileTransfer, $timeout) {
$scope.downloadFile = function () {
document.addEventListener('deviceready', function () {
var url = "http://cdn.wall-pix.net/albums/art-space/00030109.jpg";
var fileDir = cordova.file.documentsDirectory + "testImage.png";
var download = $cordovaFileTransfer.download(url, fileDir).then(function (success) {
console.log("success " + JSON.stringify(success));
$timeout(function () {
$scope.downloadProgress = 100
}, 1000);
}, function (error) {
console.log("Error " + JSON.stringify(error));
}, function (progress) {
$timeout(function () {
$scope.downloadProgress = (progress.loaded / progress.total) * 100;
});
});
if ($scope.downloadProgress > 0.1) {
download.abort();
}
})
};
});

View File

@@ -0,0 +1,12 @@
<ion-view title="File Transfer">
<ion-content padding="true">
<button class="button button-block button-positive" ng-click="downloadFile()">Download File</button>
<div class="card" ng-if="downloadProgress">
<div class="item item-text-wrap">
Progress : {{downloadProgress}}%
</div>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,11 @@
angular.module('demo.flashlight.ctrl', [])
.controller('FlashlightCtrl', function ($scope, $cordovaFlashlight) {
$scope.on = function () {
$cordovaFlashlight.switchOn();
};
$scope.off = function () {
$cordovaFlashlight.switchOff();
};
});

View File

@@ -0,0 +1,11 @@
<ion-view title="Flashlight">
<ion-content scroll="false" padding="true">
<button ng-click="on()" class="button button-block button-energized">On</button>
<button ng-click="off()" class="button button-block button-dark">Off</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,20 @@
angular.module('demo.geolocation.ctrl', [])
.controller('GeolocationCtrl', function ($scope, $cordovaGeolocation) {
$scope.getLocation = function () {
$cordovaGeolocation
.getCurrentPosition({timeout: 10000, enableHighAccuracy: false})
.then(function (position) {
console.log("position found");
$scope.position = position;
// long = position.coords.longitude
// lat = position.coords.latitude
}, function (err) {
console.log("unable to find location");
$scope.errorMsg = "Error : " + err.message;
});
};
});

View File

@@ -0,0 +1,27 @@
<ion-view title="Geolocation">
<ion-content>
<div class="card">
<div class="item item-divider">
Get My Current Location
</div>
<div class="item">
<strong>Longitude </strong> &nbsp {{position.coords.longitude}}
</div>
<div class="item">
<strong>Latitude </strong> &nbsp {{position.coords.latitude}}
</div>
<div class="item" ng-show="errorMsg">
<p>{{errorMsg}}</p>
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="getLocation()">
Get My Location
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,50 @@
angular.module('demo.globalization.ctrl', [])
.controller('GlobalizationCtrl', function ($scope, $cordovaGlobalization) {
function init() {
$cordovaGlobalization.getPreferredLanguage().then(
function (result) {
$scope.language = result.value;
},
function (error) {
$scope.language = err.message;
});
$cordovaGlobalization.getLocaleName().then(
function (result) {
$scope.locale = result.value;
},
function (error) {
$scope.locale = err.message;
});
$cordovaGlobalization.getFirstDayOfWeek().then(
function (result) {
$scope.fdow = result.value;
},
function (error) {
$scope.fdow = err.message;
});
}
$scope.refresh = function () {
init();
};
init();
// Soon implemented:
// dateToString
// stringToDate
// getDatePattern
// getDateNames
// isDayLightSavingsTime
// numberToString
// stringToNumber
// getNumberPattern
// getCurrencyPattern
});

View File

@@ -0,0 +1,25 @@
<ion-view title="Globalization">
<ion-content>
<div class="card">
<div class="item item-divider">
Globalization Values
</div>
<div class="item item-body">
<strong>Language </strong> &nbsp {{language}}
</div>
<div class="item">
<strong>Locale </strong> &nbsp {{locale}}
</div>
<div class="item">
<strong>First Day of Week </strong> &nbsp {{fdow}}
</div>
</div>
<div class="padding">
<button class="button button-block button-positive" ng-click="refresh()">
Refresh
</button>
</div>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,5 @@
angular.module('demo.googleAnalytics.ctrl', [])
.controller('GoogleAnalyticsCtrl', function ($scope, $log, $cordovaPreferences) {
});

View File

@@ -0,0 +1,5 @@
<ion-view title="Google Analytics">
<ion-content padding="true">
</ion-content>
</ion-view>

View File

@@ -0,0 +1,53 @@
angular.module('demo.healthkit.ctrl', [])
.controller('HealthKitCtrl', function($scope, $cordovaHealthKit) {
$cordovaHealthKit.isAvailable().then(function(success) {
alert('HealthKit Available');
}, function(err) {
alert('HealthKit NOT Available');
});
$scope.request = function() {
$cordovaHealthKit.requestAuthorization().then(function(success) {
$scope.granted = true;
}, function(err) {
$scope.granted = false;
});
};
$scope.checkAuth = function() {
$cordovaHealthKit.checkAuthStatus().then(function(success) {
$scope.granted = true;
}, function(err) {
$scope.granted = false;
});
};
$scope.readDOB = function() {
$cordovaHealthKit.readDateOfBirth().then(function(dob) {
alert('DOB ' + dob);
}, function(err) {
alert(err);
});
};
$scope.readGender = function() {
$cordovaHealthKit.readGender().then(function(gender) {
alert('Gender ' + gender);
}, function(err) {
alert(err);
});
};
$scope.readWeight = function() {
$cordovaHealthKit.readWeight().then(function(v) {
alert('Weight ' + JSON.stringify(v));
}, function(err) {
alert(err);
});
};
$scope.readHeight = function() {
$cordovaHealthKit.readHeight().then(function(v) {
alert('Height ' + JSON.stringify(v));
}, function(err) {
alert(err);
});
}
});

View File

@@ -0,0 +1,14 @@
<ion-view title="HealthKit (iOS Only)">
<ion-content>
<h1 class="text-center">HealthKit</h1>
<p>
Authorization: <b ng-if="granted">Granted</b><b ng-if="!granted">Not granted</b>
</p>
<button class="button button-assertive" ng-click="checkAuth()">Check Authorization</button>
<button class="button button-assertive" ng-click="request()">Request Authorization</button>
<button class="button button-assertive" ng-click="readDOB()">DOB</button>
<button class="button button-assertive" ng-click="readGender()">Gender</button>
<button class="button button-assertive" ng-click="readWeight()">Weight</button>
<button class="button button-assertive" ng-click="readHeight()">Height</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,34 @@
angular.module('demo.inAppBrowser.ctrl', [])
.controller('InAppBrowserCtrl', function ($scope, $rootScope, $cordovaInAppBrowser) {
$scope.openBrowser = function () {
document.addEventListener('deviceready', function () {
var options = {
location: "no"
};
$cordovaInAppBrowser.open('http://ngcordova.com', '_blank', options).then(function () {
console.log("InAppBrowser opened http://ngcordova.com successfully");
}, function (error) {
console.log("Error: " + error);
});
}, false);
};
document.addEventListener('deviceready', function () {
$rootScope.$on("$cordovaInAppBrowser:exit", function (event, result) {
alert("Exited Browser");
console.log(JSON.stringify(result));
});
$rootScope.$on("$cordovaInAppBrowser:loadstop", function (event, result) {
alert("Load Stop event");
console.log(JSON.stringify(result));
})
}, false);
});

View File

@@ -0,0 +1,6 @@
<ion-view title="In App Browser">
<ion-content padding="true">
<button class="button button-block button-positive" ng-click="openBrowser()">Open Browser</button>
</ion-content>
</ion-view>

View File

@@ -0,0 +1,9 @@
module.controller('MyCtrl', function($cordovaInsomnia) {
//Keep Screen on | prevent screen sleep
$cordovaInsomnia.keepAwake();
//return to standard. Aloow Sleep Again
$cordovaInsomnia.allowSleepAgain();
});

View File

@@ -0,0 +1,30 @@
angular.module('demo.localNotification.ctrl', [])
.controller('LocalNotificationCtrl', function ($scope, $rootScope, $cordovaLocalNotification) {
$scope.addNotification = function () {
var now = new Date();
var _60_seconds_from_now = new Date(now + 60 * 1000);
var event = {
id: 1,
at: _60_seconds_from_now,
title: "Test Event",
text: "this is a message about the event"
};
document.addEventListener("deviceready", function () {
$cordovaLocalNotification.schedule(event).then(function () {
console.log("local add : success");
});
}, false);
};
document.addEventListener("deviceready", function () {
$rootScope.$on("$cordovaLocalNotification:trigger", function (event, notification, state) {
console.log("notification id:" + notification.id + " state: " + state);
});
}, false);
});

Some files were not shown because too many files have changed in this diff Show More