Skip to content

Commit 74407c0

Browse files
committed
First commit
1 parent d0927ad commit 74407c0

File tree

3,050 files changed

+472449
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,050 files changed

+472449
-0
lines changed

bower.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "sample",
3+
"private": "true",
4+
"devDependencies": {
5+
"ionic": "driftyco/ionic-bower#1.0.0-rc.2",
6+
"ionic-material": "0.4.2",
7+
"ion-md-input": "1.0.4"
8+
}
9+
}

config.xml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2+
<widget id="com.odoo.app" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3+
<name>Odoo App</name>
4+
<description>
5+
Mobile app connecting to Odoo via Odoo RPC
6+
</description>
7+
<author email="[email protected]" href="http://ionicframework.com/">
8+
Sunflower IT
9+
</author>
10+
<content src="index.html"/>
11+
<access origin="*"/>
12+
<preference name="webviewbounce" value="false"/>
13+
<preference name="UIWebViewBounce" value="false"/>
14+
<preference name="DisallowOverscroll" value="true"/>
15+
<preference name="BackupWebStorage" value="none"/>
16+
<preference name="SplashScreen" value="screen"/>
17+
<preference name="SplashScreenDelay" value="3000"/>
18+
<feature name="StatusBar">
19+
<param name="ios-package" value="CDVStatusBar" onload="true"/>
20+
</feature>
21+
<platform name="android">
22+
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
23+
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
24+
<splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
25+
<splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
26+
<splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
27+
<splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
28+
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
29+
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
30+
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
31+
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
32+
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
33+
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
34+
<icon src="resources\android\icon\drawable-ldpi-icon.png" density="ldpi"/>
35+
<icon src="resources\android\icon\drawable-mdpi-icon.png" density="mdpi"/>
36+
<icon src="resources\android\icon\drawable-hdpi-icon.png" density="hdpi"/>
37+
<icon src="resources\android\icon\drawable-xhdpi-icon.png" density="xhdpi"/>
38+
</platform>
39+
<icon src="resources\android\icon\drawable-xhdpi-icon.png"/>
40+
</widget>

gulpfile.js

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
var gulp = require('gulp');
2+
var gutil = require('gulp-util');
3+
var bower = require('bower');
4+
var concat = require('gulp-concat');
5+
var sass = require('gulp-sass');
6+
var minifyCss = require('gulp-minify-css');
7+
var rename = require('gulp-rename');
8+
var sh = require('shelljs');
9+
10+
var paths = {
11+
sass: ['./scss/**/*.scss']
12+
};
13+
14+
gulp.task('default', ['sass']);
15+
16+
gulp.task('sass', function(done) {
17+
gulp.src('./scss/ionic.app.scss')
18+
.pipe(sass())
19+
.pipe(gulp.dest('./www/css/'))
20+
.pipe(minifyCss({
21+
keepSpecialComments: 0
22+
}))
23+
.pipe(rename({ extname: '.min.css' }))
24+
.pipe(gulp.dest('./www/css/'))
25+
.on('end', done);
26+
});
27+
28+
gulp.task('watch', function() {
29+
gulp.watch(paths.sass, ['sass']);
30+
});
31+
32+
gulp.task('install', ['git-check'], function() {
33+
return bower.commands.install()
34+
.on('log', function(data) {
35+
gutil.log('bower', gutil.colors.cyan(data.id), data.message);
36+
});
37+
});
38+
39+
gulp.task('git-check', function(done) {
40+
if (!sh.which('git')) {
41+
console.log(
42+
' ' + gutil.colors.red('Git is not installed.'),
43+
'\n Git, the version control system, is required to download Ionic.',
44+
'\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
45+
'\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
46+
);
47+
process.exit(1);
48+
}
49+
done();
50+
});

