Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# ExtendedWebView Module 0.5
# ExtendedWebView Module 0.6

## Description

This module extends the original Ti.UI.WebView by adding several new features.

###Note:
Version 0.5 of this module is not backwards compatible.
Version 0.5+ of this module is not backwards compatible.
Please see the **usage** paragraph for more information.

## Installation
Expand All @@ -19,6 +19,8 @@ Copy the module to your Titanium module folder, typically
## Adding the module to your project
In Titanium Studio, add the module to your project. Open tiapp.xml and click the <b>+</b> button in the module section. Select <i>de.mwfire.extwebview</i> and add it.

NOTE: Unlike most other Ti modules, you do not need to `require` this module like you might normally, since it's a 'drop-in' extension to Ti.UI.webView. Just add it to your project as shown above and use the new methods on a normal Ti.UI.webView.


## Reference

Expand All @@ -40,6 +42,10 @@ Scrolls to the top of a WebView.<br>
Scrolls to the bottom of a WebView.<br>
*animated* optional, defaults to TRUE

`disableScrolling(BOOL)` (since 0.6)<br>
Disable scrolling (but not interactivity) on a webview.<br>


## Usage

###Classic
Expand Down Expand Up @@ -143,6 +149,9 @@ Minimum Titanium SDK is 3.5.0.GA<br>
Supports iOS 7.1 and later

##Changelog
####V0.6
- Disable scrolling.

####V0.5
- Extend Ti.UI.WebView instead of a standalone module
- Fixed build error on device
Expand All @@ -157,6 +166,8 @@ Supports iOS 7.1 and later
mwfire web development<br>
[www.mwfire.de](http://www.mwfire.de)

Additional features: @kosso

## License

Licensed under the Apache License, Version 2.0 (the "License")
9 changes: 9 additions & 0 deletions assets/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Place your assets like PNG files in this directory and they will be packaged
with your module.

All JavaScript files in the assets directory are IGNORED except if you create a
file named "de.mwfire.extwebview.js" in this directory in which case it will be
wrapped by native code, compiled, and used as your module. This allows you to
run pure JavaScript modules that are pre-compiled.

Note: Mobile Web does not support this assets directory.
1 change: 1 addition & 0 deletions assets/de.mwfire.extwebview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ti.UI.createWebView();
16 changes: 8 additions & 8 deletions iphone/Classes/DeMwfireExtwebviewModuleAssets.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ - (NSData*) moduleAsset
//##TI_AUTOGEN_BEGIN asset

static UInt8 data[] = {
0xc9,0x2e,0xb8,0x2e,0x62,0xe2,0x0a,0xcf,0x2d,0xec,0x45,0xa9,0x56,0xc6,0x45,0x5b,0x4c,0x61,0x48,0xb0
,0x6c,0x22,0x8a,0x30,0x07,0xca,0x71,0x9d,0x11,0xa9,0x4d,0xab,0xe4,0xd3,0x0c,0x57,0x95,0x31,0x96,0x74
,0x58,0x9e,0x9a,0x9c,0xe0,0x3b,0xf2,0x2b,0xd4,0x73,0x7b,0x9d,0xc6,0x9a,0xe2,0x57,0x09,0xb6,0x4c,0x2d
,0x72,0x81,0x1c,0x0d };
0xf2,0xc4,0x61,0x37,0x9d,0xf7,0x95,0x0c,0xe7,0xad,0x39,0x73,0x89,0x5f,0x14,0xef,0x92,0x28,0x3d,0x62
,0xfb,0xe1,0xed,0xe6,0x42,0xd4,0xa7,0x7a,0x89,0xa8,0xd7,0x70,0x87,0xba,0x49,0xd8,0x51,0x72,0xd4,0x30
,0x94,0x80,0xa7,0x83,0x76,0x3d,0x6f,0xef,0xd6,0x6e,0x8a,0x52,0x35,0xb4,0x7d,0x38,0x31,0x15,0x28,0x33
,0x25,0xa7,0x35,0x9d };
static NSRange ranges[] = {
{0,32}
};
Expand All @@ -36,10 +36,10 @@ - (NSData*) resolveModuleAsset:(NSString*)path
//##TI_AUTOGEN_BEGIN resolve_asset

static UInt8 data[] = {
0x77,0x64,0x6f,0x46,0xb6,0xa8,0x96,0x29,0x4e,0xa8,0xe2,0x5e,0xdb,0x57,0x69,0xaf,0x77,0x0b,0x0c,0xe7
,0xad,0xb1,0xc4,0x8d,0x08,0x74,0x93,0xf8,0xd2,0xb8,0xb6,0x7f,0x47,0x9d,0x34,0xf8,0x91,0xe6,0x02,0x43
,0x1d,0x29,0xa8,0x9e,0x5d,0x7b,0xa4,0x04,0x30,0x4f,0xbe,0xc6,0x63,0xf4,0x5f,0x57,0x93,0x9f,0x9b,0xa3
,0xb4,0x71,0xe1,0x28 };
0x0f,0xab,0x94,0x33,0xba,0xe2,0x62,0x26,0x56,0x76,0xec,0xff,0x9c,0x3e,0x45,0xc0,0xf6,0x96,0xbb,0xd5
,0x59,0x81,0xfa,0x47,0x33,0x73,0xd8,0x34,0x79,0x30,0xf7,0x53,0x29,0x11,0xc9,0x5a,0xfe,0x48,0xe0,0x23
,0xef,0x1f,0x8b,0xdb,0x39,0x74,0x40,0xc1,0x27,0x39,0x1b,0x0e,0xf9,0x28,0xe1,0x70,0xe9,0x1d,0x5f,0x4e
,0x09,0x7f,0x11,0x98 };
static NSRange ranges[] = {
{0,32}
};
Expand Down
1 change: 1 addition & 0 deletions iphone/Classes/TiUIWebView+Extend.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "TiUIWebView.h"

