├── .gitignore ├── .ruby-version ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── cocoapods_cordova.gemspec ├── lib ├── cocoapods-cordova │ ├── aggregate_target_installer.rb │ ├── builder.rb │ ├── installer.rb │ ├── plugin.rb │ └── pod_utils.rb ├── cocoapods_cordova.rb ├── cocoapods_plugin.rb └── pod │ └── command │ └── cordova.rb └── test ├── app ├── config.xml ├── hooks │ └── README.md ├── platforms │ └── ios │ │ ├── .gitignore │ │ ├── App.xcodeproj │ │ └── project.pbxproj │ │ ├── App │ │ ├── .gitignore │ │ ├── App-Info.plist │ │ ├── App-Prefix.pch │ │ ├── Classes │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── MainViewController.h │ │ │ ├── MainViewController.m │ │ │ └── MainViewController.xib │ │ ├── Plugins │ │ │ └── README │ │ ├── Resources │ │ │ ├── de.lproj │ │ │ │ └── Localizable.strings │ │ │ ├── en.lproj │ │ │ │ └── Localizable.strings │ │ │ ├── es.lproj │ │ │ │ └── Localizable.strings │ │ │ ├── icons │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-60.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ ├── icon-small.png │ │ │ │ ├── icon-small@2x.png │ │ │ │ ├── icon.png │ │ │ │ └── icon@2x.png │ │ │ ├── se.lproj │ │ │ │ └── Localizable.strings │ │ │ └── splash │ │ │ │ ├── Default-568h@2x~iphone.png │ │ │ │ ├── Default-Landscape@2x~ipad.png │ │ │ │ ├── Default-Landscape~ipad.png │ │ │ │ ├── Default-Portrait@2x~ipad.png │ │ │ │ ├── Default-Portrait~ipad.png │ │ │ │ ├── Default@2x~iphone.png │ │ │ │ └── Default~iphone.png │ │ ├── config.xml │ │ └── main.m │ │ ├── CordovaLib │ │ ├── Classes │ │ │ ├── CDV.h │ │ │ ├── CDVAvailability.h │ │ │ ├── CDVCommandDelegate.h │ │ │ ├── CDVCommandDelegateImpl.h │ │ │ ├── CDVCommandDelegateImpl.m │ │ │ ├── CDVCommandQueue.h │ │ │ ├── CDVCommandQueue.m │ │ │ ├── CDVConfigParser.h │ │ │ ├── CDVConfigParser.m │ │ │ ├── CDVDebug.h │ │ │ ├── CDVInvokedUrlCommand.h │ │ │ ├── CDVInvokedUrlCommand.m │ │ │ ├── CDVJSON.h │ │ │ ├── CDVJSON.m │ │ │ ├── CDVLocalStorage.h │ │ │ ├── CDVLocalStorage.m │ │ │ ├── CDVPlugin.h │ │ │ ├── CDVPlugin.m │ │ │ ├── CDVPluginResult.h │ │ │ ├── CDVPluginResult.m │ │ │ ├── CDVScreenOrientationDelegate.h │ │ │ ├── CDVShared.h │ │ │ ├── CDVShared.m │ │ │ ├── CDVTimer.h │ │ │ ├── CDVTimer.m │ │ │ ├── CDVURLProtocol.h │ │ │ ├── CDVURLProtocol.m │ │ │ ├── CDVUserAgentUtil.h │ │ │ ├── CDVUserAgentUtil.m │ │ │ ├── CDVViewController.h │ │ │ ├── CDVViewController.m │ │ │ ├── CDVWebViewDelegate.h │ │ │ ├── CDVWebViewDelegate.m │ │ │ ├── CDVWhitelist.h │ │ │ ├── CDVWhitelist.m │ │ │ ├── NSArray+Comparisons.h │ │ │ ├── NSArray+Comparisons.m │ │ │ ├── NSData+Base64.h │ │ │ ├── NSData+Base64.m │ │ │ ├── NSDictionary+Extensions.h │ │ │ ├── NSDictionary+Extensions.m │ │ │ ├── NSMutableArray+QueueAdditions.h │ │ │ ├── NSMutableArray+QueueAdditions.m │ │ │ ├── UIDevice+Extensions.h │ │ │ └── UIDevice+Extensions.m │ │ ├── CordovaLib.xcodeproj │ │ │ └── project.pbxproj │ │ ├── CordovaLib_Prefix.pch │ │ ├── VERSION │ │ └── cordova.js │ │ ├── cordova │ │ ├── apple_ios_version │ │ ├── apple_osx_version │ │ ├── apple_xcode_version │ │ ├── build │ │ ├── build.xcconfig │ │ ├── check_reqs │ │ ├── clean │ │ ├── defaults.xml │ │ ├── emulate │ │ ├── lib │ │ │ ├── copy-www-build-step.sh │ │ │ ├── install-device │ │ │ ├── install-emulator │ │ │ ├── list-devices │ │ │ ├── list-emulator-images │ │ │ ├── list-started-emulators │ │ │ ├── sim.applescript │ │ │ └── start-emulator │ │ ├── log │ │ ├── run │ │ └── version │ │ ├── platform_www │ │ └── cordova.js │ │ └── www │ │ ├── cordova.js │ │ ├── cordova_plugins.js │ │ ├── css │ │ └── index.css │ │ ├── img │ │ └── logo.png │ │ ├── index.html │ │ └── js │ │ └── index.js ├── plugins │ └── ios.json └── www │ ├── css │ └── index.css │ ├── img │ └── logo.png │ ├── index.html │ └── js │ └── index.js ├── build.sh ├── clean.sh └── plugins ├── A ├── .gitignore ├── .ruby-version ├── A.podspec ├── Gemfile ├── plugin.xml ├── src │ └── ios │ │ ├── A.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── A.xccheckout │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── A.xcscheme │ │ ├── A.xcworkspace │ │ └── contents.xcworkspacedata │ │ ├── A │ │ ├── A-Prefix.pch │ │ ├── A.h │ │ └── A.m │ │ ├── ATests │ │ ├── ATests-Info.plist │ │ ├── ATests.m │ │ └── en.lproj │ │ │ └── InfoPlist.strings │ │ └── Podfile └── www │ └── A.js └── B ├── .gitignore ├── .ruby-version ├── B.podspec ├── B.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── B.xccheckout └── xcshareddata │ └── xcschemes │ └── B.xcscheme ├── B.xcworkspace └── contents.xcworkspacedata ├── B ├── B-Prefix.pch ├── B.h └── B.m ├── BTests ├── BTests-Info.plist ├── BTests.m └── en.lproj │ └── InfoPlist.strings ├── Gemfile ├── Podfile ├── plugin.xml └── www └── B.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | pkg 3 | .idea/ 4 | Gemfile.lock -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.1.2 2 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in cocoapods-cordova.gemspec 4 | gemspec 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Greg Thornton 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cocoapods-cordova 2 | 3 | Cocoapods plugin for developing Cordova plugins 4 | 5 | **Requires Cocoapods >= 0.34.0** 6 | 7 | ## Features 8 | 9 | * Facilitates the use of Cocoapods packages in Cordova plugins 10 | * Allows plugin testing within Xcode 11 | * Builds plugin as a static library for use in Cordova apps 12 | * Manages `plugin.xml` sources, libraries, frameworks, resources and 13 | headers automatically 14 | * Intelligently links dependencies to prevent duplicate symbols in Cordova apps 15 | 16 | ## Installation 17 | 18 | Add `cocoapods` and `cocoapods-cordova` to your `Gemfile`: 19 | 20 | ```ruby 21 | gem 'cocoapods', '~> 0.34.0' 22 | gem 'cocoapods-cordova', :github => 'xdissent/cocoapods-cordova' 23 | ``` 24 | 25 | Update the bundle: 26 | 27 | ```console 28 | $ bundle install 29 | ``` 30 | 31 | ## Usage 32 | 33 | To build a plugin and update `plugin.xml`: 34 | 35 | ```console 36 | $ bundle exec pod cordova 37 | ``` 38 | 39 | ## Step-by-step Cordova plugin tutorial 40 | 41 | * Create a new Xcode project using the "Cocoa Touch Static Library" template. 42 | 43 | * Add `Gemfile`: 44 | 45 | ```ruby 46 | source 'https://rubygems.org' 47 | 48 | gem 'cocoapods', '~> 0.34.0' 49 | gem 'cocoapods-cordova', :github => 'xdissent/cocoapods-cordova' 50 | ``` 51 | 52 | * Install gems: 53 | 54 | ```console 55 | $ bundle install 56 | ``` 57 | 58 | * Create a `Podfile` and add dependencies: 59 | 60 | ```ruby 61 | platform :ios, '7.0' 62 | 63 | pod 'Cordova' # Required 64 | pod 'CordovaPlugin-file' # Cordova plugin dependency 65 | pod 'AFNetworking' # Non-Cordova dependency 66 | 67 | # Test target must not link against default pods (exclusive) 68 | target 'HelloTests', :exclusive => true do 69 | pod 'OCMock' 70 | end 71 | ``` 72 | 73 | * Install pods: 74 | 75 | ```console 76 | $ bundle exec pod install 77 | ``` 78 | 79 | * Add Cordova plugin JS interface in `www` folder. 80 | 81 | * Add "empty" Cordova `plugin.xml` (without specifying plugin files): 82 | 83 | ```xml 84 | 85 | 86 | Hello 87 | Cordova Hello Plugin 88 | MIT 89 | cordova,hello 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | ``` 103 | 104 | * Implement/Test plugin 105 | 106 | * Build plugin: 107 | 108 | ```console 109 | $ bundle exec pod cordova 110 | ``` 111 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' 2 | -------------------------------------------------------------------------------- /cocoapods_cordova.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'cocoapods_cordova.rb' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "cocoapods-cordova" 8 | spec.version = CocoapodsCordova::VERSION 9 | spec.authors = ["Greg Thornton"] 10 | spec.email = ["xdissent@me.com"] 11 | spec.description = %q{A short description of cocoapods-cordova.} 12 | spec.summary = %q{A longer description of cocoapods-cordova.} 13 | spec.homepage = "https://github.com/xdissent/cocoapods-cordova" 14 | spec.license = "MIT" 15 | 16 | spec.files = `git ls-files`.split($/) 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ["lib"] 20 | 21 | spec.add_runtime_dependency "cocoapods", "~> 0.34.0" 22 | spec.add_runtime_dependency "cocoapods-packager", "~> 1.1.0" 23 | spec.add_development_dependency "bundler", "~> 1.3" 24 | spec.add_development_dependency "rake" 25 | end 26 | -------------------------------------------------------------------------------- /lib/cocoapods-cordova/aggregate_target_installer.rb: -------------------------------------------------------------------------------- 1 | module Pod 2 | module Cordova 3 | class AggregateTargetInstaller < Pod::Installer::AggregateTargetInstaller 4 | 5 | attr_accessor :plugin_targets 6 | 7 | def initialize(sandbox, library, plugin_targets) 8 | super sandbox, library 9 | @plugin_targets = plugin_targets 10 | end 11 | 12 | def install! 13 | super 14 | add_copy_resources_script_phase 15 | end 16 | 17 | def create_copy_resources_script 18 | pod_targets = library.pod_targets.dup 19 | library.pod_targets.select! { |pod| 20 | plugin_targets.include? pod.pod_name 21 | } 22 | super 23 | library.pod_targets = pod_targets 24 | end 25 | 26 | def add_copy_resources_script_phase 27 | phase_name = 'Copy Pods Resources' 28 | phase = target.shell_script_build_phases.select { |bp| bp.name == phase_name }.first 29 | phase ||= target.new_shell_script_build_phase(phase_name) 30 | phase.shell_script = %(export PODS_ROOT="#{sandbox.root}"; "#{library.copy_resources_script_path}"\n) 31 | phase.show_env_vars_in_log = '0' 32 | end 33 | end 34 | end 35 | end -------------------------------------------------------------------------------- /lib/cocoapods-cordova/builder.rb: -------------------------------------------------------------------------------- 1 | require 'pty' 2 | 3 | module Pod 4 | module Cordova 5 | class Builder < Builder 6 | 7 | def build(platform, library) 8 | super 9 | copy_headers platform 10 | copy_resources platform 11 | copy_resource_bundles platform 12 | end 13 | 14 | def copy_headers(platform) 15 | header_path = Pathname.new(platform.name.to_s) + Pathname.new('include') 16 | header_path.mkdir unless header_path.exist? 17 | headers_source_root = "#{@public_headers_root}/#{@spec.name}" 18 | 19 | Dir.glob("#{headers_source_root}/**/*.h").each { |h| 20 | `ditto #{h} #{header_path}/#{h.sub(headers_source_root, '')}` 21 | } 22 | end 23 | 24 | def copy_resources(platform) 25 | resources_path = Pathname.new platform.name.to_s 26 | resources_path.mkdir unless resources_path.exist? 27 | 28 | Dir.glob("#{@sandbox_root}/build/**/*").reject { |file| 29 | File.basename(file).end_with?('.a') or 30 | File.basename(file).end_with?('.h') or 31 | File.directory?(file) or 32 | file =~ /\/?[^\/]+.bundle\// or 33 | file =~ /\/?[^\/]+.build\// 34 | }.each { |h| 35 | `ditto #{h} #{resources_path}/#{File.basename h}` 36 | } 37 | end 38 | 39 | def copy_resource_bundles(platform) 40 | resources_path = Pathname.new platform.name.to_s 41 | resources_path.mkdir unless resources_path.exist? 42 | 43 | Dir.glob("#{@sandbox_root}/build/*.bundle").each { |h| 44 | `ditto #{h} #{resources_path}/#{File.basename h}` 45 | } 46 | end 47 | 48 | # Execute a command, showing output, and raise an error if it fails 49 | def exec!(cmd) 50 | PTY.spawn(cmd) do |stdin, stdout, pid| 51 | begin 52 | stdin.each { |line| UI.puts line } 53 | rescue Errno::EIO 54 | raise RuntimeError, "Command IO error: #{cmd}" 55 | end 56 | Process.wait pid 57 | end 58 | raise RuntimeError, "Command failed: #{cmd}" unless $?.exitstatus == 0 59 | rescue PTY::ChildExited 60 | raise RuntimeError, "Command exited abnormally: #{cmd}" 61 | end 62 | 63 | # Overridden to use custom exec with output 64 | def build_static_lib_for_ios(static_libs, defines, output) 65 | exec! "libtool -static -o #{@sandbox_root}/build/package.a #{static_libs.join(' ')}" 66 | xcodebuild defines, '-sdk iphonesimulator', 'build-sim' 67 | sim_libs = static_libs_in_sandbox 'build-sim' 68 | exec! "libtool -static -o #{@sandbox_root}/build-sim/package.a #{sim_libs.join(' ')}" 69 | exec! "lipo #{@sandbox_root}/build/package.a #{@sandbox_root}/build-sim/package.a -create -output #{output}" 70 | end 71 | 72 | def xcodebuild(defines = '', args = '', build_dir = 'build') 73 | exec! "xcodebuild #{defines} CONFIGURATION_BUILD_DIR=#{build_dir} clean build #{args} -configuration Release -target Pods -project #{@sandbox_root}/Pods.xcodeproj 2>&1" 74 | end 75 | end 76 | end 77 | end -------------------------------------------------------------------------------- /lib/cocoapods-cordova/installer.rb: -------------------------------------------------------------------------------- 1 | module Pod 2 | module Cordova 3 | class Installer < Installer 4 | 5 | attr_accessor :plugin_name 6 | 7 | def initialize(plugin_name, sandbox, podfile, lockfile = nil) 8 | super sandbox, podfile, lockfile 9 | @plugin_name = plugin_name 10 | end 11 | 12 | # Filter out dependencies from cordova plugins and cordova itself 13 | def set_target_dependencies 14 | aggregate_targets.each do |aggregate_target| 15 | aggregate_target.pod_targets.each do |pod_target| 16 | if plugin_target_names.push(plugin_name).include? pod_target.pod_name 17 | aggregate_target.target.add_dependency(pod_target.target) 18 | end 19 | is_plugin = pod_target.pod_name == plugin_name 20 | pod_target.dependencies.each do |dep| 21 | is_excluded = (is_plugin and !plugin_target_names.include?(dep)) 22 | unless dep == pod_target.pod_name or is_excluded 23 | pod_dependency_target = aggregate_target.pod_targets.find { |target| target.pod_name == dep } 24 | # TODO remove me 25 | unless pod_dependency_target 26 | puts "[BUG] DEP: #{dep}" 27 | end 28 | pod_target.target.add_dependency(pod_dependency_target.target) 29 | end 30 | end 31 | end 32 | end 33 | end 34 | 35 | # Use custom aggregate target installer 36 | def install_libraries 37 | UI.message '- Installing targets' do 38 | pod_targets.sort_by(&:name).each do |pod_target| 39 | next if pod_target.target_definition.empty? 40 | target_installer = PodTargetInstaller.new(sandbox, pod_target) 41 | target_installer.install! 42 | end 43 | 44 | aggregate_targets.sort_by(&:name).each do |target| 45 | next if target.target_definition.empty? 46 | target_installer = Pod::Cordova::AggregateTargetInstaller.new(sandbox, target, plugin_target_names) 47 | target_installer.install! 48 | end 49 | 50 | # TODO 51 | # Move and add specs 52 | pod_targets.sort_by(&:name).each do |pod_target| 53 | pod_target.file_accessors.each do |file_accessor| 54 | file_accessor.spec_consumer.frameworks.each do |framework| 55 | pod_target.target.add_system_framework(framework) 56 | end 57 | end 58 | end 59 | end 60 | end 61 | 62 | # Returns an array of specs for all resolved deps 63 | def pod_specs 64 | analysis_result.specs_by_target.find { |k, v| 65 | k.name == 'Pods' 66 | }.last 67 | end 68 | 69 | # Returns a hash of specs for all resolved deps keyed by name 70 | def pod_specs_by_name 71 | Hash[pod_specs.map { |spec| [spec.name, spec] }] 72 | end 73 | 74 | # Returns an array of all non-cordova pods included in the podfile 75 | def pod_deps 76 | pod_specs_by_name[plugin_name].dependencies.reject { |dep| 77 | dep.name == 'Cordova' or dep.name.start_with? 'CordovaPlugin-' 78 | } 79 | end 80 | 81 | def plugin_spec 82 | pod_specs_by_name[plugin_name] 83 | end 84 | 85 | def plugin_target_names 86 | plugin_target_specs.map { |spec| 87 | Specification.root_name spec.name 88 | }.uniq 89 | end 90 | 91 | def plugin_target_specs 92 | recursive_specs_for_deps(pod_deps).values 93 | end 94 | 95 | # Returns specs for an array of deps 96 | def specs_for_deps(deps) 97 | deps.map { |dep| pod_specs_by_name[dep.name] } 98 | end 99 | 100 | # Returns a map of all specs and their deps keyed by name 101 | def recursive_specs_for_deps(deps, seen = {}) 102 | new_specs = specs_for_deps(deps).reject { 103 | |spec| seen.has_key? spec.name 104 | } 105 | seen.merge! Hash[new_specs.map { |spec| [spec.name, spec] }] 106 | new_deps = new_specs.map(&:dependencies).flatten.compact.uniq(&:name).reject { |dep| 107 | seen.has_key? dep.name 108 | } 109 | return seen unless new_deps.present? 110 | recursive_specs_for_deps new_deps, seen 111 | end 112 | end 113 | end 114 | end -------------------------------------------------------------------------------- /lib/cocoapods-cordova/plugin.rb: -------------------------------------------------------------------------------- 1 | require 'rexml/document' 2 | require 'pty' 3 | require 'find' 4 | 5 | module Pod 6 | module Cordova 7 | class Plugin 8 | 9 | attr_accessor :name, :sandbox, :podfile, :lockfile, :installer, 10 | :xml_path, :target_dir 11 | 12 | def initialize(name, sandbox, podfile, lockfile = nil) 13 | @name = name 14 | @sandbox = sandbox 15 | @podfile = podfile 16 | @lockfile = lockfile 17 | @installer = Pod::Cordova::Installer.new name, sandbox, podfile, lockfile 18 | end 19 | 20 | def install! 21 | @installer.install! 22 | end 23 | 24 | def update_xml!(target_dir, xml_path = nil) 25 | @target_dir = target_dir 26 | xml_path ||= find_xml_path 27 | @xml_path = xml_path 28 | clean_xml 29 | add_sources 30 | add_headers 31 | add_resources 32 | add_resource_bundles 33 | add_frameworks 34 | add_libraries 35 | write_xml! 36 | end 37 | 38 | def find_xml_path 39 | Pathname.new(target_dir).ascend { |dir| 40 | file = dir + 'plugin.xml' 41 | break file.realpath.to_s if file.file? 42 | } 43 | end 44 | 45 | def xml_doc 46 | @xml_doc ||= REXML::Document.new File.new xml_path 47 | end 48 | 49 | def xml_ios 50 | @xml_ios ||= REXML::XPath.first xml_doc, '//platform[@name="ios"]' 51 | end 52 | 53 | def clean_xml 54 | xml_ios.each_element_with_attribute('pod', 'true') { |e| e.remove } 55 | end 56 | 57 | def write_xml! 58 | File.open(xml_path, 'w') { |file| xml_doc.write file, 2 } 59 | end 60 | 61 | def plugin_relative_path(file) 62 | Pathname.new(file).relative_path_from(Pathname.new(xml_path).dirname).to_s 63 | end 64 | 65 | def add_headers 66 | headers.each { |file| 67 | add_element 'header-file', 'src' => plugin_relative_path(file) 68 | } 69 | end 70 | 71 | def add_sources 72 | sources.each { |file| 73 | add_element 'source-file', 'framework' => true, 74 | 'src' => plugin_relative_path(file) 75 | } 76 | end 77 | 78 | def add_resources 79 | resources.each { |file| 80 | add_element 'resource-file', 'src' => plugin_relative_path(file) 81 | } 82 | end 83 | 84 | def add_resource_bundles 85 | resource_bundles.each { |file| 86 | add_element 'resource-file', 'src' => plugin_relative_path(file), 87 | 'target-dir' => File.basename(file) 88 | } 89 | end 90 | 91 | def add_frameworks 92 | frameworks.each { |name| 93 | add_element 'framework', 'src' => "#{name}.framework" 94 | } 95 | end 96 | 97 | def add_libraries 98 | libraries.each { |name| 99 | add_element 'framework', 'src' => "lib#{name}.dylib" 100 | } 101 | end 102 | 103 | def add_element(*args, &block) 104 | xml_ios.add_element pod_element *args, &block 105 | end 106 | 107 | def pod_element(tag, attrs = {}) 108 | attrs['pod'] = 'true' 109 | element = REXML::Element.new tag 110 | element.add_attributes attrs 111 | element 112 | end 113 | 114 | def sources 115 | Dir.glob(File.join sources_path, '*.a').map { |file| 116 | File.absolute_path file 117 | } 118 | end 119 | 120 | def headers 121 | Dir.glob(File.join headers_path, '**/*.h').reject { |file| 122 | File.directory? file 123 | }.map { |file| File.absolute_path file } 124 | end 125 | 126 | def resources 127 | Dir.glob(File.join resources_path, '**/*').reject { |file| 128 | File.basename(file).end_with?('.a') or 129 | File.basename(file).end_with?('.h') or 130 | File.directory?(file) or 131 | plugin_relative_path(file) =~ /\/?[^\/]+.bundle\// 132 | }.map { |file| File.absolute_path file } 133 | end 134 | 135 | def resource_bundles 136 | Dir.glob(File.join resources_path, '**/*.bundle').map { |file| 137 | File.absolute_path file 138 | } 139 | end 140 | 141 | def libraries 142 | consumers.map(&:libraries).flatten.compact.uniq 143 | end 144 | 145 | def frameworks 146 | consumers.map(&:frameworks).flatten.compact.uniq 147 | end 148 | 149 | def sources_path 150 | File.join target_dir, 'ios' 151 | end 152 | 153 | def headers_path 154 | File.join target_dir, 'ios', 'include' 155 | end 156 | 157 | def resources_path 158 | File.join target_dir, 'ios' 159 | end 160 | 161 | def consumers 162 | installer.plugin_target_specs.push(installer.plugin_spec).map { |spec| 163 | spec.consumer :ios 164 | } 165 | end 166 | end 167 | end 168 | end -------------------------------------------------------------------------------- /lib/cocoapods-cordova/pod_utils.rb: -------------------------------------------------------------------------------- 1 | module Pod 2 | class Command 3 | class Cordova < Package 4 | :private 5 | 6 | # Overridden for local path in generated spec 7 | def podfile_from_spec(path, spec_name, platform_name, deployment_target, subspecs) 8 | Pod::Podfile.new do 9 | platform(platform_name, deployment_target) 10 | if path 11 | if subspecs 12 | subspecs.each do |subspec| 13 | pod spec_name + '/' + subspec, :path => path 14 | end 15 | else 16 | pod spec_name, :path => path 17 | end 18 | else 19 | if subspecs 20 | subspecs.each do |subspec| 21 | pod spec_name + '/' + subspec, :path => '.' 22 | end 23 | else 24 | pod spec_name, :path => '.' 25 | end 26 | end 27 | end 28 | end 29 | 30 | # Overridden for custom installer 31 | def install_pod(platform_name) 32 | podfile = podfile_from_spec( 33 | File.dirname(@path), 34 | @spec.name, 35 | platform_name, 36 | @spec.deployment_target(platform_name), 37 | @subspecs) 38 | 39 | sandbox = Sandbox.new(config.sandbox_root) 40 | @plugin = Pod::Cordova::Plugin.new @spec.name, sandbox, podfile 41 | @plugin.install! 42 | 43 | sandbox 44 | end 45 | end 46 | end 47 | end -------------------------------------------------------------------------------- /lib/cocoapods_cordova.rb: -------------------------------------------------------------------------------- 1 | module CocoapodsCordova 2 | VERSION = "0.0.2" 3 | end 4 | -------------------------------------------------------------------------------- /lib/cocoapods_plugin.rb: -------------------------------------------------------------------------------- 1 | require 'pod/command/package' 2 | require 'pod/command/cordova' 3 | require 'cocoapods-cordova/builder' 4 | require 'cocoapods-cordova/installer' 5 | require 'cocoapods-cordova/aggregate_target_installer' 6 | require 'cocoapods-cordova/pod_utils' 7 | require 'cocoapods-cordova/plugin' -------------------------------------------------------------------------------- /lib/pod/command/cordova.rb: -------------------------------------------------------------------------------- 1 | module Pod 2 | 3 | class Command 4 | class Cordova < Package 5 | 6 | # Inherit from Package but act like a top-level command 7 | Package.subcommands.delete self 8 | Command.subcommands.push self 9 | 10 | self.summary = "Build a cordova plugin" 11 | 12 | self.description = <<-DESC 13 | Build a cordova plugin from podspec. The plugin is compiled as a single 14 | static library. 15 | DESC 16 | 17 | self.arguments = [] 18 | 19 | def self.options 20 | [ 21 | ['--force', 'Overwrite existing files.'], 22 | ['--no-mangle', 'Do not mangle symbols of depedendant Pods.'], 23 | ['--subspecs', 'Only include the given subspecs'] 24 | ] 25 | end 26 | 27 | def initialize(argv) 28 | super 29 | path = Dir.glob(File.join config.installation_root, '*.podspec').first 30 | @spec ||= spec_with_path path 31 | @embedded = false 32 | @library = true 33 | end 34 | 35 | def run 36 | @target_dir = "#{@source_dir}/dist" 37 | super 38 | return nil if @plugin.nil? 39 | @plugin.update_xml! @target_dir 40 | `rm -f #{@target_dir}/#{@spec.name}.podspec 2>&1` 41 | end 42 | 43 | def create_target_directory 44 | if File.exist? @target_dir 45 | if @force 46 | Pathname.new(@target_dir).rmtree 47 | else 48 | UI.puts "Target directory '#{@target_dir}' already exists." 49 | return nil 50 | end 51 | end 52 | @target_dir 53 | end 54 | 55 | # Overridden to use custom builder 56 | def perform_build(platform, sandbox) 57 | builder = Pod::Cordova::Builder.new( 58 | @source_dir, 59 | config.sandbox_root, 60 | sandbox.public_headers.root, 61 | @spec, 62 | @embedded, 63 | @mangle) 64 | 65 | builder.build(platform, @library) 66 | end 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /test/app/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | App 4 | 5 | A sample Apache Cordova application that responds to the deviceready event. 6 | 7 | 8 | Apache Cordova Team 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/app/hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | This directory may contain scripts used to customize cordova commands. This 24 | directory used to exist at `.cordova/hooks`, but has now been moved to the 25 | project root. Any scripts you add to these directories will be executed before 26 | and after the commands corresponding to the directory name. Useful for 27 | integrating your own build systems or integrating with version control systems. 28 | 29 | __Remember__: Make your scripts executable. 30 | 31 | ## Hook Directories 32 | The following subdirectories will be used for hooks: 33 | 34 | after_build/ 35 | after_compile/ 36 | after_docs/ 37 | after_emulate/ 38 | after_platform_add/ 39 | after_platform_rm/ 40 | after_platform_ls/ 41 | after_plugin_add/ 42 | after_plugin_ls/ 43 | after_plugin_rm/ 44 | after_plugin_search/ 45 | after_prepare/ 46 | after_run/ 47 | after_serve/ 48 | before_build/ 49 | before_compile/ 50 | before_docs/ 51 | before_emulate/ 52 | before_platform_add/ 53 | before_platform_rm/ 54 | before_platform_ls/ 55 | before_plugin_add/ 56 | before_plugin_ls/ 57 | before_plugin_rm/ 58 | before_plugin_search/ 59 | before_prepare/ 60 | before_run/ 61 | before_serve/ 62 | pre_package/ <-- Windows 8 and Windows Phone only. 63 | 64 | ## Script Interface 65 | 66 | All scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: 67 | 68 | * CORDOVA_VERSION - The version of the Cordova-CLI. 69 | * CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). 70 | * CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) 71 | * CORDOVA_HOOK - Path to the hook that is being executed. 72 | * CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) 73 | 74 | If a script returns a non-zero exit code, then the parent cordova command will be aborted. 75 | 76 | ## Writing hooks 77 | 78 | We highly recommend writting your hooks using Node.js so that they are 79 | cross-platform. Some good examples are shown here: 80 | 81 | [http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) 82 | 83 | Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example: 84 | 85 | #!/usr/bin/env [name_of_interpreter_executable] 86 | 87 | -------------------------------------------------------------------------------- /test/app/platforms/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.perspectivev3 3 | *.pbxuser 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.perspectivev3 3 | *.pbxuser 4 | .DS_Store 5 | build/ 6 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/App-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | icon.png 13 | CFBundleIcons 14 | 15 | CFBundlePrimaryIcon 16 | 17 | CFBundleIconFiles 18 | 19 | icon-40 20 | icon-small 21 | icon-60 22 | icon.png 23 | icon@2x 24 | icon-72 25 | icon-72@2x 26 | 27 | UIPrerenderedIcon 28 | 29 | 30 | 31 | CFBundleIcons~ipad 32 | 33 | CFBundlePrimaryIcon 34 | 35 | CFBundleIconFiles 36 | 37 | icon-small 38 | icon-40 39 | icon-50 40 | icon-76 41 | icon-60 42 | icon 43 | icon@2x 44 | icon-72 45 | icon-72@2x 46 | 47 | UIPrerenderedIcon 48 | 49 | 50 | 51 | CFBundleIdentifier 52 | com.cocoapods-cordova.test.app 53 | CFBundleInfoDictionaryVersion 54 | 6.0 55 | CFBundleName 56 | ${PRODUCT_NAME} 57 | CFBundlePackageType 58 | APPL 59 | CFBundleSignature 60 | ???? 61 | CFBundleVersion 62 | 0.0.1 63 | LSRequiresIPhoneOS 64 | 65 | NSMainNibFile 66 | 67 | NSMainNibFile~ipad 68 | 69 | UISupportedInterfaceOrientations 70 | 71 | UIInterfaceOrientationPortrait 72 | 73 | UISupportedInterfaceOrientations~ipad 74 | 75 | UIInterfaceOrientationPortrait 76 | UIInterfaceOrientationLandscapeLeft 77 | UIInterfaceOrientationPortraitUpsideDown 78 | UIInterfaceOrientationLandscapeRight 79 | 80 | CFBundleShortVersionString 81 | 0.0.1 82 | 83 | 84 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/App-Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | // 20 | // Prefix header for all source files of the 'App' target in the 'App' project 21 | // 22 | 23 | #ifdef __OBJC__ 24 | #import 25 | #import 26 | #endif 27 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // AppDelegate.h 22 | // App 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import 29 | 30 | #import 31 | 32 | @interface AppDelegate : NSObject {} 33 | 34 | // invoke string is passed to your app on launch, this is only valid if you 35 | // edit App-Info.plist to add a protocol 36 | // a simple tutorial can be found here : 37 | // http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html 38 | 39 | @property (nonatomic, strong) IBOutlet UIWindow* window; 40 | @property (nonatomic, strong) IBOutlet CDVViewController* viewController; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Classes/MainViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // MainViewController.h 22 | // App 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import 29 | #import 30 | #import 31 | 32 | @interface MainViewController : CDVViewController 33 | 34 | @end 35 | 36 | @interface MainCommandDelegate : CDVCommandDelegateImpl 37 | @end 38 | 39 | @interface MainCommandQueue : CDVCommandQueue 40 | @end 41 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Classes/MainViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // 21 | // MainViewController.h 22 | // App 23 | // 24 | // Created by ___FULLUSERNAME___ on ___DATE___. 25 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 26 | // 27 | 28 | #import "MainViewController.h" 29 | 30 | @implementation MainViewController 31 | 32 | - (id)initWithNibName:(NSString*)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil 33 | { 34 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 35 | if (self) { 36 | // Uncomment to override the CDVCommandDelegateImpl used 37 | // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self]; 38 | // Uncomment to override the CDVCommandQueue used 39 | // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self]; 40 | } 41 | return self; 42 | } 43 | 44 | - (id)init 45 | { 46 | self = [super init]; 47 | if (self) { 48 | // Uncomment to override the CDVCommandDelegateImpl used 49 | // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self]; 50 | // Uncomment to override the CDVCommandQueue used 51 | // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self]; 52 | } 53 | return self; 54 | } 55 | 56 | - (void)didReceiveMemoryWarning 57 | { 58 | // Releases the view if it doesn't have a superview. 59 | [super didReceiveMemoryWarning]; 60 | 61 | // Release any cached data, images, etc that aren't in use. 62 | } 63 | 64 | #pragma mark View lifecycle 65 | 66 | - (void)viewWillAppear:(BOOL)animated 67 | { 68 | // View defaults to full size. If you want to customize the view's size, or its subviews (e.g. webView), 69 | // you can do so here. 70 | 71 | [super viewWillAppear:animated]; 72 | } 73 | 74 | - (void)viewDidLoad 75 | { 76 | [super viewDidLoad]; 77 | // Do any additional setup after loading the view from its nib. 78 | } 79 | 80 | - (void)viewDidUnload 81 | { 82 | [super viewDidUnload]; 83 | // Release any retained subviews of the main view. 84 | // e.g. self.myOutlet = nil; 85 | } 86 | 87 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 88 | { 89 | // Return YES for supported orientations 90 | return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; 91 | } 92 | 93 | /* Comment out the block below to over-ride */ 94 | 95 | /* 96 | - (UIWebView*) newCordovaViewWithFrame:(CGRect)bounds 97 | { 98 | return[super newCordovaViewWithFrame:bounds]; 99 | } 100 | */ 101 | 102 | #pragma mark UIWebDelegate implementation 103 | 104 | - (void)webViewDidFinishLoad:(UIWebView*)theWebView 105 | { 106 | // Black base color for background matches the native apps 107 | theWebView.backgroundColor = [UIColor blackColor]; 108 | 109 | return [super webViewDidFinishLoad:theWebView]; 110 | } 111 | 112 | /* Comment out the block below to over-ride */ 113 | 114 | /* 115 | 116 | - (void) webViewDidStartLoad:(UIWebView*)theWebView 117 | { 118 | return [super webViewDidStartLoad:theWebView]; 119 | } 120 | 121 | - (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error 122 | { 123 | return [super webView:theWebView didFailLoadWithError:error]; 124 | } 125 | 126 | - (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType 127 | { 128 | return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; 129 | } 130 | */ 131 | 132 | @end 133 | 134 | @implementation MainCommandDelegate 135 | 136 | /* To override the methods, uncomment the line in the init function(s) 137 | in MainViewController.m 138 | */ 139 | 140 | #pragma mark CDVCommandDelegate implementation 141 | 142 | - (id)getCommandInstance:(NSString*)className 143 | { 144 | return [super getCommandInstance:className]; 145 | } 146 | 147 | /* 148 | NOTE: this will only inspect execute calls coming explicitly from native plugins, 149 | not the commandQueue (from JavaScript). To see execute calls from JavaScript, see 150 | MainCommandQueue below 151 | */ 152 | - (BOOL)execute:(CDVInvokedUrlCommand*)command 153 | { 154 | return [super execute:command]; 155 | } 156 | 157 | - (NSString*)pathForResource:(NSString*)resourcepath; 158 | { 159 | return [super pathForResource:resourcepath]; 160 | } 161 | 162 | @end 163 | 164 | @implementation MainCommandQueue 165 | 166 | /* To override, uncomment the line in the init function(s) 167 | in MainViewController.m 168 | */ 169 | - (BOOL)execute:(CDVInvokedUrlCommand*)command 170 | { 171 | return [super execute:command]; 172 | } 173 | 174 | @end 175 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Classes/MainViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 1280 25 | 11C25 26 | 1919 27 | 1138.11 28 | 566.00 29 | 30 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 31 | 916 32 | 33 | 34 | IBProxyObject 35 | IBUIView 36 | 37 | 38 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 39 | 40 | 41 | PluginDependencyRecalculationVersion 42 | 43 | 44 | 45 | 46 | IBFilesOwner 47 | IBCocoaTouchFramework 48 | 49 | 50 | IBFirstResponder 51 | IBCocoaTouchFramework 52 | 53 | 54 | 55 | 274 56 | {{0, 20}, {320, 460}} 57 | 58 | 59 | 60 | 3 61 | MQA 62 | 63 | 2 64 | 65 | 66 | 67 | IBCocoaTouchFramework 68 | 69 | 70 | 71 | 72 | 73 | 74 | view 75 | 76 | 77 | 78 | 3 79 | 80 | 81 | 82 | 83 | 84 | 0 85 | 86 | 87 | 88 | 89 | 90 | 1 91 | 92 | 93 | 94 | 95 | -1 96 | 97 | 98 | File's Owner 99 | 100 | 101 | -2 102 | 103 | 104 | 105 | 106 | 107 | 108 | MainViewController 109 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 110 | UIResponder 111 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 112 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 113 | 114 | 115 | 116 | 117 | 118 | 3 119 | 120 | 121 | 122 | 123 | MainViewController 124 | UIViewController 125 | 126 | IBProjectSource 127 | ./Classes/MainViewController.h 128 | 129 | 130 | 131 | 132 | 0 133 | IBCocoaTouchFramework 134 | YES 135 | 3 136 | 916 137 | 138 | 139 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Plugins/README: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder. 21 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/de.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | 21 | // controller title for Videos 22 | "Videos title" = "Videos"; 23 | // accessibility label for recording button 24 | "toggle audio recording" = "starten/beenden der Tonaufnahme"; 25 | // notification spoken by VoiceOver when timed recording finishes 26 | "timed recording complete" = "programmierte Aufnahme beendet"; 27 | // accessibility hint for display of recorded elapsed time 28 | "recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden"; 29 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // controller title for Videos 21 | "Videos title" = "Videos"; 22 | // accessibility label for recording button 23 | "toggle audio recording" = "toggle audio recording"; 24 | // notification spoken by VoiceOver when timed recording finishes 25 | "timed recording complete" = "timed recording complete"; 26 | // accessibility hint for display of recorded elapsed time 27 | "recorded time in minutes and seconds" = "recorded time in minutes and seconds"; 28 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/es.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | // controller title for Videos 21 | "Videos title" = "Videos"; 22 | // accessibility label for recording button 23 | "toggle audio recording" = "grabación de audio cambiar"; 24 | // notification spoken by VoiceOver when timed recording finishes 25 | "timed recording complete" = "tiempo de grabación completo"; 26 | // accessibility hint for display of recorded elapsed time 27 | "recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos"; 28 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-40.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-40@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-50.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-50@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-60.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-60@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-72.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-72@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-76.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-76@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-small.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon-small@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/icons/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/icons/icon@2x.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/se.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | 21 | // controller title for Videos 22 | "Videos title" = "Videor"; 23 | // accessibility label for recording button 24 | "toggle audio recording" = "börja/avsluta inspelning"; 25 | // notification spoken by VoiceOver when timed recording finishes 26 | "timed recording complete" = "inspelning har avslutad"; 27 | // accessibility hint for display of recorded elapsed time 28 | "recorded time in minutes and seconds" = "inspelad tid in minuter och sekund"; 29 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/Resources/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/App/Resources/splash/Default~iphone.png -------------------------------------------------------------------------------- /test/app/platforms/ios/App/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | App 23 | 24 | A sample Apache Cordova application that responds to the deviceready event. 25 | 26 | 27 | Apache Cordova Team 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/app/platforms/ios/App/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | // 20 | // main.m 21 | // App 22 | // 23 | // Created by ___FULLUSERNAME___ on ___DATE___. 24 | // Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. 25 | // 26 | 27 | #import 28 | 29 | int main(int argc, char* argv[]) 30 | { 31 | @autoreleasepool { 32 | int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); 33 | return retVal; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDV.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVAvailability.h" 21 | 22 | #import "CDVPlugin.h" 23 | #import "CDVViewController.h" 24 | #import "CDVCommandDelegate.h" 25 | #import "CDVURLProtocol.h" 26 | #import "CDVInvokedUrlCommand.h" 27 | 28 | #import "CDVDebug.h" 29 | #import "CDVPluginResult.h" 30 | #import "CDVWhitelist.h" 31 | #import "CDVLocalStorage.h" 32 | #import "CDVScreenOrientationDelegate.h" 33 | #import "CDVTimer.h" 34 | 35 | #import "NSArray+Comparisons.h" 36 | #import "NSData+Base64.h" 37 | #import "NSDictionary+Extensions.h" 38 | #import "NSMutableArray+QueueAdditions.h" 39 | #import "UIDevice+Extensions.h" 40 | 41 | #import "CDVJSON.h" 42 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVAvailability.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #define __CORDOVA_IOS__ 21 | 22 | #define __CORDOVA_0_9_6 906 23 | #define __CORDOVA_1_0_0 10000 24 | #define __CORDOVA_1_1_0 10100 25 | #define __CORDOVA_1_2_0 10200 26 | #define __CORDOVA_1_3_0 10300 27 | #define __CORDOVA_1_4_0 10400 28 | #define __CORDOVA_1_4_1 10401 29 | #define __CORDOVA_1_5_0 10500 30 | #define __CORDOVA_1_6_0 10600 31 | #define __CORDOVA_1_6_1 10601 32 | #define __CORDOVA_1_7_0 10700 33 | #define __CORDOVA_1_8_0 10800 34 | #define __CORDOVA_1_8_1 10801 35 | #define __CORDOVA_1_9_0 10900 36 | #define __CORDOVA_2_0_0 20000 37 | #define __CORDOVA_2_1_0 20100 38 | #define __CORDOVA_2_2_0 20200 39 | #define __CORDOVA_2_3_0 20300 40 | #define __CORDOVA_2_4_0 20400 41 | #define __CORDOVA_2_5_0 20500 42 | #define __CORDOVA_2_6_0 20600 43 | #define __CORDOVA_2_7_0 20700 44 | #define __CORDOVA_2_8_0 20800 45 | #define __CORDOVA_2_9_0 20900 46 | #define __CORDOVA_3_0_0 30000 47 | #define __CORDOVA_3_1_0 30100 48 | #define __CORDOVA_3_2_0 30200 49 | #define __CORDOVA_3_3_0 30300 50 | #define __CORDOVA_3_4_0 30400 51 | #define __CORDOVA_3_4_1 30401 52 | #define __CORDOVA_3_5_0 30500 53 | #define __CORDOVA_NA 99999 /* not available */ 54 | 55 | /* 56 | #if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0 57 | // do something when its at least 1.7.0 58 | #else 59 | // do something else (non 1.7.0) 60 | #endif 61 | */ 62 | #ifndef CORDOVA_VERSION_MIN_REQUIRED 63 | #define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_5_0 64 | #endif 65 | 66 | /* 67 | Returns YES if it is at least version specified as NSString(X) 68 | Usage: 69 | if (IsAtLeastiOSVersion(@"5.1")) { 70 | // do something for iOS 5.1 or greater 71 | } 72 | */ 73 | #define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) 74 | 75 | #define CDV_IsIPad() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad)) 76 | 77 | #define CDV_IsIPhone5() ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320) 78 | 79 | /* Return the string version of the decimal version */ 80 | #define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \ 81 | (CORDOVA_VERSION_MIN_REQUIRED / 10000), \ 82 | (CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \ 83 | (CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100] 84 | 85 | #ifdef __clang__ 86 | #define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) 87 | #else 88 | #define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) 89 | #endif 90 | 91 | // Enable this to log all exec() calls. 92 | #define CDV_ENABLE_EXEC_LOGGING 0 93 | #if CDV_ENABLE_EXEC_LOGGING 94 | #define CDV_EXEC_LOG NSLog 95 | #else 96 | #define CDV_EXEC_LOG(...) do {} while (NO) 97 | #endif 98 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVCommandDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVAvailability.h" 21 | #import "CDVInvokedUrlCommand.h" 22 | 23 | @class CDVPlugin; 24 | @class CDVPluginResult; 25 | @class CDVWhitelist; 26 | 27 | @protocol CDVCommandDelegate 28 | 29 | @property (nonatomic, readonly) NSDictionary* settings; 30 | 31 | - (NSString*)pathForResource:(NSString*)resourcepath; 32 | - (id)getCommandInstance:(NSString*)pluginName; 33 | 34 | // Plugins should not be using this interface to call other plugins since it 35 | // will result in bogus callbacks being made. 36 | - (BOOL)execute:(CDVInvokedUrlCommand*)command CDV_DEPRECATED(2.2, "Use direct method calls instead."); 37 | 38 | // Sends a plugin result to the JS. This is thread-safe. 39 | - (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId; 40 | // Evaluates the given JS. This is thread-safe. 41 | - (void)evalJs:(NSString*)js; 42 | // Can be used to evaluate JS right away instead of scheduling it on the run-loop. 43 | // This is required for dispatch resign and pause events, but should not be used 44 | // without reason. Without the run-loop delay, alerts used in JS callbacks may result 45 | // in dead-lock. This method must be called from the UI thread. 46 | - (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop; 47 | // Runs the given block on a background thread using a shared thread-pool. 48 | - (void)runInBackground:(void (^)())block; 49 | // Returns the User-Agent of the associated UIWebView. 50 | - (NSString*)userAgent; 51 | // Returns whether the given URL passes the white-list. 52 | - (BOOL)URLIsWhitelisted:(NSURL*)url; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVCommandDelegateImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVCommandDelegate.h" 22 | 23 | @class CDVViewController; 24 | @class CDVCommandQueue; 25 | 26 | @interface CDVCommandDelegateImpl : NSObject { 27 | @private 28 | __weak CDVViewController* _viewController; 29 | NSRegularExpression *_callbackIdPattern; 30 | @protected 31 | __weak CDVCommandQueue* _commandQueue; 32 | BOOL _delayResponses; 33 | } 34 | - (id)initWithViewController:(CDVViewController*)viewController; 35 | - (void)flushCommandQueueWithDelayedJs; 36 | @end 37 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVCommandQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @class CDVInvokedUrlCommand; 23 | @class CDVViewController; 24 | 25 | @interface CDVCommandQueue : NSObject 26 | 27 | @property (nonatomic, readonly) BOOL currentlyExecuting; 28 | 29 | - (id)initWithViewController:(CDVViewController*)viewController; 30 | - (void)dispose; 31 | 32 | - (void)resetRequestId; 33 | - (void)enqueueCommandBatch:(NSString*)batchJSON; 34 | 35 | - (void)processXhrExecBridgePoke:(NSNumber*)requestId; 36 | - (void)fetchCommandsFromJs; 37 | - (void)executePending; 38 | - (BOOL)execute:(CDVInvokedUrlCommand*)command; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVConfigParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | @interface CDVConfigParser : NSObject 21 | { 22 | NSString* featureName; 23 | } 24 | 25 | @property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict; 26 | @property (nonatomic, readonly, strong) NSMutableDictionary* settings; 27 | @property (nonatomic, readonly, strong) NSMutableArray* whitelistHosts; 28 | @property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames; 29 | @property (nonatomic, readonly, strong) NSString* startPage; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVConfigParser.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVConfigParser.h" 21 | 22 | @interface CDVConfigParser () 23 | 24 | @property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict; 25 | @property (nonatomic, readwrite, strong) NSMutableDictionary* settings; 26 | @property (nonatomic, readwrite, strong) NSMutableArray* whitelistHosts; 27 | @property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames; 28 | @property (nonatomic, readwrite, strong) NSString* startPage; 29 | 30 | @end 31 | 32 | @implementation CDVConfigParser 33 | 34 | @synthesize pluginsDict, settings, whitelistHosts, startPage, startupPluginNames; 35 | 36 | - (id)init 37 | { 38 | self = [super init]; 39 | if (self != nil) { 40 | self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30]; 41 | self.settings = [[NSMutableDictionary alloc] initWithCapacity:30]; 42 | self.whitelistHosts = [[NSMutableArray alloc] initWithCapacity:30]; 43 | [self.whitelistHosts addObject:@"file:///*"]; 44 | [self.whitelistHosts addObject:@"content:///*"]; 45 | [self.whitelistHosts addObject:@"data:///*"]; 46 | self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8]; 47 | featureName = nil; 48 | } 49 | return self; 50 | } 51 | 52 | - (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict 53 | { 54 | if ([elementName isEqualToString:@"preference"]) { 55 | settings[[attributeDict[@"name"] lowercaseString]] = attributeDict[@"value"]; 56 | } else if ([elementName isEqualToString:@"feature"]) { // store feature name to use with correct parameter set 57 | featureName = [attributeDict[@"name"] lowercaseString]; 58 | } else if ((featureName != nil) && [elementName isEqualToString:@"param"]) { 59 | NSString* paramName = [attributeDict[@"name"] lowercaseString]; 60 | id value = attributeDict[@"value"]; 61 | if ([paramName isEqualToString:@"ios-package"]) { 62 | pluginsDict[featureName] = value; 63 | } 64 | BOOL paramIsOnload = ([paramName isEqualToString:@"onload"] && [@"true" isEqualToString : value]); 65 | BOOL attribIsOnload = [@"true" isEqualToString :[attributeDict[@"onload"] lowercaseString]]; 66 | if (paramIsOnload || attribIsOnload) { 67 | [self.startupPluginNames addObject:featureName]; 68 | } 69 | } else if ([elementName isEqualToString:@"access"]) { 70 | [whitelistHosts addObject:attributeDict[@"origin"]]; 71 | } else if ([elementName isEqualToString:@"content"]) { 72 | self.startPage = attributeDict[@"src"]; 73 | } 74 | } 75 | 76 | - (void)parser:(NSXMLParser*)parser didEndElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName 77 | { 78 | if ([elementName isEqualToString:@"feature"]) { // no longer handling a feature so release 79 | featureName = nil; 80 | } 81 | } 82 | 83 | - (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError 84 | { 85 | NSAssert(NO, @"config.xml parse error line %ld col %ld", (long)[parser lineNumber], (long)[parser columnNumber]); 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #ifdef DEBUG 21 | #define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) 22 | #else 23 | #define DLog(...) 24 | #endif 25 | #define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) 26 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVInvokedUrlCommand : NSObject { 23 | NSString* _callbackId; 24 | NSString* _className; 25 | NSString* _methodName; 26 | NSArray* _arguments; 27 | } 28 | 29 | @property (nonatomic, readonly) NSArray* arguments; 30 | @property (nonatomic, readonly) NSString* callbackId; 31 | @property (nonatomic, readonly) NSString* className; 32 | @property (nonatomic, readonly) NSString* methodName; 33 | 34 | + (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry; 35 | 36 | - (id)initWithArguments:(NSArray*)arguments 37 | callbackId:(NSString*)callbackId 38 | className:(NSString*)className 39 | methodName:(NSString*)methodName; 40 | 41 | - (id)initFromJson:(NSArray*)jsonEntry; 42 | 43 | // Returns the argument at the given index. 44 | // If index >= the number of arguments, returns nil. 45 | // If the argument at the given index is NSNull, returns nil. 46 | - (id)argumentAtIndex:(NSUInteger)index; 47 | // Same as above, but returns defaultValue instead of nil. 48 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue; 49 | // Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue 50 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass; 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVInvokedUrlCommand.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVInvokedUrlCommand.h" 21 | #import "CDVJSON.h" 22 | #import "NSData+Base64.h" 23 | 24 | @implementation CDVInvokedUrlCommand 25 | 26 | @synthesize arguments = _arguments; 27 | @synthesize callbackId = _callbackId; 28 | @synthesize className = _className; 29 | @synthesize methodName = _methodName; 30 | 31 | + (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry 32 | { 33 | return [[CDVInvokedUrlCommand alloc] initFromJson:jsonEntry]; 34 | } 35 | 36 | - (id)initFromJson:(NSArray*)jsonEntry 37 | { 38 | id tmp = [jsonEntry objectAtIndex:0]; 39 | NSString* callbackId = tmp == [NSNull null] ? nil : tmp; 40 | NSString* className = [jsonEntry objectAtIndex:1]; 41 | NSString* methodName = [jsonEntry objectAtIndex:2]; 42 | NSMutableArray* arguments = [jsonEntry objectAtIndex:3]; 43 | 44 | return [self initWithArguments:arguments 45 | callbackId:callbackId 46 | className:className 47 | methodName:methodName]; 48 | } 49 | 50 | - (id)initWithArguments:(NSArray*)arguments 51 | callbackId:(NSString*)callbackId 52 | className:(NSString*)className 53 | methodName:(NSString*)methodName 54 | { 55 | self = [super init]; 56 | if (self != nil) { 57 | _arguments = arguments; 58 | _callbackId = callbackId; 59 | _className = className; 60 | _methodName = methodName; 61 | } 62 | [self massageArguments]; 63 | return self; 64 | } 65 | 66 | - (void)massageArguments 67 | { 68 | NSMutableArray* newArgs = nil; 69 | 70 | for (NSUInteger i = 0, count = [_arguments count]; i < count; ++i) { 71 | id arg = [_arguments objectAtIndex:i]; 72 | if (![arg isKindOfClass:[NSDictionary class]]) { 73 | continue; 74 | } 75 | NSDictionary* dict = arg; 76 | NSString* type = [dict objectForKey:@"CDVType"]; 77 | if (!type || ![type isEqualToString:@"ArrayBuffer"]) { 78 | continue; 79 | } 80 | NSString* data = [dict objectForKey:@"data"]; 81 | if (!data) { 82 | continue; 83 | } 84 | if (newArgs == nil) { 85 | newArgs = [NSMutableArray arrayWithArray:_arguments]; 86 | _arguments = newArgs; 87 | } 88 | [newArgs replaceObjectAtIndex:i withObject:[NSData dataFromBase64String:data]]; 89 | } 90 | } 91 | 92 | - (id)argumentAtIndex:(NSUInteger)index 93 | { 94 | return [self argumentAtIndex:index withDefault:nil]; 95 | } 96 | 97 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue 98 | { 99 | return [self argumentAtIndex:index withDefault:defaultValue andClass:nil]; 100 | } 101 | 102 | - (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass 103 | { 104 | if (index >= [_arguments count]) { 105 | return defaultValue; 106 | } 107 | id ret = [_arguments objectAtIndex:index]; 108 | if (ret == [NSNull null]) { 109 | ret = defaultValue; 110 | } 111 | if ((aClass != nil) && ![ret isKindOfClass:aClass]) { 112 | ret = defaultValue; 113 | } 114 | return ret; 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | @interface NSArray (CDVJSONSerializing) 21 | - (NSString*)JSONString; 22 | @end 23 | 24 | @interface NSDictionary (CDVJSONSerializing) 25 | - (NSString*)JSONString; 26 | @end 27 | 28 | @interface NSString (CDVJSONSerializing) 29 | - (id)JSONObject; 30 | @end 31 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVJSON.h" 21 | #import 22 | 23 | @implementation NSArray (CDVJSONSerializing) 24 | 25 | - (NSString*)JSONString 26 | { 27 | NSError* error = nil; 28 | NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self 29 | options:NSJSONWritingPrettyPrinted 30 | error:&error]; 31 | 32 | if (error != nil) { 33 | NSLog(@"NSArray JSONString error: %@", [error localizedDescription]); 34 | return nil; 35 | } else { 36 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 37 | } 38 | } 39 | 40 | @end 41 | 42 | @implementation NSDictionary (CDVJSONSerializing) 43 | 44 | - (NSString*)JSONString 45 | { 46 | NSError* error = nil; 47 | NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self 48 | options:NSJSONWritingPrettyPrinted 49 | error:&error]; 50 | 51 | if (error != nil) { 52 | NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]); 53 | return nil; 54 | } else { 55 | return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 56 | } 57 | } 58 | 59 | @end 60 | 61 | @implementation NSString (CDVJSONSerializing) 62 | 63 | - (id)JSONObject 64 | { 65 | NSError* error = nil; 66 | id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding] 67 | options:NSJSONReadingMutableContainers 68 | error:&error]; 69 | 70 | if (error != nil) { 71 | NSLog(@"NSString JSONObject error: %@", [error localizedDescription]); 72 | } 73 | 74 | return object; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVLocalStorage.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVPlugin.h" 21 | 22 | #define kCDVLocalStorageErrorDomain @"kCDVLocalStorageErrorDomain" 23 | #define kCDVLocalStorageFileOperationError 1 24 | 25 | @interface CDVLocalStorage : CDVPlugin 26 | 27 | @property (nonatomic, readonly, strong) NSMutableArray* backupInfo; 28 | 29 | - (BOOL)shouldBackup; 30 | - (BOOL)shouldRestore; 31 | - (void)backup:(CDVInvokedUrlCommand*)command; 32 | - (void)restore:(CDVInvokedUrlCommand*)command; 33 | 34 | + (void)__fixupDatabaseLocationsWithBackupType:(NSString*)backupType; 35 | // Visible for testing. 36 | + (BOOL)__verifyAndFixDatabaseLocationsWithAppPlistDict:(NSMutableDictionary*)appPlistDict 37 | bundlePath:(NSString*)bundlePath 38 | fileManager:(NSFileManager*)fileManager; 39 | @end 40 | 41 | @interface CDVBackupInfo : NSObject 42 | 43 | @property (nonatomic, copy) NSString* original; 44 | @property (nonatomic, copy) NSString* backup; 45 | @property (nonatomic, copy) NSString* label; 46 | 47 | - (BOOL)shouldBackup; 48 | - (BOOL)shouldRestore; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVPlugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | #import "CDVPluginResult.h" 23 | #import "NSMutableArray+QueueAdditions.h" 24 | #import "CDVCommandDelegate.h" 25 | 26 | extern NSString* const CDVPageDidLoadNotification; 27 | extern NSString* const CDVPluginHandleOpenURLNotification; 28 | extern NSString* const CDVPluginResetNotification; 29 | extern NSString* const CDVLocalNotification; 30 | extern NSString* const CDVRemoteNotification; 31 | extern NSString* const CDVRemoteNotificationError; 32 | 33 | @interface CDVPlugin : NSObject {} 34 | 35 | @property (nonatomic, weak) UIWebView* webView; 36 | @property (nonatomic, weak) UIViewController* viewController; 37 | @property (nonatomic, weak) id commandDelegate; 38 | 39 | @property (readonly, assign) BOOL hasPendingOperation; 40 | 41 | - (CDVPlugin*)initWithWebView:(UIWebView*)theWebView; 42 | - (void)pluginInitialize; 43 | 44 | - (void)handleOpenURL:(NSNotification*)notification; 45 | - (void)onAppTerminate; 46 | - (void)onMemoryWarning; 47 | - (void)onReset; 48 | - (void)dispose; 49 | 50 | /* 51 | // see initWithWebView implementation 52 | - (void) onPause {} 53 | - (void) onResume {} 54 | - (void) onOrientationWillChange {} 55 | - (void) onOrientationDidChange {} 56 | - (void)didReceiveLocalNotification:(NSNotification *)notification; 57 | */ 58 | 59 | - (id)appDelegate; 60 | 61 | // TODO(agrieve): Deprecate these in favour of using CDVCommandDelegate directly. 62 | - (NSString*)writeJavascript:(NSString*)javascript; 63 | - (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId; 64 | - (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVPluginResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | typedef enum { 23 | CDVCommandStatus_NO_RESULT = 0, 24 | CDVCommandStatus_OK, 25 | CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION, 26 | CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION, 27 | CDVCommandStatus_INSTANTIATION_EXCEPTION, 28 | CDVCommandStatus_MALFORMED_URL_EXCEPTION, 29 | CDVCommandStatus_IO_EXCEPTION, 30 | CDVCommandStatus_INVALID_ACTION, 31 | CDVCommandStatus_JSON_EXCEPTION, 32 | CDVCommandStatus_ERROR 33 | } CDVCommandStatus; 34 | 35 | @interface CDVPluginResult : NSObject {} 36 | 37 | @property (nonatomic, strong, readonly) NSNumber* status; 38 | @property (nonatomic, strong, readonly) id message; 39 | @property (nonatomic, strong) NSNumber* keepCallback; 40 | // This property can be used to scope the lifetime of another object. For example, 41 | // Use it to store the associated NSData when `message` is created using initWithBytesNoCopy. 42 | @property (nonatomic, strong) id associatedObject; 43 | 44 | - (CDVPluginResult*)init; 45 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal; 46 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage; 47 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage; 48 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage; 49 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage; 50 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage; 51 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage; 52 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage; 53 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages; 54 | + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode; 55 | 56 | + (void)setVerbose:(BOOL)verbose; 57 | + (BOOL)isVerbose; 58 | 59 | - (void)setKeepCallbackAsBool:(BOOL)bKeepCallback; 60 | 61 | - (NSString*)argumentsAsJSON; 62 | 63 | // These methods are used by the legacy plugin return result method 64 | - (NSString*)toJSONString; 65 | - (NSString*)toSuccessCallbackString:(NSString*)callbackId; 66 | - (NSString*)toErrorCallbackString:(NSString*)callbackId; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVScreenOrientationDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @protocol CDVScreenOrientationDelegate 23 | 24 | - (NSUInteger)supportedInterfaceOrientations; 25 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; 26 | - (BOOL)shouldAutorotate; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVShared.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @interface NSError (JSONMethods) 24 | 25 | - (NSString*)JSONRepresentation; 26 | 27 | @end 28 | 29 | @interface CLLocation (JSONMethods) 30 | 31 | - (NSString*)JSONRepresentation; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVShared.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVShared.h" 21 | 22 | #pragma mark - 23 | #pragma mark CLLocation(JSONMethods) 24 | 25 | @implementation CLLocation (JSONMethods) 26 | 27 | - (NSString*)JSONRepresentation 28 | { 29 | return [NSString stringWithFormat: 30 | @"{ timestamp: %.00f, \ 31 | coords: { latitude: %f, longitude: %f, altitude: %.02f, heading: %.02f, speed: %.02f, accuracy: %.02f, altitudeAccuracy: %.02f } \ 32 | }", 33 | [self.timestamp timeIntervalSince1970] * 1000.0, 34 | self.coordinate.latitude, 35 | self.coordinate.longitude, 36 | self.altitude, 37 | self.course, 38 | self.speed, 39 | self.horizontalAccuracy, 40 | self.verticalAccuracy 41 | ]; 42 | } 43 | 44 | @end 45 | 46 | #pragma mark NSError(JSONMethods) 47 | 48 | @implementation NSError (JSONMethods) 49 | 50 | - (NSString*)JSONRepresentation 51 | { 52 | return [NSString stringWithFormat: 53 | @"{ code: %ld, message: '%@'}", 54 | (long)self.code, 55 | [self localizedDescription] 56 | ]; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVTimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVTimer : NSObject 23 | 24 | + (void)start:(NSString*)name; 25 | + (void)stop:(NSString*)name; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVTimer.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVTimer.h" 21 | 22 | #pragma mark CDVTimerItem 23 | 24 | @interface CDVTimerItem : NSObject 25 | 26 | @property (nonatomic, strong) NSString* name; 27 | @property (nonatomic, strong) NSDate* started; 28 | @property (nonatomic, strong) NSDate* ended; 29 | 30 | - (void)log; 31 | 32 | @end 33 | 34 | @implementation CDVTimerItem 35 | 36 | - (void)log 37 | { 38 | NSLog(@"[CDVTimer][%@] %fms", self.name, [self.ended timeIntervalSinceDate:self.started] * 1000.0); 39 | } 40 | 41 | @end 42 | 43 | #pragma mark CDVTimer 44 | 45 | @interface CDVTimer () 46 | 47 | @property (nonatomic, strong) NSMutableDictionary* items; 48 | 49 | @end 50 | 51 | @implementation CDVTimer 52 | 53 | #pragma mark object methods 54 | 55 | - (id)init 56 | { 57 | if (self = [super init]) { 58 | self.items = [NSMutableDictionary dictionaryWithCapacity:6]; 59 | } 60 | 61 | return self; 62 | } 63 | 64 | - (void)add:(NSString*)name 65 | { 66 | if ([self.items objectForKey:[name lowercaseString]] == nil) { 67 | CDVTimerItem* item = [CDVTimerItem new]; 68 | item.name = name; 69 | item.started = [NSDate new]; 70 | [self.items setObject:item forKey:[name lowercaseString]]; 71 | } else { 72 | NSLog(@"Timer called '%@' already exists.", name); 73 | } 74 | } 75 | 76 | - (void)remove:(NSString*)name 77 | { 78 | CDVTimerItem* item = [self.items objectForKey:[name lowercaseString]]; 79 | 80 | if (item != nil) { 81 | item.ended = [NSDate new]; 82 | [item log]; 83 | [self.items removeObjectForKey:[name lowercaseString]]; 84 | } else { 85 | NSLog(@"Timer called '%@' does not exist.", name); 86 | } 87 | } 88 | 89 | - (void)removeAll 90 | { 91 | [self.items removeAllObjects]; 92 | } 93 | 94 | #pragma mark class methods 95 | 96 | + (void)start:(NSString*)name 97 | { 98 | [[CDVTimer sharedInstance] add:name]; 99 | } 100 | 101 | + (void)stop:(NSString*)name 102 | { 103 | [[CDVTimer sharedInstance] remove:name]; 104 | } 105 | 106 | + (void)clearAll 107 | { 108 | [[CDVTimer sharedInstance] removeAll]; 109 | } 110 | 111 | + (CDVTimer*)sharedInstance 112 | { 113 | static dispatch_once_t pred = 0; 114 | __strong static CDVTimer* _sharedObject = nil; 115 | 116 | dispatch_once(&pred, ^{ 117 | _sharedObject = [[self alloc] init]; 118 | }); 119 | 120 | return _sharedObject; 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVURLProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "CDVAvailability.h" 22 | 23 | @class CDVViewController; 24 | 25 | @interface CDVURLProtocol : NSURLProtocol {} 26 | 27 | + (void)registerViewController:(CDVViewController*)viewController; 28 | + (void)unregisterViewController:(CDVViewController*)viewController; 29 | @end 30 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVUserAgentUtil : NSObject 23 | + (NSString*)originalUserAgent; 24 | + (void)acquireLock:(void (^)(NSInteger lockToken))block; 25 | + (void)releaseLock:(NSInteger*)lockToken; 26 | + (void)setUserAgent:(NSString*)value lockToken:(NSInteger)lockToken; 27 | @end 28 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVUserAgentUtil.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "CDVUserAgentUtil.h" 21 | 22 | #import 23 | 24 | // #define VerboseLog NSLog 25 | #define VerboseLog(...) do {} while (0) 26 | 27 | static NSString* const kCdvUserAgentKey = @"Cordova-User-Agent"; 28 | static NSString* const kCdvUserAgentVersionKey = @"Cordova-User-Agent-Version"; 29 | 30 | static NSString* gOriginalUserAgent = nil; 31 | static NSInteger gNextLockToken = 0; 32 | static NSInteger gCurrentLockToken = 0; 33 | static NSMutableArray* gPendingSetUserAgentBlocks = nil; 34 | 35 | @implementation CDVUserAgentUtil 36 | 37 | + (NSString*)originalUserAgent 38 | { 39 | if (gOriginalUserAgent == nil) { 40 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppLocaleDidChange:) 41 | name:NSCurrentLocaleDidChangeNotification object:nil]; 42 | 43 | NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; 44 | NSString* systemVersion = [[UIDevice currentDevice] systemVersion]; 45 | NSString* localeStr = [[NSLocale currentLocale] localeIdentifier]; 46 | // Record the model since simulator can change it without re-install (CB-5420). 47 | NSString* model = [UIDevice currentDevice].model; 48 | NSString* systemAndLocale = [NSString stringWithFormat:@"%@ %@ %@", model, systemVersion, localeStr]; 49 | 50 | NSString* cordovaUserAgentVersion = [userDefaults stringForKey:kCdvUserAgentVersionKey]; 51 | gOriginalUserAgent = [userDefaults stringForKey:kCdvUserAgentKey]; 52 | BOOL cachedValueIsOld = ![systemAndLocale isEqualToString:cordovaUserAgentVersion]; 53 | 54 | if ((gOriginalUserAgent == nil) || cachedValueIsOld) { 55 | UIWebView* sampleWebView = [[UIWebView alloc] initWithFrame:CGRectZero]; 56 | gOriginalUserAgent = [sampleWebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"]; 57 | 58 | [userDefaults setObject:gOriginalUserAgent forKey:kCdvUserAgentKey]; 59 | [userDefaults setObject:systemAndLocale forKey:kCdvUserAgentVersionKey]; 60 | 61 | [userDefaults synchronize]; 62 | } 63 | } 64 | return gOriginalUserAgent; 65 | } 66 | 67 | + (void)onAppLocaleDidChange:(NSNotification*)notification 68 | { 69 | // TODO: We should figure out how to update the user-agent of existing UIWebViews when this happens. 70 | // Maybe use the PDF bug (noted in setUserAgent:). 71 | gOriginalUserAgent = nil; 72 | } 73 | 74 | + (void)acquireLock:(void (^)(NSInteger lockToken))block 75 | { 76 | if (gCurrentLockToken == 0) { 77 | gCurrentLockToken = ++gNextLockToken; 78 | VerboseLog(@"Gave lock %d", gCurrentLockToken); 79 | block(gCurrentLockToken); 80 | } else { 81 | if (gPendingSetUserAgentBlocks == nil) { 82 | gPendingSetUserAgentBlocks = [[NSMutableArray alloc] initWithCapacity:4]; 83 | } 84 | VerboseLog(@"Waiting for lock"); 85 | [gPendingSetUserAgentBlocks addObject:block]; 86 | } 87 | } 88 | 89 | + (void)releaseLock:(NSInteger*)lockToken 90 | { 91 | if (*lockToken == 0) { 92 | return; 93 | } 94 | NSAssert(gCurrentLockToken == *lockToken, @"Got token %ld, expected %ld", (long)*lockToken, (long)gCurrentLockToken); 95 | 96 | VerboseLog(@"Released lock %d", *lockToken); 97 | if ([gPendingSetUserAgentBlocks count] > 0) { 98 | void (^block)() = [gPendingSetUserAgentBlocks objectAtIndex:0]; 99 | [gPendingSetUserAgentBlocks removeObjectAtIndex:0]; 100 | gCurrentLockToken = ++gNextLockToken; 101 | NSLog(@"Gave lock %ld", (long)gCurrentLockToken); 102 | block(gCurrentLockToken); 103 | } else { 104 | gCurrentLockToken = 0; 105 | } 106 | *lockToken = 0; 107 | } 108 | 109 | + (void)setUserAgent:(NSString*)value lockToken:(NSInteger)lockToken 110 | { 111 | NSAssert(gCurrentLockToken == lockToken, @"Got token %ld, expected %ld", (long)lockToken, (long)gCurrentLockToken); 112 | VerboseLog(@"User-Agent set to: %@", value); 113 | 114 | // Setting the UserAgent must occur before a UIWebView is instantiated. 115 | // It is read per instantiation, so it does not affect previously created views. 116 | // Except! When a PDF is loaded, all currently active UIWebViews reload their 117 | // User-Agent from the NSUserDefaults some time after the DidFinishLoad of the PDF bah! 118 | NSDictionary* dict = [[NSDictionary alloc] initWithObjectsAndKeys:value, @"UserAgent", nil]; 119 | [[NSUserDefaults standardUserDefaults] registerDefaults:dict]; 120 | } 121 | 122 | @end 123 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | #import "CDVAvailability.h" 23 | #import "CDVInvokedUrlCommand.h" 24 | #import "CDVCommandDelegate.h" 25 | #import "CDVCommandQueue.h" 26 | #import "CDVWhitelist.h" 27 | #import "CDVScreenOrientationDelegate.h" 28 | #import "CDVPlugin.h" 29 | 30 | @interface CDVViewController : UIViewController { 31 | @protected 32 | id _commandDelegate; 33 | @protected 34 | CDVCommandQueue* _commandQueue; 35 | NSString* _userAgent; 36 | } 37 | 38 | @property (nonatomic, strong) IBOutlet UIWebView* webView; 39 | 40 | @property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects; 41 | @property (nonatomic, readonly, strong) NSDictionary* pluginsMap; 42 | @property (nonatomic, readonly, strong) NSMutableDictionary* settings; 43 | @property (nonatomic, readonly, strong) NSXMLParser* configParser; 44 | @property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public 45 | @property (nonatomic, readonly, assign) BOOL loadFromString; 46 | 47 | @property (nonatomic, readwrite, copy) NSString* wwwFolderName; 48 | @property (nonatomic, readwrite, copy) NSString* startPage; 49 | @property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue; 50 | @property (nonatomic, readonly, strong) id commandDelegate; 51 | @property (nonatomic, readonly) NSString* userAgent; 52 | 53 | + (NSDictionary*)getBundlePlist:(NSString*)plistName; 54 | + (NSString*)applicationDocumentsDirectory; 55 | 56 | - (void)printMultitaskingInfo; 57 | - (void)createGapView; 58 | - (UIWebView*)newCordovaViewWithFrame:(CGRect)bounds; 59 | 60 | - (void)javascriptAlert:(NSString*)text; 61 | - (NSString*)appURLScheme; 62 | 63 | - (NSArray*)parseInterfaceOrientations:(NSArray*)orientations; 64 | - (BOOL)supportsOrientation:(UIInterfaceOrientation)orientation; 65 | 66 | - (id)getCommandInstance:(NSString*)pluginName; 67 | - (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className; 68 | - (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName; 69 | 70 | - (BOOL)URLisAllowed:(NSURL*)url; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVWebViewDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | /** 23 | * Distinguishes top-level navigations from sub-frame navigations. 24 | * shouldStartLoadWithRequest is called for every request, but didStartLoad 25 | * and didFinishLoad is called only for top-level navigations. 26 | * Relevant bug: CB-2389 27 | */ 28 | @interface CDVWebViewDelegate : NSObject { 29 | __weak NSObject * _delegate; 30 | NSInteger _loadCount; 31 | NSInteger _state; 32 | NSInteger _curLoadToken; 33 | NSInteger _loadStartPollCount; 34 | } 35 | 36 | - (id)initWithDelegate:(NSObject *)delegate; 37 | - (BOOL)request:(NSURLRequest*)newRequest isFragmentIdentifierToRequest:(NSURLRequest*)originalRequest __attribute__((deprecated("Deprecated Since 3.5.0 -Use request:isEqualToRequestAfterStrippingFragments: instead."))); 38 | - (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/CDVWhitelist.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | extern NSString* const kCDVDefaultWhitelistRejectionString; 23 | 24 | @interface CDVWhitelist : NSObject 25 | 26 | @property (nonatomic, copy) NSString* whitelistRejectionFormatString; 27 | 28 | - (id)initWithArray:(NSArray*)array; 29 | - (BOOL)schemeIsAllowed:(NSString*)scheme; 30 | - (BOOL)URLIsAllowed:(NSURL*)url; 31 | - (BOOL)URLIsAllowed:(NSURL*)url logFailure:(BOOL)logFailure; 32 | - (NSString*)errorStringForURL:(NSURL*)url; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSArray+Comparisons.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface NSArray (Comparisons) 23 | 24 | - (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSArray+Comparisons.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "NSArray+Comparisons.h" 21 | 22 | @implementation NSArray (Comparisons) 23 | 24 | - (id)objectAtIndex:(NSUInteger)index withDefault:(id)aDefault 25 | { 26 | id obj = nil; 27 | 28 | @try { 29 | obj = [self objectAtIndex:index]; 30 | if ((obj == [NSNull null]) || (obj == nil)) { 31 | return aDefault; 32 | } 33 | } 34 | @catch(NSException* exception) { 35 | NSLog(@"Exception - Name: %@ Reason: %@", [exception name], [exception reason]); 36 | } 37 | 38 | return obj; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSData+Base64.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSData+Base64.h 3 | // base64 4 | // 5 | // Created by Matt Gallagher on 2009/06/03. 6 | // Copyright 2009 Matt Gallagher. All rights reserved. 7 | // 8 | // Permission is given to use this source code file, free of charge, in any 9 | // project, commercial or otherwise, entirely at your risk, with the condition 10 | // that any redistribution (in part or whole) of source code must retain 11 | // this copyright and permission notice. Attribution in compiled projects is 12 | // appreciated but not required. 13 | // 14 | 15 | #import 16 | 17 | void *CDVNewBase64Decode( 18 | const char* inputBuffer, 19 | size_t length, 20 | size_t * outputLength); 21 | 22 | char *CDVNewBase64Encode( 23 | const void* inputBuffer, 24 | size_t length, 25 | bool separateLines, 26 | size_t * outputLength); 27 | 28 | @interface NSData (CDVBase64) 29 | 30 | + (NSData*)dataFromBase64String:(NSString*)aString; 31 | - (NSString*)base64EncodedString; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface NSDictionary (org_apache_cordova_NSDictionary_Extension) 23 | 24 | - (bool)existsValue:(NSString*)expectedValue forKey:(NSString*)key; 25 | - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue withRange:(NSRange)range; 26 | - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue; 27 | - (BOOL)typeValueForKey:(NSString*)key isArray:(BOOL*)bArray isNull:(BOOL*)bNull isNumber:(BOOL*)bNumber isString:(BOOL*)bString; 28 | - (BOOL)valueForKeyIsArray:(NSString*)key; 29 | - (BOOL)valueForKeyIsNull:(NSString*)key; 30 | - (BOOL)valueForKeyIsString:(NSString*)key; 31 | - (BOOL)valueForKeyIsNumber:(NSString*)key; 32 | 33 | - (NSDictionary*)dictionaryWithLowercaseKeys; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSDictionary+Extensions.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "NSDictionary+Extensions.h" 21 | #import 22 | 23 | @implementation NSDictionary (org_apache_cordova_NSDictionary_Extension) 24 | 25 | - (bool)existsValue:(NSString*)expectedValue forKey:(NSString*)key 26 | { 27 | id val = [self valueForKey:key]; 28 | bool exists = false; 29 | 30 | if (val != nil) { 31 | exists = [(NSString*)val compare : expectedValue options : NSCaseInsensitiveSearch] == 0; 32 | } 33 | 34 | return exists; 35 | } 36 | 37 | - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue withRange:(NSRange)range 38 | { 39 | NSInteger value = defaultValue; 40 | 41 | NSNumber* val = [self valueForKey:key]; // value is an NSNumber 42 | 43 | if (val != nil) { 44 | value = [val integerValue]; 45 | } 46 | 47 | // min, max checks 48 | value = MAX(range.location, value); 49 | value = MIN(range.length, value); 50 | 51 | return value; 52 | } 53 | 54 | - (NSInteger)integerValueForKey:(NSString*)key defaultValue:(NSInteger)defaultValue 55 | { 56 | NSInteger value = defaultValue; 57 | 58 | NSNumber* val = [self valueForKey:key]; // value is an NSNumber 59 | 60 | if (val != nil) { 61 | value = [val integerValue]; 62 | } 63 | return value; 64 | } 65 | 66 | /* 67 | * Determine the type of object stored in a dictionary 68 | * IN: 69 | * (BOOL*) bString - if exists will be set to YES if object is an NSString, NO if not 70 | * (BOOL*) bNull - if exists will be set to YES if object is an NSNull, NO if not 71 | * (BOOL*) bArray - if exists will be set to YES if object is an NSArray, NO if not 72 | * (BOOL*) bNumber - if exists will be set to YES if object is an NSNumber, NO if not 73 | * 74 | * OUT: 75 | * YES if key exists 76 | * NO if key does not exist. Input parameters remain untouched 77 | * 78 | */ 79 | 80 | - (BOOL)typeValueForKey:(NSString*)key isArray:(BOOL*)bArray isNull:(BOOL*)bNull isNumber:(BOOL*)bNumber isString:(BOOL*)bString 81 | { 82 | BOOL bExists = YES; 83 | NSObject* value = [self objectForKey:key]; 84 | 85 | if (value) { 86 | bExists = YES; 87 | if (bString) { 88 | *bString = [value isKindOfClass:[NSString class]]; 89 | } 90 | if (bNull) { 91 | *bNull = [value isKindOfClass:[NSNull class]]; 92 | } 93 | if (bArray) { 94 | *bArray = [value isKindOfClass:[NSArray class]]; 95 | } 96 | if (bNumber) { 97 | *bNumber = [value isKindOfClass:[NSNumber class]]; 98 | } 99 | } 100 | return bExists; 101 | } 102 | 103 | - (BOOL)valueForKeyIsArray:(NSString*)key 104 | { 105 | BOOL bArray = NO; 106 | NSObject* value = [self objectForKey:key]; 107 | 108 | if (value) { 109 | bArray = [value isKindOfClass:[NSArray class]]; 110 | } 111 | return bArray; 112 | } 113 | 114 | - (BOOL)valueForKeyIsNull:(NSString*)key 115 | { 116 | BOOL bNull = NO; 117 | NSObject* value = [self objectForKey:key]; 118 | 119 | if (value) { 120 | bNull = [value isKindOfClass:[NSNull class]]; 121 | } 122 | return bNull; 123 | } 124 | 125 | - (BOOL)valueForKeyIsString:(NSString*)key 126 | { 127 | BOOL bString = NO; 128 | NSObject* value = [self objectForKey:key]; 129 | 130 | if (value) { 131 | bString = [value isKindOfClass:[NSString class]]; 132 | } 133 | return bString; 134 | } 135 | 136 | - (BOOL)valueForKeyIsNumber:(NSString*)key 137 | { 138 | BOOL bNumber = NO; 139 | NSObject* value = [self objectForKey:key]; 140 | 141 | if (value) { 142 | bNumber = [value isKindOfClass:[NSNumber class]]; 143 | } 144 | return bNumber; 145 | } 146 | 147 | - (NSDictionary*)dictionaryWithLowercaseKeys 148 | { 149 | NSMutableDictionary* result = [NSMutableDictionary dictionaryWithCapacity:self.count]; 150 | NSString* key; 151 | 152 | for (key in self) { 153 | [result setObject:[self objectForKey:key] forKey:[key lowercaseString]]; 154 | } 155 | 156 | return result; 157 | } 158 | 159 | @end 160 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSMutableArray+QueueAdditions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface NSMutableArray (QueueAdditions) 23 | 24 | - (id)pop; 25 | - (id)queueHead; 26 | - (id)dequeue; 27 | - (void)enqueue:(id)obj; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/NSMutableArray+QueueAdditions.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import "NSMutableArray+QueueAdditions.h" 21 | 22 | @implementation NSMutableArray (QueueAdditions) 23 | 24 | - (id)queueHead 25 | { 26 | if ([self count] == 0) { 27 | return nil; 28 | } 29 | 30 | return [self objectAtIndex:0]; 31 | } 32 | 33 | - (__autoreleasing id)dequeue 34 | { 35 | if ([self count] == 0) { 36 | return nil; 37 | } 38 | 39 | id head = [self objectAtIndex:0]; 40 | if (head != nil) { 41 | // [[head retain] autorelease]; ARC - the __autoreleasing on the return value should so the same thing 42 | [self removeObjectAtIndex:0]; 43 | } 44 | 45 | return head; 46 | } 47 | 48 | - (id)pop 49 | { 50 | return [self dequeue]; 51 | } 52 | 53 | - (void)enqueue:(id)object 54 | { 55 | [self addObject:object]; 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/UIDevice+Extensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface UIDevice (org_apache_cordova_UIDevice_Extension) 23 | 24 | /* 25 | Get the unique identifier from the app bundle's folder, which is already a GUID 26 | Upgrading and/or deleting the app and re-installing will get you a new GUID, so 27 | this is only unique per install per device. 28 | */ 29 | - (NSString*)uniqueAppInstanceIdentifier; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/Classes/UIDevice+Extensions.m: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import "UIDevice+Extensions.h" 22 | 23 | @implementation UIDevice (org_apache_cordova_UIDevice_Extension) 24 | 25 | - (NSString*)uniqueAppInstanceIdentifier 26 | { 27 | NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults]; 28 | static NSString* UUID_KEY = @"CDVUUID"; 29 | 30 | NSString* app_uuid = [userDefaults stringForKey:UUID_KEY]; 31 | 32 | if (app_uuid == nil) { 33 | CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault); 34 | CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef); 35 | 36 | app_uuid = [NSString stringWithString:(__bridge NSString*)uuidString]; 37 | [userDefaults setObject:app_uuid forKey:UUID_KEY]; 38 | [userDefaults synchronize]; 39 | 40 | CFRelease(uuidString); 41 | CFRelease(uuidRef); 42 | } 43 | 44 | return app_uuid; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/CordovaLib_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #ifdef __OBJC__ 21 | #import 22 | #endif 23 | -------------------------------------------------------------------------------- /test/app/platforms/ios/CordovaLib/VERSION: -------------------------------------------------------------------------------- 1 | 3.5.0 2 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/apple_ios_version: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # outputs the highest level of iOS sdk installed 23 | iOS_X_VERSIONS=$(xcodebuild -showsdks | sed -e '/./{H;$!d;}' -e 'x;/iOS SDKs/!d;' | grep -o '[0-9]*\.[0-9]* '); 24 | echo $iOS_X_VERSIONS | tr " " "\n" | sort -g | tail -1; -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/apple_osx_version: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # outputs the highest level of OS X sdk installed 23 | OS_X_VERSIONS=$(xcodebuild -showsdks | sed -e '/./{H;$!d;}' -e 'x;/OS X SDKs/!d;' | grep -o '[0-9]*\.[0-9]* '); 24 | echo $OS_X_VERSIONS | tr " " "\n" | sort -g | tail -1; -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/apple_xcode_version: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # outputs which version of XCODE is installed 23 | XCODEBUILD_VERSION=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 24 | echo $XCODEBUILD_VERSION -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/build: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # 23 | # compile and launch a Cordova/iOS project to the simulator 24 | # 25 | 26 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 27 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 28 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 29 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 30 | 31 | source "$CORDOVA_PATH/check_reqs" 32 | 33 | cd "$PROJECT_PATH" 34 | 35 | APP=build/$PROJECT_NAME.app 36 | 37 | CONFIGURATION=Debug 38 | EMULATOR=1 39 | DEVICE=0 40 | while [[ $# -gt 0 ]]; do 41 | case "$1" in 42 | --debug) ;; 43 | --release) CONFIGURATION=Release;; 44 | --device) EMULATOR=0;; 45 | --emulator) ;; 46 | *) echo "Unrecognized flag: $1"; exit 2;; 47 | esac 48 | shift 49 | done 50 | 51 | if (( $EMULATOR )); then 52 | exec xcodebuild -project "$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphonesimulator build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/emulator" 53 | else 54 | exec xcodebuild -xcconfig "$CORDOVA_PATH/build.xcconfig" -project "$PROJECT_NAME.xcodeproj" ARCHS="armv7 armv7s arm64" -target "$PROJECT_NAME" -configuration $CONFIGURATION -sdk iphoneos build VALID_ARCHS="armv7 armv7s arm64" CONFIGURATION_BUILD_DIR="$PROJECT_PATH/build/device" 55 | fi 56 | 57 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/build.xcconfig: -------------------------------------------------------------------------------- 1 | // to list all installed iOS identities, run: 2 | // security find-identity | sed -n 's/.*\("[^"]*"\).*/\1/p' | grep 'iPhone' 3 | 4 | // generic 'iPhone Developer' (no quotes) will match the right Identity with the right Provisioning Profile plus Certificate, based on the app bundle id 5 | CODE_SIGN_IDENTITY = iPhone Developer -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/check_reqs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | XCODEBUILD_LOCATION=$(which xcodebuild) 23 | if [ $? != 0 ]; then 24 | echo "Xcode is (probably) not installed, specifically the command 'xcodebuild' is unavailable." 25 | exit 2 26 | fi 27 | 28 | XCODEBUILD_MIN_VERSION="4.6" 29 | XCODEBUILD_VERSION=$(xcodebuild -version | head -n 1 | sed -e 's/Xcode //') 30 | 31 | if [[ "$XCODEBUILD_VERSION" < "$XCODEBUILD_MIN_VERSION" ]]; then 32 | echo "Cordova can only run in Xcode version $XCODEBUILD_MIN_VERSION or greater." 33 | exit 2 34 | fi 35 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/clean: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # 23 | # Clean a Cordova/iOS project 24 | # 25 | 26 | set -e 27 | 28 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 29 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 30 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 31 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 32 | 33 | source "$CORDOVA_PATH/check_reqs" 34 | 35 | cd "$PROJECT_PATH" 36 | 37 | xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Debug -alltargets clean 38 | xcodebuild -project "$PROJECT_NAME.xcodeproj" -configuration Release -alltargets clean 39 | 40 | rm -rf "build" -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/defaults.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/emulate: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'` 22 | 23 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 24 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 25 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 26 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 27 | 28 | source "$CORDOVA_PATH/check_reqs" 29 | 30 | APP_PATH=${1:-$PROJECT_PATH/build/emulator/$(xcodebuild -project "$PROJECT_PATH/$PROJECT_NAME.xcodeproj" -arch i386 -target "$PROJECT_NAME" -configuration Debug -sdk $SDK -showBuildSettings | grep FULL_PRODUCT_NAME | awk -F ' = ' '{print $2}')} 31 | 32 | DEVICE_FAMILY=${2:-${DEVICE_FAMILY:-iphone}} 33 | 34 | IOS_SIM_MIN_VERSION="1.7" 35 | IOS_SIM_LOCATION=$(which ios-sim) 36 | if [ $? != 0 ]; then 37 | echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m" 1>&2; 38 | exit 1; 39 | fi 40 | 41 | IOS_SIM_VERSION=$(ios-sim --version) 42 | 43 | if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then 44 | echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 1>&2; 45 | exit 1 46 | fi 47 | 48 | if [ ! -d "$APP_PATH" ]; then 49 | echo "Project '$APP_PATH' is not built. Building." 50 | "$CORDOVA_PATH/build" || exit $? 51 | fi 52 | 53 | if [ ! -d "$APP_PATH" ]; then 54 | echo "$APP_PATH not found to emulate." 1>&2; 55 | exit 1 56 | fi 57 | 58 | # launch using ios-sim 59 | ios-sim launch "$APP_PATH" --family "$DEVICE_FAMILY" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" --exit 60 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/copy-www-build-step.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # 21 | # This script copies the www directory into the Xcode project. 22 | # 23 | # This script should not be called directly. 24 | # It is called as a build step from Xcode. 25 | 26 | SRC_DIR="www/" 27 | DST_DIR="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/www" 28 | COPY_HIDDEN= 29 | ORIG_IFS=$IFS 30 | IFS=$(echo -en "\n\b") 31 | 32 | if [[ -z "$BUILT_PRODUCTS_DIR" ]]; then 33 | echo "The script is meant to be run as an Xcode build step and relies on env variables set by Xcode." 34 | exit 1 35 | fi 36 | if [[ ! -e "$SRC_DIR" ]]; then 37 | echo "Path does not exist: $SRC_DIR" 38 | exit 1 39 | fi 40 | 41 | # Use full path to find to avoid conflict with macports find (CB-6383). 42 | if [[ -n $COPY_HIDDEN ]]; then 43 | alias do_find='/usr/bin/find "$SRC_DIR"' 44 | else 45 | alias do_find='/usr/bin/find -L "$SRC_DIR" -name ".*" -prune -o' 46 | fi 47 | 48 | time ( 49 | # Code signing files must be removed or else there are 50 | # resource signing errors. 51 | rm -rf "$DST_DIR" \ 52 | "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/_CodeSignature" \ 53 | "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/PkgInfo" \ 54 | "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME/embedded.mobileprovision" 55 | 56 | # Directories 57 | for p in $(do_find -type d -print); do 58 | subpath="${p#$SRC_DIR}" 59 | mkdir "$DST_DIR$subpath" || exit 1 60 | done 61 | 62 | # Symlinks 63 | for p in $(do_find -type l -print); do 64 | subpath="${p#$SRC_DIR}" 65 | source=$(readlink $SRC_DIR$subpath) 66 | sourcetype=$(stat -f "%HT%SY" $source) 67 | if [ "$sourcetype" = "Directory" ]; then 68 | mkdir "$DST_DIR$subpath" || exit 2 69 | else 70 | rsync -a "$source" "$DST_DIR$subpath" || exit 3 71 | fi 72 | done 73 | 74 | # Files 75 | for p in $(do_find -type f -print); do 76 | subpath="${p#$SRC_DIR}" 77 | if ! ln "$SRC_DIR$subpath" "$DST_DIR$subpath" 2>/dev/null; then 78 | rsync -a "$SRC_DIR$subpath" "$DST_DIR$subpath" || exit 4 79 | fi 80 | done 81 | 82 | # Copy the config.xml file. 83 | cp -f "${PROJECT_FILE_PATH%.xcodeproj}/config.xml" "$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME" 84 | 85 | ) 86 | IFS=$ORIG_IFS 87 | 88 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/install-device: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P) 28 | CORDOVA_PATH="$(dirname "$LIB_PATH")" 29 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 30 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 31 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 32 | 33 | DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app" 34 | 35 | source "$CORDOVA_PATH/check_reqs" 36 | 37 | if [ ! -d "$DEVICE_APP_PATH" ]; then 38 | echo "Project '$DEVIC_APP_PATH' is not built." 39 | exit 1 40 | fi 41 | 42 | 43 | IOS_DEPLOY_MIN_VERSION="1.0.4" 44 | IOS_DEPLOY_LOCATION=$(which ios-deploy) 45 | if [ $? != 0 ]; then 46 | echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m"; exit 1; 47 | exit 1 48 | fi 49 | 50 | IOS_DEPLOY_VERSION=$(ios-deploy --version) 51 | if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then 52 | echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION." 53 | exit 1 54 | fi 55 | 56 | # if we got here, we can deploy the app, then exit success 57 | ios-deploy -b "$DEVICE_APP_PATH" 58 | exit 0 59 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/install-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | OPTION_RESULT=() 28 | TARGET="iPhone (Retina 3.5-inch)" 29 | TARGET_FLAG='--family iphone --retina' 30 | 31 | # separates "key=value", sets an array with 0th index as key, 1st index as value 32 | _parseOption() 33 | { 34 | local ARG=$@ 35 | OIFS=$IFS 36 | IFS='=' 37 | 38 | OPTION_RESULT=() 39 | for i in ${ARG[@]} 40 | do 41 | OPTION_RESULT+=($i) 42 | done 43 | 44 | IFS=$OIFS 45 | } 46 | 47 | # parses key=value arguments 48 | _parseArgs() 49 | { 50 | for arg in "$@" 51 | do 52 | _parseOption ${arg} 53 | case "${OPTION_RESULT[0]}" in 54 | "--target") 55 | TARGET=${OPTION_RESULT[1]} 56 | ;; 57 | esac 58 | done 59 | } 60 | 61 | _parseArgs "$@" 62 | 63 | # lowercase the target string 64 | TARGET_LC=`echo $TARGET | tr '[:upper:]' '[:lower:]'` 65 | 66 | # remember the comparison is lowercase 67 | case "$TARGET_LC" in 68 | "iphone (retina 3.5-inch)") 69 | TARGET_FLAG="--family iphone --retina" 70 | ;; 71 | "iphone (retina 4-inch)") 72 | TARGET_FLAG="--family iphone --retina --tall" 73 | ;; 74 | # --64bit not supportted by ios-sim yet 75 | #"iphone retina (4-inch 64-bit)") 76 | #TARGET_FLAG="--family iphone --retina --tall --64bit" 77 | #;; 78 | "iphone") 79 | TARGET_FLAG="--family iphone" 80 | ;; 81 | "ipad") 82 | TARGET_FLAG="--family ipad" 83 | ;; 84 | "ipad (retina)") 85 | TARGET_FLAG="--family ipad --retina" 86 | ;; 87 | esac 88 | 89 | LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P) 90 | CORDOVA_PATH="$(dirname "$LIB_PATH")" 91 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 92 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 93 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 94 | 95 | SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app" 96 | 97 | source "$CORDOVA_PATH/check_reqs" 98 | 99 | if [ ! -d "$SIMULATOR_APP_PATH" ]; then 100 | echo "Project '$SIMULATOR_APP_PATH' is not built." 101 | exit 1 102 | fi 103 | 104 | if [ ! -d "$SIMULATOR_APP_PATH" ]; then 105 | echo "$SIMULATOR_APP_PATH not found to emulate." 106 | exit 1 107 | fi 108 | 109 | IOS_SIM_MIN_VERSION="1.7" 110 | IOS_SIM_LOCATION=$(which ios-sim) 111 | if [ $? != 0 ]; then 112 | echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m"; exit 1; 113 | exit 1 114 | fi 115 | 116 | IOS_SIM_VERSION=$(ios-sim --version) 117 | 118 | if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then 119 | echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 120 | exit 1 121 | fi 122 | 123 | # launch using ios-sim 124 | ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" $TARGET_FLAG --exit 125 | 126 | 127 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/list-devices: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPad"}' 22 | system_profiler SPUSBDataType | sed -n -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2 " iPhone"}' 23 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/list-emulator-images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Valid values for "--target" (case insensitive): 21 | # "iPhone Retina (3.5-inch)" (default) 22 | # "iPhone Retina (4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad Retina" 26 | 27 | set -e 28 | 29 | echo \""iPhone (Retina 3.5-inch)"\" 30 | echo \""iPhone (Retina 4-inch)"\" 31 | 32 | # this assumes Xcode 5 minimum not supported by ios-sim yet 33 | # echo \""iPhone (Retina 4-inch 64-bit)"\" 34 | 35 | echo \""iPhone"\" 36 | echo \""iPad"\" 37 | echo \""iPad (Retina)"\" 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/list-started-emulators: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | set -e 28 | 29 | SIM_RUNNING=$(ps aux | grep -i "[i]Phone Simulator" | wc -l) 30 | if [ $SIM_RUNNING == 0 ]; then 31 | echo "No emulators are running." 32 | exit 1 33 | fi 34 | 35 | SIM_ID=`defaults read com.apple.iphonesimulator "SimulateDevice"` 36 | echo \"$SIM_ID\" 37 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/sim.applescript: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | 18 | tell application "System Events" 19 | set UI elements enabled to true 20 | end tell 21 | 22 | tell application "iPhone Simulator" 23 | activate 24 | end tell 25 | 26 | tell application "System Events" 27 | tell process "iPhone Simulator" 28 | click menu item "$DEVICE_NAME" of menu 1 of menu item "Device" of menu 1 of menu bar item "Hardware" of menu bar 1 29 | click menu item "Home" of menu 1 of menu bar item "Hardware" of menu bar 1 30 | end tell 31 | end tell 32 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/lib/start-emulator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | set -e 28 | 29 | 30 | DEFAULT_TARGET="iPhone Retina (3.5-inch)" 31 | TARGET=${1:-$DEFAULT_TARGET} 32 | LIB_PATH=$( cd "$( dirname "$0" )" && pwd -P) 33 | 34 | SCPT=`sed -e "s/\\$DEVICE_NAME/$TARGET/g" "$LIB_PATH/sim.applescript"` 35 | osascript -e "$SCPT" 36 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/log: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 22 | 23 | tail -f "$CORDOVA_PATH/console.log" 24 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | # Valid values for "--target" (case insensitive): 21 | # "iPhone (Retina 3.5-inch)" (default) 22 | # "iPhone (Retina 4-inch)" 23 | # "iPhone" 24 | # "iPad" 25 | # "iPad (Retina)" 26 | 27 | OPTION_RESULT=() 28 | TARGET="iPhone (Retina 3.5-inch)" 29 | TARGET_FLAG='--family iphone --retina' 30 | # multi-device flow default 31 | USE_DEVICE=true 32 | USE_SIMULATOR=false 33 | 34 | # separates "key=value", sets an array with 0th index as key, 1st index as value 35 | _parseOption() 36 | { 37 | local ARG=$@ 38 | OIFS=$IFS 39 | IFS='=' 40 | 41 | OPTION_RESULT=() 42 | for i in ${ARG[@]} 43 | do 44 | OPTION_RESULT+=($i) 45 | done 46 | 47 | IFS=$OIFS 48 | } 49 | 50 | # parses key=value arguments 51 | _parseArgs() 52 | { 53 | for arg in "$@" 54 | do 55 | _parseOption ${arg} 56 | case "${OPTION_RESULT[0]}" in 57 | "--target") 58 | TARGET=${OPTION_RESULT[1]} 59 | ;; 60 | "--device") 61 | USE_DEVICE=true 62 | USE_SIMULATOR=false 63 | ;; 64 | "--emulator") 65 | USE_DEVICE=false 66 | USE_SIMULATOR=true 67 | ;; 68 | esac 69 | done 70 | } 71 | 72 | _parseArgs "$@" 73 | 74 | # "iPhone (Retina 3.5-inch)" -> --family iphone --retina 75 | # "iPhone (Retina 4-inch)" -> --family iphone --retina --tall 76 | # "iPhone" -> --family iphone 77 | # "iPad" -> --family ipad 78 | # "iPad (Retina)" -> --family ipad --retina 79 | 80 | # lowercase the target string 81 | TARGET_LC=`echo $TARGET | tr '[:upper:]' '[:lower:]'` 82 | 83 | # remember the comparison is lowercase 84 | case "$TARGET_LC" in 85 | "iphone (retina 3.5-inch)") 86 | TARGET_FLAG="--family iphone --retina" 87 | ;; 88 | "iphone (retina 4-inch)") 89 | TARGET_FLAG="--family iphone --retina --tall" 90 | ;; 91 | "iphone") 92 | TARGET_FLAG="--family iphone" 93 | ;; 94 | "ipad") 95 | TARGET_FLAG="--family ipad" 96 | ;; 97 | "ipad (retina)") 98 | TARGET_FLAG="--family ipad --retina" 99 | ;; 100 | esac 101 | 102 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 103 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 104 | XCODEPROJ=$( ls "$PROJECT_PATH" | grep .xcodeproj ) 105 | PROJECT_NAME=$(basename "$XCODEPROJ" .xcodeproj) 106 | 107 | SIMULATOR_APP_PATH="$PROJECT_PATH/build/emulator/$PROJECT_NAME.app" 108 | DEVICE_APP_PATH="$PROJECT_PATH/build/device/$PROJECT_NAME.app" 109 | 110 | source "$CORDOVA_PATH/check_reqs" 111 | 112 | 113 | # if device build found, run it first 114 | if "$USE_DEVICE"; then 115 | IOS_DEPLOY_MIN_VERSION="1.0.4" 116 | IOS_DEPLOY_LOCATION=$(which ios-deploy) 117 | if [ $? != 0 ]; then 118 | echo -e "\033[31mError: ios-deploy was not found. Please download, build and install version $IOS_DEPLOY_MIN_VERSION or greater from https://github.com/phonegap/ios-deploy into your path. Or 'npm install -g ios-deploy' using node.js: http://nodejs.org/\033[m" 1>&2; 119 | exit 1 120 | fi 121 | 122 | IOS_DEPLOY_VERSION=$(ios-deploy --version) 123 | if [[ "$IOS_DEPLOY_VERSION" < "$IOS_DEPLOY_MIN_VERSION" ]]; then 124 | echo "Cordova needs ios-deploy version $IOS_DEPLOY_MIN_VERSION or greater, you have version $IOS_DEPLOY_VERSION." 1>&2; 125 | exit 1 126 | fi 127 | 128 | DEVICE_CONNECTED=$(ios-deploy -c) 129 | if [ $? != 0 ]; then 130 | echo "No device is connected, trying Simulator." 1>&2; 131 | USE_SIMULATOR=true 132 | else 133 | # if we got here, we can deploy the app, then exit success 134 | "$CORDOVA_PATH/build" --device || exit $? 135 | ios-deploy -d -b "$DEVICE_APP_PATH" 136 | exit 0 137 | fi 138 | fi 139 | 140 | if "$USE_SIMULATOR"; then 141 | IOS_SIM_MIN_VERSION="1.7" 142 | IOS_SIM_LOCATION=$(which ios-sim) 143 | if [ $? != 0 ]; then 144 | echo -e "\033[31mError: ios-sim was not found. Please download, build and install version $IOS_SIM_MIN_VERSION or greater from https://github.com/phonegap/ios-sim into your path. Or 'npm install -g ios-sim' using node.js: http://nodejs.org/\033[m" 1>&2; 145 | exit 1 146 | fi 147 | 148 | IOS_SIM_VERSION=$(ios-sim --version) 149 | 150 | if [[ "$IOS_SIM_VERSION" < "$IOS_SIM_MIN_VERSION" ]]; then 151 | echo "Cordova needs ios-sim version $IOS_SIM_MIN_VERSION or greater, you have version $IOS_SIM_VERSION." 1>&2; 152 | exit 1 153 | fi 154 | 155 | # launch using ios-sim 156 | "$CORDOVA_PATH/build" --emulator || exit $? 157 | ios-sim launch "$SIMULATOR_APP_PATH" --stderr "$CORDOVA_PATH/console.log" --stdout "$CORDOVA_PATH/console.log" $TARGET_FLAG --exit 158 | fi 159 | 160 | -------------------------------------------------------------------------------- /test/app/platforms/ios/cordova/version: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, 15 | # software distributed under the License is distributed on an 16 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | # KIND, either express or implied. See the License for the 18 | # specific language governing permissions and limitations 19 | # under the License. 20 | # 21 | 22 | # 23 | # Returns the VERSION of CordovaLib used. 24 | # Note: it does not work if the --shared option was used to create the project. 25 | # 26 | 27 | set -e 28 | 29 | CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd -P) 30 | PROJECT_PATH="$(dirname "$CORDOVA_PATH")" 31 | 32 | VERSION_FILE_PATH="$PROJECT_PATH/CordovaLib/VERSION" 33 | VERSION=$(<"$VERSION_FILE_PATH") 34 | 35 | if [ -f "$VERSION_FILE_PATH" ]; then 36 | echo $VERSION 37 | else 38 | echo "The file \"$VERSION_FILE_PATH\" does not exist." 39 | exit 1 40 | fi -------------------------------------------------------------------------------- /test/app/platforms/ios/www/cordova_plugins.js: -------------------------------------------------------------------------------- 1 | cordova.define('cordova/plugin_list', function(require, exports, module) { 2 | module.exports = []; 3 | module.exports.metadata = 4 | // TOP OF METADATA 5 | {} 6 | // BOTTOM OF METADATA 7 | }); -------------------------------------------------------------------------------- /test/app/platforms/ios/www/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | * { 20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 21 | } 22 | 23 | body { 24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 27 | background-color:#E4E4E4; 28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 31 | background-image:-webkit-gradient( 32 | linear, 33 | left top, 34 | left bottom, 35 | color-stop(0, #A7A7A7), 36 | color-stop(0.51, #E4E4E4) 37 | ); 38 | background-attachment:fixed; 39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 40 | font-size:12px; 41 | height:100%; 42 | margin:0px; 43 | padding:0px; 44 | text-transform:uppercase; 45 | width:100%; 46 | } 47 | 48 | /* Portrait layout (default) */ 49 | .app { 50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ 51 | position:absolute; /* position in the center of the screen */ 52 | left:50%; 53 | top:50%; 54 | height:50px; /* text area height */ 55 | width:225px; /* text area width */ 56 | text-align:center; 57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ 58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ 59 | /* offset horizontal: half of text area width */ 60 | } 61 | 62 | /* Landscape layout (with min-width) */ 63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { 64 | .app { 65 | background-position:left center; 66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ 67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ 68 | /* offset horizontal: half of image width and text area width */ 69 | } 70 | } 71 | 72 | h1 { 73 | font-size:24px; 74 | font-weight:normal; 75 | margin:0px; 76 | overflow:visible; 77 | padding:0px; 78 | text-align:center; 79 | } 80 | 81 | .event { 82 | border-radius:4px; 83 | -webkit-border-radius:4px; 84 | color:#FFFFFF; 85 | font-size:12px; 86 | margin:0px 30px; 87 | padding:2px 0px; 88 | } 89 | 90 | .event.listening { 91 | background-color:#333333; 92 | display:block; 93 | } 94 | 95 | .event.received { 96 | background-color:#4B946A; 97 | display:none; 98 | } 99 | 100 | @keyframes fade { 101 | from { opacity: 1.0; } 102 | 50% { opacity: 0.4; } 103 | to { opacity: 1.0; } 104 | } 105 | 106 | @-webkit-keyframes fade { 107 | from { opacity: 1.0; } 108 | 50% { opacity: 0.4; } 109 | to { opacity: 1.0; } 110 | } 111 | 112 | .blink { 113 | animation:fade 3000ms infinite; 114 | -webkit-animation:fade 3000ms infinite; 115 | } 116 | -------------------------------------------------------------------------------- /test/app/platforms/ios/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/platforms/ios/www/img/logo.png -------------------------------------------------------------------------------- /test/app/platforms/ios/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Hello World 29 | 30 | 31 |
32 |

