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": "./bower_components"
}

View File

@@ -0,0 +1,9 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

12
www/lib/ngCordova/.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
.*.sw*
node_modules/
.idea/*
demo/platforms/*
demo/plugins/*
_site
bower_components
coverage
Gemfile.lock
.DS_Store*
npm-debug.log
.project

3
www/lib/ngCordova/.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "src/plugins/oauth"]
path = src/plugins/oauth
url = https://github.com/nraboy/ng-cordova-oauth

View File

@@ -0,0 +1,26 @@
{
"node": true,
"browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": false,
"trailing": true,
"smarttabs": true,
"validthis": true,
"globals": {
"cordova": false,
"angular": false
}
}

View File

@@ -0,0 +1,16 @@
language: node_js
node_js:
- '0.10'
before_install:
- npm install -g gulp bower
- bower install
notifications:
email: false
deploy:
provider: npm
email: paolo.enrico.bernasconi@gmail.com
api_key:
secure: dBjQuYwAMqzziqwKKzntnQGKT3LLK+U/ZUuAHvemuuMYHlXcJSwO6gqBcGynGVjzUbq6ONJ4orDqSdicjJXgOXzjJ6PeP5KQzcQ4MHW2ZEnaEr/Wyu81GbwgivOmvF6kJj+7o/oLHSmrSVVXPTxxKNH+5K3CpLlzxaJmCO1UpyI=
on:
tags: true
branch: master

View File

@@ -0,0 +1 @@
Please refer to the [Github ngCordova Releases file](https://github.com/driftyco/ng-cordova/releases) for detailed information.

View File

@@ -0,0 +1,22 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)

View File

@@ -0,0 +1,51 @@
## Contributing
### New Here and want to help?
First off, Welcome! NgCordova is possible because of your support. There are a lot of community plugins out there; many more than any one person could maintain and support. Likewise, the wrappers take a level of support that no one person could provide on their own. We need your help. If you've never contributed to open source before, now's your chance. There are lots of things you can do to help.
If you're nervous about writing plugin wrappers (It's really not as hard as it looks), there is lots you can do:
- Report bugs! When reporting a bug, please include a [Minimal, Complete, Verifiable Example](http://stackoverflow.com/help/mcve). These are important because it gets us much closer to fixing the bug you've found, and it verifies that this is an actual bug. When creating an MCVE, feel free to put it in a public repo and linking to it in your issue. The closer we can get to simply building your repo and running it, the more likely we're able to fix the issue quickly. If a bug report doesn't include an MCVE, we'll probably have to close it.
- Improve the documentation! Documentation is boring, but it's the first thing newcomers see. If you think the documentation can be improved, submit a pull request that improves it. How to do that is included below.
#### I want a new plugin included in NgCordova
Awesome! Please write a wrapper for it to ensure we get it in as quickly as possible. Not sure how to do that? I've included references in issue #885.
#### *Plugin I Use* is no longer maintained/supported
Create a pull request that updates the README.md with the version of Cordova that plugin works with; and if there's a new plugin that is supported, please help us by writing a wrapper for it.
#### Creating an Issue
If you have a problem with ng-cordova, you can [submit a new Issue](https://github.com/driftyco/ng-cordova/issues/new). Please be detailed in your issue report, and include keywords such as : `Feat`, `Bug`, etc
If you think you have found a bug, or have a new feature idea, please start by making sure it hasn't already been reported. You can [search through existing issues](https://github.com/driftyco/ng-cordova/issues?state=open) to see if someone's reported one similar to yours.
#### Making edits to ng-cordova
1. [Fork](https://github.com/driftyco/ng-cordova/fork) then clone `git clone git@github.com:your-username/ng-cordova.git` ng-cordova repository
2. Create a new branch in your personally forked repo, with a name similar to your edits, such as `fix-facebook-plugin`
3. Make your edits inside your new branch
4. Commit them and push them back to your personal github fork
5. Make a new [Pull Request](https://github.com/driftyco/ng-cordova/compare/) on the ng-cordova repo. Point your branch to the `dev-next` ng-cordova branch and submit.
#### Fix the Docs
1. [Fork](https://github.com/driftyco/ng-cordova/fork) and clone
2. Create a new branch from the `gh-pages` branch
3. Make your edits
4. Push your edits back to your personal github repo
5. Make a [Pull Request](https://github.com/driftyco/ng-cordova/compare/) on the ng-cordova repo. Point your branch to the `gh-pages` branch and submit
##### License
By contributing your code to the driftyco/ionic GitHub Repository, you agree to license your contribution under the MIT license.
##### Contributor's Convenant
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

21
www/lib/ngCordova/LICENSE Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Drifty
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.

128
www/lib/ngCordova/README.md Normal file
View File

@@ -0,0 +1,128 @@
[ngCordova](http://ngcordova.com/)
==========
[![Travis](http://img.shields.io/travis/driftyco/ng-cordova.svg?style=flat)](https://travis-ci.org/driftyco/ng-cordova) [![Bower](http://img.shields.io/badge/bower-ngCordova-FFCC2F.svg?style=flat)](http://bower.io/search/?q=ngCordova)
### Cordova with AngularJS Goodness
[<img src="http://ionicframework.com/img/ngcordova-context-logo.png" alt="ngCordova Logo" width="210px" height="210px" />](http://ngcordova.com/)
ngCordova gives you simple AngularJS wrappers for a massive amount of Cordova plugins. Check out the list below for all of the available plugins, and create an issue for a new request.
Created by the [Ionic Framework](http://ionicframework.com/) team and the community.
| RESOURCE | LINK |
|------------|---------|
| **Website** | [ngCordova.com](http://ngcordova.com/) |
| **Docs** | [ngCordova.com/docs](http://ngcordova.com/docs) |
| **Requirements** | [AngularJS](https://github.com/angular/angular.js), [Cordova](http://cordova.apache.org/) |
| **Install** | `bower install ngCordova` or [download zip file](https://github.com/driftyco/ng-cordova/archive/master.zip) |
| **Custom build** | [ngCordova.com/build](http://ngcordova.com/build/) |
## Installation
Install manually, or from bower:
```bash
$ bower install ngCordova
```
## Plugins `(67+)`
- [Action Sheet](https://github.com/EddyVerbruggen/cordova-plugin-actionsheet)
- [AdMob](https://github.com/floatinghotpot/cordova-plugin-admob) (:warning: share % Ad revenue)
- [App Availability](https://github.com/ohh2ahh/AppAvailability)
- [App Rate](https://github.com/pushandplay/cordova-plugin-apprate)
- [App Version](https://github.com/whiteoctober/cordova-plugin-app-version)
- [Background Geolocation](https://github.com/christocracy/cordova-plugin-background-geolocation)
- [Badge](https://github.com/katzer/cordova-plugin-badge)
- [Barcode Scanner](https://github.com/wildabeast/BarcodeScanner)
- [Battery Status](https://github.com/apache/cordova-plugin-battery-status) *
- [Beacon](https://github.com/petermetz/cordova-plugin-ibeacon)
- [Bluetooth Low Energy](https://github.com/don/cordova-plugin-ble-central)
- [Bluetooth Serial](https://github.com/don/BluetoothSerial)
- [Brightness](https://github.com/fiscal-cliff/phonegap-plugin-brightness)
- [Calendar](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin)
- [Camera](https://github.com/apache/cordova-plugin-camera) *
- [Clipboard](https://github.com/VersoSolutions/CordovaClipboard)
- [Console](https://github.com/apache/cordova-plugin-console) *
- [Contacts](https://github.com/apache/cordova-plugin-contacts) *
- [Date Picker](https://github.com/VitaliiBlagodir/cordova-plugin-datepicker)
- [Device Motion](https://github.com/apache/cordova-plugin-device-motion) *
- [Device Orientation](https://github.com/apache/cordova-plugin-device-orientation) *
- [Device](https://github.com/apache/cordova-plugin-device) *
- [Dialogs](https://github.com/apache/cordova-plugin-dialogs) *
- [Email Composer](https://github.com/katzer/cordova-plugin-email-composer)
- [Facebook Connect](https://github.com/Wizcorp/phonegap-facebook-plugin)
- [Facebook AudienceNetwork Ads](https://github.com/floatinghotpot/cordova-plugin-facebookads) (:warning: share % Ad revenue)
- [File](https://github.com/apache/cordova-plugin-file) *
- [File Transfer](https://github.com/apache/cordova-plugin-file-transfer) *
- [Flashlight](https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin)
- [Flurry Ads](https://github.com/floatinghotpot/cordova-plugin-flurry) (:warning: share % Ad revenue)
- [Geolocation](https://github.com/apache/cordova-plugin-geolocation) *
- [Globalization](https://github.com/apache/cordova-plugin-globalization) *
- [Google Ads](https://github.com/floatinghotpot/cordova-admob-pro) (:warning: share % Ad revenue)
- [Google Analytics](https://github.com/danwilson/google-analytics-plugin)
- [Google Plus](https://github.com/EddyVerbruggen/cordova-plugin-googleplus)
- [HealthKit for iOS](https://github.com/Telerik-Verified-Plugins/HealthKit)
- [Httpd (Web Server)](https://github.com/floatinghotpot/cordova-httpd)
- [Apple iAd](https://github.com/floatinghotpot/cordova-iad-pro) (:warning: share % Ad revenue)
- [Image Picker](https://github.com/wymsee/cordova-imagePicker)
- [InAppBrowser](https://github.com/apache/cordova-plugin-inappbrowser)*
- [Keyboard](https://github.com/driftyco/ionic-plugins-keyboard)
- [Keychain](https://github.com/shazron/KeychainPlugin)
- [Launch Navigator](https://github.com/dpa99c/phonegap-launch-navigator)
- [Local Notifications](https://github.com/katzer/cordova-plugin-local-notifications/)
- [Media Capture](https://github.com/apache/cordova-plugin-media-capture)
- [Media](https://github.com/apache/cordova-plugin-media) *
- [MillennialMedia Ads](https://github.com/floatinghotpot/cordova-plugin-mmedia) (:warning: share % Ad revenue)
- [MobFox Ads](https://github.com/floatinghotpot/cordova-mobfox-pro) (:warning: share % Ad revenue)
- [MoPub Ads](https://github.com/floatinghotpot/cordova-plugin-mopub) (:warning: share % Ad revenue)
- [Native Audio](https://github.com/SidneyS/cordova-plugin-nativeaudio)
- [Network Information](https://github.com/apache/cordova-plugin-network-information) *
- [Oauth](https://github.com/nraboy/ng-cordova-oauth)
- [Pin Dialog](https://github.com/Paldom/PinDialog)
- [Preferences](https://github.com/apla/me.apla.cordova.app-preferences)
- [Printer](https://github.com/katzer/cordova-plugin-printer)
- [Progress Indicator](https://github.com/pbernasconi/cordova-progressIndicator)
- [Push Notifications](https://github.com/phonegap-build/PushPlugin) (**deprecated** - Will be removed in future release)
- [Push Notifications - V5] (https://github.com/phonegap/phonegap-plugin-push)
- [SMS](https://github.com/aharris88/phonegap-sms-plugin)
- [Social Sharing](https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
- [Spinner Dialog](https://github.com/Paldom/SpinnerDialog)
- [Splashscreen](https://github.com/apache/cordova-plugin-splashscreen) *
- [SQLite](https://github.com/brodysoft/Cordova-SQLitePlugin)
- [StatusBar](https://github.com/apache/cordova-plugin-statusbar) *
- [Toast](https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin)
- [Touchid](https://github.com/leecrossley/cordova-plugin-touchid)
- [Vibration](https://github.com/apache/cordova-plugin-vibration) *
- [Video Capture Plus](https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin) *
- [Zip](https://github.com/MobileChromeApps/zip)
`* official Apache Cordova Plugin`
## Authors
#### Max Lynch
- https://twitter.com/maxlynch
- https://github.com/mlynch
#### Paolo Bernasconi
- https://twitter.com/paolobernasconi
- https://github.com/pbernasconi
## Project Maintainer
#### George Stocker
- https://twitter.com/gortok
- https://github.com/gortok
## LICENSE
ngCordova is licensed under the MIT Open Source license. For more information, see the LICENSE file in this repository.

View File

@@ -0,0 +1,46 @@
{
"name": "ngCordova",
"version": "0.1.23-alpha",
"homepage": "http://ngCordova.com/",
"authors": [
"Max Lynch <max@drifty.com>",
"Paolo Bernasconi <paolo.enrico.bernasconi@gmail.com>",
"Chad Campbell <chad.campbell@ecofic.com>"
],
"description": "AngularJS Cordova wrappers for common Cordova plugins.",
"main": [
"./dist/ng-cordova.js"
],
"ignore": [
"**/.*",
"gulpfile.js",
"test",
"src",
"config",
"demo",
"CONTRIBUTING.md",
"CODE_OF_CONDUCT.md"
],
"dependencies": {
"angular": ">= 1.2.23"
},
"keywords": [
"ngCordova",
"ng-cordova",
"ngcordova",
"ng cordova",
"cordova",
"phonegap",
"angular",
"angularjs",
"ionic",
"cordova plugin"
],
"license": "MIT",
"private": false,
"devDependencies": {
"angular": ">= 1.2.23",
"angular-mocks": ">= 1.2.23",
"jquery": "~2.1.1"
}
}

