-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ludei/develop
Develop
- Loading branch information
Showing
10 changed files
with
196 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,35 @@ | ||
webview-plus-ios | ||
================ | ||
|
||
This project is a plugin for cordova apps that provides a WKWebView as a replacement for UIWebView that includes the Nitro JS engine. | ||
# Webview+ for iOs # | ||
|
||
This project is a plugin for cordova/phonegap apps, and provides a replacement for **the UIWebView that includes the Nitro JS engine based on the WKWebView**. | ||
|
||
Looking for [Webview+ for Android](https://github.com/ludei/webview-plus)? | ||
|
||
## Webview+ Features, Advantages and Benefits ## | ||
|
||
* WebGL | ||
* Better support for CSS3 | ||
* Faster JS (Nitro JS Virtual Machine) | ||
* Support for IndexedDB | ||
* Crypto API | ||
* Navigation Timing API | ||
* CSS layering | ||
* Fullscreen API | ||
|
||
#### How to install the Webview+ in your current project #### | ||
|
||
Even though it's a cordova-compatible plugin, some steps must be done for the installation. If you prefer, you can install it automatically using the [CocoonJS Command Line Interface](https://github.com/ludei/cocoonjs-cli). The cocoonjs-cli has the same usage and commands of [cordova-cli](https://github.com/apache/cordova-cli#project-commands). | ||
|
||
Once the cocoonjs-cli is installed in your system, just type: | ||
|
||
``` | ||
$ cd /to/your/cordova/based/project | ||
$ cocoonjs plugin add com.ludei.ios.webview.plus | ||
``` | ||
|
||
#### Manual installation #### | ||
|
||
Refer to the hook located at ios/hooks/install.js for the steps needed to install the Webview+ manually. | ||
|
||
### About the author ### | ||
|
||
[Ludei](http://www.ludei.com) is a San Francisco based company, creators of CocoonJS. Ludei aims to empower HTML5 industry with a set of tools that eases the adoption of HTML5 as the target platform for every mobile development. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 1.0.0 | ||
|
||
- First public release. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.88 MB
ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS_force_load.a
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
function WebViewPlusInstaller(project_path) { | ||
|
||
try { | ||
|
||
var platform_path = path.join(project_path, "platforms", "ios"); | ||
var plugins_path = path.join(project_path, "plugins", "com.ludei.ios.webview.plus"); | ||
var folderContent = fs.readdirSync(platform_path); | ||
var xcodeproj_path = folderContent.filter(function(item){ return item.indexOf("xcodeproj") !== -1; })[0]; | ||
var xcodeproj_name = xcodeproj_path.split(".")[0]; | ||
|
||
if (!xcodeproj_path) { | ||
throw new Error("Cannot find a valid 'xcodeproj' inside " + platform_path); | ||
} | ||
|
||
xcodeproj_path = path.join(platform_path, xcodeproj_path); | ||
var pbxpath = path.join(xcodeproj_path, "project.pbxproj"); | ||
var original_pbx = path.join(xcodeproj_path, "original_pbx.pbxproj"); | ||
|
||
var gnu_compiler = 'CLANG_ENABLE_OBJC_ARC = YES;'; | ||
var morti_compiler = 'CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++";\nCLANG_ENABLE_OBJC_ARC = YES;\n'; | ||
|
||
var valid_archs_pattern = 'TARGETED_DEVICE_FAMILY = "1,2";'; | ||
var valid_archs = valid_archs_pattern + '\nVALID_ARCHS = "armv7 i386";' | ||
|
||
// Save a copy of the original PBX | ||
fs.writeFileSync(original_pbx, fs.readFileSync(pbxpath)); | ||
|
||
var pbx_content = fs.readFileSync(pbxpath, "utf8"); | ||
var fileRef = pbx_content.match(/fileRef = [A-Z0-9]* \/\* cocoonjs.cf \*\/;/)[0].split('fileRef = ')[1].split(" ")[0]; | ||
|
||
// Rename the main file | ||
var original_main = path.join(platform_path, xcodeproj_name, "main.m"); | ||
var new_main = path.join(platform_path, xcodeproj_name, "main.mm"); | ||
|
||
fs.renameSync(original_main, new_main); | ||
pbx_content = pbx_content.replaceAll("main.m", "main.mm"); | ||
|
||
var main_content = fs.readFileSync(new_main, "utf8"); | ||
|
||
var PBXBuildFile = '590E6E6B1A14FE6800E733FF /* cocoonjs.cf in Resources */ = {isa = PBXBuildFile; fileRef = ' + fileRef + ' /* cocoonjs.cf */; };'; | ||
var PBXBuildFilePattern = '/* Begin PBXBuildFile section */'; | ||
var PBXResourcesBuildPhase = '590E6E6B1A14FE6800E733FF /* cocoonjs.cf in Resources */,'; | ||
var PBXResourcesBuildPhasePattern = 'in Resources */,'; | ||
|
||
var LinkingLibraries = '"-force_load", "$(SRCROOT)/$(PROJECT_NAME)/Plugins/com.ludei.ios.webview.plus/Release$(EFFECTIVE_PLATFORM_NAME)-libCocoonJS_force_load.a", "$(SRCROOT)/$(PROJECT_NAME)/Plugins/com.ludei.ios.webview.plus/Release$(EFFECTIVE_PLATFORM_NAME)-libCocoonJS.a",'; | ||
var LinkingLibrariesPattern = 'OTHER_LDFLAGS = ('; | ||
pbx_content = pbx_content.replaceAll( LinkingLibrariesPattern, LinkingLibrariesPattern + "\n" + LinkingLibraries); | ||
|
||
pbx_content = pbx_content.replace( PBXResourcesBuildPhasePattern, PBXResourcesBuildPhasePattern + "\n" + PBXResourcesBuildPhase); | ||
pbx_content = pbx_content.replace( PBXBuildFilePattern, PBXBuildFilePattern + "\n" + PBXBuildFile); | ||
|
||
// Set default compiler to C++11 | ||
pbx_content = pbx_content.replaceAll( gnu_compiler, morti_compiler); | ||
|
||
/** | ||
* Replace archs (deprecated) | ||
*/ | ||
//pbx_content = pbx_content.replaceAll( valid_archs_pattern, valid_archs); | ||
|
||
/** | ||
* Set format as Objective-c | ||
*/ | ||
pbx_content = pbx_content.replace('lastKnownFileType = sourcecode.c.objc; path = main.mm;', "explicitFileType = sourcecode.cpp.objcpp; path = main.mm;"); | ||
|
||
/** | ||
* Replace the main delegate | ||
*/ | ||
main_content = main_content.replace("AppDelegate","CocoonJSAppDelegate"); | ||
|
||
fs.writeFileSync(new_main, main_content, "utf8"); | ||
fs.writeFileSync(pbxpath, pbx_content, "utf8"); | ||
|
||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
|
||
module.exports = WebViewPlusInstaller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
|
||
function WebViewPlusUninstaller(project_path) { | ||
|
||
try { | ||
|
||
var platform_path = path.join(project_path, "platforms", "ios"); | ||
var plugins_path = path.join(project_path, "plugins", "com.ludei.ios.webview.plus"); | ||
var folderContent = fs.readdirSync(platform_path); | ||
var xcodeproj_path = folderContent.filter(function(item){ return item.indexOf("xcodeproj") !== -1; })[0]; | ||
var xcodeproj_name = xcodeproj_path.split(".")[0]; | ||
|
||
if(!xcodeproj_path){ | ||
throw new Error("Cannot find a valid 'xcodeproj' inside " + platform_path); | ||
} | ||
|
||
xcodeproj_path = path.join(platform_path, xcodeproj_path); | ||
var pbxpath = path.join(xcodeproj_path, "project.pbxproj"); | ||
var original_pbx = path.join(xcodeproj_path, "original_pbx.pbxproj"); | ||
|
||
fs.writeFileSync(pbxpath, fs.readFileSync(original_pbx)); | ||
|
||
// Rename the main file | ||
var original_main = path.join(platform_path, xcodeproj_name, "main.m"); | ||
var new_main = path.join(platform_path, xcodeproj_name, "main.mm"); | ||
|
||
fs.renameSync(new_main, original_main); | ||
|
||
var main_content = fs.readFileSync(original_main, "utf8"); | ||
main_content = main_content.replace("CocoonJSAppDelegate","AppDelegate"); | ||
|
||
fs.writeFileSync(original_main, main_content, "utf8"); | ||
|
||
} | ||
catch (e) { | ||
console.error(e); | ||
} | ||
} | ||
|
||
module.exports = WebViewPlusUninstaller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.ludei.ios.webview.plus" version="1.0.0"> | ||
|
||
<name>Webview+</name> | ||
<author>Ludei</author> | ||
|
||
<!-- android --> | ||
<platform name="ios"> | ||
<framework src="QuartzCore.framework" /> | ||
<framework src="CoreGraphics.framework" /> | ||
<framework src="CoreText.framework" /> | ||
<framework src="OpenGLES.framework" /> | ||
<framework src="CoreMotion.framework" /> | ||
<framework src="MobileCoreServices.framework" /> | ||
<framework src="AssetsLibrary.framework" /> | ||
<framework src="MapKit.framework" /> | ||
<framework src="ImageIO.framework" /> | ||
<framework src="CoreLocation.framework" /> | ||
<framework src="libz.dylib" /> | ||
<framework src="SystemConfiguration.framework" /> | ||
<framework src="WebKit.framework" weak="true"/> | ||
<framework src="AudioToolbox.framework"/> | ||
<framework src="OpenAL.framework"/> | ||
|
||
<source-file src="ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS.a" /> | ||
<source-file src="ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS_force_load.a" compiler-flags="-force_load" /> | ||
|
||
<source-file src="ios/Release-iphoneos/Release-iphoneos-libCocoonJS.a" /> | ||
<source-file src="ios/Release-iphoneos/Release-iphoneos-libCocoonJS_force_load.a" compiler-flags="-force_load" /> | ||
|
||
<source-file src="ios/Resources/cocoonjs.cf" /> | ||
|
||
</platform> | ||
|
||
</plugin> |