Apache Cordova

33 | 37 |
38 | 39 | 40 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/app/platforms/ios/www/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | this.bindEvents(); 23 | }, 24 | // Bind Event Listeners 25 | // 26 | // Bind any events that are required on startup. Common events are: 27 | // 'load', 'deviceready', 'offline', and 'online'. 28 | bindEvents: function() { 29 | document.addEventListener('deviceready', this.onDeviceReady, false); 30 | }, 31 | // deviceready Event Handler 32 | // 33 | // The scope of 'this' is the event. In order to call the 'receivedEvent' 34 | // function, we must explicitly call 'app.receivedEvent(...);' 35 | onDeviceReady: function() { 36 | app.receivedEvent('deviceready'); 37 | }, 38 | // Update DOM on a Received Event 39 | receivedEvent: function(id) { 40 | var parentElement = document.getElementById(id); 41 | var listeningElement = parentElement.querySelector('.listening'); 42 | var receivedElement = parentElement.querySelector('.received'); 43 | 44 | listeningElement.setAttribute('style', 'display:none;'); 45 | receivedElement.setAttribute('style', 'display:block;'); 46 | 47 | console.log('Received Event: ' + id); 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /test/app/plugins/ios.json: -------------------------------------------------------------------------------- 1 | { 2 | "prepare_queue": { 3 | "installed": [], 4 | "uninstalled": [] 5 | }, 6 | "config_munge": {}, 7 | "installed_plugins": {}, 8 | "dependent_plugins": {} 9 | } -------------------------------------------------------------------------------- /test/app/www/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | * { 20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 21 | } 22 | 23 | body { 24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 27 | background-color:#E4E4E4; 28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 31 | background-image:-webkit-gradient( 32 | linear, 33 | left top, 34 | left bottom, 35 | color-stop(0, #A7A7A7), 36 | color-stop(0.51, #E4E4E4) 37 | ); 38 | background-attachment:fixed; 39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 40 | font-size:12px; 41 | height:100%; 42 | margin:0px; 43 | padding:0px; 44 | text-transform:uppercase; 45 | width:100%; 46 | } 47 | 48 | /* Portrait layout (default) */ 49 | .app { 50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ 51 | position:absolute; /* position in the center of the screen */ 52 | left:50%; 53 | top:50%; 54 | height:50px; /* text area height */ 55 | width:225px; /* text area width */ 56 | text-align:center; 57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ 58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ 59 | /* offset horizontal: half of text area width */ 60 | } 61 | 62 | /* Landscape layout (with min-width) */ 63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { 64 | .app { 65 | background-position:left center; 66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ 67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ 68 | /* offset horizontal: half of image width and text area width */ 69 | } 70 | } 71 | 72 | h1 { 73 | font-size:24px; 74 | font-weight:normal; 75 | margin:0px; 76 | overflow:visible; 77 | padding:0px; 78 | text-align:center; 79 | } 80 | 81 | .event { 82 | border-radius:4px; 83 | -webkit-border-radius:4px; 84 | color:#FFFFFF; 85 | font-size:12px; 86 | margin:0px 30px; 87 | padding:2px 0px; 88 | } 89 | 90 | .event.listening { 91 | background-color:#333333; 92 | display:block; 93 | } 94 | 95 | .event.received { 96 | background-color:#4B946A; 97 | display:none; 98 | } 99 | 100 | @keyframes fade { 101 | from { opacity: 1.0; } 102 | 50% { opacity: 0.4; } 103 | to { opacity: 1.0; } 104 | } 105 | 106 | @-webkit-keyframes fade { 107 | from { opacity: 1.0; } 108 | 50% { opacity: 0.4; } 109 | to { opacity: 1.0; } 110 | } 111 | 112 | .blink { 113 | animation:fade 3000ms infinite; 114 | -webkit-animation:fade 3000ms infinite; 115 | } 116 | -------------------------------------------------------------------------------- /test/app/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdissent/cocoapods-cordova/380424ff93bbcdf4a3238e49dd27e32f66ac4554/test/app/www/img/logo.png -------------------------------------------------------------------------------- /test/app/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | Hello World 29 | 30 | 31 |
32 |

