Merge branch 'master' of git://github.com/phonegap/phonegap-plugins
202
Android/BluetoothPlugin/LICENSE
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
13
Android/BluetoothPlugin/NOTICE
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2012 Wolfgang Koller - http://www.gofg.at/
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
37
Android/BluetoothPlugin/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
Bluetooth
|
||||
===============
|
||||
Plugin for PhoneGap
|
||||
|
||||
The Bluetooth plugin offers access to the devices bluetooth functionality.
|
||||
Useful for any application requiring interaction with the bluetooth stack.
|
||||
|
||||
Platforms
|
||||
---------
|
||||
Currently available on:
|
||||
|
||||
### Android
|
||||
Copy the *BluetoothPlugin.java* file to your *src/* directory.
|
||||
|
||||
Edit your *AndroidManifest.xml* and add the following permissions:
|
||||
`<uses-permission android:name="android.permission.BLUETOOTH" />`
|
||||
`<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />`
|
||||
|
||||
In addition you have to edit your *res/xml/plugins.xml* file to let PhoneGap know about the plugin:
|
||||
`<plugin name="BluetoothPlugin" value="com.phonegap.plugin.BluetoothPlugin"/>`
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
Copyright 2012 Wolfgang Koller - http://www.gofg.at/
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
93
Android/BluetoothPlugin/assets/www/bluetooth.js
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Copyright 2012 Wolfgang Koller - http://www.gofg.at/
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
if( !PhoneGap.hasResource("BluetoothPlugin") ) {
|
||||
PhoneGap.addResource("BluetoothPlugin");
|
||||
|
||||
/**
|
||||
* @returns instance of powermanagement
|
||||
*/
|
||||
var Bluetooth = function() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable bluetooth
|
||||
*
|
||||
* @param successCallback function to be called when enabling of bluetooth was successfull
|
||||
* @param errorCallback function to be called when enabling was not possible / did fail
|
||||
*/
|
||||
Bluetooth.prototype.enable = function(successCallback,failureCallback) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'BluetoothPlugin', 'enable', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable bluetooth
|
||||
*
|
||||
* @param successCallback function to be called when disabling of bluetooth was successfull
|
||||
* @param errorCallback function to be called when disabling was not possible / did fail
|
||||
*/
|
||||
Bluetooth.prototype.disable = function(successCallback,failureCallback) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'BluetoothPlugin', 'disable', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for devices and list them
|
||||
*
|
||||
* @param successCallback function to be called when discovery of other devices has finished. Passed parameter is a JSONArray containing JSONObjects with 'name' and 'address' property.
|
||||
* @param errorCallback function to be called when there was a problem while discovering devices
|
||||
*/
|
||||
Bluetooth.prototype.discoverDevices = function(successCallback,failureCallback) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'BluetoothPlugin', 'discoverDevices', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of available UUIDs for a given device
|
||||
*
|
||||
* @param successCallback function to be called when listing of UUIDs has finished. Passed parameter is a JSONArray containing strings which represent the UUIDs
|
||||
* @param errorCallback function to be called when there was a problem while listing UUIDs
|
||||
*/
|
||||
Bluetooth.prototype.getUUIDs = function(successCallback,failureCallback,address) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'BluetoothPlugin', 'getUUIDs', [address]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open an RFComm channel for a given device & uuid endpoint
|
||||
*
|
||||
* @param successCallback function to be called when the connection was successfull. Passed parameter is an integer containing the socket id for the connection
|
||||
* @param errorCallback function to be called when there was a problem while opening the connection
|
||||
*/
|
||||
Bluetooth.prototype.connect = function(successCallback,failureCallback,address,uuid) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'BluetoothPlugin', 'connect', [address, uuid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read from a connected socket
|
||||
*
|
||||
* @param successCallback function to be called when reading was successfull. Passed parameter is a string containing the read content
|
||||
* @param errorCallback function to be called when there was a problem while reading
|
||||
*/
|
||||
Bluetooth.prototype.read = function(successCallback,failureCallback,socketid) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'BluetoothPlugin', 'read', [socketid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the plugin with PhoneGap
|
||||
*/
|
||||
PhoneGap.addConstructor(function() {
|
||||
// Register the PowerManagement plugin with PhoneGap
|
||||
PhoneGap.addPlugin('BluetoothPlugin', new Bluetooth());
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
/*
|
||||
Copyright 2012 Wolfgang Koller - http://www.gofg.at/
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package com.phonegap.plugin;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.phonegap.api.PhonegapActivity;
|
||||
import com.phonegap.api.Plugin;
|
||||
import com.phonegap.api.PluginResult;
|
||||
|
||||
public class BluetoothPlugin extends Plugin {
|
||||
private static final String ACTION_ENABLE = "enable";
|
||||
private static final String ACTION_DISABLE = "disable";
|
||||
private static final String ACTION_DISCOVERDEVICES = "discoverDevices";
|
||||
private static final String ACTION_GETUUIDS = "getUUIDs";
|
||||
private static final String ACTION_CONNECT = "connect";
|
||||
private static final String ACTION_READ = "read";
|
||||
|
||||
private static String ACTION_UUID = "";
|
||||
private static String EXTRA_UUID = "";
|
||||
|
||||
private BluetoothAdapter m_bluetoothAdapter = null;
|
||||
private BPBroadcastReceiver m_bpBroadcastReceiver = null;
|
||||
private boolean m_discovering = false;
|
||||
private boolean m_gettingUuids = false;
|
||||
private boolean m_stateChanging = false;
|
||||
|
||||
private JSONArray m_discoveredDevices = null;
|
||||
private JSONArray m_gotUUIDs = null;
|
||||
private boolean m_enabled = false;
|
||||
|
||||
private ArrayList<BluetoothSocket> m_bluetoothSockets = new ArrayList<BluetoothSocket>();
|
||||
|
||||
public BluetoothPlugin() {
|
||||
m_bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
m_bpBroadcastReceiver = new BPBroadcastReceiver();
|
||||
|
||||
try {
|
||||
Field actionUUID = BluetoothDevice.class.getDeclaredField("ACTION_UUID");
|
||||
BluetoothPlugin.ACTION_UUID = (String) actionUUID.get(null);
|
||||
Log.d("BluetoothPlugin", "actionUUID: " + actionUUID.getName() + " / " + actionUUID.get(null));
|
||||
|
||||
Field extraUUID = BluetoothDevice.class.getDeclaredField("EXTRA_UUID");
|
||||
BluetoothPlugin.EXTRA_UUID = (String) extraUUID.get(null);
|
||||
Log.d("BluetoothPlugin", "extraUUID: " + extraUUID.getName() + " / " + extraUUID.get(null));
|
||||
}
|
||||
catch( Exception e ) {
|
||||
Log.e("BluetoothPlugin", e.getMessage() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContext(PhonegapActivity ctx) {
|
||||
super.setContext(ctx);
|
||||
|
||||
// Register for necessary bluetooth events
|
||||
ctx.registerReceiver(m_bpBroadcastReceiver, new IntentFilter(
|
||||
BluetoothAdapter.ACTION_DISCOVERY_FINISHED));
|
||||
ctx.registerReceiver(m_bpBroadcastReceiver, new IntentFilter(
|
||||
BluetoothDevice.ACTION_FOUND));
|
||||
ctx.registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothPlugin.ACTION_UUID));
|
||||
ctx.registerReceiver(m_bpBroadcastReceiver, new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginResult execute(String action, JSONArray data, String callbackId) {
|
||||
PluginResult pluginResult = null;
|
||||
|
||||
Log.d("BluetoothPlugin", "Action: " + action);
|
||||
|
||||
// Want to enable bluetooth?
|
||||
if (ACTION_ENABLE.equals(action)) {
|
||||
m_stateChanging = true;
|
||||
ctx.startActivity(new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE));
|
||||
while(m_stateChanging) {};
|
||||
|
||||
// Check if bluetooth is enabled now
|
||||
if(m_enabled) {
|
||||
pluginResult = new PluginResult(PluginResult.Status.OK);
|
||||
}
|
||||
else {
|
||||
pluginResult = new PluginResult(PluginResult.Status.ERROR);
|
||||
}
|
||||
}
|
||||
// Want to disable bluetooth?
|
||||
else if (ACTION_DISABLE.equals(action)) {
|
||||
m_stateChanging = true;
|
||||
if( !m_bluetoothAdapter.disable() && m_bluetoothAdapter.isEnabled() ) {
|
||||
pluginResult = new PluginResult(PluginResult.Status.ERROR);
|
||||
}
|
||||
else {
|
||||
while(m_stateChanging) {};
|
||||
|
||||
// Check if bluetooth is disabled now
|
||||
if(!m_enabled) {
|
||||
pluginResult = new PluginResult(PluginResult.Status.OK);
|
||||
}
|
||||
else {
|
||||
pluginResult = new PluginResult(PluginResult.Status.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (ACTION_DISCOVERDEVICES.equals(action)) {
|
||||
m_discoveredDevices = new JSONArray();
|
||||
|
||||
if (!m_bluetoothAdapter.startDiscovery()) {
|
||||
pluginResult = new PluginResult(PluginResult.Status.ERROR,
|
||||
"Unable to start discovery");
|
||||
} else {
|
||||
m_discovering = true;
|
||||
|
||||
// Wait for discovery to finish
|
||||
while (m_discovering) {}
|
||||
|
||||
Log.d("BluetoothPlugin", "DiscoveredDevices: " + m_discoveredDevices.length());
|
||||
|
||||
pluginResult = new PluginResult(PluginResult.Status.OK, m_discoveredDevices);
|
||||
}
|
||||
}
|
||||
// Want to list UUIDs of a certain device
|
||||
else if( ACTION_GETUUIDS.equals(action) ) {
|
||||
|
||||
try {
|
||||
String address = data.getString(0);
|
||||
Log.d("BluetoothPlugin", "Listing UUIDs for: " + address);
|
||||
|
||||
// Fetch UUIDs from bluetooth device
|
||||
BluetoothDevice bluetoothDevice = m_bluetoothAdapter.getRemoteDevice(address);
|
||||
Method m = bluetoothDevice.getClass().getMethod("fetchUuidsWithSdp");
|
||||
Log.d("BluetoothPlugin", "Method: " + m);
|
||||
m.invoke(bluetoothDevice);
|
||||
|
||||
m_gettingUuids = true;
|
||||
|
||||
while(m_gettingUuids) {}
|
||||
|
||||
pluginResult = new PluginResult(PluginResult.Status.OK, m_gotUUIDs);
|
||||
|
||||
}
|
||||
catch( Exception e ) {
|
||||
Log.e("BluetoothPlugin", e.toString() + " / " + e.getMessage() );
|
||||
|
||||
pluginResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
|
||||
}
|
||||
}
|
||||
// Connect to a given device & uuid endpoint
|
||||
else if( ACTION_CONNECT.equals(action) ) {
|
||||
try {
|
||||
String address = data.getString(0);
|
||||
UUID uuid = UUID.fromString(data.getString(1));
|
||||
|
||||
BluetoothDevice bluetoothDevice = m_bluetoothAdapter.getRemoteDevice(address);
|
||||
BluetoothSocket bluetoothSocket = bluetoothDevice.createRfcommSocketToServiceRecord(uuid);
|
||||
|
||||
bluetoothSocket.connect();
|
||||
|
||||
m_bluetoothSockets.add(bluetoothSocket);
|
||||
int socketId = m_bluetoothSockets.indexOf(bluetoothSocket);
|
||||
|
||||
pluginResult = new PluginResult(PluginResult.Status.OK, socketId);
|
||||
}
|
||||
catch( Exception e ) {
|
||||
Log.e("BluetoothPlugin", e.toString() + " / " + e.getMessage() );
|
||||
|
||||
pluginResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
|
||||
}
|
||||
}
|
||||
else if( ACTION_READ.equals(action) ) {
|
||||
try {
|
||||
int socketId = data.getInt(0);
|
||||
|
||||
BluetoothSocket bluetoothSocket = m_bluetoothSockets.get(socketId);
|
||||
InputStream inputStream = bluetoothSocket.getInputStream();
|
||||
|
||||
char[] buffer = new char[128];
|
||||
for( int i = 0; i < buffer.length; i++ ) {
|
||||
buffer[i] = (char) inputStream.read();
|
||||
}
|
||||
|
||||
Log.d( "BluetoothPlugin", "Buffer: " + String.valueOf(buffer) );
|
||||
pluginResult = new PluginResult(PluginResult.Status.OK, String.valueOf(buffer));
|
||||
}
|
||||
catch( Exception e ) {
|
||||
Log.e("BluetoothPlugin", e.toString() + " / " + e.getMessage() );
|
||||
|
||||
pluginResult = new PluginResult(PluginResult.Status.JSON_EXCEPTION, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
return pluginResult;
|
||||
}
|
||||
|
||||
private class BPBroadcastReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
|
||||
// Check if we found a new device
|
||||
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||
BluetoothDevice bluetoothDevice = intent
|
||||
.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
|
||||
try {
|
||||
JSONObject deviceInfo = new JSONObject();
|
||||
deviceInfo.put("name", bluetoothDevice.getName());
|
||||
deviceInfo.put("address", bluetoothDevice.getAddress());
|
||||
|
||||
m_discoveredDevices.put(deviceInfo);
|
||||
} catch (JSONException e) {
|
||||
Log.e("BluetoothPlugin", e.getMessage());
|
||||
}
|
||||
}
|
||||
// Check if we finished discovering devices
|
||||
else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action)) {
|
||||
m_discovering = false;
|
||||
}
|
||||
// Check if we found UUIDs
|
||||
else if(BluetoothPlugin.ACTION_UUID.equals(action)) {
|
||||
m_gotUUIDs = new JSONArray();
|
||||
|
||||
Parcelable[] parcelUuids = intent.getParcelableArrayExtra(BluetoothPlugin.EXTRA_UUID);
|
||||
if( parcelUuids != null ) {
|
||||
Log.d("BluetoothPlugin", "Found UUIDs: " + parcelUuids.length);
|
||||
|
||||
// Sort UUIDs into JSON array and return it
|
||||
for( int i = 0; i < parcelUuids.length; i++ ) {
|
||||
m_gotUUIDs.put( parcelUuids[i].toString() );
|
||||
}
|
||||
|
||||
m_gettingUuids = false;
|
||||
}
|
||||
}
|
||||
else if(BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
|
||||
int adapterState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
|
||||
Log.d("BluetoothPlugin", "State changed: " + adapterState);
|
||||
|
||||
if(adapterState == BluetoothAdapter.STATE_ON) {
|
||||
m_enabled = true;
|
||||
m_stateChanging = false;
|
||||
}
|
||||
else if(adapterState == BluetoothAdapter.STATE_OFF) {
|
||||
m_enabled = false;
|
||||
m_stateChanging = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
262
Android/Diagnostic/README.md
Normal file
@@ -0,0 +1,262 @@
|
||||
# Diagnostic plugin for PhoneGap #
|
||||
|
||||
The diagnostic plugin allows you to check different device settings in your PhoneGap application.
|
||||
|
||||
A simple use case would be:
|
||||
|
||||
- Your app require geolocation and you want check if the location services are enabled in device settings.
|
||||
- Your app require the Wi-Fi enabled for the wireless network location and you want check if the Wi-Fi is enabled in device settings.
|
||||
- Your app require the bluetooth enabled and you want check if the bluetooth is enabled in device settings.
|
||||
- You want that the user enable the location services, Wi-Fi or bluetooth in device settings.
|
||||
|
||||
## Adding the Plugin to your project ##
|
||||
|
||||
Using this plugin requires a PhoneGap project for Android: [Get Started Guide](http://phonegap.com/start#android).
|
||||
|
||||
1. To install the plugin, move _diagnostic.js_ to your project's _www_ folder and include a reference to it in your _html_ file after _cordova.js_:
|
||||
|
||||
<pre>
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-X.X.X.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="diagnostic.js"></script>
|
||||
</pre>
|
||||
|
||||
2. Create a directory within your project called _src/net/avantic/diagnosticPlugin_ and move _Diagnostic.java_ into it.
|
||||
3. In your _res/xml/plugins.xml_ file add the following line:
|
||||
|
||||
<pre>
|
||||
<plugin name="Diagnostic" value="net.avantic.diagnosticPlugin.Diagnostic" />
|
||||
</pre>
|
||||
|
||||
4. And in the _AndroidManifest.xml_ add:
|
||||
<pre>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
</pre>
|
||||
|
||||
|
||||
## Using the plugin ##
|
||||
|
||||
The plugin creates the object:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic
|
||||
</pre>
|
||||
To use, call one of the following, available methods:
|
||||
|
||||
|
||||
- isLocationEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks device settings for location.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isLocationEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isLocationEnabled(locationEnabledSuccessCallback, locationEnabledErrorCallback);
|
||||
|
||||
function locationEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Location ON");
|
||||
else
|
||||
alert("Location OFF");
|
||||
}
|
||||
|
||||
function locationEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- switchToLocationSettings:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Requests that the user enable the location services in device settings.
|
||||
*/
|
||||
switchToLocationSettings()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
alert("You must enable the location services in device settings.");
|
||||
window.plugins.diagnostic.switchToLocationSettings();
|
||||
</pre>
|
||||
|
||||
- isGpsEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks device settings for GPS.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of GPS is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of GPS encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isGpsEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isGpsEnabled(gpsEnabledSuccessCallback, gpsEnabledErrorCallback);
|
||||
|
||||
function gpsEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("GPS ON");
|
||||
else
|
||||
alert("GPS OFF");
|
||||
}
|
||||
|
||||
function gpsEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- isWirelessNetworkLocationEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks device settings for wireless network location (Wi-Fi and/or mobile networks).
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of wireless network location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of wireless network location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isWirelessNetworkLocationEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isWirelessNetworkLocationEnabled(wirelessNetworkLocationEnabledSuccessCallback, wirelessNetworkLocationEnabledErrorCallback);
|
||||
|
||||
function wirelessNetworkLocationEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Wireless network location ON");
|
||||
else
|
||||
alert("Wireless network location OFF");
|
||||
}
|
||||
|
||||
function wirelessNetworkLocationEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- isWifiEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks device settings for Wi-Fi.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of Wi-Fi is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of Wi-Fi encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isWifiEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isWifiEnabled(wifiEnabledSuccessCallback, wifiEnabledErrorCallback);
|
||||
|
||||
function wifiEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Wi-Fi ON");
|
||||
else
|
||||
alert("Wi-Fi OFF");
|
||||
}
|
||||
|
||||
function wifiEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- switchToWifiSettings:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Requests that the user enable the Wi-Fi in device settings.
|
||||
*/
|
||||
switchToWifiSettings()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
alert("You must enable the Wi-Fi in device settings.");
|
||||
window.plugins.diagnostic.switchToWifiSettings();
|
||||
</pre>
|
||||
|
||||
- isBluetoothEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks device settings for bluetooth.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of bluetooth is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of bluetooth encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isBluetoothEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isBluetoothEnabled(bluetoothEnabledSuccessCallback, bluetoothEnabledErrorCallback);
|
||||
|
||||
function bluetoothEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Bluetooth ON");
|
||||
else
|
||||
alert("Bluetooth OFF");
|
||||
}
|
||||
|
||||
function bluetoothEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- switchToBluetoothSettings:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Requests that the user enable the bluetooth in device settings.
|
||||
*/
|
||||
switchToBluetoothSettings()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
alert("You must enable the Bluetooth in device settings.");
|
||||
window.plugins.diagnostic.switchToBluetoothSettings();
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
## LICENSE ##
|
||||
|
||||
Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
|
||||
The MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* Plugin diagnostic
|
||||
*
|
||||
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
*
|
||||
**/
|
||||
|
||||
package net.avantic.diagnosticPlugin;
|
||||
|
||||
import org.apache.cordova.api.PluginResult.Status;
|
||||
import org.json.JSONArray;
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.LocationManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Looper;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.phonegap.api.Plugin;
|
||||
import com.phonegap.api.PluginResult;
|
||||
|
||||
public class Diagnostic extends Plugin {
|
||||
|
||||
private static final String LOG_TAG = "Diagnostic";
|
||||
|
||||
|
||||
@Override
|
||||
public PluginResult execute(String action, JSONArray args, String callbackId) {
|
||||
Log.d(LOG_TAG, "Executing Diagnostic Plugin");
|
||||
if ("isLocationEnabled".equals(action))
|
||||
return new PluginResult(Status.OK, isLocationEnabled());
|
||||
else if ("switchToLocationSettings".equals(action)) {
|
||||
switchToLocationSettings();
|
||||
return new PluginResult(Status.OK);
|
||||
} else if ("isGpsEnabled".equals(action))
|
||||
return new PluginResult(Status.OK, isGpsEnabled());
|
||||
else if ("isWirelessNetworkLocationEnabled".equals(action))
|
||||
return new PluginResult(Status.OK, isWirelessNetworkLocationEnabled());
|
||||
else if ("isWifiEnabled".equals(action))
|
||||
return new PluginResult(Status.OK, isWifiEnabled());
|
||||
else if ("switchToWifiSettings".equals(action)) {
|
||||
switchToWifiSettings();
|
||||
return new PluginResult(Status.OK);
|
||||
} else if ("isBluetoothEnabled".equals(action))
|
||||
return new PluginResult(Status.OK, isBluetoothEnabled());
|
||||
else if ("switchToBluetoothSettings".equals(action)) {
|
||||
switchToBluetoothSettings();
|
||||
return new PluginResult(Status.OK);
|
||||
} else {
|
||||
Log.d(LOG_TAG, "Invalid action");
|
||||
return new PluginResult(Status.INVALID_ACTION);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check device settings for location.
|
||||
*
|
||||
* @returns {boolean} The status of location services in device settings.
|
||||
*/
|
||||
public boolean isLocationEnabled() {
|
||||
boolean result = (isGpsEnabled() || isWirelessNetworkLocationEnabled());
|
||||
Log.d(LOG_TAG, "Location enabled: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the user enable the location in device settings.
|
||||
*/
|
||||
public void switchToLocationSettings() {
|
||||
Log.d(LOG_TAG, "Switch to Location Settings");
|
||||
Intent settingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
||||
ctx.startActivity(settingsIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check device settings for GPS.
|
||||
*
|
||||
* @returns {boolean} The status of GPS in device settings.
|
||||
*/
|
||||
public boolean isGpsEnabled() {
|
||||
boolean result = isLocationProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
Log.d(LOG_TAG, "GPS enabled: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check device settings for wireless network location (Wi-Fi and/or mobile
|
||||
* networks).
|
||||
*
|
||||
* @returns {boolean} The status of wireless network location in device
|
||||
* settings.
|
||||
*/
|
||||
public boolean isWirelessNetworkLocationEnabled() {
|
||||
boolean result = isLocationProviderEnabled(LocationManager.NETWORK_PROVIDER);
|
||||
Log.d(LOG_TAG, "Wireless Network Location enabled: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isLocationProviderEnabled(String provider) {
|
||||
LocationManager locationManager = (LocationManager) ctx.getSystemService(Context.LOCATION_SERVICE);
|
||||
return locationManager.isProviderEnabled(provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check device settings for Wi-Fi.
|
||||
*
|
||||
* @returns {boolean} The status of Wi-Fi in device settings.
|
||||
*/
|
||||
public boolean isWifiEnabled() {
|
||||
WifiManager wifiManager = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE);
|
||||
boolean result = wifiManager.isWifiEnabled();
|
||||
Log.d(LOG_TAG, "Wifi enabled: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the user enable the Wi-Fi in device settings.
|
||||
*/
|
||||
public void switchToWifiSettings() {
|
||||
Log.d(LOG_TAG, "Switch to Wifi Settings");
|
||||
Intent settingsIntent = new Intent(Settings.ACTION_WIFI_SETTINGS);
|
||||
ctx.startActivity(settingsIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check device settings for Bluetooth.
|
||||
*
|
||||
* @returns {boolean} The status of Bluetooth in device settings.
|
||||
*/
|
||||
public boolean isBluetoothEnabled() {
|
||||
Looper.prepare();
|
||||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
boolean result = bluetoothAdapter.isEnabled();
|
||||
Log.d(LOG_TAG, "Bluetooth enabled: " + result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the user enable the Bluetooth in device settings.
|
||||
*/
|
||||
public void switchToBluetoothSettings() {
|
||||
Log.d(LOG_TAG, "Switch to Bluetooth Settings");
|
||||
Intent settingsIntent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
|
||||
ctx.startActivity(settingsIntent);
|
||||
}
|
||||
}
|
||||
129
Android/Diagnostic/www/diagnostic.js
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* Plugin diagnostic
|
||||
*
|
||||
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
var Diagnostic = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Checks device settings for location.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
Diagnostic.prototype.isLocationEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isLocationEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Requests that the user enable the location services in device settings.
|
||||
*/
|
||||
Diagnostic.prototype.switchToLocationSettings = function() {
|
||||
return cordova.exec(null,
|
||||
null,
|
||||
'Diagnostic',
|
||||
'switchToLocationSettings',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks device settings for GPS.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of GPS is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of GPS encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
Diagnostic.prototype.isGpsEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isGpsEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks device settings for wireless network location (Wi-Fi and/or mobile networks).
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of wireless network location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of wireless network location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
Diagnostic.prototype.isWirelessNetworkLocationEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isWirelessNetworkLocationEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks device settings for Wi-Fi.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of Wi-Fi is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of Wi-Fi encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
Diagnostic.prototype.isWifiEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isWifiEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Requests that the user enable the Wi-Fi in device settings.
|
||||
*/
|
||||
Diagnostic.prototype.switchToWifiSettings = function() {
|
||||
return cordova.exec(null,
|
||||
null,
|
||||
'Diagnostic',
|
||||
'switchToWifiSettings',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks device settings for bluetooth.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of bluetooth is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of bluetooth encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
Diagnostic.prototype.isBluetoothEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isBluetoothEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Requests that the user enable the bluetooth in device settings.
|
||||
*/
|
||||
Diagnostic.prototype.switchToBluetoothSettings = function() {
|
||||
return cordova.exec(null,
|
||||
null,
|
||||
'Diagnostic',
|
||||
'switchToBluetoothSettings',
|
||||
[]);
|
||||
};
|
||||
|
||||
cordova.addConstructor(function() {
|
||||
cordova.addPlugin("diagnostic", new Diagnostic());
|
||||
});
|
||||
@@ -1 +1,37 @@
|
||||
gfhgfhfghgfhyjmhj
|
||||
ExtractZipFile Phonegap Plugin for Android
|
||||
=======================================
|
||||
This plugin allows you to eatract a zip file located in your sdcard.
|
||||
|
||||
Adding the Plugin to your project
|
||||
=================================
|
||||
|
||||
To install the plugin, copy ZipPlugin.js to your project's www folder and include a reference to it in your html files.
|
||||
|
||||
<script type="text/javascript" src="ZipPlugin.js"></script>
|
||||
|
||||
Create a folder called 'com/phonegap/plugin/ExtractZipFile' within your project's src folder and copy ExtractZipFilePlugin.java file into that new folder.
|
||||
|
||||
Add a plugin line to res/xml/plugins.xml
|
||||
<plugin name="ZipPlugin" value="com.phonegap.plugin.ExtractZipFile.ExtractZipFilePlugin" />
|
||||
|
||||
Using the plugin
|
||||
================
|
||||
function extractFile(fileName)
|
||||
{
|
||||
var ZipClient = new ExtractZipFilePlugin();
|
||||
ZipClient.extractFile('sdcard/'+fileName,win,fail,'ExtractZipFilePlugin');
|
||||
}
|
||||
|
||||
function win(status)
|
||||
{
|
||||
alert('Success'+status);
|
||||
}
|
||||
|
||||
function fail(error)
|
||||
{
|
||||
alert(error);
|
||||
}
|
||||
|
||||
Function Call
|
||||
=============
|
||||
<input type="button" value="Extract Zip File" onClick="extractFile('ZipFolder/ZipFile.zip');"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
PowerManagement
|
||||
===============
|
||||
Plugin for PhoneGap
|
||||
Plugin for Cordova (1.6+)
|
||||
|
||||
The PowerManagement plugin offers access to the devices power-management functionality.
|
||||
It should be used for applications which keep running for a long time without any user interaction.
|
||||
@@ -20,19 +20,18 @@ Copy the *PowerManagement.java* file to your *src/* directory.
|
||||
Edit your *AndroidManifest.xml* and add the following permission:
|
||||
`<uses-permission android:name="android.permission.WAKE_LOCK" />`
|
||||
|
||||
In addition you have to edit your *res/xml/plugins.xml* file to let PhoneGap know about the plugin:
|
||||
`<plugin name="PowerManagement" value="com.phonegap.plugin.PowerManagement"/>`
|
||||
In addition you have to edit your *res/xml/plugins.xml* file to let Cordova know about the plugin:
|
||||
`<plugin name="PowerManagement" value="org.apache.cordova.plugin.PowerManagement"/>`
|
||||
|
||||
### iOS
|
||||
Copy the *PowerManagement.h* and *PowerManagement.m* files to your project.
|
||||
Copy the *PowerManagement.h* and *PowerManagement.m* files to your projects "Plugins" folder.
|
||||
|
||||
Add the PowerManagement plugin to the *PhoneGap.plist*:
|
||||
See http://wiki.phonegap.com/w/page/41733808/PhoneGap-iOS-Plugins-Problems
|
||||
Add the PowerManagement plugin to the *Cordova.plist* file (to the Plugins list). Both Key and Value are "PowerManagement".
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
Copyright (C) 2011 Wolfgang Koller
|
||||
Copyright (C) 2011-2012 Wolfgang Koller
|
||||
|
||||
This file is part of GOFG Sports Computer - http://www.gofg.at/.
|
||||
|
||||
|
||||
42
Android/PowerManagement/assets/www/index.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="powermanagement.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function deviceready() {
|
||||
alert( 'cordova ready!' );
|
||||
}
|
||||
|
||||
function acquire() {
|
||||
cordova.require('cordova/plugin/powermanagement').acquire(
|
||||
function() { alert( 'hooray' ); },
|
||||
function() { alert( 'oh no!' ); }
|
||||
);
|
||||
};
|
||||
|
||||
function release() {
|
||||
cordova.require('cordova/plugin/powermanagement').release(
|
||||
function() { alert( 'hooray' ); },
|
||||
function() { alert( 'oh no!' ); }
|
||||
);
|
||||
}
|
||||
|
||||
function dim() {
|
||||
cordova.require('cordova/plugin/powermanagement').dim(
|
||||
function() { alert( 'hooray' ); },
|
||||
function() { alert( 'oh no!' ); }
|
||||
);
|
||||
}
|
||||
|
||||
document.addEventListener("deviceready", deviceready, true);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<button type="button" onclick="acquire();">acquire</button>
|
||||
<br />
|
||||
<button type="button" onclick="release();">release</button>
|
||||
<br />
|
||||
<button type="button" onclick="dim();">dim</button>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Wolfgang Koller
|
||||
* Copyright (C) 2011-2012 Wolfgang Koller
|
||||
*
|
||||
* This file is part of GOFG Sports Computer - http://www.gofg.at/.
|
||||
*
|
||||
@@ -17,14 +17,10 @@
|
||||
* along with GOFG Sports Computer. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if( !PhoneGap.hasResource("PowerManagement") ) {
|
||||
PhoneGap.addResource("PowerManagement");
|
||||
|
||||
/**
|
||||
* @returns instance of powermanagement
|
||||
*/
|
||||
var PowerManagement = function() {
|
||||
}
|
||||
cordova.define("cordova/plugin/powermanagement", function(require, exports, module) {
|
||||
var exec = require('cordova/exec');
|
||||
|
||||
var PowerManagement = function() {};
|
||||
|
||||
/**
|
||||
* Acquire a new wake-lock (keep device awake)
|
||||
@@ -33,9 +29,9 @@ if( !PhoneGap.hasResource("PowerManagement") ) {
|
||||
* @param errorCallback function to be called when there was a problem with acquiring the wake-lock
|
||||
*/
|
||||
PowerManagement.prototype.acquire = function(successCallback,failureCallback) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'PowerManagement', 'acquire', []);
|
||||
exec(successCallback, failureCallback, 'PowerManagement', 'acquire', []);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Release the wake-lock
|
||||
*
|
||||
@@ -43,9 +39,9 @@ if( !PhoneGap.hasResource("PowerManagement") ) {
|
||||
* @param errorCallback function to be called when there was a problem while releasing the wake-lock
|
||||
*/
|
||||
PowerManagement.prototype.release = function(successCallback,failureCallback) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'PowerManagement', 'release', []);
|
||||
exec(successCallback, failureCallback, 'PowerManagement', 'release', []);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Acquire a partial wake-lock, allowing the device to dim the screen
|
||||
*
|
||||
@@ -53,14 +49,9 @@ if( !PhoneGap.hasResource("PowerManagement") ) {
|
||||
* @param errorCallback function to be called when there was a problem with acquiring the wake-lock
|
||||
*/
|
||||
PowerManagement.prototype.dim = function(successCallback,failureCallback) {
|
||||
return PhoneGap.exec(successCallback, failureCallback, 'PowerManagement', 'acquire', [true]);
|
||||
exec(successCallback, failureCallback, 'PowerManagement', 'acquire', [true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the plugin with PhoneGap
|
||||
*/
|
||||
PhoneGap.addConstructor(function() {
|
||||
// Register the PowerManagement plugin with PhoneGap
|
||||
PhoneGap.addPlugin('PowerManagement', new PowerManagement());
|
||||
});
|
||||
}
|
||||
var powermanagement = new PowerManagement();
|
||||
module.exports = powermanagement;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Wolfgang Koller
|
||||
* Copyright (C) 2011-2012 Wolfgang Koller
|
||||
*
|
||||
* This file is part of GOFG Sports Computer - http://www.gofg.at/.
|
||||
*
|
||||
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* PhoneGap (Android) plugin for accessing the power-management functions of the device
|
||||
* Cordova (Android) plugin for accessing the power-management functions of the device
|
||||
* @author Wolfgang Koller <viras@users.sourceforge.net>
|
||||
*/
|
||||
package com.phonegap.plugin;
|
||||
package org.apache.cordova.plugin;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -30,9 +30,10 @@ import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.phonegap.api.Plugin;
|
||||
import com.phonegap.api.PluginResult;
|
||||
import com.phonegap.api.PluginResult.Status;
|
||||
import org.apache.cordova.api.CordovaInterface;
|
||||
import org.apache.cordova.api.Plugin;
|
||||
import org.apache.cordova.api.PluginResult;
|
||||
import org.apache.cordova.api.PluginResult.Status;
|
||||
|
||||
/**
|
||||
* Plugin class which does the actual handling
|
||||
@@ -40,9 +41,29 @@ import com.phonegap.api.PluginResult.Status;
|
||||
public class PowerManagement extends Plugin {
|
||||
// As we only allow one wake-lock, we keep a reference to it here
|
||||
private PowerManager.WakeLock wakeLock = null;
|
||||
private PowerManager powerManager = null;
|
||||
|
||||
/**
|
||||
* Sets the application context for this plugin
|
||||
* Used to obtain a reference to the powermanager
|
||||
*/
|
||||
@Override
|
||||
public void setContext(CordovaInterface ctx) {
|
||||
super.setContext(ctx);
|
||||
|
||||
this.powerManager = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
|
||||
}
|
||||
|
||||
/**
|
||||
* We have a synchronous interface to our plugin, since all calls return immediately
|
||||
*/
|
||||
@Override
|
||||
public boolean isSynch(String action) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the PhoneGap framework to handle a call to this plugin
|
||||
* Called by the cordova framework to handle a call to this plugin
|
||||
* @param action currently supported are 'acquire' and 'release'
|
||||
* @param data In case of action 'acquire' this may contain a parameter set to 'true' to indicate only a dim wake-lock
|
||||
*/
|
||||
@@ -52,22 +73,22 @@ public class PowerManagement extends Plugin {
|
||||
Log.d("PowerManagementPlugin", "Plugin execute called - " + this.toString() );
|
||||
Log.d("PowerManagementPlugin", "Action is " + action );
|
||||
|
||||
if( action.equals("acquire") ) {
|
||||
try {
|
||||
if( data.length() > 0 && data.getBoolean(0) ) {
|
||||
Log.d("PowerManagementPlugin", "Only dim lock" );
|
||||
result = this.acquire( PowerManager.SCREEN_DIM_WAKE_LOCK );
|
||||
}
|
||||
else {
|
||||
result = this.acquire( PowerManager.FULL_WAKE_LOCK );
|
||||
}
|
||||
try {
|
||||
if( action.equals("acquire") ) {
|
||||
if( data.length() > 0 && data.getBoolean(0) ) {
|
||||
Log.d("PowerManagementPlugin", "Only dim lock" );
|
||||
result = this.acquire( PowerManager.SCREEN_DIM_WAKE_LOCK );
|
||||
}
|
||||
else {
|
||||
result = this.acquire( PowerManager.FULL_WAKE_LOCK );
|
||||
}
|
||||
}
|
||||
catch( JSONException jsonEx ) {
|
||||
result = new PluginResult(Status.JSON_EXCEPTION, jsonEx.getMessage());
|
||||
else if( action.equals("release") ) {
|
||||
result = this.release();
|
||||
}
|
||||
}
|
||||
else if( action.equals("release") ) {
|
||||
result = this.release();
|
||||
catch( JSONException e ) {
|
||||
result = new PluginResult(Status.JSON_EXCEPTION, e.getMessage());
|
||||
}
|
||||
|
||||
Log.d("PowerManagementPlugin", "Result is " + result.toString() );
|
||||
@@ -83,15 +104,19 @@ public class PowerManagement extends Plugin {
|
||||
private PluginResult acquire( int p_flags ) {
|
||||
PluginResult result = null;
|
||||
|
||||
if( this.wakeLock == null ) {
|
||||
PowerManager pm = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
|
||||
this.wakeLock = pm.newWakeLock(p_flags, "PowerManagementPlugin");
|
||||
this.wakeLock.acquire();
|
||||
|
||||
result = new PluginResult(PluginResult.Status.OK);
|
||||
if (this.wakeLock == null) {
|
||||
this.wakeLock = this.powerManager.newWakeLock(p_flags, "PowerManagementPlugin");
|
||||
try {
|
||||
this.wakeLock.acquire();
|
||||
result = new PluginResult(PluginResult.Status.OK);
|
||||
}
|
||||
catch( Exception e ) {
|
||||
this.wakeLock = null;
|
||||
result = new PluginResult(PluginResult.Status.ERROR, "Can't acquire wake-lock - check your permissions!");
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = new PluginResult(PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "WakeLock already active - release first");
|
||||
result = new PluginResult( PluginResult.Status.ILLEGAL_ACCESS_EXCEPTION, "WakeLock already active - release first");
|
||||
}
|
||||
|
||||
return result;
|
||||
31
Qt/PowerManagement/plugins/powermanagement.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "powermanagement.h"
|
||||
|
||||
PowerManagement::PowerManagement(QWebFrame *p_webFrame) :
|
||||
PGPlugin(p_webFrame)
|
||||
{
|
||||
m_systemScreenSaver = new QSystemScreenSaver();
|
||||
}
|
||||
|
||||
void PowerManagement::release( int scId, int ecId ) {
|
||||
m_systemScreenSaver->setScreenSaverInhibited(false);
|
||||
|
||||
// Check if everything went fine
|
||||
if( !m_systemScreenSaver->screenSaverInhibited() ) {
|
||||
this->callback( scId, "" );
|
||||
}
|
||||
else {
|
||||
this->callback( ecId, "" );
|
||||
}
|
||||
}
|
||||
|
||||
void PowerManagement::acquire( int scId, int ecId ) {
|
||||
m_systemScreenSaver->setScreenSaverInhibited(true);
|
||||
|
||||
// Check if everything went fine
|
||||
if( m_systemScreenSaver->screenSaverInhibited() ) {
|
||||
this->callback( scId, "" );
|
||||
}
|
||||
else {
|
||||
this->callback( ecId, "" );
|
||||
}
|
||||
}
|
||||
26
Qt/PowerManagement/plugins/powermanagement.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef POWERMANAGEMENT_H
|
||||
#define POWERMANAGEMENT_H
|
||||
|
||||
#include "../pgplugin.h"
|
||||
|
||||
#include <QSystemScreenSaver>
|
||||
|
||||
QTM_USE_NAMESPACE
|
||||
|
||||
class PowerManagement : public PGPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PowerManagement(QWebFrame *p_webFrame);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void release( int scId, int ecId );
|
||||
void acquire( int scId, int ecId );
|
||||
|
||||
private:
|
||||
QSystemScreenSaver *m_systemScreenSaver;
|
||||
};
|
||||
|
||||
#endif // POWERMANAGEMENT_H
|
||||
89
Qt/PowerManagement/www/js/powermanagement.js
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
|
||||
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
|
||||
*
|
||||
* Copyright (c) 2011, Wolfgang Koller - http://www.gofg.at/
|
||||
*/
|
||||
|
||||
function PowermanagementError() {
|
||||
};
|
||||
|
||||
PowermanagementError.cast = function( p_code, p_message ) {
|
||||
var powerManagementError = new PowermanagementError();
|
||||
powerManagementError.code = p_code;
|
||||
powerManagementError.message = p_message;
|
||||
|
||||
return powerManagementError;
|
||||
};
|
||||
|
||||
PowermanagementError.ALREADY_ACTIVE = 1;
|
||||
PowermanagementError.NOT_SUPPORTED = 2;
|
||||
PowermanagementError.NOT_ACTIVE = 3;
|
||||
|
||||
PowermanagementError.prototype.code = 0;
|
||||
PowermanagementError.prototype.message = "";
|
||||
|
||||
function Powermanagement() {
|
||||
};
|
||||
|
||||
Powermanagement.prototype.acquired = false;
|
||||
|
||||
Powermanagement.prototype.acquire = function( successCallback, errorCallback ) {
|
||||
if( this.acquired ) {
|
||||
errorCallback( PowermanagementError.cast( PowermanagementError.ALREADY_ACTIVE, "Powermanagement lock already active." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
PhoneGap.exec( function() {
|
||||
me.acquired = true;
|
||||
successCallback();
|
||||
}, function() {
|
||||
me.acquired = false;
|
||||
errorCallback( PowermanagementError.cast( PowermanagementError.NOT_SUPPORTED, "Powermanagement not supported." ) );
|
||||
}, "com.phonegap.plugin.Powermanagement", "acquire", [] );
|
||||
};
|
||||
|
||||
Powermanagement.prototype.release = function( successCallback, errorCallback ) {
|
||||
if( !this.acquired ) {
|
||||
errorCallback( PowermanagementError.cast( PowermanagementError.NOT_ACTIVE, "Powermanagement lock not active." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
PhoneGap.exec( function() {
|
||||
me.acquired = false;
|
||||
successCallback();
|
||||
}, function() {
|
||||
me.acquired = false;
|
||||
errorCallback( PowermanagementError.cast( PowermanagementError.NOT_SUPPORTED, "Powermanagement not supported." ) );
|
||||
}, "com.phonegap.plugin.Powermanagement", "release", [] );
|
||||
};
|
||||
|
||||
Powermanagement.prototype.dim = function( successCallback, errorCallback ) {
|
||||
if( this.acquired ) {
|
||||
errorCallback( PowermanagementError.cast( PowermanagementError.ALREADY_ACTIVE, "Powermanagement lock already active." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
var me = this;
|
||||
if( !PhoneGap.exec( function() {
|
||||
me.acquired = true;
|
||||
successCallback();
|
||||
}, function() {
|
||||
me.acquired = false;
|
||||
errorCallback( PowermanagementError.cast( PowermanagementError.NOT_SUPPORTED, "Powermanagement not supported." ) );
|
||||
}, "com.phonegap.plugin.Powermanagement", "dim", [] ) ) {
|
||||
|
||||
// If dimming doesn't work, try to acquire a full wake lock
|
||||
this.acquire( successCallback, errorCallback );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Create Powermanagement instance
|
||||
*/
|
||||
PhoneGap.addConstructor( "com.phonegap.plugin.Powermanagement", function () {
|
||||
window.Powermanagement = new Powermanagement();
|
||||
window.PowerManagement = window.Powermanagement; // Alias for backwards compatibility
|
||||
} );
|
||||
@@ -22,8 +22,8 @@ ActionSheet.prototype.create = function(title, items, callback, options) {
|
||||
title : title || '',
|
||||
items : items || ['Cancel'],
|
||||
style : options.style || 'default',
|
||||
destructiveButtonIndex : options.destructiveButtonIndex || undefined,
|
||||
cancelButtonIndex : options.cancelButtonIndex || undefined
|
||||
destructiveButtonIndex : options.hasOwnProperty('destructiveButtonIndex') ? options.destructiveButtonIndex : undefined,
|
||||
cancelButtonIndex : options.hasOwnProperty('cancelButtonIndex') ? options.cancelButtonIndex : undefined
|
||||
};
|
||||
|
||||
var _callback = function(result) {
|
||||
|
||||
@@ -77,13 +77,13 @@
|
||||
// landscape
|
||||
case 90:
|
||||
case -90:
|
||||
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier480x32;
|
||||
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierLandscape;
|
||||
self.isLandscape = YES;
|
||||
break;
|
||||
// portrait
|
||||
case 0:
|
||||
case 180:
|
||||
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier320x50;
|
||||
self.adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifierPortrait;
|
||||
self.isLandscape = NO;
|
||||
break;
|
||||
default:
|
||||
@@ -146,11 +146,13 @@
|
||||
|
||||
self.adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)];
|
||||
// we are still using these constants even though they are deprecated - if it is changed, iOS 4 devices < 4.3 will crash.
|
||||
// will need to do a run-time iOS version check
|
||||
self.adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifier320x50, ADBannerContentSizeIdentifier480x32, nil];
|
||||
// will need to do a run-time iOS version check
|
||||
self.adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil];
|
||||
|
||||
self.adView.delegate = self;
|
||||
|
||||
NSString* contentSizeId = (self.isLandscape ? ADBannerContentSizeIdentifier480x32 : ADBannerContentSizeIdentifier320x50);
|
||||
NSString* contentSizeId = (self.isLandscape ? ADBannerContentSizeIdentifierLandscape : ADBannerContentSizeIdentifierPortrait);
|
||||
|
||||
self.adView.currentContentSizeIdentifier = contentSizeId;
|
||||
|
||||
if (atBottom) {
|
||||
|
||||
@@ -20,4 +20,5 @@
|
||||
//Significant Event Method
|
||||
|
||||
- (void) sigEvent:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
|
||||
- (void) foreground:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
|
||||
@end
|
||||
|
||||
@@ -7,5 +7,9 @@ var AppiraterPlugin = {
|
||||
|
||||
sigEvent: function() {
|
||||
return Cordova.exec("AppiraterPlugin.sigEvent");
|
||||
},
|
||||
foreground: function() {
|
||||
return Cordova.exec("AppiraterPlugin.foreground");
|
||||
}
|
||||
|
||||
};
|
||||
@@ -17,4 +17,9 @@
|
||||
[Appirater userDidSignificantEvent:YES];
|
||||
}
|
||||
|
||||
- (void) foreground:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options
|
||||
{
|
||||
[Appirater appEnteredForeground:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
203
iOS/AppiraterPlugin/Classes/Appirater.h
Normal file
@@ -0,0 +1,203 @@
|
||||
/*
|
||||
This file is part of Appirater.
|
||||
|
||||
Copyright (c) 2012, Arash Payan
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Appirater.h
|
||||
* appirater
|
||||
*
|
||||
* Created by Arash Payan on 9/5/09.
|
||||
* http://arashpayan.com
|
||||
* Copyright 2012 Arash Payan. All rights reserved.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern NSString *const kAppiraterFirstUseDate;
|
||||
extern NSString *const kAppiraterUseCount;
|
||||
extern NSString *const kAppiraterSignificantEventCount;
|
||||
extern NSString *const kAppiraterCurrentVersion;
|
||||
extern NSString *const kAppiraterRatedCurrentVersion;
|
||||
extern NSString *const kAppiraterDeclinedToRate;
|
||||
extern NSString *const kAppiraterReminderRequestDate;
|
||||
|
||||
/*
|
||||
Place your Apple generated software id here.
|
||||
*/
|
||||
#define APPIRATER_APP_ID 301377083
|
||||
|
||||
/*
|
||||
Your app's name.
|
||||
*/
|
||||
#define APPIRATER_APP_NAME [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]
|
||||
|
||||
/*
|
||||
This is the message your users will see once they've passed the day+launches
|
||||
threshold.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_MESSAGE NSLocalizedString(@"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!", nil)
|
||||
#define APPIRATER_MESSAGE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE, APPIRATER_APP_NAME]
|
||||
|
||||
/*
|
||||
This is the title of the message alert that users will see.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_MESSAGE_TITLE NSLocalizedString(@"Rate %@", nil)
|
||||
#define APPIRATER_MESSAGE_TITLE [NSString stringWithFormat:APPIRATER_LOCALIZED_MESSAGE_TITLE, APPIRATER_APP_NAME]
|
||||
|
||||
/*
|
||||
The text of the button that rejects reviewing the app.
|
||||
*/
|
||||
#define APPIRATER_CANCEL_BUTTON NSLocalizedString(@"No, Thanks", nil)
|
||||
|
||||
/*
|
||||
Text of button that will send user to app review page.
|
||||
*/
|
||||
#define APPIRATER_LOCALIZED_RATE_BUTTON NSLocalizedString(@"Rate %@", nil)
|
||||
#define APPIRATER_RATE_BUTTON [NSString stringWithFormat:APPIRATER_LOCALIZED_RATE_BUTTON, APPIRATER_APP_NAME]
|
||||
|
||||
/*
|
||||
Text for button to remind the user to review later.
|
||||
*/
|
||||
#define APPIRATER_RATE_LATER NSLocalizedString(@"Remind me later", nil)
|
||||
|
||||
/*
|
||||
Users will need to have the same version of your app installed for this many
|
||||
days before they will be prompted to rate it.
|
||||
*/
|
||||
#define APPIRATER_DAYS_UNTIL_PROMPT 30 // double
|
||||
|
||||
/*
|
||||
An example of a 'use' would be if the user launched the app. Bringing the app
|
||||
into the foreground (on devices that support it) would also be considered
|
||||
a 'use'. You tell Appirater about these events using the two methods:
|
||||
[Appirater appLaunched:]
|
||||
[Appirater appEnteredForeground:]
|
||||
|
||||
Users need to 'use' the same version of the app this many times before
|
||||
before they will be prompted to rate it.
|
||||
*/
|
||||
#define APPIRATER_USES_UNTIL_PROMPT 20 // integer
|
||||
|
||||
/*
|
||||
A significant event can be anything you want to be in your app. In a
|
||||
telephone app, a significant event might be placing or receiving a call.
|
||||
In a game, it might be beating a level or a boss. This is just another
|
||||
layer of filtering that can be used to make sure that only the most
|
||||
loyal of your users are being prompted to rate you on the app store.
|
||||
If you leave this at a value of -1, then this won't be a criteria
|
||||
used for rating. To tell Appirater that the user has performed
|
||||
a significant event, call the method:
|
||||
[Appirater userDidSignificantEvent:];
|
||||
*/
|
||||
#define APPIRATER_SIG_EVENTS_UNTIL_PROMPT -1 // integer
|
||||
|
||||
/*
|
||||
Once the rating alert is presented to the user, they might select
|
||||
'Remind me later'. This value specifies how long (in days) Appirater
|
||||
will wait before reminding them.
|
||||
*/
|
||||
#define APPIRATER_TIME_BEFORE_REMINDING 1 // double
|
||||
|
||||
/*
|
||||
'YES' will show the Appirater alert everytime. Useful for testing how your message
|
||||
looks and making sure the link to your app's review page works.
|
||||
*/
|
||||
#define APPIRATER_DEBUG NO
|
||||
|
||||
@interface Appirater : NSObject <UIAlertViewDelegate> {
|
||||
|
||||
UIAlertView *ratingAlert;
|
||||
}
|
||||
|
||||
@property(nonatomic, retain) UIAlertView *ratingAlert;
|
||||
|
||||
/*
|
||||
DEPRECATED: While still functional, it's better to use
|
||||
appLaunched:(BOOL)canPromptForRating instead.
|
||||
|
||||
Calls [Appirater appLaunched:YES]. See appLaunched: for details of functionality.
|
||||
*/
|
||||
+ (void)appLaunched;
|
||||
|
||||
/*
|
||||
Tells Appirater that the app has launched, and on devices that do NOT
|
||||
support multitasking, the 'uses' count will be incremented. You should
|
||||
call this method at the end of your application delegate's
|
||||
application:didFinishLaunchingWithOptions: method.
|
||||
|
||||
If the app has been used enough to be rated (and enough significant events),
|
||||
you can suppress the rating alert
|
||||
by passing NO for canPromptForRating. The rating alert will simply be postponed
|
||||
until it is called again with YES for canPromptForRating. The rating alert
|
||||
can also be triggered by appEnteredForeground: and userDidSignificantEvent:
|
||||
(as long as you pass YES for canPromptForRating in those methods).
|
||||
*/
|
||||
+ (void)appLaunched:(BOOL)canPromptForRating;
|
||||
|
||||
/*
|
||||
Tells Appirater that the app was brought to the foreground on multitasking
|
||||
devices. You should call this method from the application delegate's
|
||||
applicationWillEnterForeground: method.
|
||||
|
||||
If the app has been used enough to be rated (and enough significant events),
|
||||
you can suppress the rating alert
|
||||
by passing NO for canPromptForRating. The rating alert will simply be postponed
|
||||
until it is called again with YES for canPromptForRating. The rating alert
|
||||
can also be triggered by appLaunched: and userDidSignificantEvent:
|
||||
(as long as you pass YES for canPromptForRating in those methods).
|
||||
*/
|
||||
+ (void)appEnteredForeground:(BOOL)canPromptForRating;
|
||||
|
||||
/*
|
||||
Tells Appirater that the user performed a significant event. A significant
|
||||
event is whatever you want it to be. If you're app is used to make VoIP
|
||||
calls, then you might want to call this method whenever the user places
|
||||
a call. If it's a game, you might want to call this whenever the user
|
||||
beats a level boss.
|
||||
|
||||
If the user has performed enough significant events and used the app enough,
|
||||
you can suppress the rating alert by passing NO for canPromptForRating. The
|
||||
rating alert will simply be postponed until it is called again with YES for
|
||||
canPromptForRating. The rating alert can also be triggered by appLaunched:
|
||||
and appEnteredForeground: (as long as you pass YES for canPromptForRating
|
||||
in those methods).
|
||||
*/
|
||||
+ (void)userDidSignificantEvent:(BOOL)canPromptForRating;
|
||||
|
||||
/*
|
||||
Tells Appirater to open the App Store page where the user can specify a
|
||||
rating for the app. Also records the fact that this has happened, so the
|
||||
user won't be prompted again to rate the app.
|
||||
|
||||
The only case where you should call this directly is if your app has an
|
||||
explicit "Rate this app" command somewhere. In all other cases, don't worry
|
||||
about calling this -- instead, just call the other functions listed above,
|
||||
and let Appirater handle the bookkeeping of deciding when to ask the user
|
||||
whether to rate the app.
|
||||
*/
|
||||
+ (void)rateApp;
|
||||
|
||||
@end
|
||||
376
iOS/AppiraterPlugin/Classes/Appirater.m
Normal file
@@ -0,0 +1,376 @@
|
||||
/*
|
||||
This file is part of Appirater.
|
||||
|
||||
Copyright (c) 2010, Arash Payan
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/*
|
||||
* Appirater.m
|
||||
* appirater
|
||||
*
|
||||
* Created by Arash Payan on 9/5/09.
|
||||
* http://arashpayan.com
|
||||
* Copyright 2010 Arash Payan. All rights reserved.
|
||||
*/
|
||||
|
||||
#import "Appirater.h"
|
||||
#import <SystemConfiguration/SCNetworkReachability.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
NSString *const kAppiraterFirstUseDate = @"kAppiraterFirstUseDate";
|
||||
NSString *const kAppiraterUseCount = @"kAppiraterUseCount";
|
||||
NSString *const kAppiraterSignificantEventCount = @"kAppiraterSignificantEventCount";
|
||||
NSString *const kAppiraterCurrentVersion = @"kAppiraterCurrentVersion";
|
||||
NSString *const kAppiraterRatedCurrentVersion = @"kAppiraterRatedCurrentVersion";
|
||||
NSString *const kAppiraterDeclinedToRate = @"kAppiraterDeclinedToRate";
|
||||
NSString *const kAppiraterReminderRequestDate = @"kAppiraterReminderRequestDate";
|
||||
|
||||
NSString *templateReviewURL = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
|
||||
|
||||
|
||||
@interface Appirater (hidden)
|
||||
- (BOOL)connectedToNetwork;
|
||||
+ (Appirater*)sharedInstance;
|
||||
- (void)showRatingAlert;
|
||||
- (BOOL)ratingConditionsHaveBeenMet;
|
||||
- (void)incrementUseCount;
|
||||
@end
|
||||
|
||||
@implementation Appirater (hidden)
|
||||
|
||||
- (BOOL)connectedToNetwork {
|
||||
// Create zero addy
|
||||
struct sockaddr_in zeroAddress;
|
||||
bzero(&zeroAddress, sizeof(zeroAddress));
|
||||
zeroAddress.sin_len = sizeof(zeroAddress);
|
||||
zeroAddress.sin_family = AF_INET;
|
||||
|
||||
// Recover reachability flags
|
||||
SCNetworkReachabilityRef defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress);
|
||||
SCNetworkReachabilityFlags flags;
|
||||
|
||||
BOOL didRetrieveFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags);
|
||||
CFRelease(defaultRouteReachability);
|
||||
|
||||
if (!didRetrieveFlags)
|
||||
{
|
||||
NSLog(@"Error. Could not recover network reachability flags");
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL isReachable = flags & kSCNetworkFlagsReachable;
|
||||
BOOL needsConnection = flags & kSCNetworkFlagsConnectionRequired;
|
||||
BOOL nonWiFi = flags & kSCNetworkReachabilityFlagsTransientConnection;
|
||||
|
||||
NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
|
||||
NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0];
|
||||
NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
|
||||
|
||||
return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
|
||||
}
|
||||
|
||||
+ (Appirater*)sharedInstance {
|
||||
static Appirater *appirater = nil;
|
||||
if (appirater == nil)
|
||||
{
|
||||
@synchronized(self) {
|
||||
if (appirater == nil) {
|
||||
appirater = [[Appirater alloc] init];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive) name:@"UIApplicationWillResignActiveNotification" object:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return appirater;
|
||||
}
|
||||
|
||||
- (void)showRatingAlert {
|
||||
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:APPIRATER_MESSAGE_TITLE
|
||||
message:APPIRATER_MESSAGE
|
||||
delegate:self
|
||||
cancelButtonTitle:APPIRATER_CANCEL_BUTTON
|
||||
otherButtonTitles:APPIRATER_RATE_BUTTON, APPIRATER_RATE_LATER, nil] autorelease];
|
||||
self.ratingAlert = alertView;
|
||||
[alertView show];
|
||||
}
|
||||
|
||||
- (BOOL)ratingConditionsHaveBeenMet {
|
||||
if (APPIRATER_DEBUG)
|
||||
return YES;
|
||||
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSDate *dateOfFirstLaunch = [NSDate dateWithTimeIntervalSince1970:[userDefaults doubleForKey:kAppiraterFirstUseDate]];
|
||||
NSTimeInterval timeSinceFirstLaunch = [[NSDate date] timeIntervalSinceDate:dateOfFirstLaunch];
|
||||
NSTimeInterval timeUntilRate = 60 * 60 * 24 * APPIRATER_DAYS_UNTIL_PROMPT;
|
||||
if (timeSinceFirstLaunch < timeUntilRate)
|
||||
return NO;
|
||||
|
||||
// check if the app has been used enough
|
||||
int useCount = [userDefaults integerForKey:kAppiraterUseCount];
|
||||
if (useCount <= APPIRATER_USES_UNTIL_PROMPT)
|
||||
return NO;
|
||||
|
||||
// check if the user has done enough significant events
|
||||
int sigEventCount = [userDefaults integerForKey:kAppiraterSignificantEventCount];
|
||||
if (sigEventCount <= APPIRATER_SIG_EVENTS_UNTIL_PROMPT)
|
||||
return NO;
|
||||
|
||||
// has the user previously declined to rate this version of the app?
|
||||
if ([userDefaults boolForKey:kAppiraterDeclinedToRate])
|
||||
return NO;
|
||||
|
||||
// has the user already rated the app?
|
||||
if ([userDefaults boolForKey:kAppiraterRatedCurrentVersion])
|
||||
return NO;
|
||||
|
||||
// if the user wanted to be reminded later, has enough time passed?
|
||||
NSDate *reminderRequestDate = [NSDate dateWithTimeIntervalSince1970:[userDefaults doubleForKey:kAppiraterReminderRequestDate]];
|
||||
NSTimeInterval timeSinceReminderRequest = [[NSDate date] timeIntervalSinceDate:reminderRequestDate];
|
||||
NSTimeInterval timeUntilReminder = 60 * 60 * 24 * APPIRATER_TIME_BEFORE_REMINDING;
|
||||
if (timeSinceReminderRequest < timeUntilReminder)
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)incrementUseCount {
|
||||
// get the app's version
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
|
||||
|
||||
// get the version number that we've been tracking
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *trackingVersion = [userDefaults stringForKey:kAppiraterCurrentVersion];
|
||||
if (trackingVersion == nil)
|
||||
{
|
||||
trackingVersion = version;
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
}
|
||||
|
||||
if (APPIRATER_DEBUG)
|
||||
NSLog(@"APPIRATER Tracking version: %@", trackingVersion);
|
||||
|
||||
if ([trackingVersion isEqualToString:version])
|
||||
{
|
||||
// check if the first use date has been set. if not, set it.
|
||||
NSTimeInterval timeInterval = [userDefaults doubleForKey:kAppiraterFirstUseDate];
|
||||
if (timeInterval == 0)
|
||||
{
|
||||
timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
[userDefaults setDouble:timeInterval forKey:kAppiraterFirstUseDate];
|
||||
}
|
||||
|
||||
// increment the use count
|
||||
int useCount = [userDefaults integerForKey:kAppiraterUseCount];
|
||||
useCount++;
|
||||
[userDefaults setInteger:useCount forKey:kAppiraterUseCount];
|
||||
if (APPIRATER_DEBUG)
|
||||
NSLog(@"APPIRATER Use count: %d", useCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a new version of the app, so restart tracking
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
[userDefaults setDouble:[[NSDate date] timeIntervalSince1970] forKey:kAppiraterFirstUseDate];
|
||||
[userDefaults setInteger:1 forKey:kAppiraterUseCount];
|
||||
[userDefaults setInteger:0 forKey:kAppiraterSignificantEventCount];
|
||||
[userDefaults setBool:NO forKey:kAppiraterRatedCurrentVersion];
|
||||
[userDefaults setBool:NO forKey:kAppiraterDeclinedToRate];
|
||||
[userDefaults setDouble:0 forKey:kAppiraterReminderRequestDate];
|
||||
}
|
||||
|
||||
[userDefaults synchronize];
|
||||
}
|
||||
|
||||
- (void)incrementSignificantEventCount {
|
||||
// get the app's version
|
||||
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
|
||||
|
||||
// get the version number that we've been tracking
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *trackingVersion = [userDefaults stringForKey:kAppiraterCurrentVersion];
|
||||
if (trackingVersion == nil)
|
||||
{
|
||||
trackingVersion = version;
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
}
|
||||
|
||||
if (APPIRATER_DEBUG)
|
||||
NSLog(@"APPIRATER Tracking version: %@", trackingVersion);
|
||||
|
||||
if ([trackingVersion isEqualToString:version])
|
||||
{
|
||||
// check if the first use date has been set. if not, set it.
|
||||
NSTimeInterval timeInterval = [userDefaults doubleForKey:kAppiraterFirstUseDate];
|
||||
if (timeInterval == 0)
|
||||
{
|
||||
timeInterval = [[NSDate date] timeIntervalSince1970];
|
||||
[userDefaults setDouble:timeInterval forKey:kAppiraterFirstUseDate];
|
||||
}
|
||||
|
||||
// increment the significant event count
|
||||
int sigEventCount = [userDefaults integerForKey:kAppiraterSignificantEventCount];
|
||||
sigEventCount++;
|
||||
[userDefaults setInteger:sigEventCount forKey:kAppiraterSignificantEventCount];
|
||||
if (APPIRATER_DEBUG)
|
||||
NSLog(@"APPIRATER Significant event count: %d", sigEventCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
// it's a new version of the app, so restart tracking
|
||||
[userDefaults setObject:version forKey:kAppiraterCurrentVersion];
|
||||
[userDefaults setDouble:0 forKey:kAppiraterFirstUseDate];
|
||||
[userDefaults setInteger:0 forKey:kAppiraterUseCount];
|
||||
[userDefaults setInteger:1 forKey:kAppiraterSignificantEventCount];
|
||||
[userDefaults setBool:NO forKey:kAppiraterRatedCurrentVersion];
|
||||
[userDefaults setBool:NO forKey:kAppiraterDeclinedToRate];
|
||||
[userDefaults setDouble:0 forKey:kAppiraterReminderRequestDate];
|
||||
}
|
||||
|
||||
[userDefaults synchronize];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface Appirater ()
|
||||
- (void)hideRatingAlert;
|
||||
@end
|
||||
|
||||
@implementation Appirater
|
||||
|
||||
@synthesize ratingAlert;
|
||||
|
||||
- (void)incrementAndRate:(NSNumber*)_canPromptForRating {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[self incrementUseCount];
|
||||
|
||||
if ([_canPromptForRating boolValue] == YES &&
|
||||
[self ratingConditionsHaveBeenMet] &&
|
||||
[self connectedToNetwork])
|
||||
{
|
||||
[self performSelectorOnMainThread:@selector(showRatingAlert) withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)incrementSignificantEventAndRate:(NSNumber*)_canPromptForRating {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
[self incrementSignificantEventCount];
|
||||
|
||||
if ([_canPromptForRating boolValue] == YES &&
|
||||
[self ratingConditionsHaveBeenMet] &&
|
||||
[self connectedToNetwork])
|
||||
{
|
||||
[self performSelectorOnMainThread:@selector(showRatingAlert) withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
+ (void)appLaunched {
|
||||
[Appirater appLaunched:YES];
|
||||
}
|
||||
|
||||
+ (void)appLaunched:(BOOL)canPromptForRating {
|
||||
NSNumber *_canPromptForRating = [[NSNumber alloc] initWithBool:canPromptForRating];
|
||||
[NSThread detachNewThreadSelector:@selector(incrementAndRate:)
|
||||
toTarget:[Appirater sharedInstance]
|
||||
withObject:_canPromptForRating];
|
||||
[_canPromptForRating release];
|
||||
}
|
||||
|
||||
- (void)hideRatingAlert {
|
||||
if (self.ratingAlert.visible) {
|
||||
if (APPIRATER_DEBUG)
|
||||
NSLog(@"APPIRATER Hiding Alert");
|
||||
[self.ratingAlert dismissWithClickedButtonIndex:-1 animated:NO];
|
||||
}
|
||||
}
|
||||
|
||||
+ (void)appWillResignActive {
|
||||
if (APPIRATER_DEBUG)
|
||||
NSLog(@"APPIRATER appWillResignActive");
|
||||
[[Appirater sharedInstance] hideRatingAlert];
|
||||
}
|
||||
|
||||
+ (void)appEnteredForeground:(BOOL)canPromptForRating {
|
||||
NSNumber *_canPromptForRating = [[NSNumber alloc] initWithBool:canPromptForRating];
|
||||
[NSThread detachNewThreadSelector:@selector(incrementAndRate:)
|
||||
toTarget:[Appirater sharedInstance]
|
||||
withObject:_canPromptForRating];
|
||||
[_canPromptForRating release];
|
||||
}
|
||||
|
||||
+ (void)userDidSignificantEvent:(BOOL)canPromptForRating {
|
||||
NSNumber *_canPromptForRating = [[NSNumber alloc] initWithBool:canPromptForRating];
|
||||
[NSThread detachNewThreadSelector:@selector(incrementSignificantEventAndRate:)
|
||||
toTarget:[Appirater sharedInstance]
|
||||
withObject:_canPromptForRating];
|
||||
[_canPromptForRating release];
|
||||
}
|
||||
|
||||
+ (void)rateApp {
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
NSLog(@"APPIRATER NOTE: iTunes App Store is not supported on the iOS simulator. Unable to open App Store page.");
|
||||
#else
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
NSString *reviewURL = [templateReviewURL stringByReplacingOccurrencesOfString:@"APP_ID" withString:[NSString stringWithFormat:@"%d", APPIRATER_APP_ID]];
|
||||
[userDefaults setBool:YES forKey:kAppiraterRatedCurrentVersion];
|
||||
[userDefaults synchronize];
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:reviewURL]];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
|
||||
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
switch (buttonIndex) {
|
||||
case 0:
|
||||
{
|
||||
// they don't want to rate it
|
||||
[userDefaults setBool:YES forKey:kAppiraterDeclinedToRate];
|
||||
[userDefaults synchronize];
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
// they want to rate it
|
||||
[Appirater rateApp];
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
// remind them later
|
||||
[userDefaults setDouble:[[NSDate date] timeIntervalSince1970] forKey:kAppiraterReminderRequestDate];
|
||||
[userDefaults synchronize];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,11 +1,14 @@
|
||||
# AppiraterPlugin #
|
||||
by James Stuckey Weber
|
||||
|
||||
This plugin allows you to call Appirater userDidSignificantEvent: from javascript. The other Appirater functions should be called in the AppDelegate class as specified by the Appirater install log.
|
||||
This plugin allows you to call Appirater userDidSignificantEvent and appEnteredForeground from javascript (sigEvent and foreground correspondingly). The Appirater appLaunched function should be called in the AppDelegate class as specified by the Appirater install log.
|
||||
|
||||
## Adding the Plugin to your Project ##
|
||||
|
||||
1. Install [Appirater](https://github.com/arashpayan/appirater).
|
||||
1a). Add call the Appirater class before return 'YES' of didFinishLaunchingWithOptions function in AppDelegate.m
|
||||
[Appirater appLaunched:YES];
|
||||
1b) If the latest version of Appirater is not working with Phonegap (checked at May 7, 2012). Use the previous version of Appirater from Class folder of the plugin.
|
||||
2. Add the AppiraterPlugin folder to the Plugins folder in XCode, using "Create groups for any added folders".
|
||||
3. Add the 'Appirater.js' file to your www folder and link to it from your html files.
|
||||
4. Add new entry key 'AppiraterPlugin' with value 'AppiraterPlugin' to 'Plugins' in 'PhoneGap.plist/Cordova.plist'
|
||||
|
||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
@@ -1,69 +1,87 @@
|
||||
/* MIT licensed */
|
||||
// (c) 2012 Jesse MacFadyen, Nitobi
|
||||
// (c) 2010 Jesse MacFadyen, Nitobi
|
||||
|
||||
/*global Cordova */
|
||||
|
||||
function ChildBrowser()
|
||||
{
|
||||
// Does nothing
|
||||
(function() {
|
||||
|
||||
var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks
|
||||
|
||||
function ChildBrowser() {
|
||||
// Does nothing
|
||||
}
|
||||
|
||||
// Callback when the location of the page changes
|
||||
// called from native
|
||||
ChildBrowser._onLocationChange = function(newLoc)
|
||||
{
|
||||
window.plugins.childBrowser.onLocationChange(newLoc);
|
||||
window.plugins.childBrowser.onLocationChange(newLoc);
|
||||
};
|
||||
|
||||
// Callback when the user chooses the 'Done' button
|
||||
// called from native
|
||||
ChildBrowser._onClose = function()
|
||||
{
|
||||
window.plugins.childBrowser.onClose();
|
||||
window.plugins.childBrowser.onClose();
|
||||
};
|
||||
|
||||
// Callback when the user chooses the 'open in Safari' button
|
||||
// called from native
|
||||
ChildBrowser._onOpenExternal = function()
|
||||
{
|
||||
window.plugins.childBrowser.onOpenExternal();
|
||||
window.plugins.childBrowser.onOpenExternal();
|
||||
};
|
||||
|
||||
// Pages loaded into the ChildBrowser can execute callback scripts, so be careful to
|
||||
// check location, and make sure it is a location you trust.
|
||||
// Warning ... don't exec arbitrary code, it's risky and could fuck up your app.
|
||||
// called from native
|
||||
ChildBrowser._onJSCallback = function(js,loc)
|
||||
{
|
||||
// Not Implemented
|
||||
//window.plugins.childBrowser.onJSCallback(js,loc);
|
||||
// Not Implemented
|
||||
//window.plugins.childBrowser.onJSCallback(js,loc);
|
||||
};
|
||||
|
||||
/* The interface that you will use to access functionality */
|
||||
|
||||
// Show a webpage, will result in a callback to onLocationChange
|
||||
ChildBrowser.prototype.showWebPage = function(loc)
|
||||
{
|
||||
cordova.exec("ChildBrowserCommand.showWebPage", loc);
|
||||
cordovaRef.exec("ChildBrowserCommand.showWebPage", loc);
|
||||
};
|
||||
ChildBrowser.prototype.getPage = function(loc){
|
||||
cordova.exec("ChildBrowserCommand.getPage",loc);
|
||||
}
|
||||
|
||||
// close the browser, will NOT result in close callback
|
||||
ChildBrowser.prototype.close = function()
|
||||
{
|
||||
cordova.exec("ChildBrowserCommand.close");
|
||||
cordovaRef.exec("ChildBrowserCommand.close");
|
||||
};
|
||||
|
||||
// Not Implemented
|
||||
ChildBrowser.prototype.jsExec = function(jsString)
|
||||
{
|
||||
// Not Implemented!!
|
||||
//Cordova.exec("ChildBrowserCommand.jsExec",jsString);
|
||||
// Not Implemented!!
|
||||
//PhoneGap.exec("ChildBrowserCommand.jsExec",jsString);
|
||||
};
|
||||
|
||||
// Note: this plugin does NOT install itself, call this method some time after deviceready to install it
|
||||
// it will be returned, and also available globally from window.plugins.childBrowser
|
||||
ChildBrowser.install = function()
|
||||
{
|
||||
if(!window.plugins)
|
||||
{
|
||||
window.plugins = {
|
||||
};
|
||||
}
|
||||
window.plugins.childBrowser = new ChildBrowser();
|
||||
return window.plugins.childBrowser;
|
||||
if(!window.plugins) {
|
||||
window.plugins = {};
|
||||
}
|
||||
if ( ! window.plugins.childBrowser ) {
|
||||
window.plugins.childBrowser = new ChildBrowser();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
if (cordovaRef && cordovaRef.addConstructor) {
|
||||
cordovaRef.addConstructor(ChildBrowser.install);
|
||||
} else {
|
||||
console.log("ChildBrowser Cordova Plugin could not be installed.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
})();
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <CORDOVA/CDVPlugin.h>
|
||||
#import <Cordova/CDVPlugin.h>
|
||||
#else
|
||||
#import "CORDOVA/CDVPlugin.h"
|
||||
#import "Cordova/CDVPlugin.h"
|
||||
#endif
|
||||
#import "ChildBrowserViewController.h"
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
@interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate> {
|
||||
#endif
|
||||
ChildBrowserViewController* childBrowser;
|
||||
ChildBrowserViewController* childBrowser;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) ChildBrowserViewController *childBrowser;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <Cordova/CDVViewController.h>
|
||||
#else
|
||||
#else
|
||||
#import "Cordova/CDVViewController.h"
|
||||
#endif
|
||||
|
||||
@@ -16,66 +16,61 @@
|
||||
@synthesize childBrowser;
|
||||
|
||||
- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url
|
||||
{
|
||||
if(childBrowser == NULL)
|
||||
{
|
||||
childBrowser = [[ ChildBrowserViewController alloc ] initWithScale:FALSE ];
|
||||
childBrowser.delegate = self;
|
||||
}
|
||||
|
||||
/* // TODO: Work in progress
|
||||
NSString* strOrientations = [ options objectForKey:@"supportedOrientations"];
|
||||
NSArray* supportedOrientations = [strOrientations componentsSeparatedByString:@","];
|
||||
*/
|
||||
|
||||
{
|
||||
if(childBrowser == NULL)
|
||||
{
|
||||
childBrowser = [[ ChildBrowserViewController alloc ] initWithScale:FALSE ];
|
||||
childBrowser.delegate = self;
|
||||
}
|
||||
|
||||
/* // TODO: Work in progress
|
||||
NSString* strOrientations = [ options objectForKey:@"supportedOrientations"];
|
||||
NSArray* supportedOrientations = [strOrientations componentsSeparatedByString:@","];
|
||||
*/
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
CDVViewController* cont = (CDVViewController*)[ super viewController ];
|
||||
childBrowser.supportedOrientations = cont.supportedOrientations;
|
||||
[ cont presentModalViewController:childBrowser animated:YES ];
|
||||
childBrowser.supportedOrientations = cont.supportedOrientations;
|
||||
[ cont presentModalViewController:childBrowser animated:YES ];
|
||||
#endif
|
||||
|
||||
NSString *url = (NSString*) [arguments objectAtIndex:0];
|
||||
|
||||
|
||||
[childBrowser loadURL:url ];
|
||||
NSString *url = (NSString*) [arguments objectAtIndex:0];
|
||||
|
||||
[childBrowser loadURL:url ];
|
||||
|
||||
}
|
||||
- (void) getPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
|
||||
NSString *url = (NSString*) [arguments objectAtIndex:0];
|
||||
[childBrowser loadURL:url ];
|
||||
NSString *url = (NSString*) [arguments objectAtIndex:0];
|
||||
[childBrowser loadURL:url ];
|
||||
}
|
||||
|
||||
-(void) close:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url
|
||||
{
|
||||
[ childBrowser closeBrowser];
|
||||
|
||||
[ childBrowser closeBrowser];
|
||||
|
||||
}
|
||||
|
||||
-(void) onClose
|
||||
{
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onClose();",@""];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onClose();",@""];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
}
|
||||
|
||||
-(void) onOpenInSafari
|
||||
{
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onOpenExternal();",@""];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onOpenExternal();",@""];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
}
|
||||
|
||||
|
||||
-(void) onChildLocationChange:(NSString*)newLoc
|
||||
{
|
||||
|
||||
NSString* tempLoc = [NSString stringWithFormat:@"%@",newLoc];
|
||||
NSString* encUrl = [tempLoc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onLocationChange('%@');",encUrl];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
|
||||
NSString* tempLoc = [NSString stringWithFormat:@"%@",newLoc];
|
||||
NSString* encUrl = [tempLoc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onLocationChange('%@');",encUrl];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,574 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
3AB508AD154084BD002C7FDE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508AC154084BD002C7FDE /* Foundation.framework */; };
|
||||
3AB508AF154084BD002C7FDE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508AE154084BD002C7FDE /* UIKit.framework */; };
|
||||
3AB508B1154084BD002C7FDE /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508B0154084BD002C7FDE /* CoreGraphics.framework */; };
|
||||
3AB508B3154084BD002C7FDE /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508B2154084BD002C7FDE /* AddressBook.framework */; };
|
||||
3AB508B5154084BD002C7FDE /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508B4154084BD002C7FDE /* AddressBookUI.framework */; };
|
||||
3AB508B7154084BD002C7FDE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508B6154084BD002C7FDE /* AudioToolbox.framework */; };
|
||||
3AB508B9154084BD002C7FDE /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508B8154084BD002C7FDE /* AVFoundation.framework */; };
|
||||
3AB508BB154084BD002C7FDE /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508BA154084BD002C7FDE /* CoreLocation.framework */; };
|
||||
3AB508BD154084BD002C7FDE /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508BC154084BD002C7FDE /* MediaPlayer.framework */; };
|
||||
3AB508BF154084BD002C7FDE /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508BE154084BD002C7FDE /* QuartzCore.framework */; };
|
||||
3AB508C1154084BD002C7FDE /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508C0154084BD002C7FDE /* SystemConfiguration.framework */; };
|
||||
3AB508C3154084BD002C7FDE /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508C2154084BD002C7FDE /* MobileCoreServices.framework */; };
|
||||
3AB508C5154084BD002C7FDE /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508C4154084BD002C7FDE /* CoreMedia.framework */; };
|
||||
3AB508CB154084BD002C7FDE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508C9154084BD002C7FDE /* InfoPlist.strings */; };
|
||||
3AB508CD154084BD002C7FDE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB508CC154084BD002C7FDE /* main.m */; };
|
||||
3AB508D0154084BD002C7FDE /* Cordova.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3AB508CF154084BD002C7FDE /* Cordova.framework */; };
|
||||
3AB508D5154084BE002C7FDE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508D3154084BE002C7FDE /* Localizable.strings */; };
|
||||
3AB508D9154084BE002C7FDE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508D7154084BE002C7FDE /* Localizable.strings */; };
|
||||
3AB508DD154084BE002C7FDE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508DB154084BE002C7FDE /* Localizable.strings */; };
|
||||
3AB508E1154084BE002C7FDE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508DF154084BE002C7FDE /* Localizable.strings */; };
|
||||
3AB508E4154084BE002C7FDE /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508E3154084BE002C7FDE /* icon.png */; };
|
||||
3AB508E6154084BE002C7FDE /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508E5154084BE002C7FDE /* icon@2x.png */; };
|
||||
3AB508E8154084BE002C7FDE /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508E7154084BE002C7FDE /* icon-72.png */; };
|
||||
3AB508EB154084BE002C7FDE /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508EA154084BE002C7FDE /* Default.png */; };
|
||||
3AB508ED154084BE002C7FDE /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508EC154084BE002C7FDE /* Default@2x.png */; };
|
||||
3AB508EF154084BE002C7FDE /* Capture.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508EE154084BE002C7FDE /* Capture.bundle */; };
|
||||
3AB508F1154084BE002C7FDE /* Cordova.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508F0154084BE002C7FDE /* Cordova.plist */; };
|
||||
3AB508F5154084BE002C7FDE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB508F4154084BE002C7FDE /* AppDelegate.m */; };
|
||||
3AB508F8154084BE002C7FDE /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB508F7154084BE002C7FDE /* MainViewController.m */; };
|
||||
3AB508FA154084BE002C7FDE /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508F9154084BE002C7FDE /* MainViewController.xib */; };
|
||||
3AB508FE154084BE002C7FDE /* verify.sh in Resources */ = {isa = PBXBuildFile; fileRef = 3AB508FD154084BE002C7FDE /* verify.sh */; };
|
||||
3AB5090515408689002C7FDE /* www in Resources */ = {isa = PBXBuildFile; fileRef = 3AB5090415408689002C7FDE /* www */; };
|
||||
3AB5090A154086B0002C7FDE /* ChildBrowserCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB50907154086B0002C7FDE /* ChildBrowserCommand.m */; };
|
||||
3AB5090B154086B0002C7FDE /* ChildBrowserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3AB50909154086B0002C7FDE /* ChildBrowserViewController.m */; };
|
||||
3AB5090E1540870B002C7FDE /* ChildBrowser.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3AB5090C1540870B002C7FDE /* ChildBrowser.bundle */; };
|
||||
3AB5090F1540870B002C7FDE /* ChildBrowserViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3AB5090D1540870B002C7FDE /* ChildBrowserViewController.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
3AB508A8154084BD002C7FDE /* ChildBrowserExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ChildBrowserExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3AB508AC154084BD002C7FDE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
3AB508AE154084BD002C7FDE /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||
3AB508B0154084BD002C7FDE /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||
3AB508B2154084BD002C7FDE /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
|
||||
3AB508B4154084BD002C7FDE /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
|
||||
3AB508B6154084BD002C7FDE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
|
||||
3AB508B8154084BD002C7FDE /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
3AB508BA154084BD002C7FDE /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
|
||||
3AB508BC154084BD002C7FDE /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; };
|
||||
3AB508BE154084BD002C7FDE /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
3AB508C0154084BD002C7FDE /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||
3AB508C2154084BD002C7FDE /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
|
||||
3AB508C4154084BD002C7FDE /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
|
||||
3AB508C8154084BD002C7FDE /* ChildBrowserExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "ChildBrowserExample-Info.plist"; sourceTree = "<group>"; };
|
||||
3AB508CA154084BD002C7FDE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
3AB508CC154084BD002C7FDE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
3AB508CE154084BD002C7FDE /* ChildBrowserExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ChildBrowserExample-Prefix.pch"; sourceTree = "<group>"; };
|
||||
3AB508CF154084BD002C7FDE /* Cordova.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cordova.framework; path = /Users/Shared/Cordova/Frameworks/Cordova.framework; sourceTree = "<absolute>"; };
|
||||
3AB508D4154084BE002C7FDE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Resources/en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
3AB508D8154084BE002C7FDE /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = Resources/es.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
3AB508DC154084BE002C7FDE /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = Resources/de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
3AB508E0154084BE002C7FDE /* se */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = se; path = Resources/se.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
3AB508E3154084BE002C7FDE /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = icon.png; path = Resources/icons/icon.png; sourceTree = "<group>"; };
|
||||
3AB508E5154084BE002C7FDE /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon@2x.png"; path = "Resources/icons/icon@2x.png"; sourceTree = "<group>"; };
|
||||
3AB508E7154084BE002C7FDE /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "icon-72.png"; path = "Resources/icons/icon-72.png"; sourceTree = "<group>"; };
|
||||
3AB508EA154084BE002C7FDE /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Resources/splash/Default.png; sourceTree = "<group>"; };
|
||||
3AB508EC154084BE002C7FDE /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "Resources/splash/Default@2x.png"; sourceTree = "<group>"; };
|
||||
3AB508EE154084BE002C7FDE /* Capture.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Capture.bundle; path = Resources/Capture.bundle; sourceTree = "<group>"; };
|
||||
3AB508F0154084BE002C7FDE /* Cordova.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Cordova.plist; sourceTree = "<group>"; };
|
||||
3AB508F3154084BE002C7FDE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Classes/AppDelegate.h; sourceTree = "<group>"; };
|
||||
3AB508F4154084BE002C7FDE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Classes/AppDelegate.m; sourceTree = "<group>"; };
|
||||
3AB508F6154084BE002C7FDE /* MainViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MainViewController.h; path = Classes/MainViewController.h; sourceTree = "<group>"; };
|
||||
3AB508F7154084BE002C7FDE /* MainViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MainViewController.m; path = Classes/MainViewController.m; sourceTree = "<group>"; };
|
||||
3AB508F9154084BE002C7FDE /* MainViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainViewController.xib; path = Classes/MainViewController.xib; sourceTree = "<group>"; };
|
||||
3AB508FC154084BE002C7FDE /* README */ = {isa = PBXFileReference; lastKnownFileType = text; name = README; path = Plugins/README; sourceTree = "<group>"; };
|
||||
3AB508FD154084BE002C7FDE /* verify.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = verify.sh; sourceTree = "<group>"; };
|
||||
3AB5090415408689002C7FDE /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = "<group>"; };
|
||||
3AB50906154086B0002C7FDE /* ChildBrowserCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildBrowserCommand.h; sourceTree = "<group>"; };
|
||||
3AB50907154086B0002C7FDE /* ChildBrowserCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChildBrowserCommand.m; sourceTree = "<group>"; };
|
||||
3AB50908154086B0002C7FDE /* ChildBrowserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildBrowserViewController.h; sourceTree = "<group>"; };
|
||||
3AB50909154086B0002C7FDE /* ChildBrowserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChildBrowserViewController.m; sourceTree = "<group>"; };
|
||||
3AB5090C1540870B002C7FDE /* ChildBrowser.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ChildBrowser.bundle; sourceTree = "<group>"; };
|
||||
3AB5090D1540870B002C7FDE /* ChildBrowserViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ChildBrowserViewController.xib; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
3AB508A2154084BD002C7FDE /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3AB508AD154084BD002C7FDE /* Foundation.framework in Frameworks */,
|
||||
3AB508AF154084BD002C7FDE /* UIKit.framework in Frameworks */,
|
||||
3AB508B1154084BD002C7FDE /* CoreGraphics.framework in Frameworks */,
|
||||
3AB508B3154084BD002C7FDE /* AddressBook.framework in Frameworks */,
|
||||
3AB508B5154084BD002C7FDE /* AddressBookUI.framework in Frameworks */,
|
||||
3AB508B7154084BD002C7FDE /* AudioToolbox.framework in Frameworks */,
|
||||
3AB508B9154084BD002C7FDE /* AVFoundation.framework in Frameworks */,
|
||||
3AB508BB154084BD002C7FDE /* CoreLocation.framework in Frameworks */,
|
||||
3AB508BD154084BD002C7FDE /* MediaPlayer.framework in Frameworks */,
|
||||
3AB508BF154084BD002C7FDE /* QuartzCore.framework in Frameworks */,
|
||||
3AB508C1154084BD002C7FDE /* SystemConfiguration.framework in Frameworks */,
|
||||
3AB508C3154084BD002C7FDE /* MobileCoreServices.framework in Frameworks */,
|
||||
3AB508C5154084BD002C7FDE /* CoreMedia.framework in Frameworks */,
|
||||
3AB508D0154084BD002C7FDE /* Cordova.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3AB508A5154084BD002C7FDE /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
3AB5089A154084BD002C7FDE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508C6154084BD002C7FDE /* ChildBrowserExample */,
|
||||
3AB508AB154084BD002C7FDE /* Frameworks */,
|
||||
3AB508A9154084BD002C7FDE /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508A9154084BD002C7FDE /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508A8154084BD002C7FDE /* ChildBrowserExample.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508AB154084BD002C7FDE /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508AC154084BD002C7FDE /* Foundation.framework */,
|
||||
3AB508AE154084BD002C7FDE /* UIKit.framework */,
|
||||
3AB508B0154084BD002C7FDE /* CoreGraphics.framework */,
|
||||
3AB508B2154084BD002C7FDE /* AddressBook.framework */,
|
||||
3AB508B4154084BD002C7FDE /* AddressBookUI.framework */,
|
||||
3AB508B6154084BD002C7FDE /* AudioToolbox.framework */,
|
||||
3AB508B8154084BD002C7FDE /* AVFoundation.framework */,
|
||||
3AB508BA154084BD002C7FDE /* CoreLocation.framework */,
|
||||
3AB508BC154084BD002C7FDE /* MediaPlayer.framework */,
|
||||
3AB508BE154084BD002C7FDE /* QuartzCore.framework */,
|
||||
3AB508C0154084BD002C7FDE /* SystemConfiguration.framework */,
|
||||
3AB508C2154084BD002C7FDE /* MobileCoreServices.framework */,
|
||||
3AB508C4154084BD002C7FDE /* CoreMedia.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508C6154084BD002C7FDE /* ChildBrowserExample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB5090415408689002C7FDE /* www */,
|
||||
3AB508CF154084BD002C7FDE /* Cordova.framework */,
|
||||
3AB508D1154084BE002C7FDE /* Resources */,
|
||||
3AB508F2154084BE002C7FDE /* Classes */,
|
||||
3AB508FB154084BE002C7FDE /* Plugins */,
|
||||
3AB508C7154084BD002C7FDE /* Supporting Files */,
|
||||
);
|
||||
path = ChildBrowserExample;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508C7154084BD002C7FDE /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508C8154084BD002C7FDE /* ChildBrowserExample-Info.plist */,
|
||||
3AB508C9154084BD002C7FDE /* InfoPlist.strings */,
|
||||
3AB508CC154084BD002C7FDE /* main.m */,
|
||||
3AB508CE154084BD002C7FDE /* ChildBrowserExample-Prefix.pch */,
|
||||
3AB508F0154084BE002C7FDE /* Cordova.plist */,
|
||||
3AB508F9154084BE002C7FDE /* MainViewController.xib */,
|
||||
3AB508FD154084BE002C7FDE /* verify.sh */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508D1154084BE002C7FDE /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB5090C1540870B002C7FDE /* ChildBrowser.bundle */,
|
||||
3AB5090D1540870B002C7FDE /* ChildBrowserViewController.xib */,
|
||||
3AB508EE154084BE002C7FDE /* Capture.bundle */,
|
||||
3AB508D2154084BE002C7FDE /* en.lproj */,
|
||||
3AB508D6154084BE002C7FDE /* es.lproj */,
|
||||
3AB508DA154084BE002C7FDE /* de.lproj */,
|
||||
3AB508DE154084BE002C7FDE /* se.lproj */,
|
||||
3AB508E2154084BE002C7FDE /* icons */,
|
||||
3AB508E9154084BE002C7FDE /* splash */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508D2154084BE002C7FDE /* en.lproj */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508D3154084BE002C7FDE /* Localizable.strings */,
|
||||
);
|
||||
name = en.lproj;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508D6154084BE002C7FDE /* es.lproj */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508D7154084BE002C7FDE /* Localizable.strings */,
|
||||
);
|
||||
name = es.lproj;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508DA154084BE002C7FDE /* de.lproj */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508DB154084BE002C7FDE /* Localizable.strings */,
|
||||
);
|
||||
name = de.lproj;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508DE154084BE002C7FDE /* se.lproj */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508DF154084BE002C7FDE /* Localizable.strings */,
|
||||
);
|
||||
name = se.lproj;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508E2154084BE002C7FDE /* icons */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508E3154084BE002C7FDE /* icon.png */,
|
||||
3AB508E5154084BE002C7FDE /* icon@2x.png */,
|
||||
3AB508E7154084BE002C7FDE /* icon-72.png */,
|
||||
);
|
||||
name = icons;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508E9154084BE002C7FDE /* splash */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508EA154084BE002C7FDE /* Default.png */,
|
||||
3AB508EC154084BE002C7FDE /* Default@2x.png */,
|
||||
);
|
||||
name = splash;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508F2154084BE002C7FDE /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB508F3154084BE002C7FDE /* AppDelegate.h */,
|
||||
3AB508F4154084BE002C7FDE /* AppDelegate.m */,
|
||||
3AB508F6154084BE002C7FDE /* MainViewController.h */,
|
||||
3AB508F7154084BE002C7FDE /* MainViewController.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508FB154084BE002C7FDE /* Plugins */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3AB50906154086B0002C7FDE /* ChildBrowserCommand.h */,
|
||||
3AB50907154086B0002C7FDE /* ChildBrowserCommand.m */,
|
||||
3AB50908154086B0002C7FDE /* ChildBrowserViewController.h */,
|
||||
3AB50909154086B0002C7FDE /* ChildBrowserViewController.m */,
|
||||
3AB508FC154084BE002C7FDE /* README */,
|
||||
);
|
||||
name = Plugins;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3AB508A7154084BD002C7FDE /* ChildBrowserExample */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3AB50901154084BE002C7FDE /* Build configuration list for PBXNativeTarget "ChildBrowserExample" */;
|
||||
buildPhases = (
|
||||
3AB508A1154084BD002C7FDE /* Sources */,
|
||||
3AB508A2154084BD002C7FDE /* Frameworks */,
|
||||
3AB508A3154084BD002C7FDE /* Resources */,
|
||||
3AB508A4154084BD002C7FDE /* Sources */,
|
||||
3AB508A5154084BD002C7FDE /* Frameworks */,
|
||||
3AB508A6154084BD002C7FDE /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = ChildBrowserExample;
|
||||
productName = ChildBrowserExample;
|
||||
productReference = 3AB508A8154084BD002C7FDE /* ChildBrowserExample.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
3AB5089C154084BD002C7FDE /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0430;
|
||||
ORGANIZATIONNAME = meusPartum;
|
||||
};
|
||||
buildConfigurationList = 3AB5089F154084BD002C7FDE /* Build configuration list for PBXProject "ChildBrowserExample" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
es,
|
||||
de,
|
||||
se,
|
||||
);
|
||||
mainGroup = 3AB5089A154084BD002C7FDE;
|
||||
productRefGroup = 3AB508A9154084BD002C7FDE /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3AB508A7154084BD002C7FDE /* ChildBrowserExample */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
3AB508A3154084BD002C7FDE /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3AB508CB154084BD002C7FDE /* InfoPlist.strings in Resources */,
|
||||
3AB508D5154084BE002C7FDE /* Localizable.strings in Resources */,
|
||||
3AB508D9154084BE002C7FDE /* Localizable.strings in Resources */,
|
||||
3AB508DD154084BE002C7FDE /* Localizable.strings in Resources */,
|
||||
3AB508E1154084BE002C7FDE /* Localizable.strings in Resources */,
|
||||
3AB508E4154084BE002C7FDE /* icon.png in Resources */,
|
||||
3AB508E6154084BE002C7FDE /* icon@2x.png in Resources */,
|
||||
3AB508E8154084BE002C7FDE /* icon-72.png in Resources */,
|
||||
3AB508EB154084BE002C7FDE /* Default.png in Resources */,
|
||||
3AB508ED154084BE002C7FDE /* Default@2x.png in Resources */,
|
||||
3AB508EF154084BE002C7FDE /* Capture.bundle in Resources */,
|
||||
3AB508F1154084BE002C7FDE /* Cordova.plist in Resources */,
|
||||
3AB508FA154084BE002C7FDE /* MainViewController.xib in Resources */,
|
||||
3AB508FE154084BE002C7FDE /* verify.sh in Resources */,
|
||||
3AB5090515408689002C7FDE /* www in Resources */,
|
||||
3AB5090E1540870B002C7FDE /* ChildBrowser.bundle in Resources */,
|
||||
3AB5090F1540870B002C7FDE /* ChildBrowserViewController.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3AB508A6154084BD002C7FDE /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/bash;
|
||||
shellScript = "\n\t\t\t\t\t\t\t\tchmod 755 \"$PROJECT_DIR/$PROJECT_NAME/verify.sh\"\n\t\t\t\t\t\t\t\t\"$PROJECT_DIR/$PROJECT_NAME/verify.sh\"\n\t\t\t\t\t";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
3AB508A1154084BD002C7FDE /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3AB508CD154084BD002C7FDE /* main.m in Sources */,
|
||||
3AB508F5154084BE002C7FDE /* AppDelegate.m in Sources */,
|
||||
3AB508F8154084BE002C7FDE /* MainViewController.m in Sources */,
|
||||
3AB5090A154086B0002C7FDE /* ChildBrowserCommand.m in Sources */,
|
||||
3AB5090B154086B0002C7FDE /* ChildBrowserViewController.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
3AB508A4154084BD002C7FDE /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
3AB508C9154084BD002C7FDE /* InfoPlist.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3AB508CA154084BD002C7FDE /* en */,
|
||||
);
|
||||
name = InfoPlist.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508D3154084BE002C7FDE /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3AB508D4154084BE002C7FDE /* en */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508D7154084BE002C7FDE /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3AB508D8154084BE002C7FDE /* es */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508DB154084BE002C7FDE /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3AB508DC154084BE002C7FDE /* de */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3AB508DF154084BE002C7FDE /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
3AB508E0154084BE002C7FDE /* se */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
3AB508FF154084BE002C7FDE /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = (
|
||||
armv6,
|
||||
"$(ARCHS_STANDARD_32_BIT)",
|
||||
);
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3AB50900154084BE002C7FDE /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ARCHS = (
|
||||
armv6,
|
||||
"$(ARCHS_STANDARD_32_BIT)",
|
||||
);
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 3.0;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3AB50902154084BE002C7FDE /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = /Users/Shared/Cordova/Frameworks;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "ChildBrowserExample/ChildBrowserExample-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1,",
|
||||
"CORDOVA_FRAMEWORK=1",
|
||||
);
|
||||
INFOPLIST_FILE = "ChildBrowserExample/ChildBrowserExample-Info.plist";
|
||||
OTHER_LDFLAGS = (
|
||||
"-weak_framework",
|
||||
UIKit,
|
||||
"-weak_framework",
|
||||
AVFoundation,
|
||||
"-weak_framework",
|
||||
CoreMedia,
|
||||
"-weak_library",
|
||||
/usr/lib/libSystem.B.dylib,
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3AB50903154084BE002C7FDE /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
COPY_PHASE_STRIP = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
FRAMEWORK_SEARCH_PATHS = /Users/Shared/Cordova/Frameworks;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "ChildBrowserExample/ChildBrowserExample-Prefix.pch";
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"NDEBUG=1,",
|
||||
"CORDOVA_FRAMEWORK=1",
|
||||
);
|
||||
INFOPLIST_FILE = "ChildBrowserExample/ChildBrowserExample-Info.plist";
|
||||
OTHER_LDFLAGS = (
|
||||
"-weak_framework",
|
||||
UIKit,
|
||||
"-weak_framework",
|
||||
AVFoundation,
|
||||
"-weak_framework",
|
||||
CoreMedia,
|
||||
"-weak_library",
|
||||
/usr/lib/libSystem.B.dylib,
|
||||
);
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
WRAPPER_EXTENSION = app;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
3AB5089F154084BD002C7FDE /* Build configuration list for PBXProject "ChildBrowserExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3AB508FF154084BE002C7FDE /* Debug */,
|
||||
3AB50900154084BE002C7FDE /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3AB50901154084BE002C7FDE /* Build configuration list for PBXNativeTarget "ChildBrowserExample" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3AB50902154084BE002C7FDE /* Debug */,
|
||||
3AB50903154084BE002C7FDE /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 3AB5089C154084BD002C7FDE /* Project object */;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:ChildBrowserExample.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3AB508A7154084BD002C7FDE"
|
||||
BuildableName = "ChildBrowserExample.app"
|
||||
BlueprintName = "ChildBrowserExample"
|
||||
ReferencedContainer = "container:ChildBrowserExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3AB508A7154084BD002C7FDE"
|
||||
BuildableName = "ChildBrowserExample.app"
|
||||
BlueprintName = "ChildBrowserExample"
|
||||
ReferencedContainer = "container:ChildBrowserExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3AB508A7154084BD002C7FDE"
|
||||
BuildableName = "ChildBrowserExample.app"
|
||||
BlueprintName = "ChildBrowserExample"
|
||||
ReferencedContainer = "container:ChildBrowserExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "3AB508A7154084BD002C7FDE"
|
||||
BuildableName = "ChildBrowserExample.app"
|
||||
BlueprintName = "ChildBrowserExample"
|
||||
ReferencedContainer = "container:ChildBrowserExample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>ChildBrowserExample.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>3AB508A7154084BD002C7FDE</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
@@ -1,26 +0,0 @@
|
||||
// Created by Jesse MacFadyen on 10-05-29.
|
||||
// Copyright 2010 Nitobi. All rights reserved.
|
||||
// Copyright 2012, Randy McMillan
|
||||
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <CORDOVA/CDVPlugin.h>
|
||||
#else
|
||||
#import "CORDOVA/CDVPlugin.h"
|
||||
#endif
|
||||
#import "ChildBrowserViewController.h"
|
||||
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
@interface ChildBrowserCommand : CDVPlugin <ChildBrowserDelegate> {
|
||||
#endif
|
||||
ChildBrowserViewController* childBrowser;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) ChildBrowserViewController *childBrowser;
|
||||
|
||||
|
||||
- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
|
||||
-(void) onChildLocationChange:(NSString*)newLoc;
|
||||
|
||||
@end
|
||||
@@ -1,81 +0,0 @@
|
||||
// Created by Jesse MacFadyen on 10-05-29.
|
||||
// Copyright 2010 Nitobi. All rights reserved.
|
||||
// Copyright 2012, Randy McMillan
|
||||
|
||||
#import "ChildBrowserCommand.h"
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <Cordova/CDVViewController.h>
|
||||
#else
|
||||
#import "Cordova/CDVViewController.h"
|
||||
#endif
|
||||
|
||||
|
||||
@implementation ChildBrowserCommand
|
||||
|
||||
@synthesize childBrowser;
|
||||
|
||||
- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url
|
||||
{
|
||||
if(childBrowser == NULL)
|
||||
{
|
||||
childBrowser = [[ ChildBrowserViewController alloc ] initWithScale:FALSE ];
|
||||
childBrowser.delegate = self;
|
||||
}
|
||||
|
||||
/* // TODO: Work in progress
|
||||
NSString* strOrientations = [ options objectForKey:@"supportedOrientations"];
|
||||
NSArray* supportedOrientations = [strOrientations componentsSeparatedByString:@","];
|
||||
*/
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
CDVViewController* cont = (CDVViewController*)[ super viewController ];
|
||||
childBrowser.supportedOrientations = cont.supportedOrientations;
|
||||
[ cont presentModalViewController:childBrowser animated:YES ];
|
||||
#endif
|
||||
|
||||
NSString *url = (NSString*) [arguments objectAtIndex:0];
|
||||
|
||||
|
||||
[childBrowser loadURL:url ];
|
||||
|
||||
}
|
||||
- (void) getPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
|
||||
NSString *url = (NSString*) [arguments objectAtIndex:0];
|
||||
[childBrowser loadURL:url ];
|
||||
}
|
||||
|
||||
-(void) close:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url
|
||||
{
|
||||
[ childBrowser closeBrowser];
|
||||
|
||||
}
|
||||
|
||||
-(void) onClose
|
||||
{
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onClose();",@""];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
}
|
||||
|
||||
-(void) onOpenInSafari
|
||||
{
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onOpenExternal();",@""];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
}
|
||||
|
||||
|
||||
-(void) onChildLocationChange:(NSString*)newLoc
|
||||
{
|
||||
|
||||
NSString* tempLoc = [NSString stringWithFormat:@"%@",newLoc];
|
||||
NSString* encUrl = [tempLoc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onLocationChange('%@');",encUrl];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIconFiles</key>
|
||||
<array>
|
||||
<string>icon.png</string>
|
||||
<string>icon@2x.png</string>
|
||||
<string>icon-72.png</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icon.png</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.drewdahlman.ChildBrowserExample</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
<string></string>
|
||||
<key>NSMainNibFile~ipad</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,7 +0,0 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'ChildBrowserExample' target in the 'ChildBrowserExample' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
// Created by Jesse MacFadyen on 10-05-29.
|
||||
// Copyright 2010 Nitobi. All rights reserved.
|
||||
// Copyright 2012, Randy McMillan
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@protocol ChildBrowserDelegate<NSObject>
|
||||
|
||||
|
||||
/*
|
||||
* onChildLocationChanging:newLoc
|
||||
*
|
||||
* Discussion:
|
||||
* Invoked when a new page has loaded
|
||||
*/
|
||||
-(void) onChildLocationChange:(NSString*)newLoc;
|
||||
-(void) onOpenInSafari;
|
||||
-(void) onClose;
|
||||
@end
|
||||
|
||||
|
||||
@interface ChildBrowserViewController : UIViewController < UIWebViewDelegate > {
|
||||
IBOutlet UIWebView* webView;
|
||||
IBOutlet UIBarButtonItem* closeBtn;
|
||||
IBOutlet UIBarButtonItem* refreshBtn;
|
||||
IBOutlet UILabel* addressLabel;
|
||||
IBOutlet UIBarButtonItem* backBtn;
|
||||
IBOutlet UIBarButtonItem* fwdBtn;
|
||||
IBOutlet UIBarButtonItem* safariBtn;
|
||||
IBOutlet UIActivityIndicatorView* spinner;
|
||||
BOOL scaleEnabled;
|
||||
BOOL isImage;
|
||||
NSString* imageURL;
|
||||
NSArray* supportedOrientations;
|
||||
id <ChildBrowserDelegate> delegate;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain)id <ChildBrowserDelegate> delegate;
|
||||
@property (nonatomic, retain) NSArray* supportedOrientations;
|
||||
@property(retain) NSString* imageURL;
|
||||
@property(assign) BOOL isImage;
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation;
|
||||
- (ChildBrowserViewController*)initWithScale:(BOOL)enabled;
|
||||
- (IBAction)onDoneButtonPress:(id)sender;
|
||||
- (IBAction)onSafariButtonPress:(id)sender;
|
||||
- (void)loadURL:(NSString*)url;
|
||||
-(void)closeBrowser;
|
||||
|
||||
@end
|
||||
@@ -1,232 +0,0 @@
|
||||
/// Created by Jesse MacFadyen on 10-05-29.
|
||||
// Copyright 2010 Nitobi. All rights reserved.
|
||||
// Copyright 2012, Randy McMillan
|
||||
|
||||
#import "ChildBrowserViewController.h"
|
||||
|
||||
@implementation ChildBrowserViewController
|
||||
|
||||
@synthesize imageURL;
|
||||
@synthesize supportedOrientations;
|
||||
@synthesize isImage;
|
||||
@synthesize delegate;
|
||||
|
||||
/*
|
||||
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
*/
|
||||
|
||||
+ (NSString*) resolveImageResource:(NSString*)resource
|
||||
{
|
||||
NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
|
||||
BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending);
|
||||
|
||||
// the iPad image (nor retina) differentiation code was not in 3.x, and we have to explicitly set the path
|
||||
if (isLessThaniOS4)
|
||||
{
|
||||
return [NSString stringWithFormat:@"%@.png", resource];
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
- (ChildBrowserViewController*)initWithScale:(BOOL)enabled
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
scaleEnabled = enabled;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
refreshBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/but_refresh"]];
|
||||
backBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_left"]];
|
||||
fwdBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_right"]];
|
||||
safariBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/compass"]];
|
||||
|
||||
webView.delegate = self;
|
||||
webView.scalesPageToFit = TRUE;
|
||||
webView.backgroundColor = [UIColor whiteColor];
|
||||
NSLog(@"View did load");
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
NSLog(@"View did UN-load");
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
|
||||
webView.delegate = nil;
|
||||
|
||||
[webView release];
|
||||
[closeBtn release];
|
||||
[refreshBtn release];
|
||||
[addressLabel release];
|
||||
[backBtn release];
|
||||
[fwdBtn release];
|
||||
[safariBtn release];
|
||||
[spinner release];
|
||||
[ supportedOrientations release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)closeBrowser
|
||||
{
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onClose];
|
||||
}
|
||||
if ([self respondsToSelector:@selector(presentingViewController)]) {
|
||||
//Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan
|
||||
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||
} else {
|
||||
[[self parentViewController] dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
-(IBAction) onDoneButtonPress:(id)sender
|
||||
{
|
||||
[ self closeBrowser];
|
||||
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
|
||||
[webView loadRequest:request];
|
||||
}
|
||||
|
||||
|
||||
-(IBAction) onSafariButtonPress:(id)sender
|
||||
{
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onOpenInSafari];
|
||||
}
|
||||
|
||||
if(isImage)
|
||||
{
|
||||
NSURL* pURL = [ [NSURL alloc] initWithString:imageURL ];
|
||||
[ [ UIApplication sharedApplication ] openURL:pURL ];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSURLRequest *request = webView.request;
|
||||
[[UIApplication sharedApplication] openURL:request.URL];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
|
||||
{
|
||||
BOOL autoRotate = [self.supportedOrientations count] > 1; // autorotate if only more than 1 orientation supported
|
||||
if (autoRotate)
|
||||
{
|
||||
if ([self.supportedOrientations containsObject:
|
||||
[NSNumber numberWithInt:interfaceOrientation]]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)loadURL:(NSString*)url
|
||||
{
|
||||
NSLog(@"Opening Url : %@",url);
|
||||
|
||||
if( [url hasSuffix:@".png" ] ||
|
||||
[url hasSuffix:@".jpg" ] ||
|
||||
[url hasSuffix:@".jpeg" ] ||
|
||||
[url hasSuffix:@".bmp" ] ||
|
||||
[url hasSuffix:@".gif" ] )
|
||||
{
|
||||
[ imageURL release ];
|
||||
imageURL = [url copy];
|
||||
isImage = YES;
|
||||
NSString* htmlText = @"<html><body style='background-color:#333;margin:0px;padding:0px;'><img style='min-height:200px;margin:0px;padding:0px;width:100%;height:auto;' alt='' src='IMGSRC'/></body></html>";
|
||||
htmlText = [ htmlText stringByReplacingOccurrencesOfString:@"IMGSRC" withString:url ];
|
||||
|
||||
[webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@""]];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
imageURL = @"";
|
||||
isImage = NO;
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
|
||||
[webView loadRequest:request];
|
||||
}
|
||||
webView.hidden = NO;
|
||||
}
|
||||
|
||||
|
||||
- (void)webViewDidStartLoad:(UIWebView *)sender {
|
||||
addressLabel.text = @"Loading...";
|
||||
backBtn.enabled = webView.canGoBack;
|
||||
fwdBtn.enabled = webView.canGoForward;
|
||||
|
||||
[ spinner startAnimating ];
|
||||
|
||||
}
|
||||
|
||||
- (void)webViewDidFinishLoad:(UIWebView *)sender
|
||||
{
|
||||
NSURLRequest *request = webView.request;
|
||||
NSLog(@"New Address is : %@",request.URL.absoluteString);
|
||||
addressLabel.text = request.URL.absoluteString;
|
||||
backBtn.enabled = webView.canGoBack;
|
||||
fwdBtn.enabled = webView.canGoForward;
|
||||
[ spinner stopAnimating ];
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onChildLocationChange:request.URL.absoluteString];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*- (void)webView:(UIWebView *)wv didFailLoadWithError:(NSError *)error {
|
||||
NSLog (@"webView:didFailLoadWithError");
|
||||
[spinner stopAnimating];
|
||||
addressLabel.text = @"Failed";
|
||||
if (error != NULL) {
|
||||
UIAlertView *errorAlert = [[UIAlertView alloc]
|
||||
initWithTitle: [error localizedDescription]
|
||||
message: [error localizedFailureReason]
|
||||
delegate:nil
|
||||
cancelButtonTitle:@"OK"
|
||||
otherButtonTitles:nil];
|
||||
[errorAlert show];
|
||||
[errorAlert release];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,875 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">768</int>
|
||||
<string key="IBDocument.SystemVersion">10K540</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">851</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.36</string>
|
||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">141</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="191373211">
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">292</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIWebView" id="345761693">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">-2147483374</int>
|
||||
<string key="NSFrameSize">{480, 229}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSNextKeyView" ref="471899933"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">1</int>
|
||||
<bytes key="NSRGB">MCAwIDAAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIMultipleTouchEnabled">YES</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIDataDetectorTypes">1</int>
|
||||
<bool key="IBUIDetectsPhoneNumbers">YES</bool>
|
||||
</object>
|
||||
<object class="IBUIToolbar" id="471899933">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{0, 256}, {480, 44}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSNextKeyView" ref="349240355"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIBarStyle">1</int>
|
||||
<object class="NSMutableArray" key="IBUIItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIBarButtonItem" id="966737436">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<int key="IBUIStyle">1</int>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
<int key="IBUISystemItemIdentifier">0</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="312951844">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="615970053">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="111711024">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="227415391">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<float key="IBUIWidth">32</float>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="766205236">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="283287216">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<float key="IBUIWidth">32</float>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="129413107">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="1046195837">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<float key="IBUIWidth">32</float>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="667527307">
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<reference key="IBUIToolbar" ref="471899933"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUILabel" id="349240355">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">270</int>
|
||||
<string key="NSFrame">{{5, 230}, {418, 21}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<reference key="NSNextKeyView" ref="89602979"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">4</int>
|
||||
<bytes key="NSWhite">MC42NjY2NjY2OSAwAA</bytes>
|
||||
</object>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClipsSubviews">YES</bool>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<string key="IBUIText">Loading...</string>
|
||||
<object class="NSFont" key="IBUIFont">
|
||||
<string key="NSName">Helvetica</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">16</int>
|
||||
</object>
|
||||
<object class="NSColor" key="IBUITextColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
</object>
|
||||
<nil key="IBUIHighlightedColor"/>
|
||||
<int key="IBUIBaselineAdjustment">1</int>
|
||||
<bool key="IBUIAdjustsFontSizeToFit">NO</bool>
|
||||
<float key="IBUIMinimumFontSize">10</float>
|
||||
</object>
|
||||
<object class="IBUIActivityIndicatorView" id="89602979">
|
||||
<reference key="NSNextResponder" ref="191373211"/>
|
||||
<int key="NSvFlags">-2147483383</int>
|
||||
<string key="NSFrame">{{454, 231}, {20, 20}}</string>
|
||||
<reference key="NSSuperview" ref="191373211"/>
|
||||
<bool key="IBUIOpaque">NO</bool>
|
||||
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
|
||||
<bool key="IBUIUserInteractionEnabled">NO</bool>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{0, 20}, {480, 300}}</string>
|
||||
<reference key="NSNextKeyView" ref="345761693"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MC41AA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
|
||||
<int key="interfaceOrientation">3</int>
|
||||
</object>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">webView</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="345761693"/>
|
||||
</object>
|
||||
<int key="connectionID">17</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">addressLabel</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="349240355"/>
|
||||
</object>
|
||||
<int key="connectionID">18</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">backBtn</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="227415391"/>
|
||||
</object>
|
||||
<int key="connectionID">19</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">fwdBtn</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="283287216"/>
|
||||
</object>
|
||||
<int key="connectionID">22</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">refreshBtn</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="615970053"/>
|
||||
</object>
|
||||
<int key="connectionID">23</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onDoneButtonPress:</string>
|
||||
<reference key="source" ref="966737436"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">26</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">reload</string>
|
||||
<reference key="source" ref="615970053"/>
|
||||
<reference key="destination" ref="345761693"/>
|
||||
</object>
|
||||
<int key="connectionID">27</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">goBack</string>
|
||||
<reference key="source" ref="227415391"/>
|
||||
<reference key="destination" ref="345761693"/>
|
||||
</object>
|
||||
<int key="connectionID">28</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">goForward</string>
|
||||
<reference key="source" ref="283287216"/>
|
||||
<reference key="destination" ref="345761693"/>
|
||||
</object>
|
||||
<int key="connectionID">29</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||
<string key="label">onSafariButtonPress:</string>
|
||||
<reference key="source" ref="1046195837"/>
|
||||
<reference key="destination" ref="372490531"/>
|
||||
</object>
|
||||
<int key="connectionID">31</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">35</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">spinner</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="89602979"/>
|
||||
</object>
|
||||
<int key="connectionID">36</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">safariBtn</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="1046195837"/>
|
||||
</object>
|
||||
<int key="connectionID">40</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<reference key="object" ref="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="471899933"/>
|
||||
<reference ref="349240355"/>
|
||||
<reference ref="89602979"/>
|
||||
<reference ref="345761693"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">4</int>
|
||||
<reference key="object" ref="345761693"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">6</int>
|
||||
<reference key="object" ref="471899933"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="966737436"/>
|
||||
<reference ref="615970053"/>
|
||||
<reference ref="227415391"/>
|
||||
<reference ref="283287216"/>
|
||||
<reference ref="1046195837"/>
|
||||
<reference ref="111711024"/>
|
||||
<reference ref="129413107"/>
|
||||
<reference ref="312951844"/>
|
||||
<reference ref="667527307"/>
|
||||
<reference ref="766205236"/>
|
||||
</object>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">7</int>
|
||||
<reference key="object" ref="966737436"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">8</int>
|
||||
<reference key="object" ref="615970053"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
<string key="objectName">Bar Button Item (Reload)</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">9</int>
|
||||
<reference key="object" ref="227415391"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
<string key="objectName">Bar Button Item (Go Back)</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">10</int>
|
||||
<reference key="object" ref="283287216"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
<string key="objectName">Bar Button Item (Go Forward)</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">11</int>
|
||||
<reference key="object" ref="1046195837"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
<string key="objectName">Bar Button Item (Safari)</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">13</int>
|
||||
<reference key="object" ref="349240355"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">14</int>
|
||||
<reference key="object" ref="111711024"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">15</int>
|
||||
<reference key="object" ref="129413107"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">32</int>
|
||||
<reference key="object" ref="89602979"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">37</int>
|
||||
<reference key="object" ref="312951844"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">38</int>
|
||||
<reference key="object" ref="667527307"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">39</int>
|
||||
<reference key="object" ref="766205236"/>
|
||||
<reference key="parent" ref="471899933"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.CustomClassName</string>
|
||||
<string>-2.CustomClassName</string>
|
||||
<string>1.IBEditorWindowLastContentRect</string>
|
||||
<string>1.IBPluginDependency</string>
|
||||
<string>10.IBPluginDependency</string>
|
||||
<string>11.IBPluginDependency</string>
|
||||
<string>13.IBPluginDependency</string>
|
||||
<string>13.IBViewBoundsToFrameTransform</string>
|
||||
<string>14.IBPluginDependency</string>
|
||||
<string>15.IBPluginDependency</string>
|
||||
<string>32.IBPluginDependency</string>
|
||||
<string>32.IBViewBoundsToFrameTransform</string>
|
||||
<string>37.IBPluginDependency</string>
|
||||
<string>38.IBPluginDependency</string>
|
||||
<string>39.IBPluginDependency</string>
|
||||
<string>4.IBPluginDependency</string>
|
||||
<string>4.IBViewBoundsToFrameTransform</string>
|
||||
<string>6.IBPluginDependency</string>
|
||||
<string>6.IBViewBoundsToFrameTransform</string>
|
||||
<string>7.IBPluginDependency</string>
|
||||
<string>8.IBPluginDependency</string>
|
||||
<string>9.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>ChildBrowserViewController</string>
|
||||
<string>UIResponder</string>
|
||||
<string>{{250, 643}, {480, 320}}</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABCoAAAwygAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABD5gAAw3kAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABB8AAAwwUAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAw10AAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">40</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">ChildBrowserViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>onDoneButtonPress:</string>
|
||||
<string>onSafariButtonPress:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>onDoneButtonPress:</string>
|
||||
<string>onSafariButtonPress:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">onDoneButtonPress:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">onSafariButtonPress:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>addressLabel</string>
|
||||
<string>backBtn</string>
|
||||
<string>closeBtn</string>
|
||||
<string>delegate</string>
|
||||
<string>fwdBtn</string>
|
||||
<string>refreshBtn</string>
|
||||
<string>safariBtn</string>
|
||||
<string>spinner</string>
|
||||
<string>webView</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>UILabel</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>id</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIActivityIndicatorView</string>
|
||||
<string>UIWebView</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>addressLabel</string>
|
||||
<string>backBtn</string>
|
||||
<string>closeBtn</string>
|
||||
<string>delegate</string>
|
||||
<string>fwdBtn</string>
|
||||
<string>refreshBtn</string>
|
||||
<string>safariBtn</string>
|
||||
<string>spinner</string>
|
||||
<string>webView</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">addressLabel</string>
|
||||
<string key="candidateClassName">UILabel</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">backBtn</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">closeBtn</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">delegate</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">fwdBtn</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">refreshBtn</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">safariBtn</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">spinner</string>
|
||||
<string key="candidateClassName">UIActivityIndicatorView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">webView</string>
|
||||
<string key="candidateClassName">UIWebView</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">Plugins/ChildBrowser/ChildBrowserViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="485348283">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIActivityIndicatorView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIActivityIndicatorView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIBarButtonItem</string>
|
||||
<string key="superclassName">UIBarItem</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIBarItem</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UILabel</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UILabel.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIResponder</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<reference key="sourceIdentifier" ref="485348283"/>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchBar</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UISearchDisplayController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIToolbar</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIToolbar.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIView</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">MediaPlayer.framework/Headers/MPMoviePlayerViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIViewController</string>
|
||||
<string key="superclassName">UIResponder</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">UIWebView</string>
|
||||
<string key="superclassName">UIView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">UIKit.framework/Headers/UIWebView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<integer value="768" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
|
||||
<integer value="1056" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">141</string>
|
||||
</data>
|
||||
</archive>
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// AppDelegate.h
|
||||
// ChildBrowserExample
|
||||
//
|
||||
// Created by Andrew Dahlman on 4/19/12.
|
||||
// Copyright meusPartum 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <Cordova/CDVViewController.h>
|
||||
#else
|
||||
#import "CDVViewController.h"
|
||||
#endif
|
||||
|
||||
|
||||
@interface AppDelegate : NSObject < UIApplicationDelegate > {
|
||||
|
||||
}
|
||||
|
||||
// invoke string is passed to your app on launch, this is only valid if you
|
||||
// edit ChildBrowserExample-Info.plist to add a protocol
|
||||
// a simple tutorial can be found here :
|
||||
// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIWindow* window;
|
||||
@property (nonatomic, retain) IBOutlet CDVViewController* viewController;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// AppDelegate.m
|
||||
// ChildBrowserExample
|
||||
//
|
||||
// Created by Andrew Dahlman on 4/19/12.
|
||||
// Copyright meusPartum 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "MainViewController.h"
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <Cordova/CDVPlugin.h>
|
||||
#import <Cordova/CDVURLProtocol.h>
|
||||
#else
|
||||
#import "CDVPlugin.h"
|
||||
#import "CDVURLProtocol.h"
|
||||
#endif
|
||||
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
@synthesize window, viewController;
|
||||
|
||||
- (id) init
|
||||
{
|
||||
/** If you need to do any extra app-specific initialization, you can do it here
|
||||
* -jm
|
||||
**/
|
||||
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
|
||||
[cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
|
||||
|
||||
[CDVURLProtocol registerURLProtocol];
|
||||
|
||||
return [super init];
|
||||
}
|
||||
|
||||
#pragma UIApplicationDelegate implementation
|
||||
|
||||
/**
|
||||
* This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
|
||||
*/
|
||||
- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
|
||||
{
|
||||
NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
|
||||
NSString* invokeString = nil;
|
||||
|
||||
if (url && [url isKindOfClass:[NSURL class]]) {
|
||||
invokeString = [url absoluteString];
|
||||
NSLog(@"ChildBrowserExample launchOptions = %@", url);
|
||||
}
|
||||
|
||||
CGRect screenBounds = [[UIScreen mainScreen] bounds];
|
||||
self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
|
||||
self.window.autoresizesSubviews = YES;
|
||||
|
||||
CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
|
||||
|
||||
self.viewController = [[[MainViewController alloc] init] autorelease];
|
||||
self.viewController.useSplashScreen = YES;
|
||||
self.viewController.wwwFolderName = @"www";
|
||||
self.viewController.startPage = @"index.html";
|
||||
self.viewController.invokeString = invokeString;
|
||||
self.viewController.view.frame = viewBounds;
|
||||
|
||||
// check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation
|
||||
BOOL forceStartupRotation = YES;
|
||||
UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
|
||||
|
||||
if (UIDeviceOrientationUnknown == curDevOrientation) {
|
||||
// UIDevice isn't firing orientation notifications yet… go look at the status bar
|
||||
curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
|
||||
}
|
||||
|
||||
if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) {
|
||||
for (NSNumber *orient in self.viewController.supportedOrientations) {
|
||||
if ([orient intValue] == curDevOrientation) {
|
||||
forceStartupRotation = NO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (forceStartupRotation) {
|
||||
NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations);
|
||||
// The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait)
|
||||
UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0] intValue];
|
||||
NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation);
|
||||
[[UIApplication sharedApplication] setStatusBarOrientation:newOrient];
|
||||
}
|
||||
|
||||
[self.window addSubview:self.viewController.view];
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// this happens while we are running ( in the background, or from within our own app )
|
||||
// only valid if ChildBrowserExample-Info.plist specifies a protocol to handle
|
||||
- (BOOL) application:(UIApplication*)application handleOpenURL:(NSURL*)url
|
||||
{
|
||||
if (!url) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
// calls into javascript global function 'handleOpenURL'
|
||||
NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url];
|
||||
[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
|
||||
// all plugins will get the notification, and their handlers will be called
|
||||
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// MainViewController.h
|
||||
// ChildBrowserExample
|
||||
//
|
||||
// Created by Andrew Dahlman on 4/19/12.
|
||||
// Copyright meusPartum 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#ifdef CORDOVA_FRAMEWORK
|
||||
#import <Cordova/CDVViewController.h>
|
||||
#else
|
||||
#import "CDVViewController.h"
|
||||
#endif
|
||||
|
||||
@interface MainViewController : CDVViewController
|
||||
|
||||
@end
|
||||
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
//
|
||||
// MainViewController.h
|
||||
// ChildBrowserExample
|
||||
//
|
||||
// Created by Andrew Dahlman on 4/19/12.
|
||||
// Copyright meusPartum 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MainViewController.h"
|
||||
|
||||
@implementation MainViewController
|
||||
|
||||
- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) didReceiveMemoryWarning
|
||||
{
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
#pragma mark - View lifecycle
|
||||
|
||||
- (void) viewDidLoad
|
||||
{
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
}
|
||||
|
||||
- (void) viewDidUnload
|
||||
{
|
||||
[super viewDidUnload];
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
}
|
||||
|
||||
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
|
||||
{
|
||||
// Return YES for supported orientations
|
||||
return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
|
||||
}
|
||||
|
||||
/* Comment out the block below to over-ride */
|
||||
/*
|
||||
#pragma CDVCommandDelegate implementation
|
||||
|
||||
- (id) getCommandInstance:(NSString*)className
|
||||
{
|
||||
return [super getCommandInstance:className];
|
||||
}
|
||||
|
||||
- (BOOL) execute:(CDVInvokedUrlCommand*)command
|
||||
{
|
||||
return [super execute:command];
|
||||
}
|
||||
|
||||
- (NSString*) pathForResource:(NSString*)resourcepath;
|
||||
{
|
||||
return [super pathForResource:resourcepath];
|
||||
}
|
||||
|
||||
- (void) registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
|
||||
{
|
||||
return [super registerPlugin:plugin withClassName:className];
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma UIWebDelegate implementation
|
||||
|
||||
- (void) webViewDidFinishLoad:(UIWebView*) theWebView
|
||||
{
|
||||
// only valid if ___PROJECTNAME__-Info.plist specifies a protocol to handle
|
||||
if (self.invokeString)
|
||||
{
|
||||
// this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
|
||||
NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
|
||||
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
}
|
||||
|
||||
// Black base color for background matches the native apps
|
||||
theWebView.backgroundColor = [UIColor blackColor];
|
||||
|
||||
return [super webViewDidFinishLoad:theWebView];
|
||||
}
|
||||
|
||||
/* Comment out the block below to over-ride */
|
||||
/*
|
||||
|
||||
- (void) webViewDidStartLoad:(UIWebView*)theWebView
|
||||
{
|
||||
return [super webViewDidStartLoad:theWebView];
|
||||
}
|
||||
|
||||
- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
|
||||
{
|
||||
return [super webView:theWebView didFailLoadWithError:error];
|
||||
}
|
||||
|
||||
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
|
||||
{
|
||||
return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -1,118 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1280</int>
|
||||
<string key="IBDocument.SystemVersion">11C25</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">1919</string>
|
||||
<string key="IBDocument.AppKitVersion">1138.11</string>
|
||||
<string key="IBDocument.HIToolboxVersion">566.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="NS.object.0">916</string>
|
||||
</object>
|
||||
<array key="IBDocument.IntegratedClassDependencies">
|
||||
<string>IBProxyObject</string>
|
||||
<string>IBUIView</string>
|
||||
</array>
|
||||
<array key="IBDocument.PluginDependencies">
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</array>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
|
||||
<object class="IBProxyObject" id="372490531">
|
||||
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBProxyObject" id="975951072">
|
||||
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
<object class="IBUIView" id="191373211">
|
||||
<reference key="NSNextResponder"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<object class="NSColor" key="IBUIBackgroundColor">
|
||||
<int key="NSColorSpace">3</int>
|
||||
<bytes key="NSWhite">MQA</bytes>
|
||||
<object class="NSColorSpace" key="NSCustomColorSpace">
|
||||
<int key="NSID">2</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
|
||||
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<array class="NSMutableArray" key="connectionRecords">
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">view</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="191373211"/>
|
||||
</object>
|
||||
<int key="connectionID">3</int>
|
||||
</object>
|
||||
</array>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<array key="orderedObjects">
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<array key="object" id="0"/>
|
||||
<reference key="children" ref="1000"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">1</int>
|
||||
<reference key="object" ref="191373211"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="372490531"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="975951072"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<dictionary class="NSMutableDictionary" key="flattenedProperties">
|
||||
<string key="-1.CustomClassName">MainViewController</string>
|
||||
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="-2.CustomClassName">UIResponder</string>
|
||||
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</dictionary>
|
||||
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
|
||||
<nil key="activeLocalization"/>
|
||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">3</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MainViewController</string>
|
||||
<string key="superclassName">UIViewController</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MainViewController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</array>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<string key="IBCocoaTouchPluginVersion">916</string>
|
||||
</data>
|
||||
</archive>
|
||||
@@ -1,61 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIWebViewBounce</key>
|
||||
<true/>
|
||||
<key>TopActivityIndicator</key>
|
||||
<string>gray</string>
|
||||
<key>EnableLocation</key>
|
||||
<false/>
|
||||
<key>EnableViewportScale</key>
|
||||
<false/>
|
||||
<key>AutoHideSplashScreen</key>
|
||||
<true/>
|
||||
<key>ShowSplashScreenSpinner</key>
|
||||
<true/>
|
||||
<key>MediaPlaybackRequiresUserAction</key>
|
||||
<false/>
|
||||
<key>AllowInlineMediaPlayback</key>
|
||||
<false/>
|
||||
<key>OpenAllWhitelistURLsInWebView</key>
|
||||
<false/>
|
||||
<key>ExternalHosts</key>
|
||||
<array>
|
||||
<string>*</string>
|
||||
</array>
|
||||
<key>Plugins</key>
|
||||
<dict>
|
||||
<key>ChildBrowserCommand</key>
|
||||
<string>ChildBrowserCommand</string>
|
||||
<key>Compass</key>
|
||||
<string>CDVLocation</string>
|
||||
<key>Accelerometer</key>
|
||||
<string>CDVAccelerometer</string>
|
||||
<key>Camera</key>
|
||||
<string>CDVCamera</string>
|
||||
<key>NetworkStatus</key>
|
||||
<string>CDVConnection</string>
|
||||
<key>Contacts</key>
|
||||
<string>CDVContacts</string>
|
||||
<key>Debug Console</key>
|
||||
<string>CDVDebugConsole</string>
|
||||
<key>File</key>
|
||||
<string>CDVFile</string>
|
||||
<key>FileTransfer</key>
|
||||
<string>CDVFileTransfer</string>
|
||||
<key>Geolocation</key>
|
||||
<string>CDVLocation</string>
|
||||
<key>Notification</key>
|
||||
<string>CDVNotification</string>
|
||||
<key>Media</key>
|
||||
<string>CDVSound</string>
|
||||
<key>Capture</key>
|
||||
<string>CDVCapture</string>
|
||||
<key>SplashScreen</key>
|
||||
<string>CDVSplashScreen</string>
|
||||
<key>Battery</key>
|
||||
<string>CDVBattery</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1 +0,0 @@
|
||||
Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder.
|
||||
|
Before Width: | Height: | Size: 955 B |
|
Before Width: | Height: | Size: 971 B |
|
Before Width: | Height: | Size: 969 B |
|
Before Width: | Height: | Size: 70 KiB |
|
Before Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 385 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 973 B |
|
Before Width: | Height: | Size: 990 B |
|
Before Width: | Height: | Size: 996 B |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
|
||||
// accessibility label for recording button
|
||||
"toggle audio recording" = "starten/beenden der Tonaufnahme";
|
||||
// notification spoken by VoiceOver when timed recording finishes
|
||||
"timed recording complete" = "programmierte Aufnahme beendet";
|
||||
// accessibility hint for display of recorded elapsed time
|
||||
"recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden";
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// accessibility label for recording button
|
||||
"toggle audio recording" = "toggle audio recording";
|
||||
// notification spoken by VoiceOver when timed recording finishes
|
||||
"timed recording complete" = "timed recording complete";
|
||||
// accessibility hint for display of recorded elapsed time
|
||||
"recorded time in minutes and seconds" = "recorded time in minutes and seconds";
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
// accessibility label for recording button
|
||||
"toggle audio recording" = "grabación de audio cambiar";
|
||||
// notification spoken by VoiceOver when timed recording finishes
|
||||
"timed recording complete" = "tiempo de grabación completo";
|
||||
// accessibility hint for display of recorded elapsed time
|
||||
"recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos";
|
||||
|
Before Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 7.7 KiB |
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
|
||||
|
||||
// accessibility label for recording button
|
||||
"toggle audio recording" = "börja/avsluta inspelning";
|
||||
// notification spoken by VoiceOver when timed recording finishes
|
||||
"timed recording complete" = "inspelning har avslutad";
|
||||
// accessibility hint for display of recorded elapsed time
|
||||
"recorded time in minutes and seconds" = "inspelad tid in minuter och sekund";
|
||||
|
Before Width: | Height: | Size: 92 KiB |
|
Before Width: | Height: | Size: 342 KiB |
@@ -1,2 +0,0 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
*/
|
||||
//
|
||||
// main.m
|
||||
// ChildBrowserExample
|
||||
//
|
||||
// Created by Andrew Dahlman on 4/19/12.
|
||||
// Copyright meusPartum 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
if [ ! -d "$PROJECT_DIR/www" ] ; then
|
||||
cp -R /Users/Shared/Cordova/Frameworks/Cordova.framework/www "$PROJECT_DIR"
|
||||
fi
|
||||
# detect www folder reference in project, if missing, print warning
|
||||
grep "{isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = \"<group>\"; };" "$PROJECT_DIR/$PROJECT_NAME.xcodeproj/project.pbxproj"
|
||||
rc=$?
|
||||
if [ $rc != 0 ] ; then
|
||||
echo -e "warning: Missing - Add $PROJECT_DIR/www as a folder reference in your project. Just drag and drop the folder into your project, into the Project Navigator of Xcode 4. Make sure you select the second radio-button: 'Create folder references for any added folders' (which will create a blue folder)" 1>&2
|
||||
fi
|
||||
@@ -1,69 +0,0 @@
|
||||
/* MIT licensed */
|
||||
// (c) 2012 Jesse MacFadyen, Nitobi
|
||||
|
||||
/*global Cordova */
|
||||
|
||||
function ChildBrowser()
|
||||
{
|
||||
// Does nothing
|
||||
}
|
||||
// Callback when the location of the page changes
|
||||
// called from native
|
||||
ChildBrowser._onLocationChange = function(newLoc)
|
||||
{
|
||||
window.plugins.childBrowser.onLocationChange(newLoc);
|
||||
};
|
||||
// Callback when the user chooses the 'Done' button
|
||||
// called from native
|
||||
ChildBrowser._onClose = function()
|
||||
{
|
||||
window.plugins.childBrowser.onClose();
|
||||
};
|
||||
// Callback when the user chooses the 'open in Safari' button
|
||||
// called from native
|
||||
ChildBrowser._onOpenExternal = function()
|
||||
{
|
||||
window.plugins.childBrowser.onOpenExternal();
|
||||
};
|
||||
// Pages loaded into the ChildBrowser can execute callback scripts, so be careful to
|
||||
// check location, and make sure it is a location you trust.
|
||||
// Warning ... don't exec arbitrary code, it's risky and could fuck up your app.
|
||||
// called from native
|
||||
ChildBrowser._onJSCallback = function(js,loc)
|
||||
{
|
||||
// Not Implemented
|
||||
//window.plugins.childBrowser.onJSCallback(js,loc);
|
||||
};
|
||||
/* The interface that you will use to access functionality */
|
||||
|
||||
// Show a webpage, will result in a callback to onLocationChange
|
||||
ChildBrowser.prototype.showWebPage = function(loc)
|
||||
{
|
||||
cordova.exec("ChildBrowserCommand.showWebPage", loc);
|
||||
};
|
||||
ChildBrowser.prototype.getPage = function(loc){
|
||||
cordova.exec("ChildBrowserCommand.getPage",loc);
|
||||
}
|
||||
// close the browser, will NOT result in close callback
|
||||
ChildBrowser.prototype.close = function()
|
||||
{
|
||||
cordova.exec("ChildBrowserCommand.close");
|
||||
};
|
||||
// Not Implemented
|
||||
ChildBrowser.prototype.jsExec = function(jsString)
|
||||
{
|
||||
// Not Implemented!!
|
||||
//Cordova.exec("ChildBrowserCommand.jsExec",jsString);
|
||||
};
|
||||
// Note: this plugin does NOT install itself, call this method some time after deviceready to install it
|
||||
// it will be returned, and also available globally from window.plugins.childBrowser
|
||||
ChildBrowser.install = function()
|
||||
{
|
||||
if(!window.plugins)
|
||||
{
|
||||
window.plugins = {
|
||||
};
|
||||
}
|
||||
window.plugins.childBrowser = new ChildBrowser();
|
||||
return window.plugins.childBrowser;
|
||||
};
|
||||
@@ -1,71 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
<!-- iPad/iPhone specific css below, add after your main css >
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
|
||||
-->
|
||||
<!-- If your application is targeting iOS BEFORE 4.0 you MUST put json2.js from http://www.JSON.org/json2.js into your www directory and include it here -->
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
|
||||
<script src='ChildBrowser.js'></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
// If you want to prevent dragging, uncomment this section
|
||||
/*
|
||||
function preventBehavior(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
};
|
||||
document.addEventListener("touchmove", preventBehavior, false);
|
||||
*/
|
||||
|
||||
/* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
|
||||
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
|
||||
for more details -jm */
|
||||
/*
|
||||
function handleOpenURL(url)
|
||||
{
|
||||
// TODO: do something with the url passed in.
|
||||
}
|
||||
*/
|
||||
|
||||
function onBodyLoad()
|
||||
{
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
/* When this function is called, Cordova has been initialized and is ready to roll */
|
||||
/* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
|
||||
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
|
||||
for more details -jm */
|
||||
function onDeviceReady()
|
||||
{
|
||||
// do your thing!
|
||||
|
||||
ChildBrowser.install();
|
||||
window.plugins.childBrowser.showWebPage('http://www.google.com');
|
||||
setTimeout('goNew()',2500);
|
||||
}
|
||||
function goNew(){
|
||||
window.plugins.childBrowser.getPage('http://www.phonegap.com');
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onBodyLoad()">
|
||||
<h1>Hey, it's Cordova!</h1>
|
||||
<p>Don't know how to get started? Check out our <em><a target="_blank" href="http://docs.phonegap.com/en/edge/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS">Getting Started Guide</a></em>
|
||||
<br />
|
||||
<ol>
|
||||
<li>Check your console log for any white-list rejection errors.</li>
|
||||
<li>Add your allowed <strong>hosts</strong> in Cordova.plist/ExternalHosts (wildcards OK, don't enter the URL scheme)</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,64 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
<!-- iPad/iPhone specific css below, add after your main css >
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
|
||||
-->
|
||||
<!-- If your application is targeting iOS BEFORE 4.0 you MUST put json2.js from http://www.JSON.org/json2.js into your www directory and include it here -->
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.6.0.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
// If you want to prevent dragging, uncomment this section
|
||||
/*
|
||||
function preventBehavior(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
};
|
||||
document.addEventListener("touchmove", preventBehavior, false);
|
||||
*/
|
||||
|
||||
/* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
|
||||
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
|
||||
for more details -jm */
|
||||
/*
|
||||
function handleOpenURL(url)
|
||||
{
|
||||
// TODO: do something with the url passed in.
|
||||
}
|
||||
*/
|
||||
|
||||
function onBodyLoad()
|
||||
{
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
/* When this function is called, Cordova has been initialized and is ready to roll */
|
||||
/* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
|
||||
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
|
||||
for more details -jm */
|
||||
function onDeviceReady()
|
||||
{
|
||||
// do your thing!
|
||||
navigator.notification.alert("Cordova is working")
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onBodyLoad()">
|
||||
<h1>Hey, it's Cordova!</h1>
|
||||
<p>Don't know how to get started? Check out our <em><a target="_blank" href="http://docs.phonegap.com/en/edge/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS">Getting Started Guide</a></em>
|
||||
<br />
|
||||
<ol>
|
||||
<li>Check your console log for any white-list rejection errors.</li>
|
||||
<li>Add your allowed <strong>hosts</strong> in Cordova.plist/ExternalHosts (wildcards OK, don't enter the URL scheme)</li>
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/*
|
||||
* onChildLocationChanging:newLoc
|
||||
*
|
||||
*
|
||||
* Discussion:
|
||||
* Invoked when a new page has loaded
|
||||
*/
|
||||
@@ -20,27 +20,27 @@
|
||||
|
||||
|
||||
@interface ChildBrowserViewController : UIViewController < UIWebViewDelegate > {
|
||||
IBOutlet UIWebView* webView;
|
||||
IBOutlet UIBarButtonItem* closeBtn;
|
||||
IBOutlet UIBarButtonItem* refreshBtn;
|
||||
IBOutlet UILabel* addressLabel;
|
||||
IBOutlet UIBarButtonItem* backBtn;
|
||||
IBOutlet UIBarButtonItem* fwdBtn;
|
||||
IBOutlet UIBarButtonItem* safariBtn;
|
||||
IBOutlet UIActivityIndicatorView* spinner;
|
||||
BOOL scaleEnabled;
|
||||
BOOL isImage;
|
||||
NSString* imageURL;
|
||||
NSArray* supportedOrientations;
|
||||
id <ChildBrowserDelegate> delegate;
|
||||
IBOutlet UIWebView* webView;
|
||||
IBOutlet UIBarButtonItem* closeBtn;
|
||||
IBOutlet UIBarButtonItem* refreshBtn;
|
||||
IBOutlet UILabel* addressLabel;
|
||||
IBOutlet UIBarButtonItem* backBtn;
|
||||
IBOutlet UIBarButtonItem* fwdBtn;
|
||||
IBOutlet UIBarButtonItem* safariBtn;
|
||||
IBOutlet UIActivityIndicatorView* spinner;
|
||||
BOOL scaleEnabled;
|
||||
BOOL isImage;
|
||||
NSString* imageURL;
|
||||
NSArray* supportedOrientations;
|
||||
id <ChildBrowserDelegate> delegate;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain)id <ChildBrowserDelegate> delegate;
|
||||
@property (nonatomic, retain) NSArray* supportedOrientations;
|
||||
@property (nonatomic, retain) NSArray* supportedOrientations;
|
||||
@property(retain) NSString* imageURL;
|
||||
@property(assign) BOOL isImage;
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation;
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation;
|
||||
- (ChildBrowserViewController*)initWithScale:(BOOL)enabled;
|
||||
- (IBAction)onDoneButtonPress:(id)sender;
|
||||
- (IBAction)onSafariButtonPress:(id)sender;
|
||||
|
||||
@@ -23,82 +23,82 @@
|
||||
|
||||
+ (NSString*) resolveImageResource:(NSString*)resource
|
||||
{
|
||||
NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
|
||||
BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending);
|
||||
|
||||
// the iPad image (nor retina) differentiation code was not in 3.x, and we have to explicitly set the path
|
||||
if (isLessThaniOS4)
|
||||
{
|
||||
NSString* systemVersion = [[UIDevice currentDevice] systemVersion];
|
||||
BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending);
|
||||
|
||||
// the iPad image (nor retina) differentiation code was not in 3.x, and we have to explicitly set the path
|
||||
if (isLessThaniOS4) {
|
||||
return [NSString stringWithFormat:@"%@.png", resource];
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES && [[UIScreen mainScreen] scale] == 2.00) {
|
||||
return [NSString stringWithFormat:@"%@-72@2x.png", resource];
|
||||
}
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
|
||||
- (ChildBrowserViewController*)initWithScale:(BOOL)enabled
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
scaleEnabled = enabled;
|
||||
|
||||
return self;
|
||||
scaleEnabled = enabled;
|
||||
return self;
|
||||
}
|
||||
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[super viewDidLoad];
|
||||
|
||||
refreshBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/but_refresh"]];
|
||||
backBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_left"]];
|
||||
fwdBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_right"]];
|
||||
safariBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/compass"]];
|
||||
refreshBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/but_refresh"]];
|
||||
backBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_left"]];
|
||||
fwdBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_right"]];
|
||||
safariBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/compass"]];
|
||||
|
||||
webView.delegate = self;
|
||||
webView.scalesPageToFit = TRUE;
|
||||
webView.backgroundColor = [UIColor whiteColor];
|
||||
NSLog(@"View did load");
|
||||
webView.delegate = self;
|
||||
webView.scalesPageToFit = TRUE;
|
||||
webView.backgroundColor = [UIColor whiteColor];
|
||||
NSLog(@"View did load");
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
NSLog(@"View did UN-load");
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
NSLog(@"View did UN-load");
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
|
||||
webView.delegate = nil;
|
||||
|
||||
[webView release];
|
||||
[closeBtn release];
|
||||
[refreshBtn release];
|
||||
[addressLabel release];
|
||||
[backBtn release];
|
||||
[fwdBtn release];
|
||||
[safariBtn release];
|
||||
[spinner release];
|
||||
[ supportedOrientations release];
|
||||
[super dealloc];
|
||||
webView.delegate = nil;
|
||||
|
||||
[webView release];
|
||||
[closeBtn release];
|
||||
[refreshBtn release];
|
||||
[addressLabel release];
|
||||
[backBtn release];
|
||||
[fwdBtn release];
|
||||
[safariBtn release];
|
||||
[spinner release];
|
||||
[ supportedOrientations release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)closeBrowser
|
||||
{
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onClose];
|
||||
}
|
||||
|
||||
if(delegate != NULL) {
|
||||
[delegate onClose];
|
||||
}
|
||||
if ([self respondsToSelector:@selector(presentingViewController)]) {
|
||||
//Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan
|
||||
[[self presentingViewController] dismissViewControllerAnimated:YES completion:nil];
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
-(IBAction) onDoneButtonPress:(id)sender
|
||||
{
|
||||
[ self closeBrowser];
|
||||
[ self closeBrowser];
|
||||
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
|
||||
[webView loadRequest:request];
|
||||
@@ -118,38 +118,38 @@
|
||||
|
||||
-(IBAction) onSafariButtonPress:(id)sender
|
||||
{
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onOpenInSafari];
|
||||
}
|
||||
|
||||
if(isImage)
|
||||
{
|
||||
NSURL* pURL = [ [NSURL alloc] initWithString:imageURL ];
|
||||
[ [ UIApplication sharedApplication ] openURL:pURL ];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSURLRequest *request = webView.request;
|
||||
[[UIApplication sharedApplication] openURL:request.URL];
|
||||
}
|
||||
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onOpenInSafari];
|
||||
}
|
||||
|
||||
if(isImage)
|
||||
{
|
||||
NSURL* pURL = [ [NSURL alloc] initWithString:imageURL ];
|
||||
[ [ UIApplication sharedApplication ] openURL:pURL ];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSURLRequest *request = webView.request;
|
||||
[[UIApplication sharedApplication] openURL:request.URL];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
|
||||
{
|
||||
BOOL autoRotate = [self.supportedOrientations count] > 1; // autorotate if only more than 1 orientation supported
|
||||
if (autoRotate)
|
||||
{
|
||||
if ([self.supportedOrientations containsObject:
|
||||
[NSNumber numberWithInt:interfaceOrientation]]) {
|
||||
return YES;
|
||||
}
|
||||
BOOL autoRotate = [self.supportedOrientations count] > 1; // autorotate if only more than 1 orientation supported
|
||||
if (autoRotate)
|
||||
{
|
||||
if ([self.supportedOrientations containsObject:
|
||||
[NSNumber numberWithInt:interfaceOrientation]]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,56 +157,56 @@
|
||||
|
||||
- (void)loadURL:(NSString*)url
|
||||
{
|
||||
NSLog(@"Opening Url : %@",url);
|
||||
|
||||
if( [url hasSuffix:@".png" ] ||
|
||||
[url hasSuffix:@".jpg" ] ||
|
||||
[url hasSuffix:@".jpeg" ] ||
|
||||
[url hasSuffix:@".bmp" ] ||
|
||||
[url hasSuffix:@".gif" ] )
|
||||
{
|
||||
[ imageURL release ];
|
||||
imageURL = [url copy];
|
||||
isImage = YES;
|
||||
NSString* htmlText = @"<html><body style='background-color:#333;margin:0px;padding:0px;'><img style='min-height:200px;margin:0px;padding:0px;width:100%;height:auto;' alt='' src='IMGSRC'/></body></html>";
|
||||
htmlText = [ htmlText stringByReplacingOccurrencesOfString:@"IMGSRC" withString:url ];
|
||||
NSLog(@"Opening Url : %@",url);
|
||||
|
||||
[webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@""]];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
imageURL = @"";
|
||||
isImage = NO;
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
|
||||
[webView loadRequest:request];
|
||||
}
|
||||
webView.hidden = NO;
|
||||
if( [url hasSuffix:@".png" ] ||
|
||||
[url hasSuffix:@".jpg" ] ||
|
||||
[url hasSuffix:@".jpeg" ] ||
|
||||
[url hasSuffix:@".bmp" ] ||
|
||||
[url hasSuffix:@".gif" ] )
|
||||
{
|
||||
[ imageURL release ];
|
||||
imageURL = [url copy];
|
||||
isImage = YES;
|
||||
NSString* htmlText = @"<html><body style='background-color:#333;margin:0px;padding:0px;'><img style='min-height:200px;margin:0px;padding:0px;width:100%;height:auto;' alt='' src='IMGSRC'/></body></html>";
|
||||
htmlText = [ htmlText stringByReplacingOccurrencesOfString:@"IMGSRC" withString:url ];
|
||||
|
||||
[webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@""]];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
imageURL = @"";
|
||||
isImage = NO;
|
||||
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
|
||||
[webView loadRequest:request];
|
||||
}
|
||||
webView.hidden = NO;
|
||||
}
|
||||
|
||||
|
||||
- (void)webViewDidStartLoad:(UIWebView *)sender {
|
||||
addressLabel.text = @"Loading...";
|
||||
backBtn.enabled = webView.canGoBack;
|
||||
fwdBtn.enabled = webView.canGoForward;
|
||||
|
||||
[ spinner startAnimating ];
|
||||
|
||||
addressLabel.text = @"Loading...";
|
||||
backBtn.enabled = webView.canGoBack;
|
||||
fwdBtn.enabled = webView.canGoForward;
|
||||
|
||||
[ spinner startAnimating ];
|
||||
|
||||
}
|
||||
|
||||
- (void)webViewDidFinishLoad:(UIWebView *)sender
|
||||
{
|
||||
NSURLRequest *request = webView.request;
|
||||
NSLog(@"New Address is : %@",request.URL.absoluteString);
|
||||
addressLabel.text = request.URL.absoluteString;
|
||||
backBtn.enabled = webView.canGoBack;
|
||||
fwdBtn.enabled = webView.canGoForward;
|
||||
[ spinner stopAnimating ];
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onChildLocationChange:request.URL.absoluteString];
|
||||
}
|
||||
NSURLRequest *request = webView.request;
|
||||
NSLog(@"New Address is : %@",request.URL.absoluteString);
|
||||
addressLabel.text = request.URL.absoluteString;
|
||||
backBtn.enabled = webView.canGoBack;
|
||||
fwdBtn.enabled = webView.canGoForward;
|
||||
[ spinner stopAnimating ];
|
||||
|
||||
if(delegate != NULL)
|
||||
{
|
||||
[delegate onChildLocationChange:request.URL.absoluteString];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -226,7 +226,4 @@
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
BIN
iOS/ChildBrowser/Cordova.plist.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
@@ -1,79 +1,61 @@
|
||||
UPDATED March 7 2012 for Cordova 1.5 - @RandyMcMillan
|
||||
This version contains a sterile Cordova naming convention. No backwards support intended for this iOS version.
|
||||
Tested on Lion / Xcode 4.2 (4D199) and iPhone Simulator: 5.0: (9A334)
|
||||
Tested on Mnt Lion / Xcode Version 4.4 (4F90) and iPhone Simulator: 5.0: (9A334)
|
||||
The ChildBrowser allows you to display external webpages within your [PhoneGap](http://phonegap.com/) application.
|
||||
|
||||
For backwards support reference: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ChildBrowser
|
||||
=================================
|
||||
- For back support reference:<br>
|
||||
[https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ChildBrowser
|
||||
](https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ChildBrowser)
|
||||
|
||||
The child browser allows you to display external webpages within your Cordova application.
|
||||
|
||||
A simple use case would be:
|
||||
|
||||
- Users can follow links/buttons to view web content without leaving your app.
|
||||
- Display web pages/images/videos/pdfs in the ChildBrowser.
|
||||
|
||||
This command creates a popup browser that is shown in front of your app, when the user presses the done button they are simply returned to your app ( actually they never left )
|
||||
This command creates a popup browser that is shown in front of your app, when the user presses the DONE button they are simply returned to your app ( actually they never left ).
|
||||
|
||||
The ChildBrowser has buttons for refreshing, navigating back + forwards, as well as the option to open in Safari.
|
||||
|
||||
Note, because this is open source, I could not include the graphics I usually use for the back/forward and safari buttons. I have changed the XIB file to use system buttons ( rewind / fast-forward + action ) Ideally you should modify the XIB to use your own look.
|
||||
Icons are located in the [ChildBrowser.bundle](https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ChildBrowser/ChildBrowser.bundle) and can be customized. Added Retina -72@2x.png image support to fix small icons in the webview toolbar when displayed on Retina devices.
|
||||
|
||||
Here is a sample command to open google in a ChildBrowser :
|
||||
- Added Temporary Scope (self executing) per [Cordova Plugin Upgrade Guide](https://github.com/phonegap/phonegap-plugins/blob/master/iOS/README.md).
|
||||
|
||||
|
||||
|
||||
|
||||
- add Key **ChildBrowserCommand** and Value **ChildBrowserCommand** to the Cordova.plist in your application xcode project.
|
||||
|
||||

|
||||
|
||||
Here is a sample command to open Google in a ChildBrowser :
|
||||
|
||||
Cordova.exec("ChildBrowserCommand.showWebPage", "http://www.google.com" );
|
||||
cordova.exec("ChildBrowserCommand.showWebPage", "http://www.google.com" );
|
||||
|
||||
=================================
|
||||
|
||||
June 1, 2010
|
||||
Added support for orientations, supportedOrientations are passed through to the child view controller. -jm
|
||||
###Sample use:
|
||||
|
||||
|
||||
function onDeviceReady() {
|
||||
|
||||
================================
|
||||
var root = this;
|
||||
cb = window.plugins.childBrowser;
|
||||
|
||||
Sept 13, 2010
|
||||
+ added callbacks for location change, close, opening in safari,
|
||||
+ added method to close the browser from js.
|
||||
( This should allow easy additions for facebook connect as you can monitor the browser's address and respond accordingly. )
|
||||
+ added images to the XIB, these need to be attached as resources in your xcode project.
|
||||
|
||||
Sample use:
|
||||
|
||||
<code>
|
||||
var root = this;
|
||||
|
||||
/* When this function is called, PhoneGap has been initialized and is ready to roll */
|
||||
function onDeviceReady()
|
||||
{
|
||||
var cb = ChildBrowser.install();
|
||||
if(cb != null)
|
||||
{
|
||||
if(cb != null) {
|
||||
cb.onLocationChange = function(loc){ root.locChanged(loc); };
|
||||
cb.onClose = function(){root.onCloseBrowser()};
|
||||
cb.onOpenExternal = function(){root.onOpenExternal();};
|
||||
cb.onClose = function(){root.onCloseBrowser(); };
|
||||
cb.onOpenExternal = function(){root.onOpenExternal(); };
|
||||
cb.showWebPage("http://google.com");
|
||||
|
||||
window.plugins.childBrowser.showWebPage("http://google.com");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onCloseBrowser()
|
||||
{
|
||||
alert("In index.html child browser closed");
|
||||
}
|
||||
|
||||
function locChanged(loc)
|
||||
{
|
||||
alert("In index.html new loc = " + loc);
|
||||
}
|
||||
|
||||
function onOpenExternal()
|
||||
{
|
||||
alert("In index.html onOpenExternal");
|
||||
}
|
||||
</code>
|
||||
|
||||
function onCloseBrowser() {
|
||||
console.log("onCloseBrowser!");
|
||||
}
|
||||
|
||||
function locChanged(loc) {
|
||||
console.log("locChanged!");
|
||||
}
|
||||
|
||||
function onOpenExternal() {
|
||||
alert("onOpenExternal!");
|
||||
}
|
||||
|
||||
|
||||
95
iOS/ChildBrowser/index.html
Normal file
@@ -0,0 +1,95 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
|
||||
<meta charset="utf-8">
|
||||
|
||||
|
||||
<!-- iPad/iPhone specific css below, add after your main css >
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 1024px)" href="ipad.css" type="text/css" />
|
||||
<link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="iphone.css" type="text/css" />
|
||||
-->
|
||||
<!-- If your application is targeting iOS BEFORE 4.0 you MUST put json2.js from http://www.JSON.org/json2.js into your www directory and include it here -->
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="ChildBrowser.js"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-WebInspector.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
// If you want to prevent dragging, uncomment this section
|
||||
/*
|
||||
function preventBehavior(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
};
|
||||
document.addEventListener("touchmove", preventBehavior, false);
|
||||
*/
|
||||
|
||||
/* If you are supporting your own protocol, the var invokeString will contain any arguments to the app launch.
|
||||
see http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
|
||||
for more details -jm */
|
||||
/*
|
||||
function handleOpenURL(url)
|
||||
{
|
||||
// TODO: do something with the url passed in.
|
||||
}
|
||||
*/
|
||||
|
||||
function onBodyLoad()
|
||||
{
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* When this function is called, PhoneGap has been initialized and is ready to roll */
|
||||
function onDeviceReady() {
|
||||
|
||||
var root = this;
|
||||
|
||||
cb = window.plugins.childBrowser;
|
||||
|
||||
if (cb != null) {
|
||||
cb.onLocationChange = function(loc){ root.locChanged(loc); };
|
||||
cb.onClose = function(){root.onCloseBrowser()};
|
||||
cb.onOpenExternal = function(){root.onOpenExternal();};
|
||||
cb.showWebPage("http://google.com");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onCloseBrowser() {
|
||||
console.log("onCloseBrowser!");
|
||||
}
|
||||
|
||||
function locChanged(loc) {
|
||||
console.log("locChanged!");
|
||||
}
|
||||
|
||||
function onOpenExternal() {
|
||||
console.log("onOpenExternal!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="onBodyLoad()">
|
||||
<h1>Hey, it's Cordova!</h1>
|
||||
<p>Don't know how to get started? Check out our <em><a target="_blank" href="http://docs.phonegap.com/en/edge/guide_getting-started_ios_index.md.html#Getting%20Started%20with%20iOS">Getting Started Guide</a></em>
|
||||
<br />
|
||||
<ol>
|
||||
<li>Check your console log for any white-list rejection errors.</li>
|
||||
<li>Add your allowed <strong>hosts</strong> in Cordova.plist/ExternalHosts (wildcards OK, don't enter the URL scheme)</li>
|
||||
</ol>
|
||||
|
||||
<button onclick="cb.showWebPage('http://google.com');">Click to open ChildBrowser!</button>
|
||||
</body>
|
||||
</html>
|
||||
18
iOS/Diagnostic/Diagnostic.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Diagnostic.h
|
||||
// Plugin diagnostic
|
||||
//
|
||||
// Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
//
|
||||
|
||||
#import <Cordova/CDVPlugin.h>
|
||||
|
||||
@interface Diagnostic : CDVPlugin
|
||||
|
||||
- (void) isLocationEnabled: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options;
|
||||
- (void) isLocationEnabledOnly: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options;
|
||||
- (void) isLocationAuthorized: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options;
|
||||
- (void) isWifiEnabled: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options;
|
||||
- (void) isCameraEnabled: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options;
|
||||
|
||||
@end
|
||||
209
iOS/Diagnostic/Diagnostic.m
Normal file
@@ -0,0 +1,209 @@
|
||||
//
|
||||
// Diagnostic.m
|
||||
// Plugin diagnostic
|
||||
//
|
||||
// Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
//
|
||||
|
||||
#import "Diagnostic.h"
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
#import <arpa/inet.h> // For AF_INET, etc.
|
||||
#import <ifaddrs.h> // For getifaddrs()
|
||||
#import <net/if.h> // For IFF_LOOPBACK
|
||||
|
||||
@implementation Diagnostic
|
||||
|
||||
|
||||
- (void) isLocationEnabled: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options
|
||||
{
|
||||
NSString * callbackId = [arguments objectAtIndex:0];
|
||||
NSLog(@"Loading Location status...");
|
||||
CDVPluginResult* pluginResult;
|
||||
if([self isLocationEnabled] && [self isLocationAuthorized])
|
||||
{
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:1];
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:0];
|
||||
|
||||
}
|
||||
[self writeJavascript: [pluginResult toSuccessCallbackString:callbackId]];
|
||||
|
||||
}
|
||||
|
||||
- (void) isLocationEnabledSetting: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options
|
||||
{
|
||||
NSString * callbackId = [arguments objectAtIndex:0];
|
||||
NSLog(@"Loading Location status...");
|
||||
CDVPluginResult* pluginResult;
|
||||
if([self isLocationEnabled])
|
||||
{
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:1];
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:0];
|
||||
|
||||
}
|
||||
[self writeJavascript: [pluginResult toSuccessCallbackString:callbackId]];
|
||||
|
||||
}
|
||||
|
||||
- (void) isLocationAuthorized: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options
|
||||
{
|
||||
NSString * callbackId = [arguments objectAtIndex:0];
|
||||
NSLog(@"Loading Location authentication...");
|
||||
CDVPluginResult* pluginResult;
|
||||
if([self isLocationAuthorized])
|
||||
{
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:1];
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:0];
|
||||
|
||||
}
|
||||
[self writeJavascript: [pluginResult toSuccessCallbackString:callbackId]];
|
||||
|
||||
}
|
||||
|
||||
- (BOOL) isLocationEnabled
|
||||
{
|
||||
|
||||
if([CLLocationManager locationServicesEnabled])
|
||||
{
|
||||
NSLog(@"Location is enabled.");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
NSLog(@"Location is disabled.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (BOOL) isLocationAuthorized
|
||||
{
|
||||
|
||||
if([CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied)
|
||||
{
|
||||
NSLog(@"This app is authorized to use location.");
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
NSLog(@"This app is not authorized to use location.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (void) isWifiEnabled: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options
|
||||
{
|
||||
NSString * callbackId = [arguments objectAtIndex:0];
|
||||
NSLog(@"Loading WiFi status...");
|
||||
CDVPluginResult* pluginResult;
|
||||
if([self connectedToWifi])
|
||||
{
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:1];
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:0];
|
||||
|
||||
}
|
||||
[self writeJavascript: [pluginResult toSuccessCallbackString:callbackId]];
|
||||
|
||||
}
|
||||
|
||||
- (BOOL) connectedToWifi // Don't work on iOS Simulator, only in the device
|
||||
{
|
||||
struct ifaddrs *addresses;
|
||||
struct ifaddrs *cursor;
|
||||
BOOL wiFiAvailable = NO;
|
||||
|
||||
if (getifaddrs(&addresses) != 0)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
cursor = addresses;
|
||||
|
||||
while (cursor != NULL)
|
||||
{
|
||||
if (cursor -> ifa_addr -> sa_family == AF_INET && !(cursor -> ifa_flags & IFF_LOOPBACK)) // Ignore the loopback address
|
||||
{
|
||||
// Check for WiFi adapter
|
||||
|
||||
if (strcmp(cursor -> ifa_name, "en0") == 0) {
|
||||
|
||||
NSLog(@"Wifi ON");
|
||||
wiFiAvailable = YES;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cursor = cursor -> ifa_next;
|
||||
}
|
||||
|
||||
freeifaddrs(addresses);
|
||||
return wiFiAvailable;
|
||||
}
|
||||
|
||||
- (void) isCameraEnabled: (NSMutableArray*)arguments withDict:(NSMutableDictionary*) options
|
||||
{
|
||||
NSString * callbackId = [arguments objectAtIndex:0];
|
||||
NSLog(@"Loading camera status...");
|
||||
CDVPluginResult* pluginResult;
|
||||
if([self isCameraEnabled])
|
||||
{
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:1];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:0];
|
||||
|
||||
}
|
||||
[self writeJavascript: [pluginResult toSuccessCallbackString:callbackId]];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isCameraEnabled
|
||||
{
|
||||
|
||||
BOOL cameraAvailable =
|
||||
[UIImagePickerController
|
||||
isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
|
||||
if(cameraAvailable)
|
||||
{
|
||||
NSLog(@"Camera enabled");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Camera disabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
206
iOS/Diagnostic/README.md
Normal file
@@ -0,0 +1,206 @@
|
||||
# Diagnostic plugin for PhoneGap #
|
||||
|
||||
The diagnostic plugin allows you to check different device settings in your PhoneGap application.
|
||||
|
||||
A simple use case would be:
|
||||
|
||||
- Your app require geolocation and you want check if the location services are enabled in device settings.
|
||||
- Your app require the Wi-Fi enabled for the wireless network location and you want check if the Wi-Fi is enabled in device settings.
|
||||
- Your app require the camera enabled and you want check if the camera is enabled in device settings.
|
||||
|
||||
## Adding the Plugin to your project ##
|
||||
|
||||
Using this plugin requires a PhoneGap project for iOS: [Get Started Guide](http://phonegap.com/start#ios-x4).
|
||||
|
||||
1. To install the plugin, move _diagnostic.js_ to your project's _www_ folder and include a reference to it in your _html_ file after _cordova.js_:
|
||||
|
||||
<pre>
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-X.X.X.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="diagnostic.js"></script>
|
||||
</pre>
|
||||
|
||||
2. Move _Diagnostic.h_ and _Diagnostic.m_ files into _Plugins_ folder.
|
||||
3. And edit _Cordova.plist_ creating a new entry in the _Plugins_ section as follows:
|
||||
|
||||
<pre>
|
||||
- Key: Diagnostic
|
||||
- Type: String
|
||||
- Value: Diagnostic
|
||||
</pre>
|
||||
|
||||
## Using the plugin ##
|
||||
|
||||
The plugin creates the object:
|
||||
<pre>
|
||||
window.plugins.diagnostic
|
||||
</pre>
|
||||
To use, call one of the following, available methods:
|
||||
|
||||
|
||||
- isLocationEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks if location is enabled (Device setting for location and authorization).
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isLocationEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isLocationEnabled(locationEnabledSuccessCallback, locationEnabledErrorCallback);
|
||||
|
||||
function locationEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Location ON");
|
||||
else
|
||||
alert("Location OFF");
|
||||
}
|
||||
|
||||
function locationEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- isLocationEnabledSetting:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks device settings for location.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isLocationEnabledSetting()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isLocationEnabledSetting(locationEnabledSettingSuccessCallback, locationEnabledSettingErrorCallback);
|
||||
|
||||
function locationEnabledSettingSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Location ON");
|
||||
else
|
||||
alert("Location OFF");
|
||||
}
|
||||
|
||||
function locationEnabledSettingErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- isLocationAuthorized:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isLocationAuthorized()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isLocationAuthorized(locationAuthorizedSuccessCallback, locationAuthorizedErrorCallback);
|
||||
|
||||
function locationAuthorizedSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Authorized to use location");
|
||||
else
|
||||
alert("Not authorized to use location");
|
||||
}
|
||||
|
||||
function locationAuthorizedErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- isWifiEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks if exists Wi-Fi connection.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of Wi-Fi is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of Wi-Fi encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isWifiEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isWifiEnabled(wifiEnabledSuccessCallback, wifiEnabledErrorCallback);
|
||||
|
||||
function wifiEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Wi-Fi ON");
|
||||
else
|
||||
alert("Wi-Fi OFF");
|
||||
}
|
||||
|
||||
function wifiEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
- isCameraEnabled:
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Checks if exists camera.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of camera is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of camera encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
isCameraEnabled()
|
||||
</pre>
|
||||
|
||||
Usage:
|
||||
|
||||
<pre>
|
||||
window.plugins.diagnostic.isCameraEnabled(cameraEnabledSuccessCallback, cameraEnabledErrorCallback);
|
||||
|
||||
function cameraEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
alert("Camera ON");
|
||||
else
|
||||
alert("Camera OFF");
|
||||
}
|
||||
|
||||
function cameraEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
## LICENSE ##
|
||||
|
||||
Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
|
||||
The MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
102
iOS/Diagnostic/diagnostic.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* Plugin diagnostic
|
||||
*
|
||||
* Copyright (c) 2012 AVANTIC ESTUDIO DE INGENIEROS
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
var Diagnostic = function() {
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if location is enabled (Device setting for location and authorization).
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
|
||||
Diagnostic.prototype.isLocationEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isLocationEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks device settings for location.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
|
||||
Diagnostic.prototype.isLocationEnabledSetting = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isLocationEnabledSetting',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the application is authorized to use location.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of location is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of location encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
|
||||
Diagnostic.prototype.isLocationAuthorized = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isLocationAuthorized',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if exists Wi-Fi connection.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of Wi-Fi is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of Wi-Fi encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
|
||||
Diagnostic.prototype.isWifiEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isWifiEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if exists camera.
|
||||
*
|
||||
* @param successCallback The callback which will be called when diagnostic of camera is successful.
|
||||
* This callback function have a boolean param with the diagnostic result.
|
||||
* @param errorCallback The callback which will be called when diagnostic of camera encounters an error.
|
||||
* This callback function have a string param with the error.
|
||||
*/
|
||||
|
||||
|
||||
Diagnostic.prototype.isCameraEnabled = function(successCallback, errorCallback) {
|
||||
return cordova.exec(successCallback,
|
||||
errorCallback,
|
||||
'Diagnostic',
|
||||
'isCameraEnabled',
|
||||
[]);
|
||||
};
|
||||
|
||||
cordova.addConstructor(function() {
|
||||
if(!window.plugins)
|
||||
window.plugins = {};
|
||||
window.plugins.diagnostic = new Diagnostic();
|
||||
});
|
||||
22
iOS/Diagnostic/example/www/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="diagnostic.js"></script>
|
||||
</head>
|
||||
<body onload="onLoad()">
|
||||
|
||||
<h1>Welcome to my test app.</h1>
|
||||
|
||||
<ul>
|
||||
<li>Checking the diagnostics plugin.</li>
|
||||
<li>Press the button to go to the diagnostics page.</li>
|
||||
</ul>
|
||||
<button type="button" onclick="location.href = 'status.html'" >Diagnostics</button>
|
||||
</body>
|
||||
</html>
|
||||
123
iOS/Diagnostic/example/www/init.js
Normal file
@@ -0,0 +1,123 @@
|
||||
|
||||
|
||||
function onLoad() {
|
||||
document.addEventListener("deviceready", onDeviceReady, false);
|
||||
}
|
||||
|
||||
function onDeviceReady() {
|
||||
|
||||
|
||||
|
||||
// To know if the location is turned ON/OFF and if the app is allowed to use it.
|
||||
window.plugins.diagnostic.isLocationEnabled(locationEnabledSuccessCallback, locationEnabledErrorCallback);
|
||||
|
||||
function locationEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
{
|
||||
//alert("Location ON");
|
||||
document.getElementById('location').innerHTML = 'ON';
|
||||
|
||||
//alert("Location Setting ON");
|
||||
document.getElementById('locationSetting').innerHTML = 'ON';
|
||||
|
||||
//alert("Auth Location ON");
|
||||
document.getElementById('locationAuthorization').innerHTML = 'ON';
|
||||
|
||||
function locationAuthorizedErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert("Location OFF");
|
||||
document.getElementById('location').innerHTML = 'OFF';
|
||||
// To know if the location is turned ON/OFF.
|
||||
window.plugins.diagnostic.isLocationEnabledSetting(locationEnabledSettingSuccessCallback, locationEnabledSettingErrorCallback);
|
||||
|
||||
function locationEnabledSettingSuccessCallback(result) {
|
||||
if (result)
|
||||
{
|
||||
//alert("Location Setting ON");
|
||||
document.getElementById('locationSetting').innerHTML = 'ON';
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert("Location Setting OFF");
|
||||
document.getElementById('locationSetting').innerHTML = 'OFF';
|
||||
}
|
||||
}
|
||||
|
||||
function locationEnabledSettingErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
// To know if the app is allowed to use it.
|
||||
window.plugins.diagnostic.isLocationAuthorized(locationAuthorizedSuccessCallback, locationAuthorizedErrorCallback);
|
||||
|
||||
function locationAuthorizedSuccessCallback(result) {
|
||||
if (result)
|
||||
{
|
||||
//alert("Auth Location ON");
|
||||
document.getElementById('locationAuthorization').innerHTML = 'ON';
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert("Auth Location OFF");
|
||||
document.getElementById('locationAuthorization').innerHTML = 'OFF';
|
||||
}
|
||||
}
|
||||
|
||||
function locationAuthorizedErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function locationEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
|
||||
// To know if the WiFi is turned ON/OFF.
|
||||
window.plugins.diagnostic.isWifiEnabled(wifiEnabledSuccessCallback, wifiEnabledErrorCallback);
|
||||
|
||||
function wifiEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
{
|
||||
//alert("WiFi ON");
|
||||
document.getElementById('wifi').innerHTML = 'ON';
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert("WiFi OFF");
|
||||
document.getElementById('wifi').innerHTML = 'OFF';
|
||||
}
|
||||
}
|
||||
|
||||
function wifiEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
// To know if the camera is enabled.
|
||||
window.plugins.diagnostic.isCameraEnabled(cameraEnabledSuccessCallback, cameraEnabledErrorCallback);
|
||||
|
||||
function cameraEnabledSuccessCallback(result) {
|
||||
if (result)
|
||||
{
|
||||
//alert("Camera ON");
|
||||
document.getElementById('camera').innerHTML = 'ON';
|
||||
}
|
||||
else
|
||||
{
|
||||
//alert("Camera OFF");
|
||||
document.getElementById('camera').innerHTML = 'OFF';
|
||||
}
|
||||
}
|
||||
|
||||
function cameraEnabledErrorCallback(error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
31
iOS/Diagnostic/example/www/status.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
|
||||
<meta charset="utf-8">
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0rc1.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="diagnostic.js"></script>
|
||||
<script type="text/javascript" charset="utf-8" src="init.js"></script>
|
||||
</head>
|
||||
|
||||
<body onload="onLoad()">
|
||||
|
||||
<h1>Diagnostics.</h1>
|
||||
<p>
|
||||
The diagnostic of the iPhone's settings.
|
||||
</p>
|
||||
<ul>
|
||||
<li >Location: <span id="location"></span></li>
|
||||
<ul>
|
||||
<li >Location setting: <span id="locationSetting"></span></li>
|
||||
<li >Location authorization: <span id="locationAuthorization"></span></li>
|
||||
</ul>
|
||||
<li>WiFi Connection: <span id="wifi"></span></li>
|
||||
<li>Camera: <span id="camera"></span></li>
|
||||
</ul>
|
||||
<button type="button" onclick="location.href = 'status.html'" >Refresh</button>
|
||||
</body>
|
||||
</html>
|
||||
90
iOS/LowLatencyAudio/README.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
LowLatencyAudio plugin for PhoneGap/Apache Cordova
|
||||
Developed by Andrew Trice - http://tricedesigns.com
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY ANDREW TRICE "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
EVENT SHALL ANDREW TRICE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
You can read more about this plugin at:
|
||||
http://www.tricedesigns.com/2012/01/25/low-latency-polyphonic-audio-in-phonegap/
|
||||
|
||||
The low latency audio plugin is designed to enable low latency and polyphonic audio from PhoneGap applications, using a very simple and basic API.
|
||||
|
||||
Getting started:
|
||||
Add the following files to your PhoneGap Plugins directory (and add to XCode Project):
|
||||
LowLatencyAudio.h
|
||||
LowLatencyAudio.m
|
||||
LowLatencyAudioAsset.h
|
||||
LowLatencyAudioAsset.m
|
||||
|
||||
Add the following file to your www directory, and add to index.html:
|
||||
LowLatencyAudio.js
|
||||
|
||||
Add an entry to your PhoneGap.plist file under plugins:
|
||||
Key: LowLatencyAudio
|
||||
Type: String
|
||||
Value: LowLatencyAudio
|
||||
|
||||
Note: If you are using automated reference counting (ARC), you may need to remove retain/release statements.
|
||||
|
||||
Usage:
|
||||
1) Preload the audio asset
|
||||
Note: Make sure to wait for phonegap deviceready event before atteptimpting to load assets
|
||||
2) Play the audio asset
|
||||
3) When done, unload the audio asset
|
||||
|
||||
API methods:
|
||||
preloadFX: function ( id, assetPath, success, fail)
|
||||
params: ID - string unique ID for the audio file
|
||||
assetPath - the relative path to the audio asset within the www directory
|
||||
success - success callback function
|
||||
fail - error/fail callback function
|
||||
detail:
|
||||
The preloadFX function loads an audio file into memory. Assets that are loaded using preloadFX are managed/played using AudioServices methods from the AudioToolbox framework. These are very low-level audio methods and have minimal overhead. Audio loaded using this function is played using AudioServicesPlaySystemSound. These assets should be short, and are not intended to be looped or stopped. They are fully concurrent and polyphonic.
|
||||
|
||||
preloadAudio: function ( id, assetPath, voices, success, fail)
|
||||
params: ID - string unique ID for the audio file
|
||||
assetPath - the relative path to the audio asset within the www directory
|
||||
voices - the number of polyphonic voices available
|
||||
success - success callback function
|
||||
fail - error/fail callback function
|
||||
detail:
|
||||
The preloadAudio function loads an audio file into memory. Assets that are loaded using preloadAudio are managed/played using AVAudioPlayer. These have more overhead than assets laoded via preloadFX, and can be looped/stopped. By default, there is a single "voice" - only one instance that will be stopped & restarted when you hit play. If there are multiple voices (number greater than 0), it will cycle through voices to play overlapping audio.
|
||||
|
||||
play: function (id, success, fail)
|
||||
params: ID - string unique ID for the audio file
|
||||
success - success callback function
|
||||
fail - error/fail callback function
|
||||
detail:
|
||||
Plays an audio asset
|
||||
|
||||
loop: function (id, success, fail)
|
||||
params: ID - string unique ID for the audio file
|
||||
success - success callback function
|
||||
fail - error/fail callback function
|
||||
detail:
|
||||
Loops an audio asset infinitely - this only works for assets loaded via preloadAudio
|
||||
|
||||
stop: function (id, success, fail)
|
||||
params: ID - string unique ID for the audio file
|
||||
success - success callback function
|
||||
fail - error/fail callback function
|
||||
detail:
|
||||
Stops an audio file - this only works for assets loaded via preloadAudio
|
||||
|
||||
unload: function (id, success, fail)
|
||||
params: ID - string unique ID for the audio file
|
||||
success - success callback function
|
||||
fail - error/fail callback function
|
||||
detail:
|
||||
Unloads an audio file from memory
|
||||
|
||||
|
||||
|
||||