diff --git a/demo/README.md b/demo/README.md deleted file mode 100644 index 1e806eb..0000000 --- a/demo/README.md +++ /dev/null @@ -1,88 +0,0 @@ -Ionic App Base -===================== - -A starting project for Ionic that optionally supports -using custom SCSS. - -## Using this project - -We recommend using the `ionic` utility to create new Ionic projects that are based on this project but use a ready-made starter template. - -For example, to start a new Ionic project with the default tabs interface, make sure the `ionic` utility is installed: - -```bash -$ sudo npm install -g ionic -``` - -Then run: - -```bash -$ sudo npm install -g ionic -$ ionic start myProject tabs -``` - -More info on this can be found on the Ionic [Getting Started](http://ionicframework.com/getting-started) page. - -## Installation - -While we recommend using the `ionic` utility to create new Ionic projects, you can use this repo as a barebones starting point to your next Ionic app. - -To use this project as is, first clone the repo from GitHub, then run: - -```bash -$ cd ionic-app-base -$ sudo npm install -g cordova ionic gulp -$ npm install -$ gulp install -``` - -## Using Sass (optional) - -This project makes it easy to use Sass (the SCSS syntax) in your projects. This enables you to override styles from Ionic, and benefit from -Sass's great features. - -Just update the `./scss/ionic.app.scss` file, and run `gulp` or `gulp watch` to rebuild the CSS files for Ionic. - -Note: if you choose to use the Sass method, make sure to remove the included `ionic.css` file in `index.html`, and then uncomment -the include to your `ionic.app.css` file which now contains all your Sass code and Ionic itself: - -```html - -``` - -## Updating Ionic - -To update to a new version of Ionic, open bower.json and change the version listed there. - -For example, to update from version `1.0.0-beta.4` to `1.0.0-beta.5`, open bower.json and change this: - -``` -"ionic": "driftyco/ionic-bower#1.0.0-beta.4" -``` - -To this: - -``` -"ionic": "driftyco/ionic-bower#1.0.0-beta.5" -``` - -After saving the update to bower.json file, run `gulp install`. - -Alternatively, install bower globally with `npm install -g bower` and run `bower install`. - -#### Using the Nightly Builds of Ionic - -If you feel daring and want use the bleeding edge 'Nightly' version of Ionic, change the version of Ionic in your bower.json to this: - -``` -"ionic": "driftyco/ionic-bower#master" -``` - -Warning: the nightly version is not stable. - - -## 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! - diff --git a/demo/bower.json b/demo/bower.json deleted file mode 100644 index 2202afd..0000000 --- a/demo/bower.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "HelloIonic", - "private": "true", - "devDependencies": { - "ionic": "driftyco/ionic-bower#1.0.0-beta.9" - } -} diff --git a/demo/config.xml b/demo/config.xml deleted file mode 100644 index 1853b4b..0000000 --- a/demo/config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - demo - - An Ionic Framework and Cordova project. - - - Ionic Framework Team - - - - - - - - - - - \ No newline at end of file diff --git a/demo/hooks/README.md b/demo/hooks/README.md deleted file mode 100644 index d2563ea..0000000 --- a/demo/hooks/README.md +++ /dev/null @@ -1,83 +0,0 @@ - -# 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 writting 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/) - diff --git a/demo/hooks/after_prepare/010_add_platform_class.js b/demo/hooks/after_prepare/010_add_platform_class.js deleted file mode 100755 index bda3e41..0000000 --- a/demo/hooks/after_prepare/010_add_platform_class.js +++ /dev/null @@ -1,94 +0,0 @@ -#!/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(/])(.*?)>/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 - - - - -Keyboard.hideKeyboardAccessoryBar -================= - -Hide the keyboard accessory bar with the next, previous and done buttons. - - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false); - -Supported Platforms -------------------- - -- iOS - - -Keyboard.close -================= - -Close the keyboard if it is open. - - cordova.plugins.Keyboard.close(); - -Supported Platforms -------------------- - -- iOS, Android - - -Keyboard.disableScroll -================= - -Disable native scrolling, useful if you are using JavaScript to scroll - - cordova.plugins.Keyboard.disableScroll(true); - cordova.plugins.Keyboard.disableScroll(false); - -Supported Platforms -------------------- - -- iOS - - -native.keyboardshow -================= - -This event fires when the keyboard will be shown - - window.addEventListener('native.keyboardshow', keyboardShowHandler); - - function keyboardShowHandler(e){ - alert('Keyboard height is: ' + e.keyboardHeight); - } - -Properties ------------ - -keyboardHeight: the height of the keyboard in pixels - - -Supported Platforms -------------------- - -- iOS, Android - - -native.keyboardhide -================= - -This event fires when the keyboard will hide - - window.addEventListener('native.keyboardhide', keyboardHideHandler); - - function keyboardHideHandler(e){ - alert('Goodnight, sweet prince'); - } - -Properties ------------ - -None - -Supported Platforms -------------------- - -- iOS, Android diff --git a/demo/plugins/com.ionic.keyboard/package.json b/demo/plugins/com.ionic.keyboard/package.json deleted file mode 100644 index a3a00c7..0000000 --- a/demo/plugins/com.ionic.keyboard/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "version": "1.0.2", - "name": "com.ionic.keyboard", - "cordova_name": "Keyboard", - "description": "Ionic Keyboard Plugin", - "repo": "https://github.com/driftyco/ionic-plugins-keyboard.git", - "issue": "https://github.com/driftyco/ionic-plugins-keyboard/issues", - "license": "MIT", - "keywords": [ - "ionic", - "keyboard" - ] -} diff --git a/demo/plugins/com.ionic.keyboard/plugin.xml b/demo/plugins/com.ionic.keyboard/plugin.xml deleted file mode 100644 index 3d94494..0000000 --- a/demo/plugins/com.ionic.keyboard/plugin.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - Keyboard - Ionic Keyboard Plugin - Apache 2.0 - Ionic,keyboard - https://github.com/driftyco/ionic-plugins-keyboard.git - https://github.com/driftyco/ionic-plugins-keyboard/issues - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/plugins/com.ionic.keyboard/src/android/IonicKeyboard.java b/demo/plugins/com.ionic.keyboard/src/android/IonicKeyboard.java deleted file mode 100644 index ae0cbc3..0000000 --- a/demo/plugins/com.ionic.keyboard/src/android/IonicKeyboard.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.ionic.keyboard; - -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaInterface; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.PluginResult.Status; -import org.json.JSONArray; -import org.json.JSONException; - -import android.content.Context; -import android.graphics.Rect; -import android.util.DisplayMetrics; -import android.view.View; -import android.view.ViewTreeObserver.OnGlobalLayoutListener; -import android.view.inputmethod.InputMethodManager; - -public class IonicKeyboard extends CordovaPlugin{ - - public void initialize(CordovaInterface cordova, CordovaWebView webView) { - super.initialize(cordova, webView); - - //calculate density-independent pixels (dp) - //http://developer.android.com/guide/practices/screens_support.html - DisplayMetrics dm = new DisplayMetrics(); - cordova.getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm); - final float density = dm.density; - - final CordovaWebView appView = webView; - - //http://stackoverflow.com/a/4737265/1091751 detect if keyboard is showing - final View rootView = cordova.getActivity().getWindow().getDecorView().findViewById(android.R.id.content).getRootView(); - OnGlobalLayoutListener list = new OnGlobalLayoutListener() { - int previousHeightDiff = 0; - @Override - public void onGlobalLayout() { - Rect r = new Rect(); - //r will be populated with the coordinates of your view that area still visible. - rootView.getWindowVisibleDisplayFrame(r); - - int heightDiff = rootView.getRootView().getHeight() - (r.bottom - r.top); - int pixelHeightDiff = (int)(heightDiff / density); - if (pixelHeightDiff > 100 && pixelHeightDiff != previousHeightDiff) { // if more than 100 pixels, its probably a keyboard... - appView.sendJavascript("cordova.plugins.Keyboard.isVisible = true"); - appView.sendJavascript("cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight':" + Integer.toString(pixelHeightDiff)+"});"); - - //deprecated - appView.sendJavascript("cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight':" + Integer.toString(pixelHeightDiff)+"});"); - } - else if ( pixelHeightDiff != previousHeightDiff && ( previousHeightDiff - pixelHeightDiff ) > 100 ){ - appView.sendJavascript("cordova.plugins.Keyboard.isVisible = false"); - appView.sendJavascript("cordova.fireWindowEvent('native.keyboardhide')"); - - //deprecated - appView.sendJavascript("cordova.fireWindowEvent('native.hidekeyboard')"); - } - previousHeightDiff = pixelHeightDiff; - } - }; - - rootView.getViewTreeObserver().addOnGlobalLayoutListener(list); - } - - public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { - if ("close".equals(action)) { - cordova.getThreadPool().execute(new Runnable() { - public void run() { - //http://stackoverflow.com/a/7696791/1091751 - InputMethodManager inputManager = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); - View v = cordova.getActivity().getCurrentFocus(); - - if (v == null) { - callbackContext.error("No current focus"); - } - inputManager.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); - callbackContext.success(); // Thread-safe. - } - }); - return true; - } - return false; // Returning false results in a "MethodNotFound" error. - } - - -} - diff --git a/demo/plugins/com.ionic.keyboard/src/ios/IonicKeyboard.h b/demo/plugins/com.ionic.keyboard/src/ios/IonicKeyboard.h deleted file mode 100644 index b54f430..0000000 --- a/demo/plugins/com.ionic.keyboard/src/ios/IonicKeyboard.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -@interface IonicKeyboard : CDVPlugin { - @protected - id _keyboardShowObserver, _keyboardHideObserver; -} - -@property (readwrite, assign) BOOL hideKeyboardAccessoryBar; -@property (readwrite, assign) BOOL disableScroll; -//@property (readwrite, assign) BOOL styleDark; - -@end - diff --git a/demo/plugins/com.ionic.keyboard/src/ios/IonicKeyboard.m b/demo/plugins/com.ionic.keyboard/src/ios/IonicKeyboard.m deleted file mode 100644 index 1e3639f..0000000 --- a/demo/plugins/com.ionic.keyboard/src/ios/IonicKeyboard.m +++ /dev/null @@ -1,156 +0,0 @@ -#import "IonicKeyboard.h" -#import "UIWebViewExtension.h" -#import - -@implementation IonicKeyboard - -@synthesize hideKeyboardAccessoryBar = _hideKeyboardAccessoryBar; -@synthesize disableScroll = _disableScroll; -//@synthesize styleDark = _styleDark; - -- (void)pluginInitialize { - - NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; - __weak IonicKeyboard* weakSelf = self; - - //set defaults - self.hideKeyboardAccessoryBar = NO; - self.disableScroll = NO; - //self.styleDark = NO; - - _keyboardShowObserver = [nc addObserverForName:UIKeyboardWillShowNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification* notification) { - - CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; - keyboardFrame = [self.viewController.view convertRect:keyboardFrame fromView:nil]; - - [weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.plugins.Keyboard.isVisible = true; cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]]; - - //deprecated - [weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]]; - }]; - - _keyboardHideObserver = [nc addObserverForName:UIKeyboardWillHideNotification - object:nil - queue:[NSOperationQueue mainQueue] - usingBlock:^(NSNotification* notification) { - [weakSelf.commandDelegate evalJs:@"cordova.plugins.Keyboard.isVisible = false; cordova.fireWindowEvent('native.keyboardhide'); "]; - - //deprecated - [weakSelf.commandDelegate evalJs:@"cordova.fireWindowEvent('native.hidekeyboard'); "]; - }]; -} -- (BOOL)disableScroll { - return _disableScroll; -} - -- (void)setDisableScroll:(BOOL)disableScroll { - if (disableScroll == _disableScroll) { - return; - } - if (disableScroll) { - self.webView.scrollView.scrollEnabled = NO; - self.webView.scrollView.delegate = self; - } - else { - self.webView.scrollView.scrollEnabled = YES; - self.webView.scrollView.delegate = nil; - } - - _disableScroll = disableScroll; -} - - -- (BOOL)hideKeyboardAccessoryBar { - return _hideKeyboardAccessoryBar; -} - -- (void)setHideKeyboardAccessoryBar:(BOOL)hideKeyboardAccessoryBar { - if (hideKeyboardAccessoryBar == _hideKeyboardAccessoryBar) { - return; - } - if (hideKeyboardAccessoryBar) { - self.webView.hackishlyHidesInputAccessoryView = YES; - } - else { - self.webView.hackishlyHidesInputAccessoryView = NO; - } - - _hideKeyboardAccessoryBar = hideKeyboardAccessoryBar; -} - -/* -- (BOOL)styleDark { - return _styleDark; -} - -- (void)setStyleDark:(BOOL)styleDark { - if (styleDark == _styleDark) { - return; - } - if (styleDark) { - self.webView.styleDark = YES; - } - else { - self.webView.styleDark = NO; - } - - _styleDark = styleDark; -} -*/ - - -/* ------------------------------------------------------------- */ - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - [scrollView setContentOffset: CGPointZero]; -} - -/* ------------------------------------------------------------- */ - -- (void)dealloc { - NSNotificationCenter* nc = [NSNotificationCenter defaultCenter]; - - [nc removeObserver:self name:UIKeyboardWillShowNotification object:nil]; - [nc removeObserver:self name:UIKeyboardWillHideNotification object:nil]; -} - -/* ------------------------------------------------------------- */ - -- (void) disableScroll:(CDVInvokedUrlCommand*)command { - if (!command.arguments || ![command.arguments count]){ - return; - } - id value = [command.arguments objectAtIndex:0]; - - self.disableScroll = [value boolValue]; -} - -- (void) hideKeyboardAccessoryBar:(CDVInvokedUrlCommand*)command { - if (!command.arguments || ![command.arguments count]){ - return; - } - id value = [command.arguments objectAtIndex:0]; - - self.hideKeyboardAccessoryBar = [value boolValue]; -} - -- (void) close:(CDVInvokedUrlCommand*)command { - [self.webView endEditing:YES]; -} - -/* -- (void) styleDark:(CDVInvokedUrlCommand*)command { - if (!command.arguments || ![command.arguments count]){ - return; - } - id value = [command.arguments objectAtIndex:0]; - - self.styleDark = [value boolValue]; -} -*/ - -@end - diff --git a/demo/plugins/com.ionic.keyboard/src/ios/UIWebViewExtension.h b/demo/plugins/com.ionic.keyboard/src/ios/UIWebViewExtension.h deleted file mode 100644 index 1d6c293..0000000 --- a/demo/plugins/com.ionic.keyboard/src/ios/UIWebViewExtension.h +++ /dev/null @@ -1,4 +0,0 @@ -@interface UIWebView (HackishAccessoryHiding) -@property (nonatomic, assign) BOOL hackishlyHidesInputAccessoryView; -//@property (nonatomic, assign) BOOL styleDark; -@end diff --git a/demo/plugins/com.ionic.keyboard/src/ios/UIWebViewExtension.m b/demo/plugins/com.ionic.keyboard/src/ios/UIWebViewExtension.m deleted file mode 100644 index 25403e6..0000000 --- a/demo/plugins/com.ionic.keyboard/src/ios/UIWebViewExtension.m +++ /dev/null @@ -1,109 +0,0 @@ -#import -#import -#import "UIWebViewExtension.h" - -//Credit: https://gist.github.com/bjhomer/2048571 -//Also: http://stackoverflow.com/a/23398487/1091751 -@implementation UIWebView (HackishAccessoryHiding) - -static const char * const hackishFixClassName = "UIWebBrowserViewMinusAccessoryView"; -static Class hackishFixClass = Nil; - -- (UIView *)hackishlyFoundBrowserView { - UIScrollView *scrollView = self.scrollView; - - UIView *browserView = nil; - for (UIView *subview in scrollView.subviews) { - if ([NSStringFromClass([subview class]) hasPrefix:@"UIWebBrowserView"]) { - browserView = subview; - break; - } - } - return browserView; -} - -- (id)methodReturningNil { - return nil; -} - -- (void)ensureHackishSubclassExistsOfBrowserViewClass:(Class)browserViewClass { - if (!hackishFixClass) { - Class newClass = objc_allocateClassPair(browserViewClass, hackishFixClassName, 0); - IMP nilImp = [self methodForSelector:@selector(methodReturningNil)]; - class_addMethod(newClass, @selector(inputAccessoryView), nilImp, "@@:"); - objc_registerClassPair(newClass); - - hackishFixClass = newClass; - } -} - -- (BOOL) hackishlyHidesInputAccessoryView { - UIView *browserView = [self hackishlyFoundBrowserView]; - return [browserView class] == hackishFixClass; -} - -- (void) setHackishlyHidesInputAccessoryView:(BOOL)value { - UIView *browserView = [self hackishlyFoundBrowserView]; - if (browserView == nil) { - return; - } - [self ensureHackishSubclassExistsOfBrowserViewClass:[browserView class]]; - - if (value) { - object_setClass(browserView, hackishFixClass); - } - else { - Class normalClass = objc_getClass("UIWebBrowserView"); - object_setClass(browserView, normalClass); - } - [browserView reloadInputViews]; -} -/* ---------------------------------------------------------------- */ - -/* -- (UIKeyboardAppearance) darkKeyboardAppearanceTemplateMethod { - return UIKeyboardAppearanceDark; -} - -- (UIKeyboardAppearance) lightKeyboardAppearanceTemplateMethod { - return UIKeyboardAppearanceLight; -} - -- (BOOL) styleDark { - UIView *browserView = [self hackishlyFoundBrowserView]; - if (browserView == nil) { - return false; - } - - Method m = class_getInstanceMethod( [self class], @selector( darkKeyboardAppearanceTemplateMethod ) ); - IMP imp = method_getImplementation( m ); - - Method m2 = class_getInstanceMethod( [browserView class], @selector(keyboardAppearance) ); - IMP imp2 = method_getImplementation( m2 ); - - return imp == imp2; -} - -- (void) setStyleDark:(BOOL)styleDark { - UIView *browserView = [self hackishlyFoundBrowserView]; - if (browserView == nil) { - return; - } - - if ( styleDark ) { - Method m = class_getInstanceMethod( [self class], @selector( darkKeyboardAppearanceTemplateMethod ) ); - IMP imp = method_getImplementation( m ); - const char* typeEncoding = method_getTypeEncoding( m ); - class_replaceMethod( [browserView class], @selector(keyboardAppearance), imp, typeEncoding ); - } - else { - Method m = class_getInstanceMethod( [self class], @selector( lightKeyboardAppearanceTemplateMethod ) ); - IMP imp = method_getImplementation( m ); - const char* typeEncoding = method_getTypeEncoding( m ); - class_replaceMethod( [browserView class], @selector(keyboardAppearance), imp, typeEncoding ); - } -} -*/ - -@end - diff --git a/demo/plugins/com.ionic.keyboard/www/keyboard.js b/demo/plugins/com.ionic.keyboard/www/keyboard.js deleted file mode 100644 index 0145dc1..0000000 --- a/demo/plugins/com.ionic.keyboard/www/keyboard.js +++ /dev/null @@ -1,32 +0,0 @@ - -var argscheck = require('cordova/argscheck'), - utils = require('cordova/utils'), - exec = require('cordova/exec'); - -var Keyboard = function() { -}; - -Keyboard.hideKeyboardAccessoryBar = function(hide) { - exec(null, null, "Keyboard", "hideKeyboardAccessoryBar", [hide]); -}; - -Keyboard.close = function() { - exec(null, null, "Keyboard", "close", []); -}; - -Keyboard.disableScroll = function(disable) { - exec(null, null, "Keyboard", "disableScroll", [disable]); -}; - -/* -Keyboard.styleDark = function(dark) { - exec(null, null, "Keyboard", "styleDark", [dark]); -}; -*/ - -Keyboard.isVisible = false; - -module.exports = Keyboard; - - - diff --git a/demo/plugins/ios.json b/demo/plugins/ios.json deleted file mode 100644 index 58fa2b5..0000000 --- a/demo/plugins/ios.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "prepare_queue": { - "installed": [], - "uninstalled": [] - }, - "config_munge": { - "files": { - "config.xml": { - "parents": { - "/*": [ - { - "xml": "", - "count": 1 - }, - { - "xml": "", - "count": 1 - }, - { - "xml": "", - "count": 1 - }, - { - "xml": "", - "count": 2 - } - ] - } - } - } - }, - "installed_plugins": { - "com.ionic.keyboard": { - "PACKAGE_NAME": "com.ionicframework.demo962822" - }, - "org.apache.cordova.console": { - "PACKAGE_NAME": "com.ionicframework.demo962822" - }, - "org.apache.cordova.device": { - "PACKAGE_NAME": "com.ionicframework.demo962822" - }, - "org.pbernasconi.progressIndicator": { - "PACKAGE_NAME": "com.ionicframework.demo962822" - }, - "org.pbernasconi.progressindicator": { - "PACKAGE_NAME": "com.ionicframework.demo962822" - } - }, - "dependent_plugins": {} -} \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.console/.fetch.json b/demo/plugins/org.apache.cordova.console/.fetch.json deleted file mode 100644 index 067b3a9..0000000 --- a/demo/plugins/org.apache.cordova.console/.fetch.json +++ /dev/null @@ -1 +0,0 @@ -{"source":{"type":"local","path":"/Users/paolob/.plugman/cache/org.apache.cordova.console/0.2.9/package"}} \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.console/CONTRIBUTING.md b/demo/plugins/org.apache.cordova.console/CONTRIBUTING.md deleted file mode 100644 index f7dbcab..0000000 --- a/demo/plugins/org.apache.cordova.console/CONTRIBUTING.md +++ /dev/null @@ -1,37 +0,0 @@ - - -# Contributing to Apache Cordova - -Anyone can contribute to Cordova. And we need your contributions. - -There are multiple ways to contribute: report bugs, improve the docs, and -contribute code. - -For instructions on this, start with the -[contribution overview](http://cordova.apache.org/#contribute). - -The details are explained there, but the important items are: - - Sign and submit an Apache ICLA (Contributor License Agreement). - - Have a Jira issue open that corresponds to your contribution. - - Run the tests so your patch doesn't break existing functionality. - -We look forward to your contributions! diff --git a/demo/plugins/org.apache.cordova.console/LICENSE b/demo/plugins/org.apache.cordova.console/LICENSE deleted file mode 100644 index 7a4a3ea..0000000 --- a/demo/plugins/org.apache.cordova.console/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.console/NOTICE b/demo/plugins/org.apache.cordova.console/NOTICE deleted file mode 100644 index 8ec56a5..0000000 --- a/demo/plugins/org.apache.cordova.console/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Cordova -Copyright 2012 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). diff --git a/demo/plugins/org.apache.cordova.console/README.md b/demo/plugins/org.apache.cordova.console/README.md deleted file mode 100644 index c7552cb..0000000 --- a/demo/plugins/org.apache.cordova.console/README.md +++ /dev/null @@ -1,22 +0,0 @@ - - -# org.apache.cordova.console - -Plugin documentation: [doc/index.md](doc/index.md) diff --git a/demo/plugins/org.apache.cordova.console/RELEASENOTES.md b/demo/plugins/org.apache.cordova.console/RELEASENOTES.md deleted file mode 100644 index 73d6a49..0000000 --- a/demo/plugins/org.apache.cordova.console/RELEASENOTES.md +++ /dev/null @@ -1,51 +0,0 @@ - -# Release Notes - -### 0.2.3 (Sept 25, 2013) -* CB-4889 bumping&resetting version -* CB-4889 renaming org.apache.cordova.core.console to org.apache.cordova.console -* Rename CHANGELOG.md -> RELEASENOTES.md -* [CB-4752] Incremented plugin version on dev branch. - - ### 0.2.4 (Oct 28, 2013) -* CB-5154 log formatting incorrectly to native -* CB-5128: added repo + issue tag to plugin.xml for console plugin -* [CB-4915] Incremented plugin version on dev branch. - -### 0.2.5 (Dec 4, 2013) -* add ubuntu platform - -### 0.2.6 (Jan 02, 2014) -* CB-5658 Add doc/index.md for Console plugin - -### 0.2.7 (Feb 05, 2014) -* Native console needs to be called DebugConsole to avoid ambiguous reference. This commit requires the 3.4.0 version of the native class factory -* CB-4718 fixed Console plugin not working on wp - -### 0.2.8 (Apr 17, 2014) -* CB-6460: Update license headers -* Add NOTICE file - -### 0.2.9 (Jun 05, 2014) -* CB-6848 Add Android quirk, list applicable platforms -* CB-6796 Add license -* CB-6491 add CONTRIBUTING.md diff --git a/demo/plugins/org.apache.cordova.console/doc/index.md b/demo/plugins/org.apache.cordova.console/doc/index.md deleted file mode 100644 index 437846f..0000000 --- a/demo/plugins/org.apache.cordova.console/doc/index.md +++ /dev/null @@ -1,36 +0,0 @@ - - -# org.apache.cordova.console - -This plugin is meant to ensure that console.log() is as useful as it can be. -It adds additional function for iOS, Ubuntu, Windows Phone 8, and Windows 8. If -you are happy with how console.log() works for you, then you probably -don't need this plugin. - -## Installation - - cordova plugin add org.apache.cordova.console - -### Android Quirks - -On some platforms other than Android, console.log() will act on multiple -arguments, such as console.log("1", "2", "3"). However, Android will act only -on the first argument. Subsequent arguments to console.log() will be ignored. -This plugin is not the cause of that, it is a limitation of Android itself. diff --git a/demo/plugins/org.apache.cordova.console/package.json b/demo/plugins/org.apache.cordova.console/package.json deleted file mode 100644 index 3ea6d90..0000000 --- a/demo/plugins/org.apache.cordova.console/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "version": "0.2.9", - "name": "org.apache.cordova.console", - "cordova_name": "Console", - "description": "Cordova Console Plugin", - "license": "Apache 2.0", - "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git", - "issue": "https://issues.apache.org/jira/browse/CB/component/12320644", - "keywords": [ - "cordova", - "console" - ], - "platforms": [ - "ios", - "ubuntu", - "wp7", - "wp8", - "windows8" - ], - "engines": [], - "englishdoc": "\n\n# org.apache.cordova.console\n\nThis plugin is meant to ensure that console.log() is as useful as it can be.\nIt adds additional function for iOS, Ubuntu, Windows Phone 8, and Windows 8. If\nyou are happy with how console.log() works for you, then you probably\ndon't need this plugin.\n\n## Installation\n\n cordova plugin add org.apache.cordova.console\n\n### Android Quirks\n\nOn some platforms other than Android, console.log() will act on multiple\narguments, such as console.log(\"1\", \"2\", \"3\"). However, Android will act only\non the first argument. Subsequent arguments to console.log() will be ignored.\nThis plugin is not the cause of that, it is a limitation of Android itself.\n" -} \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.console/plugin.xml b/demo/plugins/org.apache.cordova.console/plugin.xml deleted file mode 100644 index 00829de..0000000 --- a/demo/plugins/org.apache.cordova.console/plugin.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - Console - Cordova Console Plugin - Apache 2.0 - cordova,console - https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git - https://issues.apache.org/jira/browse/CB/component/12320644 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/plugins/org.apache.cordova.console/src/ios/CDVLogger.h b/demo/plugins/org.apache.cordova.console/src/ios/CDVLogger.h deleted file mode 100644 index 7cfb306..0000000 --- a/demo/plugins/org.apache.cordova.console/src/ios/CDVLogger.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - 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. - */ - -#import - -@interface CDVLogger : CDVPlugin - -- (void)logLevel:(CDVInvokedUrlCommand*)command; - -@end diff --git a/demo/plugins/org.apache.cordova.console/src/ios/CDVLogger.m b/demo/plugins/org.apache.cordova.console/src/ios/CDVLogger.m deleted file mode 100644 index fe99f6b..0000000 --- a/demo/plugins/org.apache.cordova.console/src/ios/CDVLogger.m +++ /dev/null @@ -1,38 +0,0 @@ -/* - 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. - */ - -#import "CDVLogger.h" -#import - -@implementation CDVLogger - -/* log a message */ -- (void)logLevel:(CDVInvokedUrlCommand*)command -{ - id level = [command.arguments objectAtIndex:0]; - id message = [command.arguments objectAtIndex:1]; - - if ([level isEqualToString:@"LOG"]) { - NSLog(@"%@", message); - } else { - NSLog(@"%@: %@", level, message); - } -} - -@end diff --git a/demo/plugins/org.apache.cordova.console/src/ubuntu/console.cpp b/demo/plugins/org.apache.cordova.console/src/ubuntu/console.cpp deleted file mode 100644 index 9de09f4..0000000 --- a/demo/plugins/org.apache.cordova.console/src/ubuntu/console.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed 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. - */ - -#include "console.h" - -#include - -Console::Console(Cordova *cordova) : CPlugin(cordova) { -} - -void Console::logLevel(int scId, int ecId, QString level, QString message) { - Q_UNUSED(scId) - Q_UNUSED(ecId) - - if (level != "LOG") - std::cout << "[" << level.toStdString() << "] "; - std::cout << message.toStdString() << std::endl; -} diff --git a/demo/plugins/org.apache.cordova.console/src/ubuntu/console.h b/demo/plugins/org.apache.cordova.console/src/ubuntu/console.h deleted file mode 100644 index 3f3d163..0000000 --- a/demo/plugins/org.apache.cordova.console/src/ubuntu/console.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed 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. - */ - -#ifndef CONSOLE_H_FDSVCXGFRS -#define CONSOLE_H_FDSVCXGFRS - -#include - -#include - -class Console : public CPlugin { - Q_OBJECT -public: - explicit Console(Cordova *cordova); - - virtual const QString fullName() override { - return Console::fullID(); - } - - virtual const QString shortName() override { - return "Console"; - } - - static const QString fullID() { - return "Console"; - } - -public slots: - void logLevel(int scId, int ecId, QString level, QString message); -}; - -#endif diff --git a/demo/plugins/org.apache.cordova.console/src/wp/DebugConsole.cs b/demo/plugins/org.apache.cordova.console/src/wp/DebugConsole.cs deleted file mode 100644 index 9bb5476..0000000 --- a/demo/plugins/org.apache.cordova.console/src/wp/DebugConsole.cs +++ /dev/null @@ -1,47 +0,0 @@ -/* - Licensed 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. -*/ - -using System; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; -using System.Diagnostics; - -namespace WPCordovaClassLib.Cordova.Commands -{ - public class DebugConsole : BaseCommand - { - public void logLevel(string options) - { - string[] args = JSON.JsonHelper.Deserialize(options); - string level = args[0]; - string msg = args[1]; - - if (level.Equals("LOG")) - { - Debug.WriteLine(msg); - } - else - { - Debug.WriteLine(level + ": " + msg); - } - } - } -} diff --git a/demo/plugins/org.apache.cordova.console/www/console-via-logger.js b/demo/plugins/org.apache.cordova.console/www/console-via-logger.js deleted file mode 100644 index 4095eb3..0000000 --- a/demo/plugins/org.apache.cordova.console/www/console-via-logger.js +++ /dev/null @@ -1,187 +0,0 @@ -/* - * - * 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. - * -*/ - -//------------------------------------------------------------------------------ - -var logger = require("./logger"); -var utils = require("cordova/utils"); - -//------------------------------------------------------------------------------ -// object that we're exporting -//------------------------------------------------------------------------------ -var console = module.exports; - -//------------------------------------------------------------------------------ -// copy of the original console object -//------------------------------------------------------------------------------ -var WinConsole = window.console; - -//------------------------------------------------------------------------------ -// whether to use the logger -//------------------------------------------------------------------------------ -var UseLogger = false; - -//------------------------------------------------------------------------------ -// Timers -//------------------------------------------------------------------------------ -var Timers = {}; - -//------------------------------------------------------------------------------ -// used for unimplemented methods -//------------------------------------------------------------------------------ -function noop() {} - -//------------------------------------------------------------------------------ -// used for unimplemented methods -//------------------------------------------------------------------------------ -console.useLogger = function (value) { - if (arguments.length) UseLogger = !!value; - - if (UseLogger) { - if (logger.useConsole()) { - throw new Error("console and logger are too intertwingly"); - } - } - - return UseLogger; -}; - -//------------------------------------------------------------------------------ -console.log = function() { - if (logger.useConsole()) return; - logger.log.apply(logger, [].slice.call(arguments)); -}; - -//------------------------------------------------------------------------------ -console.error = function() { - if (logger.useConsole()) return; - logger.error.apply(logger, [].slice.call(arguments)); -}; - -//------------------------------------------------------------------------------ -console.warn = function() { - if (logger.useConsole()) return; - logger.warn.apply(logger, [].slice.call(arguments)); -}; - -//------------------------------------------------------------------------------ -console.info = function() { - if (logger.useConsole()) return; - logger.info.apply(logger, [].slice.call(arguments)); -}; - -//------------------------------------------------------------------------------ -console.debug = function() { - if (logger.useConsole()) return; - logger.debug.apply(logger, [].slice.call(arguments)); -}; - -//------------------------------------------------------------------------------ -console.assert = function(expression) { - if (expression) return; - - var message = logger.format.apply(logger.format, [].slice.call(arguments, 1)); - console.log("ASSERT: " + message); -}; - -//------------------------------------------------------------------------------ -console.clear = function() {}; - -//------------------------------------------------------------------------------ -console.dir = function(object) { - console.log("%o", object); -}; - -//------------------------------------------------------------------------------ -console.dirxml = function(node) { - console.log(node.innerHTML); -}; - -//------------------------------------------------------------------------------ -console.trace = noop; - -//------------------------------------------------------------------------------ -console.group = console.log; - -//------------------------------------------------------------------------------ -console.groupCollapsed = console.log; - -//------------------------------------------------------------------------------ -console.groupEnd = noop; - -//------------------------------------------------------------------------------ -console.time = function(name) { - Timers[name] = new Date().valueOf(); -}; - -//------------------------------------------------------------------------------ -console.timeEnd = function(name) { - var timeStart = Timers[name]; - if (!timeStart) { - console.warn("unknown timer: " + name); - return; - } - - var timeElapsed = new Date().valueOf() - timeStart; - console.log(name + ": " + timeElapsed + "ms"); -}; - -//------------------------------------------------------------------------------ -console.timeStamp = noop; - -//------------------------------------------------------------------------------ -console.profile = noop; - -//------------------------------------------------------------------------------ -console.profileEnd = noop; - -//------------------------------------------------------------------------------ -console.count = noop; - -//------------------------------------------------------------------------------ -console.exception = console.log; - -//------------------------------------------------------------------------------ -console.table = function(data, columns) { - console.log("%o", data); -}; - -//------------------------------------------------------------------------------ -// return a new function that calls both functions passed as args -//------------------------------------------------------------------------------ -function wrappedOrigCall(orgFunc, newFunc) { - return function() { - var args = [].slice.call(arguments); - try { orgFunc.apply(WinConsole, args); } catch (e) {} - try { newFunc.apply(console, args); } catch (e) {} - }; -} - -//------------------------------------------------------------------------------ -// For every function that exists in the original console object, that -// also exists in the new console object, wrap the new console method -// with one that calls both -//------------------------------------------------------------------------------ -for (var key in console) { - if (typeof WinConsole[key] == "function") { - console[key] = wrappedOrigCall(WinConsole[key], console[key]); - } -} diff --git a/demo/plugins/org.apache.cordova.console/www/logger.js b/demo/plugins/org.apache.cordova.console/www/logger.js deleted file mode 100644 index cbf81b9..0000000 --- a/demo/plugins/org.apache.cordova.console/www/logger.js +++ /dev/null @@ -1,355 +0,0 @@ -/* - * - * 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. - * -*/ - -//------------------------------------------------------------------------------ -// The logger module exports the following properties/functions: -// -// LOG - constant for the level LOG -// ERROR - constant for the level ERROR -// WARN - constant for the level WARN -// INFO - constant for the level INFO -// DEBUG - constant for the level DEBUG -// logLevel() - returns current log level -// logLevel(value) - sets and returns a new log level -// useConsole() - returns whether logger is using console -// useConsole(value) - sets and returns whether logger is using console -// log(message,...) - logs a message at level LOG -// error(message,...) - logs a message at level ERROR -// warn(message,...) - logs a message at level WARN -// info(message,...) - logs a message at level INFO -// debug(message,...) - logs a message at level DEBUG -// logLevel(level,message,...) - logs a message specified level -// -//------------------------------------------------------------------------------ - -var logger = exports; - -var exec = require('cordova/exec'); -var utils = require('cordova/utils'); - -var UseConsole = false; -var UseLogger = true; -var Queued = []; -var DeviceReady = false; -var CurrentLevel; - -var originalConsole = console; - -/** - * Logging levels - */ - -var Levels = [ - "LOG", - "ERROR", - "WARN", - "INFO", - "DEBUG" -]; - -/* - * add the logging levels to the logger object and - * to a separate levelsMap object for testing - */ - -var LevelsMap = {}; -for (var i=0; i 0){ - formatArgs.unshift(fmtString); // add formatString - } - - var message = logger.format.apply(logger.format, formatArgs); - - if (LevelsMap[level] === null) { - throw new Error("invalid logging level: " + level); - } - - if (LevelsMap[level] > CurrentLevel) return; - - // queue the message if not yet at deviceready - if (!DeviceReady && !UseConsole) { - Queued.push([level, message]); - return; - } - - // Log using the native logger if that is enabled - if (UseLogger) { - exec(null, null, "Console", "logLevel", [level, message]); - } - - // Log using the console if that is enabled - if (UseConsole) { - // make sure console is not using logger - if (console.useLogger()) { - throw new Error("console and logger are too intertwingly"); - } - - // log to the console - switch (level) { - case logger.LOG: originalConsole.log(message); break; - case logger.ERROR: originalConsole.log("ERROR: " + message); break; - case logger.WARN: originalConsole.log("WARN: " + message); break; - case logger.INFO: originalConsole.log("INFO: " + message); break; - case logger.DEBUG: originalConsole.log("DEBUG: " + message); break; - } - } -}; - - -/** - * Formats a string and arguments following it ala console.log() - * - * Any remaining arguments will be appended to the formatted string. - * - * for rationale, see FireBug's Console API: - * http://getfirebug.com/wiki/index.php/Console_API - */ -logger.format = function(formatString, args) { - return __format(arguments[0], [].slice.call(arguments,1)).join(' '); -}; - - -//------------------------------------------------------------------------------ -/** - * Formats a string and arguments following it ala vsprintf() - * - * format chars: - * %j - format arg as JSON - * %o - format arg as JSON - * %c - format arg as '' - * %% - replace with '%' - * any other char following % will format it's - * arg via toString(). - * - * Returns an array containing the formatted string and any remaining - * arguments. - */ -function __format(formatString, args) { - if (formatString === null || formatString === undefined) return [""]; - if (arguments.length == 1) return [formatString.toString()]; - - if (typeof formatString != "string") - formatString = formatString.toString(); - - var pattern = /(.*?)%(.)(.*)/; - var rest = formatString; - var result = []; - - while (args.length) { - var match = pattern.exec(rest); - if (!match) break; - - var arg = args.shift(); - rest = match[3]; - result.push(match[1]); - - if (match[2] == '%') { - result.push('%'); - args.unshift(arg); - continue; - } - - result.push(__formatted(arg, match[2])); - } - - result.push(rest); - - var remainingArgs = [].slice.call(args); - remainingArgs.unshift(result.join('')); - return remainingArgs; -} - -function __formatted(object, formatChar) { - - try { - switch(formatChar) { - case 'j': - case 'o': return JSON.stringify(object); - case 'c': return ''; - } - } - catch (e) { - return "error JSON.stringify()ing argument: " + e; - } - - if ((object === null) || (object === undefined)) { - return Object.prototype.toString.call(object); - } - - return object.toString(); -} - - -//------------------------------------------------------------------------------ -// when deviceready fires, log queued messages -logger.__onDeviceReady = function() { - if (DeviceReady) return; - - DeviceReady = true; - - for (var i=0; i - -# Contributing to Apache Cordova - -Anyone can contribute to Cordova. And we need your contributions. - -There are multiple ways to contribute: report bugs, improve the docs, and -contribute code. - -For instructions on this, start with the -[contribution overview](http://cordova.apache.org/#contribute). - -The details are explained there, but the important items are: - - Sign and submit an Apache ICLA (Contributor License Agreement). - - Have a Jira issue open that corresponds to your contribution. - - Run the tests so your patch doesn't break existing functionality. - -We look forward to your contributions! diff --git a/demo/plugins/org.apache.cordova.device/LICENSE b/demo/plugins/org.apache.cordova.device/LICENSE deleted file mode 100644 index 7a4a3ea..0000000 --- a/demo/plugins/org.apache.cordova.device/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/NOTICE b/demo/plugins/org.apache.cordova.device/NOTICE deleted file mode 100644 index 8ec56a5..0000000 --- a/demo/plugins/org.apache.cordova.device/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Apache Cordova -Copyright 2012 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). diff --git a/demo/plugins/org.apache.cordova.device/README.md b/demo/plugins/org.apache.cordova.device/README.md deleted file mode 100644 index 5158f6f..0000000 --- a/demo/plugins/org.apache.cordova.device/README.md +++ /dev/null @@ -1,22 +0,0 @@ - - -# org.apache.cordova.device - -Plugin documentation: [doc/index.md](doc/index.md) diff --git a/demo/plugins/org.apache.cordova.device/RELEASENOTES.md b/demo/plugins/org.apache.cordova.device/RELEASENOTES.md deleted file mode 100644 index e368f97..0000000 --- a/demo/plugins/org.apache.cordova.device/RELEASENOTES.md +++ /dev/null @@ -1,71 +0,0 @@ - -# Release Notes - -### 0.2.1 (Sept 5, 2013) -* removed extraneous print statement -* [CB-4432] copyright notice change - -### 0.2.3 (Sept 25, 2013) -* CB-4889 bumping&resetting version -* [windows8] commandProxy has moved -* [BlackBerry10] removed uneeded permission tags in plugin.xml -* CB-4889 renaming org.apache.cordova.core.device to org.apache.cordova.device -* Rename CHANGELOG.md -> RELEASENOTES.md -* updated to use commandProxy for ffos -* add firefoxos support -* [CB-4752] Incremented plugin version on dev branch. - -### 0.2.4 (Oct 28, 2013) -* CB-5128: added repo + issue tag in plugin.xml for device plugin -* CB-5085 device.cordova returning wrong value -* [CB-4915] Incremented plugin version on dev branch. - -### 0.2.5 (Dec 4, 2013) -* CB-5316 Spell Cordova as a brand unless it's a command or script -* [ubuntu] use cordova/exec/proxy -* add ubuntu platform -* Modify Device.platform logic to use amazon-fireos as the platform for Amazon Devices -* 1. Added amazon-fireos platform. 2. Change to use cordova-amazon-fireos as the platform if user agent contains 'cordova-amazon-fireos' - -### 0.2.6 (Jan 02, 2014) -* CB-5658 Add doc/index.md for Device plugin -* CB-5504 Moving Telephony Logic out of Device - -### 0.2.7 (Jan 07, 2014) -* CB-5737 Fix exception on close caused by left over telephony code from CB-5504 - -### 0.2.8 (Feb 05, 2014) -* Tizen support added - -### 0.2.9 (Apr 17, 2014) -* CB-5105: [Android, windows8, WP, BlackBerry10] Removed dead code for device.version -* CB-6422: [windows8] use cordova/exec/proxy -* CB-6460: Update license headers -* Add NOTICE file - -### 0.2.10 (Jun 05, 2014) -* CB-6127 Spanish and French Translations added. Github close #12 -* Changing 1.5 to 2.0 -* added firefoxos version - conversion -* added firefoxos version -* CB-6800 Add license -* CB-6491 add CONTRIBUTING.md diff --git a/demo/plugins/org.apache.cordova.device/doc/de/index.md b/demo/plugins/org.apache.cordova.device/doc/de/index.md deleted file mode 100644 index ac2f344..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/de/index.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# org.apache.cordova.device - -Dieses Plugin definiert eine globale `device` -Objekt, das des Geräts Hard- und Software beschreibt. Das Objekt im globalen Gültigkeitsbereich ist es zwar nicht verfügbar bis nach dem `deviceready` Ereignis. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## Installation - - cordova plugin add org.apache.cordova.device - - -## Eigenschaften - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -Rufen Sie die Version von Cordova, die auf dem Gerät ausgeführt. - -### Unterstützte Plattformen - -* Amazon Fire OS -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 und 8 -* Windows 8 - -## device.model - -Die `device.model` gibt den Namen der Modell- oder des Geräts zurück. Der Wert wird vom Gerätehersteller festgelegt und kann zwischen den Versionen des gleichen Produkts unterschiedlich sein. - -### Unterstützte Plattformen - -* Android -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 und 8 -* Windows 8 - -### Kleines Beispiel - - / / Android: Nexus One gibt "Passion" (Nexus One Codename) / / Motorola Droid returns "Wühlmäuse" / / BlackBerry: Torch 9800 gibt "9800" / / iOS: für das iPad Mini gibt iPad2, 5; iPhone 5 ist iPhone 5,1. Finden Sie unter http://theiphonewiki.com/wiki/index.php?title=Models / / Var-Modell = device.model; - - -### Android Macken - -* Ruft den [Produktname][1] anstelle des [Modellnamens][2], das ist oft der Codename für die Produktion. Beispielsweise das Nexus One gibt `Passion` , und Motorola Droid gibt`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - [2]: http://developer.android.com/reference/android/os/Build.html#MODEL - -### Tizen Macken - -* Gibt z. B. das Gerätemodell von dem Kreditor zugeordnet,`TIZEN` - -### Windows Phone 7 und 8 Macken - -* Gibt das vom Hersteller angegebenen Gerätemodell zurück. Beispielsweise gibt der Samsung-Fokus`SGH-i917`. - -## device.name - -**Warnung**: `device.name` ist ab Version 2.3.0 veraltet. Verwendung `device.model` statt. - -## device.platform - -Name des Betriebssystems des Geräts zu erhalten. - - var string = device.platform; - - -### Unterstützte Plattformen - -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 und 8 -* Windows 8 - -### Kleines Beispiel - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 Macken - -Windows Phone 7 Geräte melden die Plattform als`WinCE`. - -### Windows Phone 8 Macken - -Windows Phone 8 Geräte melden die Plattform als`Win32NT`. - -## device.uuid - -Des Geräts Universally Unique Identifier ([UUID][3] zu erhalten). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### Beschreibung - -Die Details wie eine UUID generiert wird werden vom Gerätehersteller und beziehen sich auf die Plattform oder das Modell des Geräts. - -### Unterstützte Plattformen - -* Android -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 und 8 -* Windows 8 - -### Kleines Beispiel - - / / Android: wird eine zufällige 64-Bit-Ganzzahl (als Zeichenfolge, wieder!) / / die ganze Zahl wird beim ersten Start des Geräts erzeugt / / / / BlackBerry: gibt die PIN-Nummer des Gerätes / / Dies ist eine neunstellige eindeutige Ganzzahl (als String, obwohl!) / / / / iPhone: (paraphrasiert aus der Dokumentation zur UIDevice-Klasse) / / liefert eine Reihe von Hash-Werte, die aus mehreren Hardware erstellt identifiziert. - / / Es ist gewährleistet, dass für jedes Gerät eindeutig sein und kann nicht gebunden werden / / an den Benutzer weitergeleitet. - / / Windows Phone 7: gibt einen Hash des Gerät + aktueller Benutzer, / / wenn der Benutzer nicht definiert ist, eine Guid generiert und wird weiter bestehen, bis die app deinstalliert wird / / Tizen: gibt das Gerät IMEI (International Mobile Equipment Identity oder IMEI ist eine Zahl / / einzigartig für jedes GSM- und UMTS-Handy. - var deviceID = device.uuid; - - -### iOS Quirk - -Die `uuid` auf iOS ist nicht eindeutig auf ein Gerät, aber für jede Anwendung, für jede Installation variiert. Es ändert sich, wenn Sie löschen und neu die app installieren, und möglicherweise auch beim iOS zu aktualisieren, oder auch ein Upgrade möglich die app pro Version (scheinbaren in iOS 5.1). Die `uuid` ist kein zuverlässiger Wert. - -### Windows Phone 7 und 8 Macken - -Die `uuid` für Windows Phone 7 die Berechtigung erfordert `ID_CAP_IDENTITY_DEVICE` . Microsoft wird diese Eigenschaft wahrscheinlich bald abzuschaffen. Wenn die Funktion nicht verfügbar ist, generiert die Anwendung eine persistente Guid, die für die Dauer der Installation der Anwendung auf dem Gerät verwaltet wird. - -## device.version - -Version des Betriebssystems zu erhalten. - - var string = device.version; - - -### Unterstützte Plattformen - -* Android 2.1 + -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 und 8 -* Windows 8 - -### Kleines Beispiel - - / / Android: Froyo OS würde "2.2" zurück / / Eclair OS zurückkehren würde, "2.1", "2.0.1" oder "2.0" / / Version kann auch zurückgeben update Level "2.1-update1" / / / / BlackBerry: Torch 9800 mit OS 6.0 würde zurückgeben "6.0.0.600" / / / / iPhone: iOS 3.2 gibt "3.2" / / / / Windows Phone 7: liefert aktuelle OS-Versionsnummer, ex. on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/es/index.md b/demo/plugins/org.apache.cordova.device/doc/es/index.md deleted file mode 100644 index 052f2bb..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/es/index.md +++ /dev/null @@ -1,195 +0,0 @@ - - -# org.apache.cordova.device - -Este plugin define un global `device` objeto que describe del dispositivo hardware y software. Aunque el objeto está en el ámbito global, no está disponible hasta después de la `deviceready` evento. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## Instalación - - cordova plugin add org.apache.cordova.device - - -## Propiedades - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -Obtener la versión de Córdoba en el dispositivo. - -### Plataformas soportadas - -* Amazon fuego OS -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 y 8 -* Windows 8 - -## device.model - -El `device.model` devuelve el nombre del producto o modelo del dispositivo. El valor es fijado por el fabricante del dispositivo y puede variar entre versiones del mismo producto. - -### Plataformas soportadas - -* Android -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 y 8 -* Windows 8 - -### Ejemplo rápido - - // Android: Nexus One returns "Passion" (Nexus One code name) - // Motorola Droid returns "voles" - // BlackBerry: Torch 9800 returns "9800" - // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models - // - var model = device.model; - - -### Rarezas Android - -* Obtiene el [nombre del producto][1] en lugar del [nombre del modelo][2], que es a menudo el nombre de código de producción. Por ejemplo, el Nexus One devuelve `Passion` , y Motorola Droid devuelve`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - [2]: http://developer.android.com/reference/android/os/Build.html#MODEL - -### Rarezas Tizen - -* Devuelve el modelo de dispositivo asignado por el proveedor, por ejemplo,`TIZEN` - -### Windows Phone 7 y 8 rarezas - -* Devuelve el modelo de dispositivo especificado por el fabricante. Por ejemplo, devuelve el Samsung Focus`SGH-i917`. - -## device.name - -**ADVERTENCIA**: `device.name` es obsoleto desde la versión 2.3.0. Uso `device.model` en su lugar. - -## device.platform - -Obtener el nombre del sistema operativo del dispositivo. - - var string = device.platform; - - -### Plataformas soportadas - -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 y 8 -* Windows 8 - -### Ejemplo rápido - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 rarezas - -Dispositivos Windows Phone 7 informe de la plataforma`WinCE`. - -### Windows Phone 8 rarezas - -Dispositivos Windows Phone 8 Informe la plataforma como`Win32NT`. - -## device.uuid - -Obtener identificador universal única del dispositivo ([UUID][3]). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### Descripción - -Los detalles de cómo se genera un UUID son determinados por el fabricante del dispositivo y son específicos a la plataforma del dispositivo o modelo. - -### Plataformas soportadas - -* Android -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 y 8 -* Windows 8 - -### Ejemplo rápido - - / / Android: devuelve un entero de 64 bits al azar (como una cadena, otra vez!) / / el entero se genera en el primer arranque del dispositivo / / / / BlackBerry: devuelve el número PIN del dispositivo / / este es un entero único de nueve dígitos (como una cadena, aunque!) / / / / iPhone: (parafraseado de la documentación de la clase UIDevice) / / devuelve una cadena de valores hash creado a partir de múltiples hardware identifica. - / / Está garantizado para ser único para cada dispositivo y no puede ser atado / / a la cuenta de usuario. - / / Windows Phone 7: devuelve un hash de dispositivo + usuario actual, / / si el usuario no está definido, un guid se genera y persistirá hasta que se desinstala la aplicación / / Tizen: devuelve el dispositivo IMEI (identidad de equipo móvil internacional o IMEI es un número / / único para cada teléfono móvil GSM y UMTS. - var deviceID = device.uuid; - - -### iOS chanfle - -El `uuid` en iOS no es exclusiva de un dispositivo, pero varía para cada aplicación, para cada instalación. Cambia si borrar y volver a instalar la aplicación, y posiblemente también cuándo actualizar iOS, o incluso mejorar la aplicación por la versión (evidente en iOS 5.1). El `uuid` no es un valor confiable. - -### Windows Phone 7 y 8 rarezas - -El `uuid` para Windows Phone 7 requiere el permiso `ID_CAP_IDENTITY_DEVICE` . Microsoft pronto probablemente descartan esta propiedad. Si la capacidad no está disponible, la aplicación genera un guid persistente que se mantiene durante la duración de la instalación de la aplicación en el dispositivo. - -## device.version - -Obtiene la versión del sistema operativo. - - var string = device.version; - - -### Plataformas soportadas - -* Android 2.1 + -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 y 8 -* Windows 8 - -### Ejemplo rápido - - / / Android: Froyo OS volvería "2.2" / / Eclair OS volvería "2.1", "2.0.1" o "2.0" / / versión puede también devolver actualizar nivel "2.1-update1" / / / / BlackBerry: Torch 9800 OS 6.0 usando volvería "6.0.0.600" / / / / iPhone: iOS 3.2 devuelve "3.2" / / / / Windows Phone 7: devuelve el número de versión de sistema operativo actual, ex. on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/fr/index.md b/demo/plugins/org.apache.cordova.device/doc/fr/index.md deleted file mode 100644 index 633b5f9..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/fr/index.md +++ /dev/null @@ -1,213 +0,0 @@ - - -# org.apache.cordova.device - -Ce plugin définit un global `device` objet qui décrit le matériel et les logiciels de l'appareil. Bien que l'objet est dans la portée globale, il n'est pas disponible jusqu'après la `deviceready` événement. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## Installation - - cordova plugin add org.apache.cordova.device - - -## Propriétés - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -Retourne la version de Cordova en cours d'exécution sur l'appareil. - -### Plates-formes prises en charge - -* Amazon Fire OS -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Paciarelli -* Windows Phone 7 et 8 -* Windows 8 - -## device.model - -L'objet `device.model` retourne le nom du modèle de l'appareil/produit. Cette valeur est définie par le fabricant du périphérique et peut varier entre les différentes versions d'un même produit. - -### Plates-formes prises en charge - -* Android -* BlackBerry 10 -* iOS -* Paciarelli -* Windows Phone 7 et 8 -* Windows 8 - -### Petit exemple - - // Android : pour un Nexus One, la valeur retournée est "Passion" (le nom de code du Nexus One) - // pour un Motorola Droid, la valeur retournée est "voles" - // BlackBerry : pour un Torch 9800, la valeur retournée est "9800" - // iOS : pour un iPad Mini et un iPhone 5, les valeurs retournées sont "iPad2,5" et "iPhone 5,1" respectivement. Voir http://theiphonewiki.com/wiki/index.php?title=Models - // - var model = device.model; - - -### Quirks Android - -* Retourne le [nom du produit][1] au lieu du [nom du modèle][2], ce qui équivaut souvent au nom de code de production. Par exemple, `Passion` pour le Nexus One et `voles` pour le Motorola Droid. - - [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - [2]: http://developer.android.com/reference/android/os/Build.html#MODEL - -### Bizarreries de paciarelli - -* Retourne le modèle du dispositif, assigné par le vendeur, par exemple `TIZEN` - -### Windows Phone 7 et 8 Quirks - -* Retourne le modèle de l'appareil spécifié par le fabricant. Par exemple `SGH-i917` pour le Samsung Focus. - -## device.name - -**Avertissement**: `device.name` est obsolète depuis la version 2.3.0. Utilisation `device.model` à la place. - -## device.platform - -Retourne le nom du système d'exploitation de l'appareil. - - var string = device.platform; - - -### Plates-formes prises en charge - -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Paciarelli -* Windows Phone 7 et 8 -* Windows 8 - -### Petit exemple - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 Quirks - -Le nom de plate-forme retourné pour les appareils sous Windows Phone 7 est `WinCE`. - -### Notes au sujet de Windows Phone 8 - -Le nom de plate-forme retourné pour les appareils sous Windows Phone 8 est `Win32NT`. - -## device.uuid - -Retourne l'Identifiant Unique Universel de l'appareil ([UUID][3]). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### Description - -La façon dont est généré l'UUID est déterminée par le fabricant et est spécifique à la plate-forme ou le modèle de l'appareil. - -### Plates-formes prises en charge - -* Android -* BlackBerry 10 -* iOS -* Paciarelli -* Windows Phone 7 et 8 -* Windows 8 - -### Petit exemple - - // Android : retourne un nombre entier 64-bit aléatoire (sous la forme d'une chaîne de caractères, encore !) - // Ce nombre entier est généré lors du premier démarrage de l'appareil - // - // BlackBerry : retourne le numéro PIN de l'appareil - // Il s'agit d'un nombre entier unique à neuf chiffres (sous la forme d'une chaîne de caractères cependant !) - // - // iPhone : (copié depuis la documentation de la classe UIDevice) - // Retourne une chaîne de caractères générée à partir de plusieurs caractéristiques matérielles. - / / Il est garanti pour être unique pour chaque appareil et ne peut pas être lié / / pour le compte d'utilisateur. - // Windows Phone 7 : retourne un hashage généré à partir de appareil+utilisateur actuel, - // si aucun utilisateur n'est défini, un guid est généré persistera jusqu'à ce que l'application soit désinstallée - // Tizen : retourne le numéro IMEI (International Mobile Equipment Identity) de l'appareil, ce numéro est - // unique pour chaque téléphone GSM et UMTS. - var deviceID = device.uuid; - - -### Spécificités iOS - -Sur iOS, l'`uuid` n'est pas propre à un appareil mais varie pour chaque application et pour chaque installation d'une même application. Elle change si vous supprimez, puis réinstallez l'application, et éventuellement aussi quand vous mettre à jour d'iOS, ou même mettre à jour le soft par version (apparent dans iOS 5.1). Par conséquent, l'`uuid` n'est pas considéré comme fiable. - -### Windows Phone 7 et 8 Quirks - -Sous Windows Phone 7, l'autorisation `ID_CAP_IDENTITY_DEVICE` est requise afin d'accéder à l'`uuid`. Microsoft va probablement bientôt rendre cette propriété obsolète. Si la fonctionnalité n'est pas accessible, un guid persistant (maintenu pendant toute la durée de l'installation de l'application sur l'appareil) est généré. - -## device.version - -Retourne la version du système d'exploitation de l'appareil. - - var string = device.version; - - -### Plates-formes prises en charge - -* Android 2.1+ -* BlackBerry 10 -* iOS -* Paciarelli -* Windows Phone 7 et 8 -* Windows 8 - -### Petit exemple - - // Android : Froyo OS renvoie "2.2" - // Eclair OS renvoie "2.1", "2.0.1", ou "2.0" - // Peut également renvoyer par exemple "2.1-update1" - // - // BlackBerry : Torch 9800 sous OS 6.0 renvoie "6.0.0.600" - // - // iPhone : iOS 3.2 renvoie "3.2" - // - // Windows Phone 7 : renvoie la version actuelle de l'OS, par exemple on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/index.md b/demo/plugins/org.apache.cordova.device/doc/index.md deleted file mode 100644 index 9e5c677..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/index.md +++ /dev/null @@ -1,213 +0,0 @@ - - -# org.apache.cordova.device - -This plugin defines a global `device` object, which describes the device's hardware and software. -Although the object is in the global scope, it is not available until after the `deviceready` event. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - -## Installation - - cordova plugin add org.apache.cordova.device - -## Properties - -- device.cordova -- device.model -- device.name -- device.platform -- device.uuid -- device.version - -## device.cordova - -Get the version of Cordova running on the device. - -### Supported Platforms - -- Amazon Fire OS -- Android -- BlackBerry 10 -- Firefox OS -- iOS -- Tizen -- Windows Phone 7 and 8 -- Windows 8 - -## device.model - -The `device.model` returns the name of the device's model or -product. The value is set by the device manufacturer and may be -different across versions of the same product. - -### Supported Platforms - -- Android -- BlackBerry 10 -- iOS -- Tizen -- Windows Phone 7 and 8 -- Windows 8 - -### Quick Example - - // Android: Nexus One returns "Passion" (Nexus One code name) - // Motorola Droid returns "voles" - // BlackBerry: Torch 9800 returns "9800" - // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models - // - var model = device.model; - -### Android Quirks - -- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL), which is often the production code name. For example, the Nexus One returns `Passion`, and Motorola Droid returns `voles`. - -### Tizen Quirks - -- Returns the device model assigned by the vendor, for example, `TIZEN` - -### Windows Phone 7 and 8 Quirks - -- Returns the device model specified by the manufacturer. For example, the Samsung Focus returns `SGH-i917`. - -## device.name - -__WARNING__: `device.name` is deprecated as of version 2.3.0. Use `device.model` instead. - -## device.platform - -Get the device's operating system name. - - var string = device.platform; - -### Supported Platforms - -- Android -- BlackBerry 10 -- Firefox OS -- iOS -- Tizen -- Windows Phone 7 and 8 -- Windows 8 - -### Quick Example - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - -### Windows Phone 7 Quirks - -Windows Phone 7 devices report the platform as `WinCE`. - -### Windows Phone 8 Quirks - -Windows Phone 8 devices report the platform as `Win32NT`. - -## device.uuid - -Get the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)). - - var string = device.uuid; - -### Description - -The details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model. - -### Supported Platforms - -- Android -- BlackBerry 10 -- iOS -- Tizen -- Windows Phone 7 and 8 -- Windows 8 - -### Quick Example - - // Android: Returns a random 64-bit integer (as a string, again!) - // The integer is generated on the device's first boot - // - // BlackBerry: Returns the PIN number of the device - // This is a nine-digit unique integer (as a string, though!) - // - // iPhone: (Paraphrased from the UIDevice Class documentation) - // Returns a string of hash values created from multiple hardware identifies. - // It is guaranteed to be unique for every device and can't be tied - // to the user account. - // Windows Phone 7 : Returns a hash of device+current user, - // if the user is not defined, a guid is generated and will persist until the app is uninstalled - // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number - // unique to every GSM and UMTS mobile phone. - var deviceID = device.uuid; - -### iOS Quirk - -The `uuid` on iOS is not unique to a device, but varies for each -application, for each installation. It changes if you delete and -re-install the app, and possibly also when you upgrade iOS, or even -upgrade the app per version (apparent in iOS 5.1). The `uuid` is not -a reliable value. - -### Windows Phone 7 and 8 Quirks - -The `uuid` for Windows Phone 7 requires the permission -`ID_CAP_IDENTITY_DEVICE`. Microsoft will likely deprecate this -property soon. If the capability is not available, the application -generates a persistent guid that is maintained for the duration of the -application's installation on the device. - -## device.version - -Get the operating system version. - - var string = device.version; - -### Supported Platforms - -- Android 2.1+ -- BlackBerry 10 -- iOS -- Tizen -- Windows Phone 7 and 8 -- Windows 8 - -### Quick Example - - // Android: Froyo OS would return "2.2" - // Eclair OS would return "2.1", "2.0.1", or "2.0" - // Version can also return update level "2.1-update1" - // - // BlackBerry: Torch 9800 using OS 6.0 would return "6.0.0.600" - // - // iPhone: iOS 3.2 returns "3.2" - // - // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; - diff --git a/demo/plugins/org.apache.cordova.device/doc/it/index.md b/demo/plugins/org.apache.cordova.device/doc/it/index.md deleted file mode 100644 index 6d4242f..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/it/index.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# org.apache.cordova.device - -Questo plugin definisce un global `device` oggetto che descrive il dispositivo hardware e software. Sebbene l'oggetto sia in ambito globale, non è disponibile fino a dopo il `deviceready` evento. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## Installazione - - cordova plugin add org.apache.cordova.device - - -## Proprietà - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -Ottenere la versione di Cordova in esecuzione nel dispositivo. - -### Piattaforme supportate - -* Amazon fuoco OS -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 e 8 -* Windows 8 - -## device.model - -Il `device.model` restituisce il nome del modello del dispositivo o del prodotto. Il valore viene impostato dal produttore del dispositivo e può essere differente tra le versioni dello stesso prodotto. - -### Piattaforme supportate - -* Android -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 e 8 -* Windows 8 - -### Esempio rapido - - / / Android: Nexus One restituisce "Passione" (nome in codice Nexus One) / / Motorola Droid restituisce "arvicole" / / BlackBerry: Torch 9800 restituisce "9800" / / iOS: per l'iPad Mini, restituisce iPad2, 5; iPhone 5 è iPhone 5,1. Vedi http://theiphonewiki.com/wiki/index.php?title=Models / / modello var = device.model; - - -### Stranezze Android - -* Ottiene il [nome del prodotto][1] anziché il [nome del modello][2], che è spesso il nome di codice di produzione. Ad esempio, restituisce il Nexus One `Passion` , e Motorola Droid restituisce`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - [2]: http://developer.android.com/reference/android/os/Build.html#MODEL - -### Tizen stranezze - -* Restituisce il modello di dispositivo assegnato dal fornitore, ad esempio,`TIZEN` - -### Windows Phone 7 e 8 stranezze - -* Restituisce il modello di dispositivo specificato dal produttore. Ad esempio, restituisce il Samsung Focus`SGH-i917`. - -## device.name - -**Attenzione**: `device.name` è obsoleto a partire dalla versione 2.3.0. Uso `device.model` invece. - -## device.platform - -Ottenere il nome del sistema operativo del dispositivo. - - var string = device.platform; - - -### Piattaforme supportate - -* Android -* BlackBerry 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 e 8 -* Windows 8 - -### Esempio rapido - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 capricci - -Windows Phone 7 dispositivi segnalano la piattaforma come`WinCE`. - -### Windows Phone 8 stranezze - -Dispositivi Windows Phone 8 segnalano la piattaforma come`Win32NT`. - -## device.uuid - -Ottenere identificatore del dispositivo univoco universale ([UUID][3]). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### Descrizione - -I dettagli di come viene generato un UUID sono determinati dal produttore del dispositivo e sono specifici per la piattaforma o il modello del dispositivo. - -### Piattaforme supportate - -* Android -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 e 8 -* Windows 8 - -### Esempio rapido - - / / Android: restituisce un intero casuale di 64 bit (come stringa, ancora una volta!) / / il numero intero è generato al primo avvio del dispositivo / / / / BlackBerry: restituisce il numero PIN del dispositivo / / questo è un valore integer univoco a nove cifre (come stringa, benchè!) / / / / iPhone: (parafrasato dalla documentazione della classe UIDevice) / / restituisce una stringa di valori hash creata dall'hardware più identifica. - / / È garantito per essere unica per ogni dispositivo e non può essere legato / / per l'account utente. - / / Windows Phone 7: restituisce un hash dell'utente corrente, + dispositivo / / se l'utente non è definito, un guid generato e persisterà fino a quando l'applicazione viene disinstallata / / Tizen: restituisce il dispositivo IMEI (International Mobile Equipment Identity o IMEI è un numero / / unico per ogni cellulare GSM e UMTS. - var deviceID = device.uuid; - - -### iOS Quirk - -Il `uuid` su iOS non è univoco per un dispositivo, ma varia per ogni applicazione, per ogni installazione. Cambia se si elimina e re-installare l'app, e possibilmente anche quando aggiornare iOS o anche aggiornare l'app per ogni versione (apparente in iOS 5.1). Il `uuid` non è un valore affidabile. - -### Windows Phone 7 e 8 stranezze - -Il `uuid` per Windows Phone 7 richiede l'autorizzazione `ID_CAP_IDENTITY_DEVICE` . Microsoft probabilmente sarà presto deprecare questa proprietà. Se la funzionalità non è disponibile, l'applicazione genera un guid persistente che viene mantenuto per la durata dell'installazione dell'applicazione sul dispositivo. - -## device.version - -Ottenere la versione del sistema operativo. - - var string = device.version; - - -### Piattaforme supportate - -* Android 2.1 + -* BlackBerry 10 -* iOS -* Tizen -* Windows Phone 7 e 8 -* Windows 8 - -### Esempio rapido - - / / Android: Froyo OS sarebbe tornato "2.2" / / OS Eclair restituirebbe "2.1", "2.0.1" o "2.0" / / versione può restituire anche aggiornare il livello "2.1-update1" / / / / BlackBerry: Torch 9800 con OS 6.0 restituirebbe "6.0.0.600" / / / / iPhone: iOS 3.2 restituisce "3.2" / / / / Windows Phone 7: restituisce il numero di versione corrente del sistema operativo, es. on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/ja/index.md b/demo/plugins/org.apache.cordova.device/doc/ja/index.md deleted file mode 100644 index 9d78a58..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/ja/index.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# org.apache.cordova.device - -このプラグインをグローバル定義します `device` オブジェクトは、デバイスのハードウェアとソフトウェアについて説明します。 それは後まで利用可能なオブジェクトがグローバル スコープでは、 `deviceready` イベント。 - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## インストール - - cordova plugin add org.apache.cordova.device - - -## プロパティ - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -デバイスで実行されているコルドバのバージョンを取得します。 - -### サポートされているプラットフォーム - -* アマゾン火 OS -* アンドロイド -* ブラックベリー 10 -* Firefox の OS -* iOS -* Tizen -* Windows Phone 7 と 8 -* Windows 8 - -## device.model - -`device.model`、デバイスのモデルまたは製品の名前を返します。値は、デバイスの製造元によって設定され、同じ製品のバージョン間で異なる可能性があります。 - -### サポートされているプラットフォーム - -* アンドロイド -* ブラックベリー 10 -* iOS -* Tizen -* Windows Phone 7 と 8 -* Windows 8 - -### 簡単な例 - - //アンドロイド: ネクサス 1 つは「情熱」(ネクサス 1 つはコード名) を返します//モトローラドロイド「ハタネズミ」を返します。//ブラックベリー: トーチ 9800 を返します「9800」//iOS: iPad のミニ 5; iPad2 を返します。iPhone 5 は iPhone 5, 1 です。 Http://theiphonewiki.com/wiki/index.php?title=Models を参照してください//var モデル = device.model; - - -### Android の癖 - -* 生産コード名は[モデル名][1]の代わりに[製品名][2]を取得します。 たとえば、ネクサス 1 つを返します `Passion` 、Motorola のドロイドを返します`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#MODEL - [2]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - -### Tizen の癖 - -* たとえば、ベンダーによって割り当てられているデバイスのモデルを返します`TIZEN` - -### Windows Phone 7 と 8 癖 - -* 製造元によって指定されたデバイスのモデルを返します。たとえば、三星フォーカスを返します`SGH-i917`. - -## device.name - -**警告**: `device.name` バージョン 2.3.0 は推奨されません。使用 `device.model` 代わりに。 - -## device.platform - -デバイスのオペレーティング システム名を取得します。 - - var string = device.platform; - - -### サポートされているプラットフォーム - -* アンドロイド -* ブラックベリー 10 -* Firefox の OS -* iOS -* Tizen -* Windows Phone 7 と 8 -* Windows 8 - -### 簡単な例 - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 の癖 - -Windows Phone 7 デバイスとプラットフォームを報告します。`WinCE`. - -### Windows Phone 8 癖 - -Windows Phone 8 デバイスとプラットフォームを報告します。`Win32NT`. - -## device.uuid - -デバイスのユニバーサル ・ ユニーク識別子 ([UUID][3]を取得します。). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### 説明 - -UUID を生成する方法の詳細は、デバイスの製造元によって決定され、デバイスのプラットフォームやモデルに固有です。 - -### サポートされているプラットフォーム - -* アンドロイド -* ブラックベリー 10 -* iOS -* Tizen -* Windows Phone 7 と 8 -* Windows 8 - -### 簡単な例 - - //アンドロイド: ランダムな 64 ビットの整数 (を文字列として返します、再び !)/デバイスの最初の起動時に生成される整数/////ブラックベリー: デバイスのピン番号を返します//これは 9 桁の一意な整数 (を文字列としても !)////iPhone: (UIDevice クラスのドキュメントから言い換え)//識別複数のハードウェアから作成されたハッシュ値の文字列を返します。。 - //それはすべてのデバイスに対して一意であることが保証され、接続することはできません//ユーザー アカウント。 - //Windows Phone 7: デバイス + 現在のユーザーのハッシュを返します//ユーザーが定義されていない場合 guid が生成され、アプリがアンインストールされるまで保持されます//Tizen: デバイスの IMEI を返します (国際モバイル機器アイデンティティまたは IMEI は番号です//すべての GSM および UMTS の携帯電話に固有です。 - var deviceID = device.uuid; - - -### iOS の気まぐれ - -`uuid`IOS で、デバイスに固有はありませんインストールごと、アプリケーションごとに異なります。 削除、アプリを再インストールした場合に変更と多分またときアップグレード iOS の, またはもアップグレードするアプリ (iOS の 5.1 で明らかに) バージョンごと。 `uuid`は信頼性の高い値ではありません。 - -### Windows Phone 7 と 8 癖 - -`uuid`のために Windows Phone 7 には、権限が必要です `ID_CAP_IDENTITY_DEVICE` 。 Microsoft はすぐにこのプロパティを廃止して可能性があります。 機能が利用できない場合、アプリケーションはデバイスへのアプリケーションのインストールの持続期間のために保持されている永続的な guid を生成します。 - -## device.version - -オペレーティング システムのバージョンを取得します。 - - var string = device.version; - - -### サポートされているプラットフォーム - -* アンドロイド 2.1 + -* ブラックベリー 10 -* iOS -* Tizen -* Windows Phone 7 と 8 -* Windows 8 - -### 簡単な例 - - //アンドロイド: フローズン ヨーグルト OS は「2.2」を返します/エクレア OS は「2.1」、「2.0.1」、または「2.0」を返します//バージョンも返すことができます/レベル"2.1 update1"を更新////ブラックベリー: トーチ 9800 OS 6.0 を使用しては「6.0.0.600」を返します////iPhone: iOS 3.2 返します「3.2」////Windows Phone 7: ex 現在の OS のバージョン番号を返します。 on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/ko/index.md b/demo/plugins/org.apache.cordova.device/doc/ko/index.md deleted file mode 100644 index b78e583..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/ko/index.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# org.apache.cordova.device - -이 플러그인 정의 전역 `device` 개체, 디바이스의 하드웨어 및 소프트웨어에 설명 합니다. 개체는 전역 범위에서 비록 그것은 후까지 사용할 수 있는 `deviceready` 이벤트. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## 설치 - - cordova plugin add org.apache.cordova.device - - -## 속성 - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -코르도바는 장치에서 실행 중인 버전을 얻을. - -### 지원 되는 플랫폼 - -* 아마존 화재 운영 체제 -* 안 드 로이드 -* 블랙베리 10 -* Firefox 운영 체제 -* iOS -* Tizen -* Windows Phone 7과 8 -* 윈도우 8 - -## device.model - -`device.model`소자의 모델 또는 제품의 이름을 반환 합니다. 값 장치 제조업체에서 설정 되 고 동일 제품의 버전 간에 다를 수 있습니다. - -### 지원 되는 플랫폼 - -* 안 드 로이드 -* 블랙베리 10 -* iOS -* Tizen -* Windows Phone 7과 8 -* 윈도우 8 - -### 빠른 예제 - - / / 안 드 로이드: 넥서스 하나는 "열정" (넥서스 하나의 코드 이름)를 반환 합니다 / 모토로라 Droid 반환 "밭" / / / 블랙베리: 토치 9800 반환 "9800" / / iOS: iPad 미니, 반환 iPad2, 5; 아이폰 5 아이폰 5, 1 이다입니다. Http://theiphonewiki.com/wiki/index.php?title=Models 참조 / / var 모델 = device.model; - - -### 안 드 로이드 단점 - -* 어떤은 종종 프로덕션 코드 이름 대신 [제품 모델 이름][1], [제품 이름][2] 을 가져옵니다. 예를 들어 넥서스 하나 반환 합니다 `Passion` , 모토로라 Droid를 반환 합니다`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#MODEL - [2]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - -### Tizen 특수 - -* 예를 들어, 공급 업체에 의해 할당 된 디바이스 모델을 반환 합니다.`TIZEN` - -### Windows Phone 7, 8 특수 - -* 제조업체에서 지정 하는 장치 모델을 반환 합니다. 예를 들어 삼성 포커스를 반환 합니다.`SGH-i917`. - -## device.name - -**경고**: `device.name` 버전 2.3.0는 사용 되지 않습니다. 사용 `device.model` 대신. - -## device.platform - -장치의 운영 체제 이름을 얻을. - - var string = device.platform; - - -### 지원 되는 플랫폼 - -* 안 드 로이드 -* 블랙베리 10 -* Firefox 운영 체제 -* iOS -* Tizen -* Windows Phone 7과 8 -* 윈도우 8 - -### 빠른 예제 - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 단점 - -Windows Phone 7 장치 보고 플랫폼으로`WinCE`. - -### Windows Phone 8 단점 - -Windows Phone 8 장치 보고 플랫폼으로`Win32NT`. - -## device.uuid - -소자의 보편적으로 고유 식별자 ([UUID][3] 를 얻을합니다). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### 설명 - -UUID 생성 방법의 자세한 내용은 장치 제조업체에 의해 결정 됩니다 및 소자의 플랫폼 이나 모델. - -### 지원 되는 플랫폼 - -* 안 드 로이드 -* 블랙베리 10 -* iOS -* Tizen -* Windows Phone 7과 8 -* 윈도우 8 - -### 빠른 예제 - - / / 안 드 로이드: (문자열로 다시!) 임의의 64 비트 정수를 반환 합니다 / / 정수 장치의 첫 번째 부팅에서 생성 / / / / 블랙베리: 디바이스의 핀 번호를 반환 합니다 / / 이것은 9 자리 고유 정수 (문자열로 비록!) / / / / 아이폰: (UIDevice 클래스 설명서에서 읊 었) / / 문자열 여러 하드웨어에서 생성 하는 해시 값을 식별 하는 반환 합니다. - / 그것은 모든 장치에 대 한 고유 해야 보장 되 고 묶일 수 없습니다 / / / 사용자 계정에. - / / Windows Phone 7: 장치 + 현재 사용자의 해시를 반환 합니다 / / 사용자 정의 되지 않은 경우 guid 생성 되 고 응용 프로그램을 제거할 때까지 유지 됩니다 / / Tizen: 반환 장치 IMEI (국제 모바일 기기 식별 또는 IMEI 숫자입니다 / / 모든 GSM와 UMTS 휴대 전화 고유. - var deviceID = device.uuid; - - -### iOS 특질 - -`uuid`ios 장치에 고유 하지 않습니다 하지만 각 설치에 대 한 응용 프로그램 마다 다릅니다. 삭제 하 고 다시 애플 리 케이 션을 설치 하는 경우 변경 가능 하 게 또한 iOS를 업그레이드 하거나 때 버전 (iOS 5.1에에서 명백한) 당 응용 프로그램 업그레이드도 하 고. `uuid`은 신뢰할 수 있는 값이 아닙니다. - -### Windows Phone 7, 8 특수 - -`uuid`Windows Phone 7 필요 허가 `ID_CAP_IDENTITY_DEVICE` . Microsoft는 곧이 속성을 세웁니다 가능성이 것입니다. 기능을 사용할 수 없는 경우 응용 프로그램 장치에 응용 프로그램의 설치 하는 동안 유지 하는 영구 guid를 생성 합니다. - -## device.version - -운영 체제 버전을 얻을. - - var string = device.version; - - -### 지원 되는 플랫폼 - -* 안 드 로이드 2.1 + -* 블랙베리 10 -* iOS -* Tizen -* Windows Phone 7과 8 -* 윈도우 8 - -### 빠른 예제 - - / / 안 드 로이드: Froyo OS "2.2" 반환 / Eclair OS "2.1", "2.0.1", 또는 "2.0" 돌려보낼 것입니다 / / 버전 반환할 수 있습니다 / 업데이트 수준 "2.1 update1" / / / / 블랙베리: 토치 9800 OS 6.0을 사용 하 여 "6.0.0.600"를 반환 / / / / 아이폰: iOS 3.2 반환 "3.2" / / / / Windows Phone 7: 전 현재 운영 체제 버전 번호를 반환 합니다. on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/pl/index.md b/demo/plugins/org.apache.cordova.device/doc/pl/index.md deleted file mode 100644 index 9dab3f9..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/pl/index.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# org.apache.cordova.device - -Ten plugin określa globalne `device` obiekt, który opisuje urządzenia sprzętowe i programowe. Mimo, że obiekt jest w globalnym zasięgu, nie jest dostępne dopiero po `deviceready` zdarzenie. - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## Instalacji - - cordova plugin add org.apache.cordova.device - - -## Właściwości - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -Pobierz wersję Cordova działa na urządzeniu. - -### Obsługiwane platformy - -* Amazon ogień OS -* Android -* Jeżyna 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 i 8 -* Windows 8 - -## device.model - -`device.model`Zwraca nazwę modelu lub produktu. Wartość jest zestaw przez producenta urządzenia i mogą się różnić między wersjami tego samego produktu. - -### Obsługiwane platformy - -* Android -* Jeżyna 10 -* iOS -* Tizen -* Windows Phone 7 i 8 -* Windows 8 - -### Szybki przykład - - / / Android: Nexus One zwraca "Pasja" (nazwa kodowa Nexus One) / / Motorola Droid zwraca "voles" / / BlackBerry: Torch 9800 zwraca "9800" / / iOS: iPad Mini, zwraca iPad2, 5; iPhone 5 jest iPhone 5,1. Zobacz http://theiphonewiki.com/wiki/index.php?title=Models / / modelu var = device.model; - - -### Android dziwactwa - -* Pobiera [nazwę produktu][1] zamiast [nazwy modelu][2], który często jest nazwą kod produkcji. Na przykład, Nexus One zwraca `Passion` , i zwraca Motorola Droid`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - [2]: http://developer.android.com/reference/android/os/Build.html#MODEL - -### Osobliwości Tizen - -* Zwraca modelu urządzenia przypisane przez dostawcę, na przykład,`TIZEN` - -### Windows Phone 7 i 8 dziwactwa - -* Zwraca modelu urządzenia, określonej przez producenta. Na przykład Samsung ostrości zwraca`SGH-i917`. - -## device.name - -**Ostrzeżenie**: `device.name` jest przestarzała od wersji 2.3.0. Użycie `device.model` zamiast. - -## device.platform - -Uzyskać nazwę systemu operacyjnego urządzenia. - - var string = device.platform; - - -### Obsługiwane platformy - -* Android -* Jeżyna 10 -* Firefox OS -* iOS -* Tizen -* Windows Phone 7 i 8 -* Windows 8 - -### Szybki przykład - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 dziwactwa - -Urządzenia Windows Phone 7 raport platformy jako`WinCE`. - -### Windows Phone 8 dziwactwa - -Urządzenia Windows Phone 8 raport platformy jako`Win32NT`. - -## device.uuid - -Się urządzenia uniwersalnie unikatowy identyfikator ([UUID][3]). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### Opis - -Szczegóły jak UUID jest generowane są określane przez producenta urządzenia i są specyficzne dla platformy lub modelu urządzenia. - -### Obsługiwane platformy - -* Android -* Jeżyna 10 -* iOS -* Tizen -* Windows Phone 7 i 8 -* Windows 8 - -### Szybki przykład - - / / Android: zwraca losowe 64-bitowa liczba całkowita (jako ciąg, znowu!) / / liczba całkowita jest generowany na pierwszego uruchomienia urządzenia / / / / BlackBerry: zwraca numer PIN urządzenia / / to jest unikatową liczbą całkowitą dziewięciu cyfr (jako ciąg, choć!) / / / / iPhone: (zacytowana w dokumentacji klasy UIDevice) / / zwraca ciąg wartości mieszania utworzone z wielu sprzętu identyfikuje. - Zapewniona jest unikatowy dla każdego urządzenia i nie może być związane z / do konta użytkownika. - / / Windows Phone 7: zwraca wartość mieszania urządzenia + bieżący użytkownik, / / jeśli nie zdefiniowane przez użytkownika, identyfikator guid jest generowany i będzie trwać do czasu odinstalowania aplikacji / / Tizen: zwraca urządzenia IMEI (International Mobile Equipment Identity lub IMEI jest liczbą / / unikatowe dla każdego telefonu komórkowego GSM i UMTS. - var deviceID = device.uuid; - - -### iOS dziwactwo - -`uuid`Na iOS nie jest przypisany do urządzenia, ale różni się dla każdej aplikacji, dla każdej instalacji. Zmienia się jeśli możesz usunąć i ponownie zainstalować aplikację, a ewentualnie także po aktualizacji iOS czy nawet uaktualnienia aplikacji dla wersji (widoczny w iOS 5.1). `uuid`Jest nie wiarygodne wartości. - -### Windows Phone 7 i 8 dziwactwa - -`uuid`Dla Windows Phone 7 wymaga zgody `ID_CAP_IDENTITY_DEVICE` . Microsoft będzie prawdopodobnie potępiać ten wkrótce. Jeśli funkcja nie jest dostępna, aplikacja generuje trwałe identyfikator guid, który jest utrzymywany przez czas trwania instalacji aplikacji na urządzeniu. - -## device.version - -Pobierz wersję systemu operacyjnego. - - var string = device.version; - - -### Obsługiwane platformy - -* Android 2.1 + -* Jeżyna 10 -* iOS -* Tizen -* Windows Phone 7 i 8 -* Windows 8 - -### Szybki przykład - - / / Android: Froyo OS zwróci "2.2" / / Eclair OS zwróci "2.1", "2.0.1" lub "2.0" / / wersji mogą również zwracać zaktualizować poziom "2.1-update1" / / / / BlackBerry: 9800 Torch za pomocą OS 6.0 zwróci "6.0.0.600" / / / / iPhone: iOS 3.2 zwraca "3.2" / / / / Windows Phone 7: Zwraca bieżący numer wersji systemu operacyjnego, ex. on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/doc/zh/index.md b/demo/plugins/org.apache.cordova.device/doc/zh/index.md deleted file mode 100644 index 639a9b6..0000000 --- a/demo/plugins/org.apache.cordova.device/doc/zh/index.md +++ /dev/null @@ -1,190 +0,0 @@ - - -# org.apache.cordova.device - -這個外掛程式定義全球 `device` 物件,描述該設備的硬體和軟體。 雖然物件是在全球範圍內,但不是可用,直到後 `deviceready` 事件。 - - document.addEventListener("deviceready", onDeviceReady, false); - function onDeviceReady() { - console.log(device.cordova); - } - - -## 安裝 - - cordova plugin add org.apache.cordova.device - - -## 屬性 - -* device.cordova -* device.model -* device.name -* device.platform -* device.uuid -* device.version - -## device.cordova - -獲取科爾多瓦在設備上運行的版本。 - -### 支援的平臺 - -* 亞馬遜火 OS -* Android 系統 -* 黑莓 10 -* 火狐瀏覽器作業系統 -* iOS -* Tizen -* Windows Phone 7 和 8 -* Windows 8 - -## device.model - -`device.model`返回設備的模型或產品的名稱。值由設備製造商設置和同一產品的不同版本可能不同。 - -### 支援的平臺 - -* Android 系統 -* 黑莓 10 -* iOS -* Tizen -* Windows Phone 7 和 8 -* Windows 8 - -### 快速的示例 - - / / Android: Nexus 返回"激情"(Nexus One 代碼名稱) / / 摩托羅拉 Droid 返回"田鼠"/ / 黑莓手機: 火炬 9800 返回"9800"/ / iOS: 迷你 ipad,返回與 iPad2,5 ;iPhone 5 是 iPhone 5,1。 請參閱 HTTP://theiphonewiki.com/wiki/index.php?title=Models / / var 模型 = device.model ; - - -### Android 的怪癖 - -* 獲取[產品名稱][1]而不是[產品型號名稱][2],這往往是生產代碼名稱。 例如,Nexus One 返回 `Passion` ,和摩托羅拉 Droid 返回`voles`. - - [1]: http://developer.android.com/reference/android/os/Build.html#PRODUCT - [2]: http://developer.android.com/reference/android/os/Build.html#MODEL - -### Tizen 怪癖 - -* 例如,返回與供應商指派的設備模型`TIZEN` - -### Windows Phone 7 和 8 怪癖 - -* 返回由製造商指定的設備模型。例如,三星焦點返回`SGH-i917`. - -## device.name - -**警告**: `device.name` 從版 2.3.0 已被否決。使用 `device.model` 相反。 - -## device.platform - -獲取該設備的作業系統名稱。 - - var string = device.platform; - - -### 支援的平臺 - -* Android 系統 -* 黑莓 10 -* 火狐瀏覽器作業系統 -* iOS -* Tizen -* Windows Phone 7 和 8 -* Windows 8 - -### 快速的示例 - - // Depending on the device, a few examples are: - // - "Android" - // - "BlackBerry 10" - // - "iOS" - // - "WinCE" - // - "Tizen" - var devicePlatform = device.platform; - - -### Windows Phone 7 的怪癖 - -Windows Phone 7 設備報告作為平臺`WinCE`. - -### Windows Phone 8 怪癖 - -Windows Phone 8 設備報告作為平臺`Win32NT`. - -## device.uuid - -獲取設備的通用唯一識別碼 ([UUID][3]). - - [3]: http://en.wikipedia.org/wiki/Universally_Unique_Identifier - - var string = device.uuid; - - -### 說明 - -UUID 如何生成的詳細資訊由設備製造商和特定于設備的平臺或模型。 - -### 支援的平臺 - -* Android 系統 -* 黑莓 10 -* iOS -* Tizen -* Windows Phone 7 和 8 -* Windows 8 - -### 快速的示例 - - / / Android: 一個隨機的 64 位整數 (作為字串返回,再次!) / / 上設備的第一次啟動生成的整數 / / / / 黑莓手機: 返回設備的 PIN 號碼 / / 這是九個數字的唯一整數 (作為字串,雖然!) / / / / iPhone: (從 UIDevice 類文檔解釋) / / 返回一個字串的雜湊值創建的多個硬體標識。 - / / 它保證是唯一的每個設備並不能綁 / / 到使用者帳戶。 - / / Windows Phone 7: 返回的雜湊代碼的設備 + 當前使用者,/ / 如果未定義使用者,則一個 guid 生成的並且將會保留直到卸載該應用程式 / / Tizen: 返回設備 IMEI (國際行動裝置身份或 IMEI 是一個數位 / / 獨有的每一個 UMTS 和 GSM 行動電話。 - var deviceID = device.uuid; - - -### iOS 怪癖 - -`uuid`在 iOS 上不是獨有的一種設備,但對於每個應用程式,為每個安裝各不相同。 如果您刪除並重新安裝應用程式,它會更改和可能還當你升級 iOS,或甚至升級每個版本 (明顯在 iOS 5.1 中) 的應用程式。 `uuid`不是一個可靠的值。 - -### Windows Phone 7 和 8 怪癖 - -`uuid`為 Windows Phone 7 需要許可權 `ID_CAP_IDENTITY_DEVICE` 。 Microsoft 可能會很快就棄用此屬性。 如果能力不是可用的應用程式將生成一個持久性的 guid 並保持應用程式的安裝在設備上的持續時間。 - -## device.version - -獲取作業系統版本。 - - var string = device.version; - - -### 支援的平臺 - -* Android 2.1 + -* 黑莓 10 -* iOS -* Tizen -* Windows Phone 7 和 8 -* Windows 8 - -### 快速的示例 - - / / Android: Froyo OS 將返回"2.2"/ / Eclair OS 將返回"2.1"、"2.0.1"2.0"/ / 版本,也可以返回更新級別"2.1 update1"/ / / / 黑莓手機: 火炬 9800 使用 OS 6.0 將返回"6.0.0.600"/ / / / iPhone: iOS 3.2 返回"3.2"/ / / / Windows Phone 7: 返回當前 OS 版本數,。 on Mango returns 7.10.7720 - // Tizen: returns "TIZEN_20120425_2" - var deviceVersion = device.version; \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/package.json b/demo/plugins/org.apache.cordova.device/package.json deleted file mode 100644 index 1454915..0000000 --- a/demo/plugins/org.apache.cordova.device/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": "0.2.10", - "name": "org.apache.cordova.device", - "cordova_name": "Device", - "description": "Cordova Device Plugin", - "license": "Apache 2.0", - "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git", - "issue": "https://issues.apache.org/jira/browse/CB/component/12320648", - "keywords": [ - "cordova", - "device" - ], - "platforms": [ - "firefoxos", - "tizen", - "android", - "amazon-fireos", - "ubuntu", - "ios", - "blackberry10", - "wp7", - "wp8", - "windows8" - ], - "engines": [], - "englishdoc": "\n\n# org.apache.cordova.device\n\nThis plugin defines a global `device` object, which describes the device's hardware and software.\nAlthough the object is in the global scope, it is not available until after the `deviceready` event.\n\n document.addEventListener(\"deviceready\", onDeviceReady, false);\n function onDeviceReady() {\n console.log(device.cordova);\n }\n\n## Installation\n\n cordova plugin add org.apache.cordova.device\n\n## Properties\n\n- device.cordova\n- device.model\n- device.name\n- device.platform\n- device.uuid\n- device.version\n\n## device.cordova\n\nGet the version of Cordova running on the device.\n\n### Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n## device.model\n\nThe `device.model` returns the name of the device's model or\nproduct. The value is set by the device manufacturer and may be\ndifferent across versions of the same product.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Nexus One returns \"Passion\" (Nexus One code name)\n // Motorola Droid returns \"voles\"\n // BlackBerry: Torch 9800 returns \"9800\"\n // iOS: for the iPad Mini, returns iPad2,5; iPhone 5 is iPhone 5,1. See http://theiphonewiki.com/wiki/index.php?title=Models\n //\n var model = device.model;\n\n### Android Quirks\n\n- Gets the [product name](http://developer.android.com/reference/android/os/Build.html#PRODUCT) instead of the [model name](http://developer.android.com/reference/android/os/Build.html#MODEL), which is often the production code name. For example, the Nexus One returns `Passion`, and Motorola Droid returns `voles`.\n\n### Tizen Quirks\n\n- Returns the device model assigned by the vendor, for example, `TIZEN`\n\n### Windows Phone 7 and 8 Quirks\n\n- Returns the device model specified by the manufacturer. For example, the Samsung Focus returns `SGH-i917`.\n\n## device.name\n\n__WARNING__: `device.name` is deprecated as of version 2.3.0. Use `device.model` instead.\n\n## device.platform\n\nGet the device's operating system name.\n\n var string = device.platform;\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Depending on the device, a few examples are:\n // - \"Android\"\n // - \"BlackBerry 10\"\n // - \"iOS\"\n // - \"WinCE\"\n // - \"Tizen\"\n var devicePlatform = device.platform;\n\n### Windows Phone 7 Quirks\n\nWindows Phone 7 devices report the platform as `WinCE`.\n\n### Windows Phone 8 Quirks\n\nWindows Phone 8 devices report the platform as `Win32NT`.\n\n## device.uuid\n\nGet the device's Universally Unique Identifier ([UUID](http://en.wikipedia.org/wiki/Universally_Unique_Identifier)).\n\n var string = device.uuid;\n\n### Description\n\nThe details of how a UUID is generated are determined by the device manufacturer and are specific to the device's platform or model.\n\n### Supported Platforms\n\n- Android\n- BlackBerry 10\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Returns a random 64-bit integer (as a string, again!)\n // The integer is generated on the device's first boot\n //\n // BlackBerry: Returns the PIN number of the device\n // This is a nine-digit unique integer (as a string, though!)\n //\n // iPhone: (Paraphrased from the UIDevice Class documentation)\n // Returns a string of hash values created from multiple hardware identifies.\n // It is guaranteed to be unique for every device and can't be tied\n // to the user account.\n // Windows Phone 7 : Returns a hash of device+current user,\n // if the user is not defined, a guid is generated and will persist until the app is uninstalled\n // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number\n // unique to every GSM and UMTS mobile phone.\n var deviceID = device.uuid;\n\n### iOS Quirk\n\nThe `uuid` on iOS is not unique to a device, but varies for each\napplication, for each installation. It changes if you delete and\nre-install the app, and possibly also when you upgrade iOS, or even\nupgrade the app per version (apparent in iOS 5.1). The `uuid` is not\na reliable value.\n\n### Windows Phone 7 and 8 Quirks\n\nThe `uuid` for Windows Phone 7 requires the permission\n`ID_CAP_IDENTITY_DEVICE`. Microsoft will likely deprecate this\nproperty soon. If the capability is not available, the application\ngenerates a persistent guid that is maintained for the duration of the\napplication's installation on the device.\n\n## device.version\n\nGet the operating system version.\n\n var string = device.version;\n\n### Supported Platforms\n\n- Android 2.1+\n- BlackBerry 10\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Android: Froyo OS would return \"2.2\"\n // Eclair OS would return \"2.1\", \"2.0.1\", or \"2.0\"\n // Version can also return update level \"2.1-update1\"\n //\n // BlackBerry: Torch 9800 using OS 6.0 would return \"6.0.0.600\"\n //\n // iPhone: iOS 3.2 returns \"3.2\"\n //\n // Windows Phone 7: returns current OS version number, ex. on Mango returns 7.10.7720\n // Tizen: returns \"TIZEN_20120425_2\"\n var deviceVersion = device.version;\n\n" -} \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/plugin.xml b/demo/plugins/org.apache.cordova.device/plugin.xml deleted file mode 100644 index 0334ba7..0000000 --- a/demo/plugins/org.apache.cordova.device/plugin.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Device - Cordova Device Plugin - Apache 2.0 - cordova,device - https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git - https://issues.apache.org/jira/browse/CB/component/12320648 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - read_device_identifying_information - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/demo/plugins/org.apache.cordova.device/src/android/Device.java b/demo/plugins/org.apache.cordova.device/src/android/Device.java deleted file mode 100644 index ad9002b..0000000 --- a/demo/plugins/org.apache.cordova.device/src/android/Device.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - 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. -*/ -package org.apache.cordova.device; - -import java.util.TimeZone; - -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.CordovaInterface; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import android.provider.Settings; - -public class Device extends CordovaPlugin { - public static final String TAG = "Device"; - - public static String platform; // Device OS - public static String uuid; // Device UUID - - private static final String ANDROID_PLATFORM = "Android"; - private static final String AMAZON_PLATFORM = "amazon-fireos"; - private static final String AMAZON_DEVICE = "Amazon"; - - /** - * Constructor. - */ - public Device() { - } - - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param cordova The context of the main Activity. - * @param webView The CordovaWebView Cordova is running in. - */ - public void initialize(CordovaInterface cordova, CordovaWebView webView) { - super.initialize(cordova, webView); - Device.uuid = getUuid(); - } - - /** - * Executes the request and returns PluginResult. - * - * @param action The action to execute. - * @param args JSONArry of arguments for the plugin. - * @param callbackContext The callback id used when calling back into JavaScript. - * @return True if the action was valid, false if not. - */ - public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - if (action.equals("getDeviceInfo")) { - JSONObject r = new JSONObject(); - r.put("uuid", Device.uuid); - r.put("version", this.getOSVersion()); - r.put("platform", this.getPlatform()); - r.put("model", this.getModel()); - callbackContext.success(r); - } - else { - return false; - } - return true; - } - - //-------------------------------------------------------------------------- - // LOCAL METHODS - //-------------------------------------------------------------------------- - - /** - * Get the OS name. - * - * @return - */ - public String getPlatform() { - String platform; - if (isAmazonDevice()) { - platform = AMAZON_PLATFORM; - } else { - platform = ANDROID_PLATFORM; - } - return platform; - } - - /** - * Get the device's Universally Unique Identifier (UUID). - * - * @return - */ - public String getUuid() { - String uuid = Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); - return uuid; - } - - public String getModel() { - String model = android.os.Build.MODEL; - return model; - } - - public String getProductName() { - String productname = android.os.Build.PRODUCT; - return productname; - } - - /** - * Get the OS version. - * - * @return - */ - public String getOSVersion() { - String osversion = android.os.Build.VERSION.RELEASE; - return osversion; - } - - public String getSDKVersion() { - @SuppressWarnings("deprecation") - String sdkversion = android.os.Build.VERSION.SDK; - return sdkversion; - } - - public String getTimeZoneID() { - TimeZone tz = TimeZone.getDefault(); - return (tz.getID()); - } - - /** - * Function to check if the device is manufactured by Amazon - * - * @return - */ - public boolean isAmazonDevice() { - if (android.os.Build.MANUFACTURER.equals(AMAZON_DEVICE)) { - return true; - } - return false; - } - -} diff --git a/demo/plugins/org.apache.cordova.device/src/blackberry10/index.js b/demo/plugins/org.apache.cordova.device/src/blackberry10/index.js deleted file mode 100644 index 4d09492..0000000 --- a/demo/plugins/org.apache.cordova.device/src/blackberry10/index.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * 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. - * -*/ - -function getModelName () { - var modelName = window.qnx.webplatform.device.modelName; - //Pre 10.2 (meaning Z10 or Q10) - if (typeof modelName === "undefined") { - if (window.screen.height === 720 && window.screen.width === 720) { - if ( window.matchMedia("(-blackberry-display-technology: -blackberry-display-oled)").matches) { - modelName = "Q10"; - } else { - modelName = "Q5"; - } - } else if ((window.screen.height === 1280 && window.screen.width === 768) || - (window.screen.height === 768 && window.screen.width === 1280)) { - modelName = "Z10"; - } else { - modelName = window.qnx.webplatform.deviceName; - } - } - - return modelName; -} - -function getUUID () { - var uuid = ""; - try { - //Must surround by try catch because this will throw if the app is missing permissions - uuid = window.qnx.webplatform.device.devicePin; - } catch (e) { - //DO Nothing - } - return uuid; -} - -module.exports = { - getDeviceInfo: function (success, fail, args, env) { - var result = new PluginResult(args, env), - modelName = getModelName(), - uuid = getUUID(), - info = { - platform: "blackberry10", - version: window.qnx.webplatform.device.scmBundle, - model: modelName, - uuid: uuid - }; - - result.ok(info); - } -}; diff --git a/demo/plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.js b/demo/plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.js deleted file mode 100644 index 0f67412..0000000 --- a/demo/plugins/org.apache.cordova.device/src/firefoxos/DeviceProxy.js +++ /dev/null @@ -1,80 +0,0 @@ -/* - * - * 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. - * - */ -//example UA String for Firefox OS -//Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0 -var firefoxos = require('cordova/platform'); -var cordova = require('cordova'); - -//UA parsing not recommended but currently this is the only way to get the Firefox OS version -//https://developer.mozilla.org/en-US/docs/Gecko_user_agent_string_reference - -//Should be replaced when better conversion to Firefox OS Version is available -function convertVersionNumber(ver) { - var hashVersion = { - '18.0': '1.0.1', - '18.1': '1.1', - '26.0': '1.2', - '28.0': '1.3', - '30.0': '1.4', - '32.0': '2.0' - }; - var rver = ver; - var sStr = ver.substring(0, 4); - if (hashVersion[sStr]) { - rver = hashVersion[sStr]; - } - return (rver); - -} -function getVersion() { - if (navigator.userAgent.match(/(mobile|tablet)/i)) { - var ffVersionArray = (navigator.userAgent.match(/Firefox\/([\d]+\.[\w]?\.?[\w]+)/)); - if (ffVersionArray.length === 2) { - return (convertVersionNumber(ffVersionArray[1])); - } - } - return (null); -} - -function getModel() { - var uaArray = navigator.userAgent.split(/\s*[;)(]\s*/); - if (navigator.userAgent.match(/(mobile|tablet)/i)) { - if (uaArray.length === 5) { - return (uaArray[2]); - } - } - return (null); -} -module.exports = { - getDeviceInfo: function (success, error) { - setTimeout(function () { - success({ - cordova: firefoxos.cordovaVersion, - platform: 'firefoxos', - model: getModel(), - version: getVersion(), - uuid: null - }); - }, 0); - } -}; - -require("cordova/firefoxos/commandProxy").add("Device", module.exports); \ No newline at end of file diff --git a/demo/plugins/org.apache.cordova.device/src/ios/CDVDevice.h b/demo/plugins/org.apache.cordova.device/src/ios/CDVDevice.h deleted file mode 100644 index a146d88..0000000 --- a/demo/plugins/org.apache.cordova.device/src/ios/CDVDevice.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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. - */ - -#import -#import - -@interface CDVDevice : CDVPlugin -{} - -+ (NSString*)cordovaVersion; - -- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command; - -@end diff --git a/demo/plugins/org.apache.cordova.device/src/ios/CDVDevice.m b/demo/plugins/org.apache.cordova.device/src/ios/CDVDevice.m deleted file mode 100644 index 7e18d92..0000000 --- a/demo/plugins/org.apache.cordova.device/src/ios/CDVDevice.m +++ /dev/null @@ -1,90 +0,0 @@ -/* - 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. - */ - -#include -#include - -#import -#import "CDVDevice.h" - -@implementation UIDevice (ModelVersion) - -- (NSString*)modelVersion -{ - size_t size; - - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char* machine = malloc(size); - sysctlbyname("hw.machine", machine, &size, NULL, 0); - NSString* platform = [NSString stringWithUTF8String:machine]; - free(machine); - - return platform; -} - -@end - -@interface CDVDevice () {} -@end - -@implementation CDVDevice - -- (void)getDeviceInfo:(CDVInvokedUrlCommand*)command -{ - NSDictionary* deviceProperties = [self deviceProperties]; - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties]; - - /* Settings.plist - * Read the optional Settings.plist file and push these user-defined settings down into the web application. - * This can be useful for supplying build-time configuration variables down to the app to change its behavior, - * such as specifying Full / Lite version, or localization (English vs German, for instance). - */ - // TODO: turn this into an iOS only plugin - NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"]; - - if ([temp respondsToSelector:@selector(JSONString)]) { - NSLog(@"Deprecation warning: window.Setting will be removed Aug 2013. Refer to https://issues.apache.org/jira/browse/CB-2433"); - NSString* js = [NSString stringWithFormat:@"window.Settings = %@;", [temp JSONString]]; - [self.commandDelegate evalJs:js]; - } - - [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; -} - -- (NSDictionary*)deviceProperties -{ - UIDevice* device = [UIDevice currentDevice]; - NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4]; - - [devProps setObject:[device modelVersion] forKey:@"model"]; - [devProps setObject:@"iOS" forKey:@"platform"]; - [devProps setObject:[device systemVersion] forKey:@"version"]; - [devProps setObject:[device uniqueAppInstanceIdentifier] forKey:@"uuid"]; - [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"]; - - NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps]; - return devReturn; -} - -+ (NSString*)cordovaVersion -{ - return CDV_VERSION; -} - -@end diff --git a/demo/plugins/org.apache.cordova.device/src/tizen/DeviceProxy.js b/demo/plugins/org.apache.cordova.device/src/tizen/DeviceProxy.js deleted file mode 100644 index 2afc324..0000000 --- a/demo/plugins/org.apache.cordova.device/src/tizen/DeviceProxy.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * 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. - * -*/ - -var tizen = require('cordova/platform'); -var cordova = require('cordova'); - -module.exports = { - getDeviceInfo: function(success, error) { - setTimeout(function () { - success({ - cordova: tizen.cordovaVersion, - platform: 'tizen', - model: null, - version: null, - uuid: null - }); - }, 0); - } -}; - -require("cordova/tizen/commandProxy").add("Device", module.exports); diff --git a/demo/plugins/org.apache.cordova.device/src/ubuntu/device.cpp b/demo/plugins/org.apache.cordova.device/src/ubuntu/device.cpp deleted file mode 100644 index eb5a012..0000000 --- a/demo/plugins/org.apache.cordova.device/src/ubuntu/device.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ - * - * Licensed 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. - */ - -#include -#include - -#include"device.h" - -#define CORDOVA "3.0.0" - -Device::Device(Cordova *cordova) : CPlugin(cordova) { -} - -static QString getOSName() { -#ifdef Q_OS_SYMBIAN - QString platform = "Symbian"; -#endif -#ifdef Q_OS_WIN - QString platform = "Windows"; -#endif -#ifdef Q_OS_WINCE - QString platform = "Windows CE"; -#endif -#ifdef Q_OS_LINUX - QString platform = "Linux"; -#endif - return platform; -} - -void Device::getInfo(int scId, int ecId) { - Q_UNUSED(ecId) - - QDeviceInfo systemDeviceInfo; - QDeviceInfo systemInfo; - - QString platform = getOSName(); - - QString uuid = systemDeviceInfo.uniqueDeviceID(); - if (uuid.isEmpty()) { - QString deviceDescription = systemInfo.imei(0) + ";" + systemInfo.manufacturer() + ";" + systemInfo.model() + ";" + systemInfo.productName() + ";" + platform; - QString user = qgetenv("USER"); - if (user.isEmpty()) { - user = qgetenv("USERNAME"); - if (user.isEmpty()) - user = QDir::homePath(); - } - uuid = QString(QCryptographicHash::hash((deviceDescription + ";" + user).toUtf8(), QCryptographicHash::Md5).toHex()); - } - - this->cb(scId, systemDeviceInfo.model(), CORDOVA, platform, uuid, systemInfo.version(QDeviceInfo::Os)); -} diff --git a/demo/plugins/org.apache.cordova.device/src/ubuntu/device.h b/demo/plugins/org.apache.cordova.device/src/ubuntu/device.h deleted file mode 100644 index 91cb937..0000000 --- a/demo/plugins/org.apache.cordova.device/src/ubuntu/device.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ - * - * Licensed 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. - */ - -#ifndef DEVICE_H_FDSAFAS -#define DEVICE_H_FDSAFAS - -#include - -#include - -class Device: public CPlugin { - Q_OBJECT -public: - explicit Device(Cordova *cordova); - - virtual const QString fullName() override { - return Device::fullID(); - } - - virtual const QString shortName() override { - return "Device"; - } - - static const QString fullID() { - return "com.cordova.Device"; - } - -signals: - -public slots: - void getInfo(int scId, int ecId); -}; - -#endif diff --git a/demo/plugins/org.apache.cordova.device/src/ubuntu/device.js b/demo/plugins/org.apache.cordova.device/src/ubuntu/device.js deleted file mode 100644 index 3adb110..0000000 --- a/demo/plugins/org.apache.cordova.device/src/ubuntu/device.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * 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. - * -*/ - -var cordova = require('cordova'); -var exec = require('cordova/exec'); - -module.exports = { - getInfo:function(win,fail,args) { - Cordova.exec(function (model, cordova, platform, uuid, version) { - win({name: name, model: model, cordova: cordova, - platform: platform, uuid: uuid, version: version}); - }, null, "com.cordova.Device", "getInfo", []); - } -}; - -require("cordova/exec/proxy").add("Device", module.exports); diff --git a/demo/plugins/org.apache.cordova.device/src/windows8/DeviceProxy.js b/demo/plugins/org.apache.cordova.device/src/windows8/DeviceProxy.js deleted file mode 100644 index 3a2aed3..0000000 --- a/demo/plugins/org.apache.cordova.device/src/windows8/DeviceProxy.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * 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. - * -*/ - - -var cordova = require('cordova'); -var utils = require('cordova/utils'); - -module.exports = { - - getDeviceInfo:function(win,fail,args) { - - // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId - var deviceId; - - var localSettings = Windows.Storage.ApplicationData.current.localSettings; - - if (localSettings.values.deviceId) { - deviceId = localSettings.values.deviceId; - } - else { - deviceId = localSettings.values.deviceId = utils.createUUID(); - } - - setTimeout(function () { - win({ platform: "windows8", version: "8", uuid: deviceId, model: window.clientInformation.platform }); - }, 0); - } - -}; - -require("cordova/exec/proxy").add("Device", module.exports); - diff --git a/demo/plugins/org.apache.cordova.device/src/wp/Device.cs b/demo/plugins/org.apache.cordova.device/src/wp/Device.cs deleted file mode 100644 index b8a8045..0000000 --- a/demo/plugins/org.apache.cordova.device/src/wp/Device.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* - Licensed 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. -*/ - -using System; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Ink; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; -using Microsoft.Phone.Info; -using System.IO.IsolatedStorage; -using System.Windows.Resources; -using System.IO; -using System.Diagnostics; - -namespace WPCordovaClassLib.Cordova.Commands -{ - public class Device : BaseCommand - { - public void getDeviceInfo(string notused) - { - - string res = String.Format("\"name\":\"{0}\",\"platform\":\"{1}\",\"uuid\":\"{2}\",\"version\":\"{3}\",\"model\":\"{4}\"", - this.name, - this.platform, - this.uuid, - this.version, - this.model); - - res = "{" + res + "}"; - //Debug.WriteLine("Result::" + res); - DispatchCommandResult(new PluginResult(PluginResult.Status.OK, res)); - } - - public string model - { - get - { - return DeviceStatus.DeviceName; - //return String.Format("{0},{1},{2}", DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceHardwareVersion, DeviceStatus.DeviceFirmwareVersion); - } - } - - public string name - { - get - { - return DeviceStatus.DeviceName; - - } - } - - public string platform - { - get - { - return Environment.OSVersion.Platform.ToString(); - } - } - - public string uuid - { - get - { - string returnVal = ""; - object id; - UserExtendedProperties.TryGetValue("ANID", out id); - - if (id != null) - { - returnVal = id.ToString().Substring(2, 32); - } - else - { - returnVal = "???unknown???"; - - using (IsolatedStorageFile appStorage = IsolatedStorageFile.GetUserStoreForApplication()) - { - try - { - IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream("DeviceID.txt", FileMode.Open, FileAccess.Read, appStorage); - - using (StreamReader reader = new StreamReader(fileStream)) - { - returnVal = reader.ReadLine(); - } - } - catch (Exception /*ex*/) - { - - } - } - } - - return returnVal; - } - } - - public string version - { - get - { - return Environment.OSVersion.Version.ToString(); - } - } - - } -} diff --git a/demo/plugins/org.apache.cordova.device/www/device.js b/demo/plugins/org.apache.cordova.device/www/device.js deleted file mode 100644 index 05f4c47..0000000 --- a/demo/plugins/org.apache.cordova.device/www/device.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * - * 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. - * -*/ - -var argscheck = require('cordova/argscheck'), - channel = require('cordova/channel'), - utils = require('cordova/utils'), - exec = require('cordova/exec'), - cordova = require('cordova'); - -channel.createSticky('onCordovaInfoReady'); -// Tell cordova channel to wait on the CordovaInfoReady event -channel.waitForInitialization('onCordovaInfoReady'); - -/** - * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the - * phone, etc. - * @constructor - */ -function Device() { - this.available = false; - this.platform = null; - this.version = null; - this.uuid = null; - this.cordova = null; - this.model = null; - - var me = this; - - channel.onCordovaReady.subscribe(function() { - me.getInfo(function(info) { - //ignoring info.cordova returning from native, we should use value from cordova.version defined in cordova.js - //TODO: CB-5105 native implementations should not return info.cordova - var buildLabel = cordova.version; - me.available = true; - me.platform = info.platform; - me.version = info.version; - me.uuid = info.uuid; - me.cordova = buildLabel; - me.model = info.model; - channel.onCordovaInfoReady.fire(); - },function(e) { - me.available = false; - utils.alert("[ERROR] Error initializing Cordova: " + e); - }); - }); -} - -/** - * Get device info - * - * @param {Function} successCallback The function to call when the heading data is available - * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) - */ -Device.prototype.getInfo = function(successCallback, errorCallback) { - argscheck.checkArgs('fF', 'Device.getInfo', arguments); - exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); -}; - -module.exports = new Device(); diff --git a/demo/plugins/org.pbernasconi.progressIndicator/.fetch.json b/demo/plugins/org.pbernasconi.progressIndicator/.fetch.json deleted file mode 100644 index 5c7279b..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/.fetch.json +++ /dev/null @@ -1 +0,0 @@ -{"source":{"type":"registry","id":"org.pbernasconi.progressindicator"}} \ No newline at end of file diff --git a/demo/plugins/org.pbernasconi.progressIndicator/LICENSE b/demo/plugins/org.pbernasconi.progressIndicator/LICENSE deleted file mode 100644 index 5c304d1..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed 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. diff --git a/demo/plugins/org.pbernasconi.progressIndicator/README.md b/demo/plugins/org.pbernasconi.progressIndicator/README.md deleted file mode 100644 index f98ed13..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Cordova Progress-Indicator Plugin# -This plugin allows you to show a native Progress Indicator on iOS - by [Paolo Bernasconi](https://github.com/pbernasconi) - -There are several types of indicators available: - -* [Simple](http://pbernasconi.github.io/cordova-progressIndicator/#simple) -* [Determinate](http://pbernasconi.github.io/cordova-progressIndicator/#determinate) -* [Annular](http://pbernasconi.github.io/cordova-progressIndicator/#annular) -* [Bar](http://pbernasconi.github.io/cordova-progressIndicator/#bar) -* [Success](http://pbernasconi.github.io/cordova-progressIndicator/#others) -* [Simple Text](http://pbernasconi.github.io/cordova-progressIndicator/#others) - -# Install - -``` -cordova plugin add org.pbernasconi.progressindicator -``` - -# [View the Docs](http://pbernasconi.github.io/cordova-progressIndicator/) - -The Docs are situated at [http://pbernasconi.github.io/cordova-progressIndicator/](http://pbernasconi.github.io/cordova-progressIndicator/) - - -## Screenshots - -iOS - -![ScreenShot](demo/screenshots/simple-large-img.jpg ) - -|Simple|Label|Label-Detail|Success|Text Top|Text Botom| -|------|-----|------------|-------|--------|----------| -|![](demo/screenshots/simple.jpg)|![](demo/screenshots/simple-label.jpg)|![](demo/screenshots/simple-label-detail.jpg)|![](demo/screenshots/success.jpg)|![](demo/screenshots/text-top.jpg)|![](demo/screenshots/text-bottom.jpg) - - -|Determinate|Determinate Label|Annular|Annular Label|Bar|Bar Label| -|-----------|-----------------|-------|-------------|---|--------- -|![](demo/screenshots/determinate-simple.jpg)|![](demo/screenshots/determinate-label.jpg)|![](demo/screenshots/annular-simple.jpg)|![](demo/screenshots/annular-label.jpg)|![](demo/screenshots/bar-simple.jpg)|![](demo/screenshots/bar-label.jpg) - - - -### CREDITS - - - [MBProgressHUD](https://github.com/jdg/MBProgressHUD) - - [Cordova-ActivityIndicator](https://github.com/Initsogar/cordova-activityindicator) - - - -#### License - -Apache license 2.0 - Use this plugin for any production / development needs, and if you'd like to make an attribution to me somewhere. diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/README.md b/demo/plugins/org.pbernasconi.progressIndicator/demo/README.md deleted file mode 100644 index 1e806eb..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/README.md +++ /dev/null @@ -1,88 +0,0 @@ -Ionic App Base -===================== - -A starting project for Ionic that optionally supports -using custom SCSS. - -## Using this project - -We recommend using the `ionic` utility to create new Ionic projects that are based on this project but use a ready-made starter template. - -For example, to start a new Ionic project with the default tabs interface, make sure the `ionic` utility is installed: - -```bash -$ sudo npm install -g ionic -``` - -Then run: - -```bash -$ sudo npm install -g ionic -$ ionic start myProject tabs -``` - -More info on this can be found on the Ionic [Getting Started](http://ionicframework.com/getting-started) page. - -## Installation - -While we recommend using the `ionic` utility to create new Ionic projects, you can use this repo as a barebones starting point to your next Ionic app. - -To use this project as is, first clone the repo from GitHub, then run: - -```bash -$ cd ionic-app-base -$ sudo npm install -g cordova ionic gulp -$ npm install -$ gulp install -``` - -## Using Sass (optional) - -This project makes it easy to use Sass (the SCSS syntax) in your projects. This enables you to override styles from Ionic, and benefit from -Sass's great features. - -Just update the `./scss/ionic.app.scss` file, and run `gulp` or `gulp watch` to rebuild the CSS files for Ionic. - -Note: if you choose to use the Sass method, make sure to remove the included `ionic.css` file in `index.html`, and then uncomment -the include to your `ionic.app.css` file which now contains all your Sass code and Ionic itself: - -```html - -``` - -## Updating Ionic - -To update to a new version of Ionic, open bower.json and change the version listed there. - -For example, to update from version `1.0.0-beta.4` to `1.0.0-beta.5`, open bower.json and change this: - -``` -"ionic": "driftyco/ionic-bower#1.0.0-beta.4" -``` - -To this: - -``` -"ionic": "driftyco/ionic-bower#1.0.0-beta.5" -``` - -After saving the update to bower.json file, run `gulp install`. - -Alternatively, install bower globally with `npm install -g bower` and run `bower install`. - -#### Using the Nightly Builds of Ionic - -If you feel daring and want use the bleeding edge 'Nightly' version of Ionic, change the version of Ionic in your bower.json to this: - -``` -"ionic": "driftyco/ionic-bower#master" -``` - -Warning: the nightly version is not stable. - - -## 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! - diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/bower.json b/demo/plugins/org.pbernasconi.progressIndicator/demo/bower.json deleted file mode 100644 index 2202afd..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/bower.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "HelloIonic", - "private": "true", - "devDependencies": { - "ionic": "driftyco/ionic-bower#1.0.0-beta.9" - } -} diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/config.xml b/demo/plugins/org.pbernasconi.progressIndicator/demo/config.xml deleted file mode 100644 index 1853b4b..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/config.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - demo - - An Ionic Framework and Cordova project. - - - Ionic Framework Team - - - - - - - - - - - \ No newline at end of file diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/hooks/README.md b/demo/plugins/org.pbernasconi.progressIndicator/demo/hooks/README.md deleted file mode 100644 index d2563ea..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/hooks/README.md +++ /dev/null @@ -1,83 +0,0 @@ - -# 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 writting 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/) - diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/hooks/after_prepare/010_add_platform_class.js b/demo/plugins/org.pbernasconi.progressIndicator/demo/hooks/after_prepare/010_add_platform_class.js deleted file mode 100755 index bda3e41..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/hooks/after_prepare/010_add_platform_class.js +++ /dev/null @@ -1,94 +0,0 @@ -#!/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(/])(.*?)>/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= __CORDOVA_1_7_0 - // do something when its at least 1.7.0 - #else - // do something else (non 1.7.0) - #endif - */ -#ifndef CORDOVA_VERSION_MIN_REQUIRED - #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_6_3 -#endif - -/* - Returns YES if it is at least version specified as NSString(X) - Usage: - if (IsAtLeastiOSVersion(@"5.1")) { - // do something for iOS 5.1 or greater - } - */ -#define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) - -#define CDV_IsIPad() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)) - -#define CDV_IsIPhone5() ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320) - -/* Return the string version of the decimal version */ -#define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \ - (CORDOVA_VERSION_MIN_REQUIRED / 10000), \ - (CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \ - (CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100] - -#ifdef __clang__ - #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) -#else - #define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) -#endif - -// Enable this to log all exec() calls. -#define CDV_ENABLE_EXEC_LOGGING 0 -#if CDV_ENABLE_EXEC_LOGGING - #define CDV_EXEC_LOG NSLog -#else - #define CDV_EXEC_LOG(...) do {} while (NO) -#endif diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h deleted file mode 100644 index 04df6bc..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - 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. - */ - -#import "CDVAvailability.h" -#import "CDVInvokedUrlCommand.h" - -@class CDVPlugin; -@class CDVPluginResult; -@class CDVWhitelist; - -@protocol CDVCommandDelegate - -@property (nonatomic, readonly) NSDictionary* settings; - -- (NSString*)pathForResource:(NSString*)resourcepath; -- (id)getCommandInstance:(NSString*)pluginName; - -// Sends a plugin result to the JS. This is thread-safe. -- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId; -// Evaluates the given JS. This is thread-safe. -- (void)evalJs:(NSString*)js; -// Can be used to evaluate JS right away instead of scheduling it on the run-loop. -// This is required for dispatch resign and pause events, but should not be used -// without reason. Without the run-loop delay, alerts used in JS callbacks may result -// in dead-lock. This method must be called from the UI thread. -- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop; -// Runs the given block on a background thread using a shared thread-pool. -- (void)runInBackground:(void (^)())block; -// Returns the User-Agent of the associated UIWebView. -- (NSString*)userAgent; -// Returns whether the given URL passes the white-list. -- (BOOL)URLIsWhitelisted:(NSURL*)url; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h deleted file mode 100644 index 0531134..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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. - */ - -#import -#import "CDVCommandDelegate.h" - -@class CDVViewController; -@class CDVCommandQueue; - -@interface CDVCommandDelegateImpl : NSObject { - @private - __weak CDVViewController* _viewController; - NSRegularExpression* _callbackIdPattern; - @protected - __weak CDVCommandQueue* _commandQueue; - BOOL _delayResponses; -} -- (id)initWithViewController:(CDVViewController*)viewController; -- (void)flushCommandQueueWithDelayedJs; -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m deleted file mode 100644 index 76f5ef4..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.m +++ /dev/null @@ -1,184 +0,0 @@ -/* - 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. - */ - -#import "CDVCommandDelegateImpl.h" -#import "CDVJSON.h" -#import "CDVCommandQueue.h" -#import "CDVPluginResult.h" -#import "CDVViewController.h" - -@implementation CDVCommandDelegateImpl - -- (id)initWithViewController:(CDVViewController*)viewController -{ - self = [super init]; - if (self != nil) { - _viewController = viewController; - _commandQueue = _viewController.commandQueue; - _callbackIdPattern = nil; - } - return self; -} - -- (NSString*)pathForResource:(NSString*)resourcepath -{ - NSBundle* mainBundle = [NSBundle mainBundle]; - NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]]; - NSString* filename = [directoryParts lastObject]; - - [directoryParts removeLastObject]; - - NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"]; - NSString* directoryStr = _viewController.wwwFolderName; - - if ([directoryPartsJoined length] > 0) { - directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]]; - } - - return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr]; -} - -- (void)flushCommandQueueWithDelayedJs -{ - _delayResponses = YES; - [_commandQueue executePending]; - _delayResponses = NO; -} - -- (void)evalJsHelper2:(NSString*)js -{ - CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]); - NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js]; - if ([commandsJSON length] > 0) { - CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining."); - } - - [_commandQueue enqueueCommandBatch:commandsJSON]; - [_commandQueue executePending]; -} - -- (void)evalJsHelper:(NSString*)js -{ - // Cycle the run-loop before executing the JS. - // For _delayResponses - - // This ensures that we don't eval JS during the middle of an existing JS - // function (possible since UIWebViewDelegate callbacks can be synchronous). - // For !isMainThread - - // It's a hard error to eval on the non-UI thread. - // For !_commandQueue.currentlyExecuting - - // This works around a bug where sometimes alerts() within callbacks can cause - // dead-lock. - // If the commandQueue is currently executing, then we know that it is safe to - // execute the callback immediately. - // Using (dispatch_get_main_queue()) does *not* fix deadlocks for some reason, - // but performSelectorOnMainThread: does. - if (_delayResponses || ![NSThread isMainThread] || !_commandQueue.currentlyExecuting) { - [self performSelectorOnMainThread:@selector(evalJsHelper2:) withObject:js waitUntilDone:NO]; - } else { - [self evalJsHelper2:js]; - } -} - -- (BOOL)isValidCallbackId:(NSString*)callbackId -{ - NSError* err = nil; - - if (callbackId == nil) { - return NO; - } - - // Initialize on first use - if (_callbackIdPattern == nil) { - // Catch any invalid characters in the callback id. - _callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"[^A-Za-z0-9._-]" options:0 error:&err]; - if (err != nil) { - // Couldn't initialize Regex; No is safer than Yes. - return NO; - } - } - // Disallow if too long or if any invalid characters were found. - if (([callbackId length] > 100) || [_callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) { - return NO; - } - return YES; -} - -- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId -{ - CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status); - // This occurs when there is are no win/fail callbacks for the call. - if ([@"INVALID" isEqualToString : callbackId]) { - return; - } - // This occurs when the callback id is malformed. - if (![self isValidCallbackId:callbackId]) { - NSLog(@"Invalid callback id received by sendPluginResult"); - return; - } - int status = [result.status intValue]; - BOOL keepCallback = [result.keepCallback boolValue]; - NSString* argumentsAsJSON = [result argumentsAsJSON]; - - NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)", callbackId, status, argumentsAsJSON, keepCallback]; - - [self evalJsHelper:js]; -} - -- (void)evalJs:(NSString*)js -{ - [self evalJs:js scheduledOnRunLoop:YES]; -} - -- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop -{ - js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})", js]; - if (scheduledOnRunLoop) { - [self evalJsHelper:js]; - } else { - [self evalJsHelper2:js]; - } -} - -- (id)getCommandInstance:(NSString*)pluginName -{ - return [_viewController getCommandInstance:pluginName]; -} - -- (void)runInBackground:(void (^)())block -{ - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); -} - -- (NSString*)userAgent -{ - return [_viewController userAgent]; -} - -- (BOOL)URLIsWhitelisted:(NSURL*)url -{ - return ![_viewController.whitelist schemeIsAllowed:[url scheme]] || - [_viewController.whitelist URLIsAllowed:url logFailure:NO]; -} - -- (NSDictionary*)settings -{ - return _viewController.settings; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandQueue.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandQueue.h deleted file mode 100644 index 3329078..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandQueue.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - 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. - */ - -#import - -@class CDVInvokedUrlCommand; -@class CDVViewController; - -@interface CDVCommandQueue : NSObject - -@property (nonatomic, readonly) BOOL currentlyExecuting; - -- (id)initWithViewController:(CDVViewController*)viewController; -- (void)dispose; - -- (void)resetRequestId; -- (void)enqueueCommandBatch:(NSString*)batchJSON; - -- (void)processXhrExecBridgePoke:(NSNumber*)requestId; -- (void)fetchCommandsFromJs; -- (void)executePending; -- (BOOL)execute:(CDVInvokedUrlCommand*)command; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandQueue.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandQueue.m deleted file mode 100644 index 1eddfe3..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVCommandQueue.m +++ /dev/null @@ -1,210 +0,0 @@ -/* - 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. - */ - -#include -#import "CDV.h" -#import "CDVCommandQueue.h" -#import "CDVViewController.h" -#import "CDVCommandDelegateImpl.h" - -// Parse JS on the main thread if it's shorter than this. -static const NSInteger JSON_SIZE_FOR_MAIN_THREAD = 4 * 1024; // Chosen arbitrarily. -// Execute multiple commands in one go until this many seconds have passed. -static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame. - -@interface CDVCommandQueue () { - NSInteger _lastCommandQueueFlushRequestId; - __weak CDVViewController* _viewController; - NSMutableArray* _queue; - NSTimeInterval _startExecutionTime; -} -@end - -@implementation CDVCommandQueue - -- (BOOL)currentlyExecuting -{ - return _startExecutionTime > 0; -} - -- (id)initWithViewController:(CDVViewController*)viewController -{ - self = [super init]; - if (self != nil) { - _viewController = viewController; - _queue = [[NSMutableArray alloc] init]; - } - return self; -} - -- (void)dispose -{ - // TODO(agrieve): Make this a zeroing weak ref once we drop support for 4.3. - _viewController = nil; -} - -- (void)resetRequestId -{ - _lastCommandQueueFlushRequestId = 0; -} - -- (void)enqueueCommandBatch:(NSString*)batchJSON -{ - if ([batchJSON length] > 0) { - NSMutableArray* commandBatchHolder = [[NSMutableArray alloc] init]; - [_queue addObject:commandBatchHolder]; - if ([batchJSON length] < JSON_SIZE_FOR_MAIN_THREAD) { - [commandBatchHolder addObject:[batchJSON JSONObject]]; - } else { - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() { - NSMutableArray* result = [batchJSON JSONObject]; - @synchronized(commandBatchHolder) { - [commandBatchHolder addObject:result]; - } - [self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO]; - }); - } - } -} - -- (void)processXhrExecBridgePoke:(NSNumber*)requestId -{ - NSInteger rid = [requestId integerValue]; - - // An ID of 1 is a special case because that signifies the first request of - // the page. Since resetRequestId is called from webViewDidStartLoad, and the - // JS context at the time of webViewDidStartLoad is still that of the previous - // page, it's possible for requests from the previous page to come in after this - // point. We ignore these by enforcing that ID=1 be the first ID. - if ((_lastCommandQueueFlushRequestId == 0) && (rid != 1)) { - CDV_EXEC_LOG(@"Exec: Ignoring exec request from previous page."); - return; - } - - // Use the request ID to determine if we've already flushed for this request. - // This is required only because the NSURLProtocol enqueues the same request - // multiple times. - if (rid > _lastCommandQueueFlushRequestId) { - _lastCommandQueueFlushRequestId = [requestId integerValue]; - [self fetchCommandsFromJs]; - [self executePending]; - } -} - -- (void)fetchCommandsFromJs -{ - // Grab all the queued commands from the JS side. - NSString* queuedCommandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString: - @"cordova.require('cordova/exec').nativeFetchMessages()"]; - - CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0); - [self enqueueCommandBatch:queuedCommandsJSON]; -} - -- (void)executePending -{ - // Make us re-entrant-safe. - if (_startExecutionTime > 0) { - return; - } - @try { - _startExecutionTime = [NSDate timeIntervalSinceReferenceDate]; - - while ([_queue count] > 0) { - NSMutableArray* commandBatchHolder = _queue[0]; - NSMutableArray* commandBatch = nil; - @synchronized(commandBatchHolder) { - // If the next-up command is still being decoded, wait for it. - if ([commandBatchHolder count] == 0) { - break; - } - commandBatch = commandBatchHolder[0]; - } - - while ([commandBatch count] > 0) { - @autoreleasepool { - // Execute the commands one-at-a-time. - NSArray* jsonEntry = [commandBatch dequeue]; - if ([commandBatch count] == 0) { - [_queue removeObjectAtIndex:0]; - } - CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry]; - CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName); - - if (![self execute:command]) { -#ifdef DEBUG - NSString* commandJson = [jsonEntry JSONString]; - static NSUInteger maxLogLength = 1024; - NSString* commandString = ([commandJson length] > maxLogLength) ? - [NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] : - commandJson; - - DLog(@"FAILED pluginJSON = %@", commandString); -#endif - } - } - - // Yield if we're taking too long. - if (([_queue count] > 0) && ([NSDate timeIntervalSinceReferenceDate] - _startExecutionTime > MAX_EXECUTION_TIME)) { - [self performSelector:@selector(executePending) withObject:nil afterDelay:0]; - return; - } - } - } - } @finally - { - _startExecutionTime = 0; - } -} - -- (BOOL)execute:(CDVInvokedUrlCommand*)command -{ - if ((command.className == nil) || (command.methodName == nil)) { - NSLog(@"ERROR: Classname and/or methodName not found for command."); - return NO; - } - - // Fetch an instance of this class - CDVPlugin* obj = [_viewController.commandDelegate getCommandInstance:command.className]; - - if (!([obj isKindOfClass:[CDVPlugin class]])) { - NSLog(@"ERROR: Plugin '%@' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.", command.className); - return NO; - } - BOOL retVal = YES; - double started = [[NSDate date] timeIntervalSince1970] * 1000.0; - // Find the proper selector to call. - NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName]; - SEL normalSelector = NSSelectorFromString(methodName); - if ([obj respondsToSelector:normalSelector]) { - // [obj performSelector:normalSelector withObject:command]; - ((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command); - } else { - // There's no method to call, so throw an error. - NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className); - retVal = NO; - } - double elapsed = [[NSDate date] timeIntervalSince1970] * 1000.0 - started; - if (elapsed > 10) { - NSLog(@"THREAD WARNING: ['%@'] took '%f' ms. Plugin should use a background thread.", command.className, elapsed); - } - return retVal; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVConfigParser.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVConfigParser.h deleted file mode 100644 index 2e06c88..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVConfigParser.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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. - */ - -@interface CDVConfigParser : NSObject -{ - NSString* featureName; -} - -@property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict; -@property (nonatomic, readonly, strong) NSMutableDictionary* settings; -@property (nonatomic, readonly, strong) NSMutableArray* whitelistHosts; -@property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames; -@property (nonatomic, readonly, strong) NSString* startPage; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVConfigParser.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVConfigParser.m deleted file mode 100644 index 4b73b60..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVConfigParser.m +++ /dev/null @@ -1,88 +0,0 @@ -/* - 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. - */ - -#import "CDVConfigParser.h" - -@interface CDVConfigParser () - -@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict; -@property (nonatomic, readwrite, strong) NSMutableDictionary* settings; -@property (nonatomic, readwrite, strong) NSMutableArray* whitelistHosts; -@property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames; -@property (nonatomic, readwrite, strong) NSString* startPage; - -@end - -@implementation CDVConfigParser - -@synthesize pluginsDict, settings, whitelistHosts, startPage, startupPluginNames; - -- (id)init -{ - self = [super init]; - if (self != nil) { - self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30]; - self.settings = [[NSMutableDictionary alloc] initWithCapacity:30]; - self.whitelistHosts = [[NSMutableArray alloc] initWithCapacity:30]; - [self.whitelistHosts addObject:@"file:///*"]; - [self.whitelistHosts addObject:@"content:///*"]; - [self.whitelistHosts addObject:@"data:///*"]; - self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8]; - featureName = nil; - } - return self; -} - -- (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict -{ - if ([elementName isEqualToString:@"preference"]) { - settings[[attributeDict[@"name"] lowercaseString]] = attributeDict[@"value"]; - } else if ([elementName isEqualToString:@"feature"]) { // store feature name to use with correct parameter set - featureName = [attributeDict[@"name"] lowercaseString]; - } else if ((featureName != nil) && [elementName isEqualToString:@"param"]) { - NSString* paramName = [attributeDict[@"name"] lowercaseString]; - id value = attributeDict[@"value"]; - if ([paramName isEqualToString:@"ios-package"]) { - pluginsDict[featureName] = value; - } - BOOL paramIsOnload = ([paramName isEqualToString:@"onload"] && [@"true" isEqualToString : value]); - BOOL attribIsOnload = [@"true" isEqualToString :[attributeDict[@"onload"] lowercaseString]]; - if (paramIsOnload || attribIsOnload) { - [self.startupPluginNames addObject:featureName]; - } - } else if ([elementName isEqualToString:@"access"]) { - [whitelistHosts addObject:attributeDict[@"origin"]]; - } else if ([elementName isEqualToString:@"content"]) { - self.startPage = attributeDict[@"src"]; - } -} - -- (void)parser:(NSXMLParser*)parser didEndElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName -{ - if ([elementName isEqualToString:@"feature"]) { // no longer handling a feature so release - featureName = nil; - } -} - -- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError -{ - NSAssert(NO, @"config.xml parse error line %ld col %ld", (long)[parser lineNumber], (long)[parser columnNumber]); -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVDebug.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVDebug.h deleted file mode 100644 index 4a0d9f9..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVDebug.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - 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. - */ - -#ifdef DEBUG - #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) -#else - #define DLog(...) -#endif -#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.h deleted file mode 100644 index 993e0a2..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - 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. - */ - -#import - -@interface CDVInvokedUrlCommand : NSObject { - NSString* _callbackId; - NSString* _className; - NSString* _methodName; - NSArray* _arguments; -} - -@property (nonatomic, readonly) NSArray* arguments; -@property (nonatomic, readonly) NSString* callbackId; -@property (nonatomic, readonly) NSString* className; -@property (nonatomic, readonly) NSString* methodName; - -+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry; - -- (id)initWithArguments:(NSArray*)arguments - callbackId:(NSString*)callbackId - className:(NSString*)className - methodName:(NSString*)methodName; - -- (id)initFromJson:(NSArray*)jsonEntry; - -// Returns the argument at the given index. -// If index >= the number of arguments, returns nil. -// If the argument at the given index is NSNull, returns nil. -- (id)argumentAtIndex:(NSUInteger)index; -// Same as above, but returns defaultValue instead of nil. -- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue; -// Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue -- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.m deleted file mode 100644 index ff5f647..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.m +++ /dev/null @@ -1,117 +0,0 @@ -/* - 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. - */ - -#import "CDVInvokedUrlCommand.h" -#import "CDVJSON.h" -#import "NSData+Base64.h" - -@implementation CDVInvokedUrlCommand - -@synthesize arguments = _arguments; -@synthesize callbackId = _callbackId; -@synthesize className = _className; -@synthesize methodName = _methodName; - -+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry -{ - return [[CDVInvokedUrlCommand alloc] initFromJson:jsonEntry]; -} - -- (id)initFromJson:(NSArray*)jsonEntry -{ - id tmp = [jsonEntry objectAtIndex:0]; - NSString* callbackId = tmp == [NSNull null] ? nil : tmp; - NSString* className = [jsonEntry objectAtIndex:1]; - NSString* methodName = [jsonEntry objectAtIndex:2]; - NSMutableArray* arguments = [jsonEntry objectAtIndex:3]; - - return [self initWithArguments:arguments - callbackId:callbackId - className:className - methodName:methodName]; -} - -- (id)initWithArguments:(NSArray*)arguments - callbackId:(NSString*)callbackId - className:(NSString*)className - methodName:(NSString*)methodName -{ - self = [super init]; - if (self != nil) { - _arguments = arguments; - _callbackId = callbackId; - _className = className; - _methodName = methodName; - } - [self massageArguments]; - return self; -} - -- (void)massageArguments -{ - NSMutableArray* newArgs = nil; - - for (NSUInteger i = 0, count = [_arguments count]; i < count; ++i) { - id arg = [_arguments objectAtIndex:i]; - if (![arg isKindOfClass:[NSDictionary class]]) { - continue; - } - NSDictionary* dict = arg; - NSString* type = [dict objectForKey:@"CDVType"]; - if (!type || ![type isEqualToString:@"ArrayBuffer"]) { - continue; - } - NSString* data = [dict objectForKey:@"data"]; - if (!data) { - continue; - } - if (newArgs == nil) { - newArgs = [NSMutableArray arrayWithArray:_arguments]; - _arguments = newArgs; - } - [newArgs replaceObjectAtIndex:i withObject:[NSData dataFromBase64String:data]]; - } -} - -- (id)argumentAtIndex:(NSUInteger)index -{ - return [self argumentAtIndex:index withDefault:nil]; -} - -- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue -{ - return [self argumentAtIndex:index withDefault:defaultValue andClass:nil]; -} - -- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass -{ - if (index >= [_arguments count]) { - return defaultValue; - } - id ret = [_arguments objectAtIndex:index]; - if (ret == [NSNull null]) { - ret = defaultValue; - } - if ((aClass != nil) && ![ret isKindOfClass:aClass]) { - ret = defaultValue; - } - return ret; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVJSON.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVJSON.h deleted file mode 100644 index eaa895e..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVJSON.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - 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. - */ - -@interface NSArray (CDVJSONSerializing) -- (NSString*)JSONString; -@end - -@interface NSDictionary (CDVJSONSerializing) -- (NSString*)JSONString; -@end - -@interface NSString (CDVJSONSerializing) -- (id)JSONObject; -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVJSON.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVJSON.m deleted file mode 100644 index f42dfae..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVJSON.m +++ /dev/null @@ -1,77 +0,0 @@ -/* - 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. - */ - -#import "CDVJSON.h" -#import - -@implementation NSArray (CDVJSONSerializing) - -- (NSString*)JSONString -{ - NSError* error = nil; - NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self - options:NSJSONWritingPrettyPrinted - error:&error]; - - if (error != nil) { - NSLog(@"NSArray JSONString error: %@", [error localizedDescription]); - return nil; - } else { - return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - } -} - -@end - -@implementation NSDictionary (CDVJSONSerializing) - -- (NSString*)JSONString -{ - NSError* error = nil; - NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self - options:NSJSONWritingPrettyPrinted - error:&error]; - - if (error != nil) { - NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]); - return nil; - } else { - return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - } -} - -@end - -@implementation NSString (CDVJSONSerializing) - -- (id)JSONObject -{ - NSError* error = nil; - id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] - options:NSJSONReadingMutableContainers - error:&error]; - - if (error != nil) { - NSLog(@"NSString JSONObject error: %@", [error localizedDescription]); - } - - return object; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVLocalStorage.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVLocalStorage.h deleted file mode 100644 index dec6ab3..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVLocalStorage.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - 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. - */ - -#import "CDVPlugin.h" - -#define kCDVLocalStorageErrorDomain @"kCDVLocalStorageErrorDomain" -#define kCDVLocalStorageFileOperationError 1 - -@interface CDVLocalStorage : CDVPlugin - -@property (nonatomic, readonly, strong) NSMutableArray* backupInfo; - -- (BOOL)shouldBackup; -- (BOOL)shouldRestore; -- (void)backup:(CDVInvokedUrlCommand*)command; -- (void)restore:(CDVInvokedUrlCommand*)command; - -+ (void)__fixupDatabaseLocationsWithBackupType:(NSString*)backupType; -// Visible for testing. -+ (BOOL)__verifyAndFixDatabaseLocationsWithAppPlistDict:(NSMutableDictionary*)appPlistDict - bundlePath:(NSString*)bundlePath - fileManager:(NSFileManager*)fileManager; -@end - -@interface CDVBackupInfo : NSObject - -@property (nonatomic, copy) NSString* original; -@property (nonatomic, copy) NSString* backup; -@property (nonatomic, copy) NSString* label; - -- (BOOL)shouldBackup; -- (BOOL)shouldRestore; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVLocalStorage.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVLocalStorage.m deleted file mode 100644 index 5e2f4bb..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVLocalStorage.m +++ /dev/null @@ -1,491 +0,0 @@ -/* - 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. - */ - -#import "CDVLocalStorage.h" -#import "CDV.h" - -@interface CDVLocalStorage () - -@property (nonatomic, readwrite, strong) NSMutableArray* backupInfo; // array of CDVBackupInfo objects -@property (nonatomic, readwrite, weak) id webviewDelegate; - -@end - -@implementation CDVLocalStorage - -@synthesize backupInfo, webviewDelegate; - -- (void)pluginInitialize -{ - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResignActive) - name:UIApplicationWillResignActiveNotification object:nil]; - BOOL cloudBackup = [@"cloud" isEqualToString : self.commandDelegate.settings[[@"BackupWebStorage" lowercaseString]]]; - - self.backupInfo = [[self class] createBackupInfoWithCloudBackup:cloudBackup]; -} - -#pragma mark - -#pragma mark Plugin interface methods - -+ (NSMutableArray*)createBackupInfoWithTargetDir:(NSString*)targetDir backupDir:(NSString*)backupDir targetDirNests:(BOOL)targetDirNests backupDirNests:(BOOL)backupDirNests rename:(BOOL)rename -{ - /* - This "helper" does so much work and has so many options it would probably be clearer to refactor the whole thing. - Basically, there are three database locations: - - 1. "Normal" dir -- LIB// - 2. "Caches" dir -- LIB/Caches/ - 3. "Backup" dir -- DOC/Backups/ - - And between these three, there are various migration paths, most of which only consider 2 of the 3, which is why this helper is based on 2 locations and has a notion of "direction". - */ - NSMutableArray* backupInfo = [NSMutableArray arrayWithCapacity:3]; - - NSString* original; - NSString* backup; - CDVBackupInfo* backupItem; - - // ////////// LOCALSTORAGE - - original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/file__0.localstorage":@"file__0.localstorage"]; - backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage" : @"")]; - backup = [backup stringByAppendingPathComponent:(rename ? @"localstorage.appdata.db" : @"file__0.localstorage")]; - - backupItem = [[CDVBackupInfo alloc] init]; - backupItem.backup = backup; - backupItem.original = original; - backupItem.label = @"localStorage database"; - - [backupInfo addObject:backupItem]; - - // ////////// WEBSQL MAIN DB - - original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/Databases.db":@"Databases.db"]; - backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage" : @"")]; - backup = [backup stringByAppendingPathComponent:(rename ? @"websqlmain.appdata.db" : @"Databases.db")]; - - backupItem = [[CDVBackupInfo alloc] init]; - backupItem.backup = backup; - backupItem.original = original; - backupItem.label = @"websql main database"; - - [backupInfo addObject:backupItem]; - - // ////////// WEBSQL DATABASES - - original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/file__0":@"file__0"]; - backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage" : @"")]; - backup = [backup stringByAppendingPathComponent:(rename ? @"websqldbs.appdata.db" : @"file__0")]; - - backupItem = [[CDVBackupInfo alloc] init]; - backupItem.backup = backup; - backupItem.original = original; - backupItem.label = @"websql databases"; - - [backupInfo addObject:backupItem]; - - return backupInfo; -} - -+ (NSMutableArray*)createBackupInfoWithCloudBackup:(BOOL)cloudBackup -{ - // create backup info from backup folder to caches folder - NSString* appLibraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - NSString* appDocumentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - NSString* cacheFolder = [appLibraryFolder stringByAppendingPathComponent:@"Caches"]; - NSString* backupsFolder = [appDocumentsFolder stringByAppendingPathComponent:@"Backups"]; - - // create the backups folder, if needed - [[NSFileManager defaultManager] createDirectoryAtPath:backupsFolder withIntermediateDirectories:YES attributes:nil error:nil]; - - [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:backupsFolder] skip:!cloudBackup]; - - return [self createBackupInfoWithTargetDir:cacheFolder backupDir:backupsFolder targetDirNests:NO backupDirNests:NO rename:YES]; -} - -+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL*)URL skip:(BOOL)skip -{ - NSAssert(IsAtLeastiOSVersion(@"5.1"), @"Cannot mark files for NSURLIsExcludedFromBackupKey on iOS less than 5.1"); - - NSError* error = nil; - BOOL success = [URL setResourceValue:[NSNumber numberWithBool:skip] forKey:NSURLIsExcludedFromBackupKey error:&error]; - if (!success) { - NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error); - } - return success; -} - -+ (BOOL)copyFrom:(NSString*)src to:(NSString*)dest error:(NSError* __autoreleasing*)error -{ - NSFileManager* fileManager = [NSFileManager defaultManager]; - - if (![fileManager fileExistsAtPath:src]) { - NSString* errorString = [NSString stringWithFormat:@"%@ file does not exist.", src]; - if (error != NULL) { - (*error) = [NSError errorWithDomain:kCDVLocalStorageErrorDomain - code:kCDVLocalStorageFileOperationError - userInfo:[NSDictionary dictionaryWithObject:errorString - forKey:NSLocalizedDescriptionKey]]; - } - return NO; - } - - // generate unique filepath in temp directory - CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault); - CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef); - NSString* tempBackup = [[NSTemporaryDirectory() stringByAppendingPathComponent:(__bridge NSString*)uuidString] stringByAppendingPathExtension:@"bak"]; - CFRelease(uuidString); - CFRelease(uuidRef); - - BOOL destExists = [fileManager fileExistsAtPath:dest]; - - // backup the dest - if (destExists && ![fileManager copyItemAtPath:dest toPath:tempBackup error:error]) { - return NO; - } - - // remove the dest - if (destExists && ![fileManager removeItemAtPath:dest error:error]) { - return NO; - } - - // create path to dest - if (!destExists && ![fileManager createDirectoryAtPath:[dest stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:error]) { - return NO; - } - - // copy src to dest - if ([fileManager copyItemAtPath:src toPath:dest error:error]) { - // success - cleanup - delete the backup to the dest - if ([fileManager fileExistsAtPath:tempBackup]) { - [fileManager removeItemAtPath:tempBackup error:error]; - } - return YES; - } else { - // failure - we restore the temp backup file to dest - [fileManager copyItemAtPath:tempBackup toPath:dest error:error]; - // cleanup - delete the backup to the dest - if ([fileManager fileExistsAtPath:tempBackup]) { - [fileManager removeItemAtPath:tempBackup error:error]; - } - return NO; - } -} - -- (BOOL)shouldBackup -{ - for (CDVBackupInfo* info in self.backupInfo) { - if ([info shouldBackup]) { - return YES; - } - } - - return NO; -} - -- (BOOL)shouldRestore -{ - for (CDVBackupInfo* info in self.backupInfo) { - if ([info shouldRestore]) { - return YES; - } - } - - return NO; -} - -/* copy from webkitDbLocation to persistentDbLocation */ -- (void)backup:(CDVInvokedUrlCommand*)command -{ - NSString* callbackId = command.callbackId; - - NSError* __autoreleasing error = nil; - CDVPluginResult* result = nil; - NSString* message = nil; - - for (CDVBackupInfo* info in self.backupInfo) { - if ([info shouldBackup]) { - [[self class] copyFrom:info.original to:info.backup error:&error]; - - if (callbackId) { - if (error == nil) { - message = [NSString stringWithFormat:@"Backed up: %@", info.label]; - NSLog(@"%@", message); - - result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message]; - [self.commandDelegate sendPluginResult:result callbackId:callbackId]; - } else { - message = [NSString stringWithFormat:@"Error in CDVLocalStorage (%@) backup: %@", info.label, [error localizedDescription]]; - NSLog(@"%@", message); - - result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message]; - [self.commandDelegate sendPluginResult:result callbackId:callbackId]; - } - } - } - } -} - -/* copy from persistentDbLocation to webkitDbLocation */ -- (void)restore:(CDVInvokedUrlCommand*)command -{ - NSError* __autoreleasing error = nil; - CDVPluginResult* result = nil; - NSString* message = nil; - - for (CDVBackupInfo* info in self.backupInfo) { - if ([info shouldRestore]) { - [[self class] copyFrom:info.backup to:info.original error:&error]; - - if (error == nil) { - message = [NSString stringWithFormat:@"Restored: %@", info.label]; - NSLog(@"%@", message); - - result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message]; - [self.commandDelegate sendPluginResult:result callbackId:command.callbackId]; - } else { - message = [NSString stringWithFormat:@"Error in CDVLocalStorage (%@) restore: %@", info.label, [error localizedDescription]]; - NSLog(@"%@", message); - - result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message]; - [self.commandDelegate sendPluginResult:result callbackId:command.callbackId]; - } - } - } -} - -+ (void)__fixupDatabaseLocationsWithBackupType:(NSString*)backupType -{ - [self __verifyAndFixDatabaseLocations]; - [self __restoreLegacyDatabaseLocationsWithBackupType:backupType]; -} - -+ (void)__verifyAndFixDatabaseLocations -{ - NSBundle* mainBundle = [NSBundle mainBundle]; - NSString* bundlePath = [[mainBundle bundlePath] stringByDeletingLastPathComponent]; - NSString* bundleIdentifier = [[mainBundle infoDictionary] objectForKey:@"CFBundleIdentifier"]; - NSString* appPlistPath = [bundlePath stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/Preferences/%@.plist", bundleIdentifier]]; - - NSMutableDictionary* appPlistDict = [NSMutableDictionary dictionaryWithContentsOfFile:appPlistPath]; - BOOL modified = [[self class] __verifyAndFixDatabaseLocationsWithAppPlistDict:appPlistDict - bundlePath:bundlePath - fileManager:[NSFileManager defaultManager]]; - - if (modified) { - BOOL ok = [appPlistDict writeToFile:appPlistPath atomically:YES]; - [[NSUserDefaults standardUserDefaults] synchronize]; - NSLog(@"Fix applied for database locations?: %@", ok ? @"YES" : @"NO"); - } -} - -+ (BOOL)__verifyAndFixDatabaseLocationsWithAppPlistDict:(NSMutableDictionary*)appPlistDict - bundlePath:(NSString*)bundlePath - fileManager:(NSFileManager*)fileManager -{ - NSString* libraryCaches = @"Library/Caches"; - NSString* libraryWebKit = @"Library/WebKit"; - - NSArray* keysToCheck = [NSArray arrayWithObjects: - @"WebKitLocalStorageDatabasePathPreferenceKey", - @"WebDatabaseDirectory", - nil]; - - BOOL dirty = NO; - - for (NSString* key in keysToCheck) { - NSString* value = [appPlistDict objectForKey:key]; - // verify key exists, and path is in app bundle, if not - fix - if ((value != nil) && ![value hasPrefix:bundlePath]) { - // the pathSuffix to use may be wrong - OTA upgrades from < 5.1 to 5.1 do keep the old path Library/WebKit, - // while Xcode synced ones do change the storage location to Library/Caches - NSString* newBundlePath = [bundlePath stringByAppendingPathComponent:libraryCaches]; - if (![fileManager fileExistsAtPath:newBundlePath]) { - newBundlePath = [bundlePath stringByAppendingPathComponent:libraryWebKit]; - } - [appPlistDict setValue:newBundlePath forKey:key]; - dirty = YES; - } - } - - return dirty; -} - -+ (void)__restoreLegacyDatabaseLocationsWithBackupType:(NSString*)backupType -{ - // on iOS 6, if you toggle between cloud/local backup, you must move database locations. Default upgrade from iOS5.1 to iOS6 is like a toggle from local to cloud. - if (!IsAtLeastiOSVersion(@"6.0")) { - return; - } - - NSString* appLibraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - NSString* appDocumentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; - - NSMutableArray* backupInfo = [NSMutableArray arrayWithCapacity:0]; - - if ([backupType isEqualToString:@"cloud"]) { -#ifdef DEBUG - NSLog(@"\n\nStarted backup to iCloud! Please be careful." - "\nYour application might be rejected by Apple if you store too much data." - "\nFor more information please read \"iOS Data Storage Guidelines\" at:" - "\nhttps://developer.apple.com/icloud/documentation/data-storage/\n\n"); -#endif - // We would like to restore old backups/caches databases to the new destination (nested in lib folder) - [backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:appLibraryFolder backupDir:[appDocumentsFolder stringByAppendingPathComponent:@"Backups"] targetDirNests:YES backupDirNests:NO rename:YES]]; - [backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:appLibraryFolder backupDir:[appLibraryFolder stringByAppendingPathComponent:@"Caches"] targetDirNests:YES backupDirNests:NO rename:NO]]; - } else { - // For ios6 local backups we also want to restore from Backups dir -- but we don't need to do that here, since the plugin will do that itself. - [backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:[appLibraryFolder stringByAppendingPathComponent:@"Caches"] backupDir:appLibraryFolder targetDirNests:NO backupDirNests:YES rename:NO]]; - } - - NSFileManager* manager = [NSFileManager defaultManager]; - - for (CDVBackupInfo* info in backupInfo) { - if ([manager fileExistsAtPath:info.backup]) { - if ([info shouldRestore]) { - NSLog(@"Restoring old webstorage backup. From: '%@' To: '%@'.", info.backup, info.original); - [self copyFrom:info.backup to:info.original error:nil]; - } - NSLog(@"Removing old webstorage backup: '%@'.", info.backup); - [manager removeItemAtPath:info.backup error:nil]; - } - } - - [[NSUserDefaults standardUserDefaults] setBool:[backupType isEqualToString:@"cloud"] forKey:@"WebKitStoreWebDataForBackup"]; -} - -#pragma mark - -#pragma mark Notification handlers - -- (void)onResignActive -{ - UIDevice* device = [UIDevice currentDevice]; - NSNumber* exitsOnSuspend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIApplicationExitsOnSuspend"]; - - BOOL isMultitaskingSupported = [device respondsToSelector:@selector(isMultitaskingSupported)] && [device isMultitaskingSupported]; - - if (exitsOnSuspend == nil) { // if it's missing, it should be NO (i.e. multi-tasking on by default) - exitsOnSuspend = [NSNumber numberWithBool:NO]; - } - - if (exitsOnSuspend) { - [self backup:nil]; - } else if (isMultitaskingSupported) { - __block UIBackgroundTaskIdentifier backgroundTaskID = UIBackgroundTaskInvalid; - - backgroundTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ - [[UIApplication sharedApplication] endBackgroundTask:backgroundTaskID]; - backgroundTaskID = UIBackgroundTaskInvalid; - NSLog(@"Background task to backup WebSQL/LocalStorage expired."); - }]; - CDVLocalStorage __weak* weakSelf = self; - [self.commandDelegate runInBackground:^{ - [weakSelf backup:nil]; - - [[UIApplication sharedApplication] endBackgroundTask:backgroundTaskID]; - backgroundTaskID = UIBackgroundTaskInvalid; - }]; - } -} - -- (void)onAppTerminate -{ - [self onResignActive]; -} - -- (void)onReset -{ - [self restore:nil]; -} - -@end - -#pragma mark - -#pragma mark CDVBackupInfo implementation - -@implementation CDVBackupInfo - -@synthesize original, backup, label; - -- (BOOL)file:(NSString*)aPath isNewerThanFile:(NSString*)bPath -{ - NSFileManager* fileManager = [NSFileManager defaultManager]; - NSError* __autoreleasing error = nil; - - NSDictionary* aPathAttribs = [fileManager attributesOfItemAtPath:aPath error:&error]; - NSDictionary* bPathAttribs = [fileManager attributesOfItemAtPath:bPath error:&error]; - - NSDate* aPathModDate = [aPathAttribs objectForKey:NSFileModificationDate]; - NSDate* bPathModDate = [bPathAttribs objectForKey:NSFileModificationDate]; - - if ((nil == aPathModDate) && (nil == bPathModDate)) { - return NO; - } - - return [aPathModDate compare:bPathModDate] == NSOrderedDescending || bPathModDate == nil; -} - -- (BOOL)item:(NSString*)aPath isNewerThanItem:(NSString*)bPath -{ - NSFileManager* fileManager = [NSFileManager defaultManager]; - - BOOL aPathIsDir = NO, bPathIsDir = NO; - BOOL aPathExists = [fileManager fileExistsAtPath:aPath isDirectory:&aPathIsDir]; - - [fileManager fileExistsAtPath:bPath isDirectory:&bPathIsDir]; - - if (!aPathExists) { - return NO; - } - - if (!(aPathIsDir && bPathIsDir)) { // just a file - return [self file:aPath isNewerThanFile:bPath]; - } - - // essentially we want rsync here, but have to settle for our poor man's implementation - // we get the files in aPath, and see if it is newer than the file in bPath - // (it is newer if it doesn't exist in bPath) if we encounter the FIRST file that is newer, - // we return YES - NSDirectoryEnumerator* directoryEnumerator = [fileManager enumeratorAtPath:aPath]; - NSString* path; - - while ((path = [directoryEnumerator nextObject])) { - NSString* aPathFile = [aPath stringByAppendingPathComponent:path]; - NSString* bPathFile = [bPath stringByAppendingPathComponent:path]; - - BOOL isNewer = [self file:aPathFile isNewerThanFile:bPathFile]; - if (isNewer) { - return YES; - } - } - - return NO; -} - -- (BOOL)shouldBackup -{ - return [self item:self.original isNewerThanItem:self.backup]; -} - -- (BOOL)shouldRestore -{ - return [self item:self.backup isNewerThanItem:self.original]; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPlugin.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPlugin.h deleted file mode 100644 index 5e8b283..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPlugin.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - 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. - */ - -#import -#import -#import "CDVPluginResult.h" -#import "NSMutableArray+QueueAdditions.h" -#import "CDVCommandDelegate.h" - -extern NSString* const CDVPageDidLoadNotification; -extern NSString* const CDVPluginHandleOpenURLNotification; -extern NSString* const CDVPluginResetNotification; -extern NSString* const CDVLocalNotification; -extern NSString* const CDVRemoteNotification; -extern NSString* const CDVRemoteNotificationError; - -@interface CDVPlugin : NSObject {} - -@property (nonatomic, weak) UIWebView* webView; -@property (nonatomic, weak) UIViewController* viewController; -@property (nonatomic, weak) id commandDelegate; - -@property (readonly, assign) BOOL hasPendingOperation; - -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView; -- (void)pluginInitialize; - -- (void)handleOpenURL:(NSNotification*)notification; -- (void)onAppTerminate; -- (void)onMemoryWarning; -- (void)onReset; -- (void)dispose; - -/* - // see initWithWebView implementation - - (void) onPause {} - - (void) onResume {} - - (void) onOrientationWillChange {} - - (void) onOrientationDidChange {} - - (void)didReceiveLocalNotification:(NSNotification *)notification; - */ - -- (id)appDelegate; - -- (NSString*)writeJavascript:(NSString*)javascript CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of evalJs:. This will be removed in 4.0.0"); - -- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId. This will be removed in 4.0.0"); - -- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate equivalent of sendPluginResult:callbackId. This will be removed in 4.0.0"); - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPlugin.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPlugin.m deleted file mode 100644 index ea81ddd..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPlugin.m +++ /dev/null @@ -1,154 +0,0 @@ -/* - 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. - */ - -#import "CDVPlugin.h" - -NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification"; -NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification"; -NSString* const CDVPluginResetNotification = @"CDVPluginResetNotification"; -NSString* const CDVLocalNotification = @"CDVLocalNotification"; -NSString* const CDVRemoteNotification = @"CDVRemoteNotification"; -NSString* const CDVRemoteNotificationError = @"CDVRemoteNotificationError"; - -@interface CDVPlugin () - -@property (readwrite, assign) BOOL hasPendingOperation; - -@end - -@implementation CDVPlugin -@synthesize webView, viewController, commandDelegate, hasPendingOperation; - -// Do not override these methods. Use pluginInitialize instead. -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings -{ - return [self initWithWebView:theWebView]; -} - -- (CDVPlugin*)initWithWebView:(UIWebView*)theWebView -{ - self = [super init]; - if (self) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebView]; - - self.webView = theWebView; - } - return self; -} - -- (void)pluginInitialize -{ - // You can listen to more app notifications, see: - // http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-DontLinkElementID_4 - - // NOTE: if you want to use these, make sure you uncomment the corresponding notification handler - - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil]; - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil]; - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil]; - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; - - // Added in 2.3.0 - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil]; - - // Added in 2.5.0 - // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView]; -} - -- (void)dispose -{ - viewController = nil; - commandDelegate = nil; - webView = nil; -} - -/* -// NOTE: for onPause and onResume, calls into JavaScript must not call or trigger any blocking UI, like alerts -- (void) onPause {} -- (void) onResume {} -- (void) onOrientationWillChange {} -- (void) onOrientationDidChange {} -*/ - -/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */ -- (void)handleOpenURL:(NSNotification*)notification -{ - // override to handle urls sent to your app - // register your url schemes in your App-Info.plist - - NSURL* url = [notification object]; - - if ([url isKindOfClass:[NSURL class]]) { - /* Do your thing! */ - } -} - -/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */ -- (void)onAppTerminate -{ - // override this if you need to do any cleanup on app exit -} - -- (void)onMemoryWarning -{ - // override to remove caches, etc -} - -- (void)onReset -{ - // Override to cancel any long-running requests when the WebView navigates or refreshes. -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; // this will remove all notification unless added using addObserverForName:object:queue:usingBlock: -} - -- (id)appDelegate -{ - return [[UIApplication sharedApplication] delegate]; -} - -- (NSString*)writeJavascript:(NSString*)javascript -{ - return [self.webView stringByEvaluatingJavaScriptFromString:javascript]; -} - -- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId -{ - [self.commandDelegate evalJs:[pluginResult toSuccessCallbackString:callbackId]]; - return @""; -} - -- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId -{ - [self.commandDelegate evalJs:[pluginResult toErrorCallbackString:callbackId]]; - return @""; -} - -// default implementation does nothing, ideally, we are not registered for notification if we aren't going to do anything. -// - (void)didReceiveLocalNotification:(NSNotification *)notification -// { -// // UILocalNotification* localNotification = [notification object]; // get the payload as a LocalNotification -// } - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPluginResult.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPluginResult.h deleted file mode 100644 index e624d4d..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPluginResult.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - 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. - */ - -#import -#import "CDVAvailability.h" - -typedef enum { - CDVCommandStatus_NO_RESULT = 0, - CDVCommandStatus_OK, - CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION, - CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION, - CDVCommandStatus_INSTANTIATION_EXCEPTION, - CDVCommandStatus_MALFORMED_URL_EXCEPTION, - CDVCommandStatus_IO_EXCEPTION, - CDVCommandStatus_INVALID_ACTION, - CDVCommandStatus_JSON_EXCEPTION, - CDVCommandStatus_ERROR -} CDVCommandStatus; - -@interface CDVPluginResult : NSObject {} - -@property (nonatomic, strong, readonly) NSNumber* status; -@property (nonatomic, strong, readonly) id message; -@property (nonatomic, strong) NSNumber* keepCallback; -// This property can be used to scope the lifetime of another object. For example, -// Use it to store the associated NSData when `message` is created using initWithBytesNoCopy. -@property (nonatomic, strong) id associatedObject; - -- (CDVPluginResult*)init; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages; -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode; - -+ (void)setVerbose:(BOOL)verbose; -+ (BOOL)isVerbose; - -- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback; - -- (NSString*)argumentsAsJSON; - -// These methods are used by the legacy plugin return result method -- (NSString*)toJSONString CDV_DEPRECATED(3.6, "Only used by toSuccessCallbackString and toErrorCallbackString which are deprecated. This will be removed in 4.0.0"); - -- (NSString*)toSuccessCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0"); - -- (NSString*)toErrorCallbackString:(NSString*)callbackId CDV_DEPRECATED(3.6, "Use the CDVCommandDelegate method sendPluginResult:callbackId instead. This will be removed in 4.0.0"); - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPluginResult.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPluginResult.m deleted file mode 100644 index 2eb46cd..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVPluginResult.m +++ /dev/null @@ -1,224 +0,0 @@ -/* - 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. - */ - -#import "CDVPluginResult.h" -#import "CDVJSON.h" -#import "CDVDebug.h" -#import "NSData+Base64.h" - -@interface CDVPluginResult () - -- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage; - -@end - -@implementation CDVPluginResult -@synthesize status, message, keepCallback, associatedObject; - -static NSArray* org_apache_cordova_CommandStatusMsgs; - -id messageFromArrayBuffer(NSData* data) -{ - return @{ - @"CDVType" : @"ArrayBuffer", - @"data" :[data base64EncodedString] - }; -} - -id massageMessage(id message) -{ - if ([message isKindOfClass:[NSData class]]) { - return messageFromArrayBuffer(message); - } - return message; -} - -id messageFromMultipart(NSArray* theMessages) -{ - NSMutableArray* messages = [NSMutableArray arrayWithArray:theMessages]; - - for (NSUInteger i = 0; i < messages.count; ++i) { - [messages replaceObjectAtIndex:i withObject:massageMessage([messages objectAtIndex:i])]; - } - - return @{ - @"CDVType" : @"MultiPart", - @"messages" : messages - }; -} - -+ (void)initialize -{ - org_apache_cordova_CommandStatusMsgs = [[NSArray alloc] initWithObjects:@"No result", - @"OK", - @"Class not found", - @"Illegal access", - @"Instantiation error", - @"Malformed url", - @"IO error", - @"Invalid action", - @"JSON error", - @"Error", - nil]; -} - -- (CDVPluginResult*)init -{ - return [self initWithStatus:CDVCommandStatus_NO_RESULT message:nil]; -} - -- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage -{ - self = [super init]; - if (self) { - status = [NSNumber numberWithInt:statusOrdinal]; - message = theMessage; - keepCallback = [NSNumber numberWithBool:NO]; - } - return self; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal -{ - return [[self alloc] initWithStatus:statusOrdinal message:nil]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:theMessage]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:theMessage]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInt:theMessage]]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithDouble:theMessage]]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithBool:theMessage]]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:theMessage]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage -{ - return [[self alloc] initWithStatus:statusOrdinal message:messageFromArrayBuffer(theMessage)]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages -{ - return [[self alloc] initWithStatus:statusOrdinal message:messageFromMultipart(theMessages)]; -} - -+ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode -{ - NSDictionary* errDict = @{@"code" :[NSNumber numberWithInt:errorCode]}; - - return [[self alloc] initWithStatus:statusOrdinal message:errDict]; -} - -- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback -{ - [self setKeepCallback:[NSNumber numberWithBool:bKeepCallback]]; -} - -- (NSString*)argumentsAsJSON -{ - id arguments = (self.message == nil ? [NSNull null] : self.message); - NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments]; - - NSString* argumentsJSON = [argumentsWrappedInArray JSONString]; - - argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)]; - - return argumentsJSON; -} - -// These methods are used by the legacy plugin return result method -- (NSString*)toJSONString -{ - NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: - self.status, @"status", - self.message ? self. message:[NSNull null], @"message", - self.keepCallback, @"keepCallback", - nil]; - - NSError* error = nil; - NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict - options:NSJSONWritingPrettyPrinted - error:&error]; - NSString* resultString = nil; - - if (error != nil) { - NSLog(@"toJSONString error: %@", [error localizedDescription]); - } else { - resultString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; - } - - if ([[self class] isVerbose]) { - NSLog(@"PluginResult:toJSONString - %@", resultString); - } - return resultString; -} - -- (NSString*)toSuccessCallbackString:(NSString*)callbackId -{ - NSString* successCB = [NSString stringWithFormat:@"cordova.callbackSuccess('%@',%@);", callbackId, [self toJSONString]]; - - if ([[self class] isVerbose]) { - NSLog(@"PluginResult toSuccessCallbackString: %@", successCB); - } - return successCB; -} - -- (NSString*)toErrorCallbackString:(NSString*)callbackId -{ - NSString* errorCB = [NSString stringWithFormat:@"cordova.callbackError('%@',%@);", callbackId, [self toJSONString]]; - - if ([[self class] isVerbose]) { - NSLog(@"PluginResult toErrorCallbackString: %@", errorCB); - } - return errorCB; -} - -static BOOL gIsVerbose = NO; -+ (void)setVerbose:(BOOL)verbose -{ - gIsVerbose = verbose; -} - -+ (BOOL)isVerbose -{ - return gIsVerbose; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVScreenOrientationDelegate.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVScreenOrientationDelegate.h deleted file mode 100644 index 7226205..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVScreenOrientationDelegate.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - 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. - */ - -#import - -@protocol CDVScreenOrientationDelegate - -- (NSUInteger)supportedInterfaceOrientations; -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; -- (BOOL)shouldAutorotate; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVShared.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVShared.h deleted file mode 100644 index 68acc5c..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVShared.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - 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. - */ - -// This file was emptied out in 3.6.0 release (July 2014). -// It will be deleted in a future release. -#import diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVTimer.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVTimer.h deleted file mode 100644 index 6d31593..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVTimer.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - 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. - */ - -#import - -@interface CDVTimer : NSObject - -+ (void)start:(NSString*)name; -+ (void)stop:(NSString*)name; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVTimer.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVTimer.m deleted file mode 100644 index 784e94d..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVTimer.m +++ /dev/null @@ -1,123 +0,0 @@ -/* - 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. - */ - -#import "CDVTimer.h" - -#pragma mark CDVTimerItem - -@interface CDVTimerItem : NSObject - -@property (nonatomic, strong) NSString* name; -@property (nonatomic, strong) NSDate* started; -@property (nonatomic, strong) NSDate* ended; - -- (void)log; - -@end - -@implementation CDVTimerItem - -- (void)log -{ - NSLog(@"[CDVTimer][%@] %fms", self.name, [self.ended timeIntervalSinceDate:self.started] * 1000.0); -} - -@end - -#pragma mark CDVTimer - -@interface CDVTimer () - -@property (nonatomic, strong) NSMutableDictionary* items; - -@end - -@implementation CDVTimer - -#pragma mark object methods - -- (id)init -{ - if (self = [super init]) { - self.items = [NSMutableDictionary dictionaryWithCapacity:6]; - } - - return self; -} - -- (void)add:(NSString*)name -{ - if ([self.items objectForKey:[name lowercaseString]] == nil) { - CDVTimerItem* item = [CDVTimerItem new]; - item.name = name; - item.started = [NSDate new]; - [self.items setObject:item forKey:[name lowercaseString]]; - } else { - NSLog(@"Timer called '%@' already exists.", name); - } -} - -- (void)remove:(NSString*)name -{ - CDVTimerItem* item = [self.items objectForKey:[name lowercaseString]]; - - if (item != nil) { - item.ended = [NSDate new]; - [item log]; - [self.items removeObjectForKey:[name lowercaseString]]; - } else { - NSLog(@"Timer called '%@' does not exist.", name); - } -} - -- (void)removeAll -{ - [self.items removeAllObjects]; -} - -#pragma mark class methods - -+ (void)start:(NSString*)name -{ - [[CDVTimer sharedInstance] add:name]; -} - -+ (void)stop:(NSString*)name -{ - [[CDVTimer sharedInstance] remove:name]; -} - -+ (void)clearAll -{ - [[CDVTimer sharedInstance] removeAll]; -} - -+ (CDVTimer*)sharedInstance -{ - static dispatch_once_t pred = 0; - __strong static CDVTimer* _sharedObject = nil; - - dispatch_once(&pred, ^{ - _sharedObject = [[self alloc] init]; - }); - - return _sharedObject; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVURLProtocol.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVURLProtocol.h deleted file mode 100644 index 5444f6d..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVURLProtocol.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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. - */ - -#import -#import "CDVAvailability.h" - -@class CDVViewController; - -@interface CDVURLProtocol : NSURLProtocol {} - -+ (void)registerViewController:(CDVViewController*)viewController; -+ (void)unregisterViewController:(CDVViewController*)viewController; -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m deleted file mode 100644 index 3ecb6a0..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVURLProtocol.m +++ /dev/null @@ -1,243 +0,0 @@ -/* - 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. - */ - -#import -#import -#import -#import -#import "CDVURLProtocol.h" -#import "CDVCommandQueue.h" -#import "CDVWhitelist.h" -#import "CDVViewController.h" - -@interface CDVHTTPURLResponse : NSHTTPURLResponse -#ifndef __IPHONE_8_0 - @property (nonatomic) NSInteger statusCode; -#endif -@end - -static CDVWhitelist* gWhitelist = nil; -// Contains a set of NSNumbers of addresses of controllers. It doesn't store -// the actual pointer to avoid retaining. -static NSMutableSet* gRegisteredControllers = nil; - -NSString* const kCDVAssetsLibraryPrefixes = @"assets-library://"; - -// Returns the registered view controller that sent the given request. -// If the user-agent is not from a UIWebView, or if it's from an unregistered one, -// then nil is returned. -static CDVViewController *viewControllerForRequest(NSURLRequest* request) -{ - // The exec bridge explicitly sets the VC address in a header. - // This works around the User-Agent not being set for file: URLs. - NSString* addrString = [request valueForHTTPHeaderField:@"vc"]; - - if (addrString == nil) { - NSString* userAgent = [request valueForHTTPHeaderField:@"User-Agent"]; - if (userAgent == nil) { - return nil; - } - NSUInteger bracketLocation = [userAgent rangeOfString:@"(" options:NSBackwardsSearch].location; - if (bracketLocation == NSNotFound) { - return nil; - } - addrString = [userAgent substringFromIndex:bracketLocation + 1]; - } - - long long viewControllerAddress = [addrString longLongValue]; - @synchronized(gRegisteredControllers) { - if (![gRegisteredControllers containsObject:[NSNumber numberWithLongLong:viewControllerAddress]]) { - return nil; - } - } - - return (__bridge CDVViewController*)(void*)viewControllerAddress; -} - -@implementation CDVURLProtocol - -+ (void)registerPGHttpURLProtocol {} - -+ (void)registerURLProtocol {} - -// Called to register the URLProtocol, and to make it away of an instance of -// a ViewController. -+ (void)registerViewController:(CDVViewController*)viewController -{ - if (gRegisteredControllers == nil) { - [NSURLProtocol registerClass:[CDVURLProtocol class]]; - gRegisteredControllers = [[NSMutableSet alloc] initWithCapacity:8]; - // The whitelist doesn't change, so grab the first one and store it. - gWhitelist = viewController.whitelist; - - // Note that we grab the whitelist from the first viewcontroller for now - but this will change - // when we allow a registered viewcontroller to have its own whitelist (e.g InAppBrowser) - // Differentiating the requests will be through the 'vc' http header below as used for the js->objc bridge. - // The 'vc' value is generated by casting the viewcontroller object to a (long long) value (see CDVViewController::webViewDidFinishLoad) - if (gWhitelist == nil) { - NSLog(@"WARNING: NO whitelist has been set in CDVURLProtocol."); - } - } - - @synchronized(gRegisteredControllers) { - [gRegisteredControllers addObject:[NSNumber numberWithLongLong:(long long)viewController]]; - } -} - -+ (void)unregisterViewController:(CDVViewController*)viewController -{ - @synchronized(gRegisteredControllers) { - [gRegisteredControllers removeObject:[NSNumber numberWithLongLong:(long long)viewController]]; - } -} - -+ (BOOL)canInitWithRequest:(NSURLRequest*)theRequest -{ - NSURL* theUrl = [theRequest URL]; - CDVViewController* viewController = viewControllerForRequest(theRequest); - - if ([[theUrl absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { - return YES; - } else if (viewController != nil) { - if ([[theUrl path] isEqualToString:@"/!gap_exec"]) { - NSString* queuedCommandsJSON = [theRequest valueForHTTPHeaderField:@"cmds"]; - NSString* requestId = [theRequest valueForHTTPHeaderField:@"rc"]; - if (requestId == nil) { - NSLog(@"!cordova request missing rc header"); - return NO; - } - BOOL hasCmds = [queuedCommandsJSON length] > 0; - if (hasCmds) { - SEL sel = @selector(enqueueCommandBatch:); - [viewController.commandQueue performSelectorOnMainThread:sel withObject:queuedCommandsJSON waitUntilDone:NO]; - [viewController.commandQueue performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO]; - } else { - SEL sel = @selector(processXhrExecBridgePoke:); - [viewController.commandQueue performSelectorOnMainThread:sel withObject:[NSNumber numberWithInteger:[requestId integerValue]] waitUntilDone:NO]; - } - // Returning NO here would be 20% faster, but it spams WebInspector's console with failure messages. - // If JS->Native bridge speed is really important for an app, they should use the iframe bridge. - // Returning YES here causes the request to come through canInitWithRequest two more times. - // For this reason, we return NO when cmds exist. - return !hasCmds; - } - // we only care about http and https connections. - // CORS takes care of http: trying to access file: URLs. - if ([gWhitelist schemeIsAllowed:[theUrl scheme]]) { - // if it FAILS the whitelist, we return TRUE, so we can fail the connection later - return ![gWhitelist URLIsAllowed:theUrl]; - } - } - - return NO; -} - -+ (NSURLRequest*)canonicalRequestForRequest:(NSURLRequest*)request -{ - // NSLog(@"%@ received %@", self, NSStringFromSelector(_cmd)); - return request; -} - -- (void)startLoading -{ - // NSLog(@"%@ received %@ - start", self, NSStringFromSelector(_cmd)); - NSURL* url = [[self request] URL]; - - if ([[url path] isEqualToString:@"/!gap_exec"]) { - [self sendResponseWithResponseCode:200 data:nil mimeType:nil]; - return; - } else if ([[url absoluteString] hasPrefix:kCDVAssetsLibraryPrefixes]) { - ALAssetsLibraryAssetForURLResultBlock resultBlock = ^(ALAsset* asset) { - if (asset) { - // We have the asset! Get the data and send it along. - ALAssetRepresentation* assetRepresentation = [asset defaultRepresentation]; - NSString* MIMEType = (__bridge_transfer NSString*)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)[assetRepresentation UTI], kUTTagClassMIMEType); - Byte* buffer = (Byte*)malloc((unsigned long)[assetRepresentation size]); - NSUInteger bufferSize = [assetRepresentation getBytes:buffer fromOffset:0.0 length:(NSUInteger)[assetRepresentation size] error:nil]; - NSData* data = [NSData dataWithBytesNoCopy:buffer length:bufferSize freeWhenDone:YES]; - [self sendResponseWithResponseCode:200 data:data mimeType:MIMEType]; - } else { - // Retrieving the asset failed for some reason. Send an error. - [self sendResponseWithResponseCode:404 data:nil mimeType:nil]; - } - }; - ALAssetsLibraryAccessFailureBlock failureBlock = ^(NSError* error) { - // Retrieving the asset failed for some reason. Send an error. - [self sendResponseWithResponseCode:401 data:nil mimeType:nil]; - }; - - ALAssetsLibrary* assetsLibrary = [[ALAssetsLibrary alloc] init]; - [assetsLibrary assetForURL:url resultBlock:resultBlock failureBlock:failureBlock]; - return; - } - - NSString* body = [gWhitelist errorStringForURL:url]; - [self sendResponseWithResponseCode:401 data:[body dataUsingEncoding:NSASCIIStringEncoding] mimeType:nil]; -} - -- (void)stopLoading -{ - // do any cleanup here -} - -+ (BOOL)requestIsCacheEquivalent:(NSURLRequest*)requestA toRequest:(NSURLRequest*)requestB -{ - return NO; -} - -- (void)sendResponseWithResponseCode:(NSInteger)statusCode data:(NSData*)data mimeType:(NSString*)mimeType -{ - if (mimeType == nil) { - mimeType = @"text/plain"; - } - NSString* encodingName = [@"text/plain" isEqualToString : mimeType] ? @"UTF-8" : nil; - -#ifdef __IPHONE_8_0 - NSHTTPURLResponse* response = [NSHTTPURLResponse alloc]; -#else - CDVHTTPURLResponse* response = [CDVHTTPURLResponse alloc]; -#endif - - response = [response initWithURL:[[self request] URL] - MIMEType:mimeType - expectedContentLength:[data length] - textEncodingName:encodingName]; - -#ifndef __IPHONE_8_0 - response.statusCode = statusCode; -#endif - - [[self client] URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed]; - if (data != nil) { - [[self client] URLProtocol:self didLoadData:data]; - } - [[self client] URLProtocolDidFinishLoading:self]; -} - -@end - -@implementation CDVHTTPURLResponse -@synthesize statusCode; - -- (NSDictionary*)allHeaderFields -{ - return nil; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.h deleted file mode 100644 index 4de382f..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - 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. - */ - -#import - -@interface CDVUserAgentUtil : NSObject -+ (NSString*)originalUserAgent; -+ (void)acquireLock:(void (^)(NSInteger lockToken))block; -+ (void)releaseLock:(NSInteger*)lockToken; -+ (void)setUserAgent:(NSString*)value lockToken:(NSInteger)lockToken; -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.m deleted file mode 100644 index c3402d0..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.m +++ /dev/null @@ -1,122 +0,0 @@ -/* - 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. - */ - -#import "CDVUserAgentUtil.h" - -#import - -// #define VerboseLog NSLog -#define VerboseLog(...) do {} while (0) - -static NSString* const kCdvUserAgentKey = @"Cordova-User-Agent"; -static NSString* const kCdvUserAgentVersionKey = @"Cordova-User-Agent-Version"; - -static NSString* gOriginalUserAgent = nil; -static NSInteger gNextLockToken = 0; -static NSInteger gCurrentLockToken = 0; -static NSMutableArray* gPendingSetUserAgentBlocks = nil; - -@implementation CDVUserAgentUtil - -+ (NSString*)originalUserAgent -{ - if (gOriginalUserAgent == nil) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppLocaleDidChange:) - name:NSCurrentLocaleDidChangeNotification object:nil]; - - NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; - NSString* systemVersion = [[UIDevice currentDevice] systemVersion]; - NSString* localeStr = [[NSLocale currentLocale] localeIdentifier]; - // Record the model since simulator can change it without re-install (CB-5420). - NSString* model = [UIDevice currentDevice].model; - NSString* systemAndLocale = [NSString stringWithFormat:@"%@ %@ %@", model, systemVersion, localeStr]; - - NSString* cordovaUserAgentVersion = [userDefaults stringForKey:kCdvUserAgentVersionKey]; - gOriginalUserAgent = [userDefaults stringForKey:kCdvUserAgentKey]; - BOOL cachedValueIsOld = ![systemAndLocale isEqualToString:cordovaUserAgentVersion]; - - if ((gOriginalUserAgent == nil) || cachedValueIsOld) { - UIWebView* sampleWebView = [[UIWebView alloc] initWithFrame:CGRectZero]; - gOriginalUserAgent = [sampleWebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; - - [userDefaults setObject:gOriginalUserAgent forKey:kCdvUserAgentKey]; - [userDefaults setObject:systemAndLocale forKey:kCdvUserAgentVersionKey]; - - [userDefaults synchronize]; - } - } - return gOriginalUserAgent; -} - -+ (void)onAppLocaleDidChange:(NSNotification*)notification -{ - // TODO: We should figure out how to update the user-agent of existing UIWebViews when this happens. - // Maybe use the PDF bug (noted in setUserAgent:). - gOriginalUserAgent = nil; -} - -+ (void)acquireLock:(void (^)(NSInteger lockToken))block -{ - if (gCurrentLockToken == 0) { - gCurrentLockToken = ++gNextLockToken; - VerboseLog(@"Gave lock %d", gCurrentLockToken); - block(gCurrentLockToken); - } else { - if (gPendingSetUserAgentBlocks == nil) { - gPendingSetUserAgentBlocks = [[NSMutableArray alloc] initWithCapacity:4]; - } - VerboseLog(@"Waiting for lock"); - [gPendingSetUserAgentBlocks addObject:block]; - } -} - -+ (void)releaseLock:(NSInteger*)lockToken -{ - if (*lockToken == 0) { - return; - } - NSAssert(gCurrentLockToken == *lockToken, @"Got token %ld, expected %ld", (long)*lockToken, (long)gCurrentLockToken); - - VerboseLog(@"Released lock %d", *lockToken); - if ([gPendingSetUserAgentBlocks count] > 0) { - void (^block)() = [gPendingSetUserAgentBlocks objectAtIndex:0]; - [gPendingSetUserAgentBlocks removeObjectAtIndex:0]; - gCurrentLockToken = ++gNextLockToken; - NSLog(@"Gave lock %ld", (long)gCurrentLockToken); - block(gCurrentLockToken); - } else { - gCurrentLockToken = 0; - } - *lockToken = 0; -} - -+ (void)setUserAgent:(NSString*)value lockToken:(NSInteger)lockToken -{ - NSAssert(gCurrentLockToken == lockToken, @"Got token %ld, expected %ld", (long)lockToken, (long)gCurrentLockToken); - VerboseLog(@"User-Agent set to: %@", value); - - // Setting the UserAgent must occur before a UIWebView is instantiated. - // It is read per instantiation, so it does not affect previously created views. - // Except! When a PDF is loaded, all currently active UIWebViews reload their - // User-Agent from the NSUserDefaults some time after the DidFinishLoad of the PDF bah! - NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys:value, @"UserAgent", nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:dict]; -} - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVViewController.h b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVViewController.h deleted file mode 100644 index 1015c50..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVViewController.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - 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. - */ - -#import -#import -#import "CDVAvailability.h" -#import "CDVInvokedUrlCommand.h" -#import "CDVCommandDelegate.h" -#import "CDVCommandQueue.h" -#import "CDVWhitelist.h" -#import "CDVScreenOrientationDelegate.h" -#import "CDVPlugin.h" - -@interface CDVViewController : UIViewController { - @protected - id _commandDelegate; - @protected - CDVCommandQueue* _commandQueue; - NSString* _userAgent; -} - -@property (nonatomic, strong) IBOutlet UIWebView* webView; - -@property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects; -@property (nonatomic, readonly, strong) NSDictionary* pluginsMap; -@property (nonatomic, readonly, strong) NSMutableDictionary* settings; -@property (nonatomic, readonly, strong) NSXMLParser* configParser; -@property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public -@property (nonatomic, readonly, assign) BOOL loadFromString; - -@property (nonatomic, readwrite, copy) NSString* wwwFolderName; -@property (nonatomic, readwrite, copy) NSString* startPage; -@property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue; -@property (nonatomic, readonly, strong) id commandDelegate; -@property (nonatomic, readonly) NSString* userAgent; - -+ (NSDictionary*)getBundlePlist:(NSString*)plistName; -+ (NSString*)applicationDocumentsDirectory; - -- (void)printMultitaskingInfo; -- (void)createGapView; -- (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds; - -- (void)javascriptAlert:(NSString*)text; -- (NSString*)appURLScheme; - -- (NSArray*)parseInterfaceOrientations:(NSArray*)orientations; -- (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation; - -- (id)getCommandInstance:(NSString*)pluginName; -- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className; -- (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName; - -- (BOOL)URLisAllowed:(NSURL*)url; - -@end diff --git a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVViewController.m b/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVViewController.m deleted file mode 100644 index 66c1850..0000000 --- a/demo/plugins/org.pbernasconi.progressIndicator/demo/platforms/ios/CordovaLib/Classes/CDVViewController.m +++ /dev/null @@ -1,997 +0,0 @@ -/* - 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. - */ - -#import -#import "CDV.h" -#import "CDVCommandDelegateImpl.h" -#import "CDVConfigParser.h" -#import "CDVUserAgentUtil.h" -#import "CDVWebViewDelegate.h" -#import - -#define degreesToRadian(x) (M_PI * (x) / 180.0) - -@interface CDVViewController () { - NSInteger _userAgentLockToken; - CDVWebViewDelegate* _webViewDelegate; -} - -@property (nonatomic, readwrite, strong) NSXMLParser* configParser; -@property (nonatomic, readwrite, strong) NSMutableDictionary* settings; -@property (nonatomic, readwrite, strong) CDVWhitelist* whitelist; -@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects; -@property (nonatomic, readwrite, strong) NSArray* startupPluginNames; -@property (nonatomic, readwrite, strong) NSDictionary* pluginsMap; -@property (nonatomic, readwrite, strong) NSArray* supportedOrientations; -@property (nonatomic, readwrite, assign) BOOL loadFromString; - -@property (readwrite, assign) BOOL initialized; - -@property (atomic, strong) NSURL* openURL; - -@end - -@implementation CDVViewController - -@synthesize webView, supportedOrientations; -@synthesize pluginObjects, pluginsMap, whitelist, startupPluginNames; -@synthesize configParser, settings, loadFromString; -@synthesize wwwFolderName, startPage, initialized, openURL; -@synthesize commandDelegate = _commandDelegate; -@synthesize commandQueue = _commandQueue; - -- (void)__init -{ - if ((self != nil) && !self.initialized) { - _commandQueue = [[CDVCommandQueue alloc] initWithViewController:self]; - _commandDelegate = [[CDVCommandDelegateImpl alloc] initWithViewController:self]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillTerminate:) - name:UIApplicationWillTerminateNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillResignActive:) - name:UIApplicationWillResignActiveNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidBecomeActive:) - name:UIApplicationDidBecomeActiveNotification object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:) - name:UIApplicationWillEnterForegroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:) - name:UIApplicationDidEnterBackgroundNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil]; - - // read from UISupportedInterfaceOrientations (or UISupportedInterfaceOrientations~iPad, if its iPad) from -Info.plist - self.supportedOrientations = [self parseInterfaceOrientations: - [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]]; - - [self printVersion]; - [self printMultitaskingInfo]; - [self printPlatformVersionWarning]; - self.initialized = YES; - - // load config.xml settings - [self loadSettings]; - } -} - -- (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - [self __init]; - return self; -} - -- (id)initWithCoder:(NSCoder*)aDecoder -{ - self = [super initWithCoder:aDecoder]; - [self __init]; - return self; -} - -- (id)init -{ - self = [super init]; - [self __init]; - return self; -} - -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; -} - -- (void)viewWillDisappear:(BOOL)animated -{ - [super viewWillDisappear:animated]; -} - -- (void)printVersion -{ - NSLog(@"Apache Cordova native platform version %@ is starting.", CDV_VERSION); -} - -- (void)printPlatformVersionWarning -{ - if (!IsAtLeastiOSVersion(@"6.0")) { - NSLog(@"CRITICAL: For Cordova 3.5.0 and above, you will need to upgrade to at least iOS 6.0 or greater. Your current version of iOS is %@.", - [[UIDevice currentDevice] systemVersion] - ); - } -} - -- (void)printMultitaskingInfo -{ - UIDevice* device = [UIDevice currentDevice]; - BOOL backgroundSupported = NO; - - if ([device respondsToSelector:@selector(isMultitaskingSupported)]) { - backgroundSupported = device.multitaskingSupported; - } - - NSNumber* exitsOnSuspend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIApplicationExitsOnSuspend"]; - if (exitsOnSuspend == nil) { // if it's missing, it should be NO (i.e. multi-tasking on by default) - exitsOnSuspend = [NSNumber numberWithBool:NO]; - } - - NSLog(@"Multi-tasking -> Device: %@, App: %@", (backgroundSupported ? @"YES" : @"NO"), (![exitsOnSuspend intValue]) ? @"YES" : @"NO"); -} - -- (BOOL)URLisAllowed:(NSURL*)url -{ - if (self.whitelist == nil) { - return YES; - } - - return [self.whitelist URLIsAllowed:url]; -} - -- (void)loadSettings -{ - CDVConfigParser* delegate = [[CDVConfigParser alloc] init]; - - // read from config.xml in the app bundle - NSString* path = [[NSBundle mainBundle] pathForResource:@"config" ofType:@"xml"]; - - if (![[NSFileManager defaultManager] fileExistsAtPath:path]) { - NSAssert(NO, @"ERROR: config.xml does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project."); - return; - } - - NSURL* url = [NSURL fileURLWithPath:path]; - - configParser = [[NSXMLParser alloc] initWithContentsOfURL:url]; - if (configParser == nil) { - NSLog(@"Failed to initialize XML parser."); - return; - } - [configParser setDelegate:((id < NSXMLParserDelegate >)delegate)]; - [configParser parse]; - - // Get the plugin dictionary, whitelist and settings from the delegate. - self.pluginsMap = delegate.pluginsDict; - self.startupPluginNames = delegate.startupPluginNames; - self.whitelist = [[CDVWhitelist alloc] initWithArray:delegate.whitelistHosts]; - self.settings = delegate.settings; - - // And the start folder/page. - self.wwwFolderName = @"www"; - self.startPage = delegate.startPage; - if (self.startPage == nil) { - self.startPage = @"index.html"; - } - - // Initialize the plugin objects dict. - self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:20]; -} - -// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. -- (void)viewDidLoad -{ - [super viewDidLoad]; - - NSURL* appURL = nil; - NSString* loadErr = nil; - - if ([self.startPage rangeOfString:@"://"].location != NSNotFound) { - appURL = [NSURL URLWithString:self.startPage]; - } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) { - appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage]]; - } else { - // CB-3005 strip parameters from start page to check if page exists in resources - NSURL* startURL = [NSURL URLWithString:self.startPage]; - NSString* startFilePath = [self.commandDelegate pathForResource:[startURL path]]; - - if (startFilePath == nil) { - loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage]; - NSLog(@"%@", loadErr); - self.loadFromString = YES; - appURL = nil; - } else { - appURL = [NSURL fileURLWithPath:startFilePath]; - // CB-3005 Add on the query params or fragment. - NSString* startPageNoParentDirs = self.startPage; - NSRange r = [startPageNoParentDirs rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"?#"] options:0]; - if (r.location != NSNotFound) { - NSString* queryAndOrFragment = [self.startPage substringFromIndex:r.location]; - appURL = [NSURL URLWithString:queryAndOrFragment relativeToURL:appURL]; - } - } - } - - // // Fix the iOS 5.1 SECURITY_ERR bug (CB-347), this must be before the webView is instantiated //// - - NSString* backupWebStorageType = @"cloud"; // default value - - id backupWebStorage = [self settingForKey:@"BackupWebStorage"]; - if ([backupWebStorage isKindOfClass:[NSString class]]) { - backupWebStorageType = backupWebStorage; - } - [self setSetting:backupWebStorageType forKey:@"BackupWebStorage"]; - - if (IsAtLeastiOSVersion(@"5.1")) { - [CDVLocalStorage __fixupDatabaseLocationsWithBackupType:backupWebStorageType]; - } - - // // Instantiate the WebView /////////////// - - if (!self.webView) { - [self createGapView]; - } - - // Configure WebView - _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self]; - self.webView.delegate = _webViewDelegate; - - // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set - [CDVURLProtocol registerViewController:self]; - - // ///////////////// - - NSString* enableViewportScale = [self settingForKey:@"EnableViewportScale"]; - NSNumber* allowInlineMediaPlayback = [self settingForKey:@"AllowInlineMediaPlayback"]; - BOOL mediaPlaybackRequiresUserAction = YES; // default value - if ([self settingForKey:@"MediaPlaybackRequiresUserAction"]) { - mediaPlaybackRequiresUserAction = [(NSNumber*)[self settingForKey:@"MediaPlaybackRequiresUserAction"] boolValue]; - } - - self.webView.scalesPageToFit = [enableViewportScale boolValue]; - - /* - * Fire up CDVLocalStorage to work-around WebKit storage limitations: on all iOS 5.1+ versions for local-only backups, but only needed on iOS 5.1 for cloud backup. - */ - if (IsAtLeastiOSVersion(@"5.1") && (([backupWebStorageType isEqualToString:@"local"]) || - ([backupWebStorageType isEqualToString:@"cloud"] && !IsAtLeastiOSVersion(@"6.0")))) { - [self registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])]; - } - - /* - * This is for iOS 4.x, where you can allow inline