Apache Cordova

33 | 37 |
38 | 39 | 40 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/app/www/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | this.bindEvents(); 23 | }, 24 | // Bind Event Listeners 25 | // 26 | // Bind any events that are required on startup. Common events are: 27 | // 'load', 'deviceready', 'offline', and 'online'. 28 | bindEvents: function() { 29 | document.addEventListener('deviceready', this.onDeviceReady, false); 30 | }, 31 | // deviceready Event Handler 32 | // 33 | // The scope of 'this' is the event. In order to call the 'receivedEvent' 34 | // function, we must explicitly call 'app.receivedEvent(...);' 35 | onDeviceReady: function() { 36 | app.receivedEvent('deviceready'); 37 | }, 38 | // Update DOM on a Received Event 39 | receivedEvent: function(id) { 40 | var parentElement = document.getElementById(id); 41 | var listeningElement = parentElement.querySelector('.listening'); 42 | var receivedElement = parentElement.querySelector('.received'); 43 | 44 | listeningElement.setAttribute('style', 'display:none;'); 45 | receivedElement.setAttribute('style', 'display:block;'); 46 | 47 | console.log('Received Event: ' + id); 48 | } 49 | }; 50 | -------------------------------------------------------------------------------- /test/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pushd plugins/A 4 | bundle install 5 | bundle exec pod cordova 6 | popd 7 | 8 | pushd plugins/B 9 | bundle install 10 | bundle exec pod cordova 11 | popd 12 | 13 | pushd app 14 | cordova plugin add ../plugins/A ../plugins/B 15 | cordova build 16 | popd -------------------------------------------------------------------------------- /test/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -rf app/{plugins,platforms} plugins/{A,B}/dist plugins/{A/src/ios,B}/Pods 4 | git checkout . -------------------------------------------------------------------------------- /test/plugins/A/.gitignore: -------------------------------------------------------------------------------- 1 | /Pods 2 | /build 3 | /Gemfile.lock 4 | /Podfile.lock -------------------------------------------------------------------------------- /test/plugins/A/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.1.2 2 | -------------------------------------------------------------------------------- /test/plugins/A/A.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'A' 3 | spec.version = '0.0.1' 4 | spec.requires_arc = true 5 | spec.platform = :ios, '7.0' 6 | spec.source = {:git => 'https://github.com/example/A.git'} 7 | spec.source_files = 'src/ios/A/A.{h,m}' 8 | spec.public_header_files = 'src/ios/A/A.h' 9 | 10 | spec.dependency 'Cordova' 11 | spec.dependency 'CordovaPlugin-file' 12 | spec.dependency 'AFNetworking' 13 | end -------------------------------------------------------------------------------- /test/plugins/A/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'cocoapods', '~> 0.34.0.rc1' 4 | gem 'cocoapods-cordova', :path => '../../../' -------------------------------------------------------------------------------- /test/plugins/A/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | A 5 | 6 | 7 | A Test Plugin 8 | 9 | 10 | MIT 11 | 12 | 13 | test 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A.xcodeproj/project.xcworkspace/xcshareddata/A.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 24AA5908-A409-407D-918B-8D9378E0EDC4 9 | IDESourceControlProjectName 10 | A 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DABCCCE5-6BAA-4249-9943-04C9FC166369 14 | https://github.com/xdissent/cocoapods-cordova.git 15 | 16 | IDESourceControlProjectPath 17 | test/plugins/A/A.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DABCCCE5-6BAA-4249-9943-04C9FC166369 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/xdissent/cocoapods-cordova.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | DABCCCE5-6BAA-4249-9943-04C9FC166369 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DABCCCE5-6BAA-4249-9943-04C9FC166369 36 | IDESourceControlWCCName 37 | A 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A.xcodeproj/xcshareddata/xcschemes/A.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 52 | 53 | 54 | 55 | 61 | 62 | 64 | 65 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A/A-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A/A.h: -------------------------------------------------------------------------------- 1 | // 2 | // A.h 3 | // A 4 | // 5 | // Created by Greg Thornton on 9/17/14. 6 | // Copyright (c) 2014 cocoapods-cordova. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface A : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/A/A.m: -------------------------------------------------------------------------------- 1 | // 2 | // A.m 3 | // A 4 | // 5 | // Created by Greg Thornton on 9/17/14. 6 | // Copyright (c) 2014 cocoapods-cordova. All rights reserved. 7 | // 8 | 9 | #import "A.h" 10 | 11 | @implementation A 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/ATests/ATests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.cocoapods-cordova.test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/ATests/ATests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ATests.m 3 | // ATests 4 | // 5 | // Created by Greg Thornton on 9/17/14. 6 | // Copyright (c) 2014 cocoapods-cordova. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ATests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation ATests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/ATests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /test/plugins/A/src/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | pod 'Cordova' 4 | pod 'CordovaPlugin-file' 5 | pod 'AFNetworking' 6 | -------------------------------------------------------------------------------- /test/plugins/A/www/A.js: -------------------------------------------------------------------------------- 1 | module.exports = {}; -------------------------------------------------------------------------------- /test/plugins/B/.gitignore: -------------------------------------------------------------------------------- 1 | /Pods 2 | /build 3 | /Gemfile.lock 4 | /Podfile.lock -------------------------------------------------------------------------------- /test/plugins/B/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.1.2 2 | -------------------------------------------------------------------------------- /test/plugins/B/B.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = 'B' 3 | spec.version = '0.0.1' 4 | spec.requires_arc = true 5 | spec.platform = :ios, '7.0' 6 | spec.source = {:git => 'https://github.com/example/B.git'} 7 | spec.source_files = 'B/B.{h,m}' 8 | spec.public_header_files = 'B/B.h' 9 | 10 | spec.dependency 'Cordova' 11 | spec.dependency 'CordovaPlugin-file' 12 | spec.dependency 'AFNetworking' 13 | end -------------------------------------------------------------------------------- /test/plugins/B/B.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/plugins/B/B.xcodeproj/project.xcworkspace/xcshareddata/B.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | B77C1327-31A4-44B8-98EA-2E94BBA7CE7C 9 | IDESourceControlProjectName 10 | B 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DABCCCE5-6BAA-4249-9943-04C9FC166369 14 | https://github.com/xdissent/cocoapods-cordova.git 15 | 16 | IDESourceControlProjectPath 17 | test/plugins/B/B.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DABCCCE5-6BAA-4249-9943-04C9FC166369 21 | ../../../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/xdissent/cocoapods-cordova.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | DABCCCE5-6BAA-4249-9943-04C9FC166369 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DABCCCE5-6BAA-4249-9943-04C9FC166369 36 | IDESourceControlWCCName 37 | B 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /test/plugins/B/B.xcodeproj/xcshareddata/xcschemes/B.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 52 | 53 | 54 | 55 | 61 | 62 | 64 | 65 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/plugins/B/B.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/plugins/B/B/B-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #endif 10 | -------------------------------------------------------------------------------- /test/plugins/B/B/B.h: -------------------------------------------------------------------------------- 1 | // 2 | // B.h 3 | // B 4 | // 5 | // Created by Greg Thornton on 9/17/14. 6 | // Copyright (c) 2014 cocoapods-cordova. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface B : NSObject 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /test/plugins/B/B/B.m: -------------------------------------------------------------------------------- 1 | // 2 | // B.m 3 | // B 4 | // 5 | // Created by Greg Thornton on 9/17/14. 6 | // Copyright (c) 2014 cocoapods-cordova. All rights reserved. 7 | // 8 | 9 | #import "B.h" 10 | 11 | @implementation B 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /test/plugins/B/BTests/BTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.cocoapods-cordova.test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/plugins/B/BTests/BTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // BTests.m 3 | // BTests 4 | // 5 | // Created by Greg Thornton on 9/17/14. 6 | // Copyright (c) 2014 cocoapods-cordova. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation BTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /test/plugins/B/BTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /test/plugins/B/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'cocoapods', '~> 0.34.0.rc1' 4 | gem 'cocoapods-cordova', :path => '../../../' -------------------------------------------------------------------------------- /test/plugins/B/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '7.0' 2 | 3 | pod 'Cordova' 4 | pod 'CordovaPlugin-file' 5 | pod 'AFNetworking' 6 | -------------------------------------------------------------------------------- /test/plugins/B/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | B 5 | 6 | 7 | B Test Plugin 8 | 9 | 10 | MIT 11 | 12 | 13 | test 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/plugins/B/www/B.js: -------------------------------------------------------------------------------- 1 | module.exports = {}; --------------------------------------------------------------------------------