View File

@@ -0,0 +1,36 @@
var fs = require('fs');
var pkg = require('../package.json');
module.exports = {
banner: '/*!\n' +
' * ngCordova\n' +
' * v' + pkg.version +'\n' +
' * Copyright 2015 Drifty Co. http://drifty.com/\n' +
' * See LICENSE in this repository for license information\n' +
' */\n',
closureStart: '(function(){\n',
closureEnd: '\n})();',
dist: 'dist',
demo : {
ngCordova : 'demo/www/lib/ngCordova/dist',
lib : 'demo/www/lib',
www : 'demo/www'
},
pluginFiles: [
'src/module.js',
'src/plugins/*.js',
'src/plugins/oauth/src/*.js'
],
mockFiles: [
'src/module-mocks.js',
'src/mocks/*.js'
],
versionData: {
version: pkg.version
}
};

View File

@@ -0,0 +1,46 @@
var buildConfig = require('./build.config.js');
module.exports = {
files: [
// Include jQuery only for testing convience (lots of DOM checking for unit tests on directives)
'bower_components/angular/angular.min.js',
'bower_components/angular-mocks/angular-mocks.js',
'bower_components/jquery/dist/jquery.js',
]
.concat(buildConfig.pluginFiles)
.concat('test/plugins/*.js')
.concat(buildConfig.mockFiles)
.concat('test/mocks/*.js')
,
frameworks: ['jasmine'],
reporters: ['progress', 'coverage'],
preprocessors: {
'src/plugins/*.js': ['coverage']
},
coverageReporter: {
type : 'html',
dir : 'coverage/'
},
port: 9876,
colors: true,
// possible values: 'OFF', 'ERROR', 'WARN', 'INFO', 'DEBUG'
logLevel: 'INFO',
autoWatch: true,
captureTimeout: 60000,
singleRun: false,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['Chrome']
};

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>

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