├── README.md ├── changelog.md ├── ios ├── Release-iphoneos │ ├── Release-iphoneos-libCocoonJS.a │ └── Release-iphoneos-libCocoonJS_force_load.a ├── Release-iphonesimulator │ ├── Release-iphonesimulator-libCocoonJS.a │ └── Release-iphonesimulator-libCocoonJS_force_load.a ├── Resources │ └── cocoonjs.cf └── hooks │ ├── install.js │ └── uninstall.js └── plugin.xml /README.md: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This project has been discontinued. For the latest Webview+ for iOS, please go to the new Cocoon Cloud at http://cocoon.io. 2 | The new Cocoon cloud is completely Cordova based and has enhanced features that include: the most up to date Webview+, new Cocoon plugins, a better Developer App, support for any Cordova plugin and a revamped UI. 3 | 4 | # Webview+ for iOs # 5 | 6 | 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**. 7 | 8 | Looking for [Webview+ for Android](https://github.com/ludei/webview-plus)? 9 | 10 | ## Webview+ Features, Advantages and Benefits ## 11 | 12 | * WebGL 13 | * Better support for CSS3 14 | * Faster JS (Nitro JS Virtual Machine) 15 | * Support for IndexedDB 16 | * Crypto API 17 | * Navigation Timing API 18 | * HTML Template element 19 | 20 | #### How to install the Webview+ in your current project #### 21 | 22 | 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). 23 | 24 | Once the cocoonjs-cli is installed in your system, just type: 25 | 26 | ``` 27 | // Install Ludei's CLI 28 | $ sudo npm install -g cocoonjs 29 | 30 | $ cocoonjs create MyProject 31 | $ cd MyProject 32 | $ cocoonjs platform add ios 33 | $ cocoonjs plugin add com.ludei.ios.webview.plus -d 34 | $ cocoonjs run/emulate 35 | ``` 36 | 37 | The `-d` flag is used to activate the verbose mode. 38 | 39 | #### Manual installation #### 40 | 41 | Refer to the hook located at ios/hooks/install.js for the steps needed to install the Webview+ manually. 42 | 43 | ### About the author ### 44 | 45 | [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. 46 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## 1.0.2 2 | 3 | - Set 'AppDelegate' as application delegate when the iOs version is below 8 4 | 5 | ## 1.0.1 6 | 7 | - Bug fixes for iOs 8.1 8 | 9 | ## 1.0.0 10 | 11 | - First public release. -------------------------------------------------------------------------------- /ios/Release-iphoneos/Release-iphoneos-libCocoonJS.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludei/webview-plus-ios/d9de707ec209c293bcb8e0bfe6c02976495a1d31/ios/Release-iphoneos/Release-iphoneos-libCocoonJS.a -------------------------------------------------------------------------------- /ios/Release-iphoneos/Release-iphoneos-libCocoonJS_force_load.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludei/webview-plus-ios/d9de707ec209c293bcb8e0bfe6c02976495a1d31/ios/Release-iphoneos/Release-iphoneos-libCocoonJS_force_load.a -------------------------------------------------------------------------------- /ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludei/webview-plus-ios/d9de707ec209c293bcb8e0bfe6c02976495a1d31/ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS.a -------------------------------------------------------------------------------- /ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS_force_load.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludei/webview-plus-ios/d9de707ec209c293bcb8e0bfe6c02976495a1d31/ios/Release-iphonesimulator/Release-iphonesimulator-libCocoonJS_force_load.a -------------------------------------------------------------------------------- /ios/Resources/cocoonjs.cf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ludei/webview-plus-ios/d9de707ec209c293bcb8e0bfe6c02976495a1d31/ios/Resources/cocoonjs.cf -------------------------------------------------------------------------------- /ios/hooks/install.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | function WebViewPlusInstaller(project_path, cmd) { 5 | 6 | try { 7 | // Install this plugin only on Cordova <= 4.0.0 8 | var version = cmd.exec("--version", { silent : true }); 9 | 10 | if(version.code !== 0){ 11 | console.error("Cannot install the Webview+ for iOs in your project because a valid cordova-cli binary wasn't found."); 12 | } 13 | 14 | if( parseFloat(version.output) > parseFloat('4.0.0') ){ 15 | throw new Error("This plugin should be installed using cordova 4.0.0 or below. Your cordova version is " + version.output); 16 | } 17 | 18 | var platform_path = path.join(project_path, "platforms", "ios"); 19 | var plugins_path = path.join(project_path, "plugins", "com.ludei.ios.webview.plus"); 20 | var folderContent = fs.readdirSync(platform_path); 21 | var xcodeproj_path = folderContent.filter(function(item){ return item.indexOf("xcodeproj") !== -1; })[0]; 22 | var xcodeproj_name = xcodeproj_path.split(".")[0]; 23 | 24 | if (!xcodeproj_path) { 25 | throw new Error("Cannot find a valid 'xcodeproj' inside " + platform_path); 26 | } 27 | 28 | xcodeproj_path = path.join(platform_path, xcodeproj_path); 29 | var pbxpath = path.join(xcodeproj_path, "project.pbxproj"); 30 | var original_pbx = path.join(xcodeproj_path, "original_pbx.pbxproj"); 31 | 32 | var gnu_compiler = 'CLANG_ENABLE_OBJC_ARC = YES;'; 33 | var morti_compiler = 'CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; CLANG_CXX_LIBRARY = "libc++";\nCLANG_ENABLE_OBJC_ARC = YES;\n'; 34 | 35 | var valid_archs_pattern = 'TARGETED_DEVICE_FAMILY = "1,2";'; 36 | var valid_archs = valid_archs_pattern + '\nVALID_ARCHS = "armv7 i386";' 37 | 38 | // Save a copy of the original PBX 39 | fs.writeFileSync(original_pbx, fs.readFileSync(pbxpath)); 40 | 41 | var pbx_content = fs.readFileSync(pbxpath, "utf8"); 42 | var fileRef = pbx_content.match(/fileRef = [A-Z0-9]* \/\* cocoonjs.cf \*\/;/)[0].split('fileRef = ')[1].split(" ")[0]; 43 | 44 | // Rename the main file 45 | var original_main = path.join(platform_path, xcodeproj_name, "main.m"); 46 | var new_main = path.join(platform_path, xcodeproj_name, "main.mm"); 47 | 48 | fs.renameSync(original_main, new_main); 49 | pbx_content = pbx_content.replaceAll("main.m", "main.mm"); 50 | 51 | var main_content = fs.readFileSync(new_main, "utf8"); 52 | 53 | var PBXBuildFile = '590E6E6B1A14FE6800E733FF /* cocoonjs.cf in Resources */ = {isa = PBXBuildFile; fileRef = ' + fileRef + ' /* cocoonjs.cf */; };'; 54 | var PBXBuildFilePattern = '/* Begin PBXBuildFile section */'; 55 | var PBXResourcesBuildPhase = '590E6E6B1A14FE6800E733FF /* cocoonjs.cf in Resources */,'; 56 | var PBXResourcesBuildPhasePattern = 'in Resources */,'; 57 | 58 | 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",'; 59 | var LinkingLibrariesPattern = 'OTHER_LDFLAGS = ('; 60 | pbx_content = pbx_content.replaceAll( LinkingLibrariesPattern, LinkingLibrariesPattern + "\n" + LinkingLibraries); 61 | 62 | pbx_content = pbx_content.replace( PBXResourcesBuildPhasePattern, PBXResourcesBuildPhasePattern + "\n" + PBXResourcesBuildPhase); 63 | pbx_content = pbx_content.replace( PBXBuildFilePattern, PBXBuildFilePattern + "\n" + PBXBuildFile); 64 | 65 | // Set default compiler to C++11 66 | pbx_content = pbx_content.replaceAll( gnu_compiler, morti_compiler); 67 | 68 | /** 69 | * Replace archs (deprecated) 70 | */ 71 | //pbx_content = pbx_content.replaceAll( valid_archs_pattern, valid_archs); 72 | 73 | /** 74 | * Set format as Objective-c 75 | */ 76 | pbx_content = pbx_content.replace('lastKnownFileType = sourcecode.c.objc; path = main.mm;', "explicitFileType = sourcecode.cpp.objcpp; path = main.mm;"); 77 | 78 | /** 79 | * Replace the main delegate 80 | */ 81 | var mainmmDelegate = 'float version = UIDevice.currentDevice.systemVersion.floatValue;\n int retVal = UIApplicationMain(argc, argv, nil, version >= 8.0 ? @"CocoonJSAppDelegate" : @"AppDelegate");'; 82 | var mainmmDelegatePattern = 'int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");'; 83 | main_content = main_content.replace(mainmmDelegatePattern,mainmmDelegate); 84 | 85 | fs.writeFileSync(new_main, main_content, "utf8"); 86 | fs.writeFileSync(pbxpath, pbx_content, "utf8"); 87 | 88 | console.log("Webview+ installed correctly in your CocoonJS project :)"); 89 | } 90 | catch (e) { 91 | throw new Error(e); 92 | } 93 | } 94 | 95 | module.exports = WebViewPlusInstaller; -------------------------------------------------------------------------------- /ios/hooks/uninstall.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | var fs = require('fs'); 3 | 4 | function WebViewPlusUninstaller(project_path) { 5 | 6 | try { 7 | 8 | var platform_path = path.join(project_path, "platforms", "ios"); 9 | var plugins_path = path.join(project_path, "plugins", "com.ludei.ios.webview.plus"); 10 | var folderContent = fs.readdirSync(platform_path); 11 | var xcodeproj_path = folderContent.filter(function(item){ return item.indexOf("xcodeproj") !== -1; })[0]; 12 | var xcodeproj_name = xcodeproj_path.split(".")[0]; 13 | 14 | if(!xcodeproj_path){ 15 | throw new Error("Cannot find a valid 'xcodeproj' inside " + platform_path); 16 | } 17 | 18 | xcodeproj_path = path.join(platform_path, xcodeproj_path); 19 | var pbxpath = path.join(xcodeproj_path, "project.pbxproj"); 20 | var original_pbx = path.join(xcodeproj_path, "original_pbx.pbxproj"); 21 | 22 | fs.writeFileSync(pbxpath, fs.readFileSync(original_pbx)); 23 | 24 | // Rename the main file 25 | var original_main = path.join(platform_path, xcodeproj_name, "main.m"); 26 | var new_main = path.join(platform_path, xcodeproj_name, "main.mm"); 27 | 28 | fs.renameSync(new_main, original_main); 29 | 30 | var main_content = fs.readFileSync(original_main, "utf8"); 31 | main_content = main_content.replace("CocoonJSAppDelegate","AppDelegate"); 32 | 33 | fs.writeFileSync(original_main, main_content, "utf8"); 34 | 35 | } 36 | catch (e) { 37 | console.error(e); 38 | } 39 | } 40 | 41 | module.exports = WebViewPlusUninstaller; -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Webview+ 5 | Ludei 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | --------------------------------------------------------------------------------