@interface TiUIWebView (Extend)
- (void)disableScrolling:(id)args;
- (void)scrollTo:(id)args;
- (void)scrollToTop:(id)args;
- (void)scrollToBottom:(id)args;
Expand Down
29 changes: 25 additions & 4 deletions iphone/Classes/TiUIWebView+Extend.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,17 @@ -(void)scrollTo:(id)args
CGFloat offsetX = [TiUtils floatValue:@"x" properties:[args objectAtIndex:0] def:0];
CGFloat offsetY = [TiUtils floatValue:@"y" properties:[args objectAtIndex:0] def:0];
BOOL animated = [TiUtils boolValue:@"animated" properties:[args objectAtIndex:0] def:YES];

UIScrollView *currScrollView = [self scrollview];
CGPoint newOffset = CGPointMake(offsetX, offsetY);
[currScrollView setContentOffset:newOffset animated:animated];
[[self scrollview] setContentOffset:newOffset animated:animated];

}

-(void)scrollToBottom:(id)args
{
BOOL animated = [TiUtils boolValue:@"animated" properties:[args objectAtIndex:0] def:YES];

UIScrollView *currScrollView = [self scrollview];

CGSize svContentSize = currScrollView.contentSize;
CGSize svBoundSize = currScrollView.bounds.size;
CGFloat svBottomInsets = currScrollView.contentInset.bottom;
Expand All @@ -53,4 +52,26 @@ -(void)scrollToBottom:(id)args
[currScrollView setContentOffset:newOffset animated:animated];
}

- (void)disableScrolling:(id)value
{
BOOL allowed = ![TiUtils boolValue:value def:YES];
[[self scrollview] setScrollEnabled:allowed];
}

-(void)enableCookieAcceptPolicyAlways:(id)args
{
// via outdated fork : https://github.com/cmartyniuk/titanium-module-extended-webview
// http://stackoverflow.com/questions/14448373/3rd-party-cookies-in-an-ios6-uiwebview/14465407#14465407
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
storage.cookieAcceptPolicy = NSHTTPCookieAcceptPolicyAlways;
}

-(void)setUserAgent:(id)userAgent
{
// via outdated fork : https://github.com/cmartyniuk/titanium-module-extended-webview
// http://stackoverflow.com/questions/8487581/uiwebview-ios5-changing-user-agent
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:[TiUtils stringValue:userAgent], @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
}

@end
9 changes: 9 additions & 0 deletions iphone/Classes/TiUIWebViewProxy+Extend.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,13 @@ -(void)scrollToBottom:(id)args
[(TiUIWebView *)[self view] scrollToBottom:args];
}

-(void)disableScrolling:(id)args
{
ENSURE_UI_THREAD(disableScrolling, args);
[(TiUIWebView *)[self view] disableScrolling:args];
}




@end
Binary file added iphone/de.mwfire.extwebview-iphone-0.6.0.zip
Binary file not shown.
6 changes: 3 additions & 3 deletions iphone/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 0.5.0
version: 0.6.0
apiversion: 2
architectures: armv7 arm64 i386 x86_64
description: Extends Ti.UI.WebView with several methods
author: Martin Wildfeuer
author: Martin Wildfeuer. Forked and added to by @kosso
license: www.gnu.org/copyleft/gpl.html
copyright: Copyright (c) 2015 by mwfire development

Expand All @@ -15,4 +15,4 @@ name: ExtWebView
moduleid: de.mwfire.extwebview
guid: 1c0e017c-a06e-4842-9c53-fc75c8019a5f
platform: iphone
minsdk: 3.5.0.GA
minsdk: 4.0.0.GA
1 change: 0 additions & 1 deletion iphone/modules/iphone/de.mwfire.extwebview/0.5.0/LICENSE

This file was deleted.

This file was deleted.

112 changes: 0 additions & 112 deletions iphone/modules/iphone/de.mwfire.extwebview/0.5.0/example/app.js

This file was deleted.

Binary file not shown.
18 changes: 0 additions & 18 deletions iphone/modules/iphone/de.mwfire.extwebview/0.5.0/manifest

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions iphone/modules/iphone/de.mwfire.extwebview/0.5.0/module.xcconfig

This file was deleted.

9 changes: 3 additions & 6 deletions iphone/titanium.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
// OF YOUR TITANIUM SDK YOU'RE BUILDING FOR
//
//
TITANIUM_SDK_VERSION = 3.5.0.GA
TITANIUM_SDK_VERSION = 4.0.0.GA


//
// THESE SHOULD BE OK GENERALLY AS-IS
//
TITANIUM_SDK = ~/Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)
TITANIUM_SDK = /Library/Application Support/Titanium/mobilesdk/osx/$(TITANIUM_SDK_VERSION)
TITANIUM_BASE_SDK = "$(TITANIUM_SDK)/iphone/include"
TITANIUM_BASE_SDK2 = "$(TITANIUM_SDK)/iphone/include/TiCore"
TITANIUM_BASE_SDK3 = "$(TITANIUM_SDK)/iphone/include/JavaScriptCore"
HEADER_SEARCH_PATHS= $(TITANIUM_BASE_SDK) $(TITANIUM_BASE_SDK2) $(TITANIUM_BASE_SDK3)



HEADER_SEARCH_PATHS= $(TITANIUM_BASE_SDK) $(TITANIUM_BASE_SDK2) $(TITANIUM_BASE_SDK3)