hooks/README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<!--
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
-->
21+
# Cordova Hooks
22+
23+
This directory may contain scripts used to customize cordova commands. This
24+
directory used to exist at `.cordova/hooks`, but has now been moved to the
25+
project root. Any scripts you add to these directories will be executed before
26+
and after the commands corresponding to the directory name. Useful for
27+
integrating your own build systems or integrating with version control systems.
28+
29+
__Remember__: Make your scripts executable.
30+
31+
## Hook Directories
32+
The following subdirectories will be used for hooks:
33+
34+
after_build/
35+
after_compile/
36+
after_docs/
37+
after_emulate/
38+
after_platform_add/
39+
after_platform_rm/
40+
after_platform_ls/
41+
after_plugin_add/
42+
after_plugin_ls/
43+
after_plugin_rm/
44+
after_plugin_search/
45+
after_prepare/
46+
after_run/
47+
after_serve/
48+
before_build/
49+
before_compile/
50+
before_docs/
51+
before_emulate/
52+
before_platform_add/
53+
before_platform_rm/
54+
before_platform_ls/
55+
before_plugin_add/
56+
before_plugin_ls/
57+
before_plugin_rm/
58+
before_plugin_search/
59+
before_prepare/
60+
before_run/
61+
before_serve/
62+
pre_package/ <-- Windows 8 and Windows Phone only.
63+
64+
## Script Interface
65+
66+
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:
67+
68+
* CORDOVA_VERSION - The version of the Cordova-CLI.
69+
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).
70+
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)
71+
* CORDOVA_HOOK - Path to the hook that is being executed.
72+
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)
73+
74+
If a script returns a non-zero exit code, then the parent cordova command will be aborted.
75+
76+
77+
## Writing hooks
78+
79+
We highly recommend writting your hooks using Node.js so that they are
80+
cross-platform. Some good examples are shown here:
81+
82+
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)
83+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env node
2+
3+
// Add Platform Class
4+
// v1.0
5+
// Automatically adds the platform class to the body tag
6+
// after the `prepare` command. By placing the platform CSS classes
7+
// directly in the HTML built for the platform, it speeds up
8+
// rendering the correct layout/style for the specific platform
9+
// instead of waiting for the JS to figure out the correct classes.
10+
11+
var fs = require('fs');
12+
var path = require('path');
13+
14+
var rootdir = process.argv[2];
15+
16+
function addPlatformBodyTag(indexPath, platform) {
17+
// add the platform class to the body tag
18+
try {
19+
var platformClass = 'platform-' + platform;
20+
var cordovaClass = 'platform-cordova platform-webview';
21+
22+
var html = fs.readFileSync(indexPath, 'utf8');
23+
24+
var bodyTag = findBodyTag(html);
25+
if(!bodyTag) return; // no opening body tag, something's wrong
26+
27+
if(bodyTag.indexOf(platformClass) > -1) return; // already added
28+
29+
var newBodyTag = bodyTag;
30+
31+
var classAttr = findClassAttr(bodyTag);
32+
if(classAttr) {
33+
// body tag has existing class attribute, add the classname
34+
var endingQuote = classAttr.substring(classAttr.length-1);
35+
var newClassAttr = classAttr.substring(0, classAttr.length-1);
36+
newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote;
37+
newBodyTag = bodyTag.replace(classAttr, newClassAttr);
38+
39+
} else {
40+
// add class attribute to the body tag
41+
newBodyTag = bodyTag.replace('>', ' class="' + platformClass + ' ' + cordovaClass + '">');
42+
}
43+
44+
html = html.replace(bodyTag, newBodyTag);
45+
46+
fs.writeFileSync(indexPath, html, 'utf8');
47+
48+
process.stdout.write('add to body class: ' + platformClass + '\n');
49+
} catch(e) {
50+
process.stdout.write(e);
51+
}
52+
}
53+
54+
function findBodyTag(html) {
55+
// get the body tag
56+
try{
57+
return html.match(/<body(?=[\s>])(.*?)>/gi)[0];
58+
}catch(e){}
59+
}
60+
61+
function findClassAttr(bodyTag) {
62+
// get the body tag's class attribute
63+
try{
64+
return bodyTag.match(/ class=["|'](.*?)["|']/gi)[0];
65+
}catch(e){}
66+
}
67+
68+
if (rootdir) {
69+
70+
// go through each of the platform directories that have been prepared
71+
var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
72+
73+
for(var x=0; x<platforms.length; x++) {
74+
// open up the index.html file at the www root
75+
try {
76+
var platform = platforms[x].trim().toLowerCase();
77+
var indexPath;
78+
79+
if(platform == 'android') {
80+
indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html');
81+
} else {
82+
indexPath = path.join('platforms', platform, 'www', 'index.html');
83+
}
84+
85+
if(fs.existsSync(indexPath)) {
86+
addPlatformBodyTag(indexPath, platform);
87+
}
88+
89+
} catch(e) {
90+
process.stdout.write(e);
91+
}
92+
}
93+
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* After prepare, files are copied to the platforms/ios and platforms/android folders.
5+
* Lets clean up some of those files that arent needed with this hook.
6+
*/
7+
var fs = require('fs');
8+
var path = require('path');
9+
10+
var deleteFolderRecursive = function(removePath) {
11+
if( fs.existsSync(removePath) ) {
12+
fs.readdirSync(removePath).forEach(function(file,index){
13+
var curPath = path.join(removePath, file);
14+
if(fs.lstatSync(curPath).isDirectory()) { // recurse
15+
deleteFolderRecursive(curPath);
16+
} else { // delete file
17+
fs.unlinkSync(curPath);
18+
}
19+
});
20+
fs.rmdirSync(removePath);
21+
}
22+
};
23+
24+
var iosPlatformsDir = path.resolve(__dirname, '../../platforms/ios/www/lib/ionic/scss');
25+
var androidPlatformsDir = path.resolve(__dirname, '../../platforms/android/assets/www/lib/ionic/scss');
26+
27+
deleteFolderRecursive(iosPlatformsDir);
28+
deleteFolderRecursive(androidPlatformsDir);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env node
2+
3+
/**
4+
* On a fresh clone, the local platforms/ and plugins/ directories will be
5+
* missing, so ensure they get created before the first platform is added.
6+
*/
7+
var fs = require('fs');
8+
var path = require('path');
9+
10+
var platformsDir = path.resolve(__dirname, '../../platforms');
11+
var pluginsDir = path.resolve(__dirname, '../../plugins');
12+
13+
try {
14+
fs.mkdirSync(platformsDir, function (err) {
15+
if (err) { console.error(err); }
16+
});
17+
} catch(ex) {}
18+
19+
try {
20+
fs.mkdirSync(pluginsDir, function (err) {
21+
if (err) { console.error(err); }
22+
});
23+
} catch(ex) {}

ionic.project

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "sample",
3+
"app_id": ""
4+
}

package.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "sample",
3+
"version": "1.0.0",
4+
"description": "sample: An Ionic project",
5+
"dependencies": {
6+
"gulp": "^3.5.6",
7+
"gulp-sass": "^1.3.3",
8+
"gulp-concat": "^2.2.0",
9+
"gulp-minify-css": "^0.3.0",
10+
"gulp-rename": "^1.2.0"
11+
},
12+
"devDependencies": {
13+
"bower": "^1.3.3",
14+
"gulp-util": "^2.2.14",
15+
"shelljs": "^0.3.0"
16+
},
17+
"cordovaPlugins": [
18+
"cordova-plugin-x-toast"
19+
],
20+
"cordovaPlatforms": []
21+
}

platforms/platforms.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

0 commit comments

Comments
 (0)