diff --git a/bowser-ios/Bowser.xcodeproj/project.pbxproj b/bowser-ios/Bowser.xcodeproj/project.pbxproj index 99c0ed6..e413dd7 100644 --- a/bowser-ios/Bowser.xcodeproj/project.pbxproj +++ b/bowser-ios/Bowser.xcodeproj/project.pbxproj @@ -13,11 +13,7 @@ 6C77B9C11599A7C200AFECC2 /* BowserHistory.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6C77B9C01599A7C200AFECC2 /* BowserHistory.plist */; }; 6C77B9CC1599D93F00AFECC2 /* BowserFavicon.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C77B9CB1599D93F00AFECC2 /* BowserFavicon.m */; }; 6C77B9D71599E1D700AFECC2 /* BowserHistoryTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 6C77B9D61599E1D600AFECC2 /* BowserHistoryTableViewCell.m */; }; - 6CB480391642972C00425E13 /* BowserMediaPermissionURLs.plist in Resources */ = {isa = PBXBuildFile; fileRef = 6CB480381642972C00425E13 /* BowserMediaPermissionURLs.plist */; }; 6CE852B51593503F00404367 /* BowserWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CE852B41593503F00404367 /* BowserWebView.m */; }; - 6CEFE68E164954010030C290 /* BowserMediaAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CEFE68D164954010030C290 /* BowserMediaAlertView.m */; }; - 749EFA2C19A3D0AA00107C9A /* libc++.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 749EFA2B19A3D0AA00107C9A /* libc++.dylib */; }; - 749EFA2E19A3D0B300107C9A /* libresolv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 749EFA2D19A3D0B200107C9A /* libresolv.dylib */; }; B7E3D0E015625681003DE0F1 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B7E3D0DE15625681003DE0F1 /* InfoPlist.strings */; }; B7E3D0E215625681003DE0F1 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B7E3D0E115625681003DE0F1 /* main.m */; }; B7E3D0E615625681003DE0F1 /* BowserAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B7E3D0E515625681003DE0F1 /* BowserAppDelegate.m */; }; @@ -30,6 +26,8 @@ F84D76DD19A368C20039552D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F84D76DC19A368C20039552D /* Images.xcassets */; }; F89E07B615F8CB5B00262F59 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F8A82AEC15F8C00E003460E5 /* AboutViewController.m */; }; F8AE2FC219D0A3F40083C6BF /* OpenWebRTC-Logo-w400.png in Resources */ = {isa = PBXBuildFile; fileRef = F8AE2FC119D0A3F40083C6BF /* OpenWebRTC-Logo-w400.png */; }; + F8E9CB4B1BD4C1B5006ED336 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E9CB4A1BD4C1B5006ED336 /* libresolv.tbd */; }; + F8E9CB4D1BD4C1C1006ED336 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = F8E9CB4C1BD4C1C1006ED336 /* libc++.tbd */; }; F8F3813019D00A6300A1B471 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = F8F3812F19D00A6300A1B471 /* Launch Screen.xib */; }; /* End PBXBuildFile section */ @@ -43,13 +41,8 @@ 6C77B9CB1599D93F00AFECC2 /* BowserFavicon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BowserFavicon.m; sourceTree = ""; }; 6C77B9D51599E1D600AFECC2 /* BowserHistoryTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BowserHistoryTableViewCell.h; sourceTree = ""; }; 6C77B9D61599E1D600AFECC2 /* BowserHistoryTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BowserHistoryTableViewCell.m; sourceTree = ""; }; - 6CB480381642972C00425E13 /* BowserMediaPermissionURLs.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = BowserMediaPermissionURLs.plist; sourceTree = ""; }; 6CE852B31593503F00404367 /* BowserWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BowserWebView.h; sourceTree = ""; }; 6CE852B41593503F00404367 /* BowserWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BowserWebView.m; sourceTree = ""; }; - 6CEFE68C164954010030C290 /* BowserMediaAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BowserMediaAlertView.h; sourceTree = ""; }; - 6CEFE68D164954010030C290 /* BowserMediaAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BowserMediaAlertView.m; sourceTree = ""; }; - 749EFA2B19A3D0AA00107C9A /* libc++.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libc++.dylib"; path = "usr/lib/libc++.dylib"; sourceTree = SDKROOT; }; - 749EFA2D19A3D0B200107C9A /* libresolv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libresolv.dylib; path = usr/lib/libresolv.dylib; sourceTree = SDKROOT; }; B7E3D0D115625681003DE0F1 /* Bowser.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Bowser.app; sourceTree = BUILT_PRODUCTS_DIR; }; B7E3D0DD15625681003DE0F1 /* Bowser-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Bowser-Info.plist"; sourceTree = ""; }; B7E3D0DF15625681003DE0F1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; @@ -73,6 +66,9 @@ F8A82AEB15F8C00E003460E5 /* AboutViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AboutViewController.h; path = ../AboutViewController.h; sourceTree = ""; }; F8A82AEC15F8C00E003460E5 /* AboutViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AboutViewController.m; path = ../AboutViewController.m; sourceTree = ""; }; F8AE2FC119D0A3F40083C6BF /* OpenWebRTC-Logo-w400.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "OpenWebRTC-Logo-w400.png"; path = "../OpenWebRTC-Logo-w400.png"; sourceTree = ""; }; + F8E9CB4A1BD4C1B5006ED336 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; + F8E9CB4C1BD4C1C1006ED336 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; + F8E9CB571BD61222006ED336 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; F8F3812F19D00A6300A1B471 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -81,8 +77,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 749EFA2E19A3D0B300107C9A /* libresolv.dylib in Frameworks */, - 749EFA2C19A3D0AA00107C9A /* libc++.dylib in Frameworks */, + F8E9CB4D1BD4C1C1006ED336 /* libc++.tbd in Frameworks */, + F8E9CB4B1BD4C1B5006ED336 /* libresolv.tbd in Frameworks */, 4CE203E180B450A9FB63C713 /* libPods-Bowser.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -121,8 +117,9 @@ B7E3D0D415625681003DE0F1 /* Frameworks */ = { isa = PBXGroup; children = ( - 749EFA2D19A3D0B200107C9A /* libresolv.dylib */, - 749EFA2B19A3D0AA00107C9A /* libc++.dylib */, + F8E9CB571BD61222006ED336 /* WebKit.framework */, + F8E9CB4C1BD4C1C1006ED336 /* libc++.tbd */, + F8E9CB4A1BD4C1B5006ED336 /* libresolv.tbd */, 4D1E82A2640957E047AA70DA /* libPods-Bowser.a */, ); name = Frameworks; @@ -143,7 +140,6 @@ 6CE852B31593503F00404367 /* BowserWebView.h */, 6CE852B41593503F00404367 /* BowserWebView.m */, 6C77B9C01599A7C200AFECC2 /* BowserHistory.plist */, - 6CB480381642972C00425E13 /* BowserMediaPermissionURLs.plist */, 6C77B9CA1599D93F00AFECC2 /* BowserFavicon.h */, 6C77B9CB1599D93F00AFECC2 /* BowserFavicon.m */, 6C77B9D51599E1D600AFECC2 /* BowserHistoryTableViewCell.h */, @@ -152,8 +148,6 @@ F8A82AEC15F8C00E003460E5 /* AboutViewController.m */, 6C733902163ED77B001908E5 /* BowserConfirmView.h */, 6C733903163ED77B001908E5 /* BowserConfirmView.m */, - 6CEFE68C164954010030C290 /* BowserMediaAlertView.h */, - 6CEFE68D164954010030C290 /* BowserMediaAlertView.m */, ); path = Bowser; sourceTree = ""; @@ -268,7 +262,6 @@ F8AE2FC219D0A3F40083C6BF /* OpenWebRTC-Logo-w400.png in Resources */, F84D76DD19A368C20039552D /* Images.xcassets in Resources */, 6C2B891E16270E5C004FA15F /* about.html in Resources */, - 6CB480391642972C00425E13 /* BowserMediaPermissionURLs.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -322,7 +315,6 @@ F81B2E031A0BD8390053E19A /* BookmarksViewController.m in Sources */, 6C733904163ED77B001908E5 /* BowserConfirmView.m in Sources */, F81B2E071A0BFB8A0053E19A /* AddBookmarkViewController.m in Sources */, - 6CEFE68E164954010030C290 /* BowserMediaAlertView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -389,9 +381,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; + STRIP_INSTALLED_PRODUCT = NO; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -422,9 +415,10 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; + STRIP_INSTALLED_PRODUCT = NO; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; diff --git a/bowser-ios/Bowser.xcodeproj/xcuserdata/stefan.xcuserdatad/xcschemes/Bowser.xcscheme b/bowser-ios/Bowser.xcodeproj/xcuserdata/stefan.xcuserdatad/xcschemes/Bowser.xcscheme index bd893f6..7d6f737 100644 --- a/bowser-ios/Bowser.xcodeproj/xcuserdata/stefan.xcuserdatad/xcschemes/Bowser.xcscheme +++ b/bowser-ios/Bowser.xcodeproj/xcuserdata/stefan.xcuserdatad/xcschemes/Bowser.xcscheme @@ -23,10 +23,10 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -38,17 +38,21 @@ ReferencedContainer = "container:Bowser.xcodeproj"> + + - + + + - + User ${USER} - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + diff --git a/bowser-ios/Bowser/BowserAppDelegate.m b/bowser-ios/Bowser/BowserAppDelegate.m index ae25d34..00a8d20 100644 --- a/bowser-ios/Bowser/BowserAppDelegate.m +++ b/bowser-ios/Bowser/BowserAppDelegate.m @@ -41,6 +41,7 @@ - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + NSLog(@"lllllslslslslslslsls"); NSError* theError = nil; BOOL result = YES; @@ -53,6 +54,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( forKey:@"UserAgent"]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaults]; + /* AVAudioSession* myAudioSession = [AVAudioSession sharedInstance]; result = [myAudioSession setCategory:AVAudioSessionCategoryPlayAndRecord error:&theError]; @@ -64,6 +66,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( if (!result) { NSLog(@"setActive failed"); } + */ // Override point for customization after application launch. return YES; diff --git a/bowser-ios/Bowser/BowserMediaAlertView.h b/bowser-ios/Bowser/BowserMediaAlertView.h deleted file mode 100644 index 4d5ef05..0000000 --- a/bowser-ios/Bowser/BowserMediaAlertView.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// BowserMediaAlertView.h -// Bowser -// -// Copyright (c) 2014, Ericsson AB. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this -// list of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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. -// - -#import - -@interface BowserMediaAlertView : UIAlertView - -@property (strong) NSString *requestId; -@property (strong) NSString *host; - -- (id)initWithRequestId:(NSString *)requestId forHost:(NSString *)host withDelegate:(id)delegate; - -@end \ No newline at end of file diff --git a/bowser-ios/Bowser/BowserMediaAlertView.m b/bowser-ios/Bowser/BowserMediaAlertView.m deleted file mode 100644 index d75d93d..0000000 --- a/bowser-ios/Bowser/BowserMediaAlertView.m +++ /dev/null @@ -1,54 +0,0 @@ -// -// BowserMediaAlertView.m -// Bowser -// -// Copyright (c) 2014, Ericsson AB. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, -// are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this -// list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this -// list of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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. -// - -#import "BowserMediaAlertView.h" - -@implementation BowserMediaAlertView - -- (id)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - // Initialization code - } - return self; -} - -- (id)initWithRequestId:(NSString *)requestId forHost:(NSString *)host withDelegate:(id)delegate -{ - NSString *message = [NSString stringWithFormat:@"%@ wants to use your camera and microphone", host]; - self = [super initWithTitle:@"Media Access" message:message delegate:delegate cancelButtonTitle:@"Don't allow" otherButtonTitles:@"Allow once", @"Always allow", nil]; - if (self) { - self.requestId = requestId; - self.host = host; - } - return self; -} - -@end \ No newline at end of file diff --git a/bowser-ios/Bowser/BowserMediaPermissionURLs.plist b/bowser-ios/Bowser/BowserMediaPermissionURLs.plist deleted file mode 100644 index 0c67376..0000000 --- a/bowser-ios/Bowser/BowserMediaPermissionURLs.plist +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/bowser-ios/Bowser/BowserViewController.h b/bowser-ios/Bowser/BowserViewController.h index ed0b6b4..8941715 100644 --- a/bowser-ios/Bowser/BowserViewController.h +++ b/bowser-ios/Bowser/BowserViewController.h @@ -28,10 +28,12 @@ // #import -#import "BowserWebView.h" +#import + +//#import "BowserWebView.h" #import "AboutViewController.h" -#import "BowserConfirmView.h" -#import "BowserMediaAlertView.h" +//#import "BowserConfirmView.h" +//#import "BowserMediaAlertView.h" #import "BookmarksViewController.h" #import "AddBookmarkViewController.h" @@ -43,7 +45,7 @@ typedef enum { BowserMenuOptionAddBookmark, } BowserMenuOption; -@interface BowserViewController : UIViewController +@interface BowserViewController : OpenWebRTCViewController { bool canChange; bool headerIsAbove; @@ -51,7 +53,6 @@ typedef enum { bool bookmarksAreVisible; NSMutableArray *bowserHistory; NSArray *filteredHistory; - NSTimer *pageNavigationTimer; __strong NSString *historyFilePath, *bookmarksFilePath; } @@ -59,14 +60,13 @@ typedef enum { @property (weak, nonatomic) IBOutlet UIScrollView *headerView; @property (weak, nonatomic) IBOutlet UIButton *bookmarkButton; -@property (weak, nonatomic) IBOutlet BowserWebView *browserView; +//@property (weak, nonatomic) IBOutlet BowserWebView *browserView; @property (weak, nonatomic) IBOutlet UIProgressView *progressBar; -@property (weak, nonatomic) IBOutlet BowserConfirmView *confirmView; +//@property (weak, nonatomic) IBOutlet BowserConfirmView *confirmView; @property (weak, nonatomic) IBOutlet UITextField *urlField; @property (weak, nonatomic) IBOutlet UIWebView *consoleLogView; @property (nonatomic, strong) NSString *lastURL; -@property (nonatomic, strong) NSString *javascriptCode; @property (weak, nonatomic) IBOutlet UIView *bookMarkView; - (void)saveFiles; diff --git a/bowser-ios/Bowser/BowserViewController.m b/bowser-ios/Bowser/BowserViewController.m index 92826f2..133024e 100644 --- a/bowser-ios/Bowser/BowserViewController.m +++ b/bowser-ios/Bowser/BowserViewController.m @@ -41,9 +41,6 @@ static NSString *logDividerHtml = @"
"; static NSString *errorDividerHtml = @"
"; -static UIImageView *selfView; -static UIImageView *remoteView; - #define kDefaultStartURL @"http://www.openwebrtc.org/bowser" #define kSearchEngineURL @"http://www.google.com/search?q=%@" #define kBridgeLocalURL @"http://localhost:10717/owr.js" @@ -51,11 +48,12 @@ @interface BowserViewController () @property (nonatomic, strong) NSMutableArray *consoleLogArray; +/* @property (nonatomic, strong) NSMutableDictionary *mediaPermissionURLs; @property (nonatomic, strong) NSString *mediaPermissionsURLsFilePath; +*/ - (void)consoleLog:(NSString *)logString isError:(BOOL)isError; -- (void)loadRequestWithURL:(NSString *)url; @end @@ -67,6 +65,7 @@ - (void)viewDidLoad NSLog(@"BowserViewController viewDidLoad"); + /* self.javascriptCode = @ "(function () {" " if (window.RTCPeerConnection)" @@ -77,9 +76,10 @@ - (void)viewDidLoad " eval(xhr.responseText);" " return \"ok\";" "})()"; + */ self.browserView.scrollView.delegate = self; - self.browserView.bowserDelegate = self; + self.browserView.owrDelegate = self; self.consoleLogView.scrollView.scrollsToTop = NO; self.consoleLogView.scrollView.bounces = NO; self.headerView.scrollsToTop = NO; @@ -91,8 +91,10 @@ - (void)viewDidLoad NSString *documentsDirectory = [paths objectAtIndex:0]; historyFilePath = [documentsDirectory stringByAppendingPathComponent:@"BowserHistory.plist"]; bookmarksFilePath = [documentsDirectory stringByAppendingPathComponent:@"Bookmarks.plist"]; - self.mediaPermissionsURLsFilePath = [documentsDirectory stringByAppendingPathComponent:@"BowserMediaPermissionURLs.plist"]; + /* + self.mediaPermissionsURLsFilePath = [documentsDirectory stringByAppendingPathComponent:@"BowserMediaPermissionURLs.plist"]; +*/ NSFileManager *fileManager = [NSFileManager defaultManager]; if (![fileManager fileExistsAtPath:historyFilePath]) { @@ -103,14 +105,20 @@ - (void)viewDidLoad NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Bookmarks" ofType:@"plist"]; [fileManager copyItemAtPath:filePath toPath:bookmarksFilePath error:&error]; } + /* if (![fileManager fileExistsAtPath:self.mediaPermissionsURLsFilePath]) { NSString *filePath = [[NSBundle mainBundle] pathForResource:@"BowserMediaPermissionURLs" ofType:@"plist"]; [fileManager copyItemAtPath:filePath toPath:self.mediaPermissionsURLsFilePath error:&error]; } self.mediaPermissionURLs = [[NSMutableDictionary alloc] initWithContentsOfFile:self.mediaPermissionsURLsFilePath]; + */ + bowserHistory = [[NSMutableArray alloc] initWithContentsOfFile:historyFilePath]; + + /* [self.confirmView setUpView]; +*/ canChange = YES; headerIsAbove = YES; @@ -120,14 +128,12 @@ - (void)viewDidLoad self.historyTableView.layer.shadowRadius = 5.0; self.historyTableView.layer.shadowOpacity = 0.7; - //Make native video elements - UIImageView *aSelfView = [[UIImageView alloc] initWithFrame:CGRectZero]; - UIImageView *aRemoteView = [[UIImageView alloc] initWithFrame:CGRectZero]; - selfView = aSelfView; - remoteView = aRemoteView; + // Make native video elements + self.selfView = [[OpenWebRTCVideoView alloc] initWithFrame:CGRectZero]; + self.remoteView = [[OpenWebRTCVideoView alloc] initWithFrame:CGRectZero]; - [self.browserView.scrollView addSubview:remoteView]; - [self.browserView.scrollView addSubview:selfView]; + [self.browserView.scrollView addSubview:self.remoteView]; + [self.browserView.scrollView addSubview:self.selfView]; [self.headerView addSubview:self.bookmarkButton]; [self.consoleLogView loadHTMLString:[startHtml stringByAppendingString:@"
"] baseURL:nil]; } @@ -192,6 +198,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } } +/* - (void)loadRequestWithURL:(NSString *)url { NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url] @@ -199,12 +206,15 @@ - (void)loadRequestWithURL:(NSString *)url timeoutInterval:10]; [self.browserView loadRequest:request]; } + */ - (IBAction)reloadButtonTapped:(id)sender { + /* if (!pageNavigationTimer.isValid) { pageNavigationTimer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(insertJavascript:) userInfo:nil repeats:YES]; } + */ [[NSURLCache sharedURLCache] removeAllCachedResponses]; [self loadRequestWithURL:self.lastURL]; } @@ -228,7 +238,9 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger { if (buttonIndex == BowserMenuOptionClearHistory) { [bowserHistory removeAllObjects]; + /* [self.mediaPermissionURLs removeAllObjects]; + */ [[NSURLCache sharedURLCache] removeAllCachedResponses]; } else if (buttonIndex == BowserMenuOptionShowConsole) { if (consoleIsVisible) { @@ -278,7 +290,9 @@ - (void)textFieldDidBeginEditing:(UITextField *)textField [self.historyTableView reloadData]; self.historyTableView.hidden = NO; - if (textField.text.length >0) [textField selectAll:nil]; + if (textField.text.length > 0) { + [textField selectAll:nil]; + } } - (void)textFieldDidEndEditing:(UITextField *)textField @@ -323,7 +337,7 @@ - (void)viewDidUnload [self setProgressBar:nil]; [self setBookmarkButton:nil]; [self setHistoryTableView:nil]; - [self setConfirmView:nil]; + //[self setConfirmView:nil]; [super viewDidUnload]; // Release any retained subviews of the main view. } @@ -378,6 +392,7 @@ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView canChange = YES; } +/* - (void)insertJavascript: (NSTimer*) theTimer { //NSLog(@"timer, webview-url: %@", [self.browserView stringByEvaluatingJavaScriptFromString:@"document.location.href"]); @@ -389,13 +404,16 @@ - (void)insertJavascript: (NSTimer*) theTimer } } } + */ #pragma mark webview delegate stuff -- (void)webViewDidStartLoad:(BowserWebView *)webView +- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; NSLog(@"webViewDidStartLoading..."); self.progressBar.hidden = NO; + + /* if (pageNavigationTimer.isValid) [pageNavigationTimer invalidate]; @@ -405,6 +423,7 @@ - (void)webViewDidStartLoad:(BowserWebView *)webView selector:@selector(insertJavascript:) userInfo:nil repeats:YES]; + */ [self newVideoRect:CGRectZero forSelfView:YES]; [self newVideoRect:CGRectZero forSelfView:NO]; } @@ -420,9 +439,9 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *) - (void)newVideoRect:(CGRect)rect forSelfView:(BOOL)rectIsSelfView { if (rectIsSelfView) { - selfView.frame = rect; + self.selfView.frame = rect; } else { - remoteView.frame = rect; + self.remoteView.frame = rect; } } @@ -434,9 +453,9 @@ - (void)webviewProgress:(float)progress } } -- (void)webViewDidFinishLoad:(UIWebView *)webView +- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { - NSURL *currentURL = webView.request.URL; + NSURL *currentURL = webView.URL; self.urlField.text = currentURL.absoluteString; [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; self.lastURL = currentURL.absoluteString; @@ -444,8 +463,10 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView [[NSUserDefaults standardUserDefaults] setValue:self.lastURL forKey:@"lastURL"]; NSLog(@"webViewDidFinishLoading... %@", self.lastURL); + /* if (pageNavigationTimer.isValid) [pageNavigationTimer invalidate]; + */ BOOL urlAlreadyExists = NO; for (NSDictionary *historyPost in bowserHistory) { @@ -455,7 +476,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView } } if (!urlAlreadyExists) { - NSString *pageTitle = [webView stringByEvaluatingJavaScriptFromString:@"document.title"]; + NSString *pageTitle = webView.title; if (pageTitle.length == 0) { pageTitle = @"No title"; } @@ -469,11 +490,14 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView [self.consoleLogView loadHTMLString:[startHtml stringByAppendingString:@""] baseURL:nil]; } -- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error +- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; //self.urlField.text = self.lastURL; + /* [pageNavigationTimer invalidate]; + */ + NSLog(@"WEBVIEW LOADING ERROR ---- %@", [error description]); if (error.code == -999) { NSLog(@"Error: %@", error.localizedDescription); @@ -485,7 +509,7 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error cancelButtonTitle:@"Close" otherButtonTitles: nil] show]; } - +/* - (void)showUserMediaRequestPermissionViewwithRequestId:(NSString *)requestId { NSString *currentHost = [self.browserView getCurrentHost]; @@ -495,24 +519,9 @@ - (void)showUserMediaRequestPermissionViewwithRequestId:(NSString *)requestId return; } } - /* :::::INFO: Uncomment and remove the line below, if the custom confirm view should be used - [self.confirmView presentWithTitle:[NSString stringWithFormat:@"%@ wants to use your camera and microphone", currentHost] andRequestId:requestId]; - [self.browserView shrink]; - */ - [[[BowserMediaAlertView alloc] initWithRequestId:requestId forHost:currentHost withDelegate:self] show]; -} -/* :::::INFO: This method is never called. Is called if the custom confirm view is used --(void)bowserConfirmViewResponded:(BOOL)response withRequestId:(NSString *)requestId willRememberResponse:(BOOL)willRemember{ - [self.browserView restore]; - if (willRemember) { - NSString *currentHost = [self.browserView getCurrentHost]; - if (currentHost) { - [self.mediaPermissionURLs setValue:[NSNumber numberWithBool:response] forKey:currentHost]; - } - } + [[[BowserMediaAlertView alloc] initWithRequestId:requestId forHost:currentHost withDelegate:self] show]; } - */ - (void)alertView:(BowserMediaAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { @@ -521,6 +530,8 @@ - (void)alertView:(BowserMediaAlertView *)alertView clickedButtonAtIndex:(NSInte [self.mediaPermissionURLs setValue:[NSNumber numberWithBool:YES] forKey:alertView.host]; } } + */ + - (void)consoleLog:(NSString *)logString isError:(BOOL)isError { /* NSLog(@"New console.log string: %@", logString);*/ @@ -544,20 +555,17 @@ - (void)slideUpView:(UIView*)view { [UIView animateWithDuration:0.4 animations:^(void) { view.frame = CGRectMake(0, self.view.bounds.size.height-view.bounds.size.height, view.frame.size.width, view.frame.size.height); - } completion:^(BOOL finished) { - - }]; + } completion:nil]; } - (void)slideDownView:(UIView*)view { [UIView animateWithDuration:0.4 animations:^(void){ view.frame = CGRectMake(0, self.view.bounds.size.height, view.frame.size.width, view.frame.size.height); - } completion:^(BOOL finished) { - - }]; + } completion:nil]; } +/* - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { @@ -566,10 +574,11 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface return !self.confirmView.isActive; } } + */ - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { - self.headerView.contentSize = CGSizeMake(self.headerView.bounds.size.width+1, self.headerView.bounds.size.height); + self.headerView.contentSize = CGSizeMake(self.headerView.bounds.size.width + 1, self.headerView.bounds.size.height); } - (IBAction)showConsole:(UIButton*)consoleButton @@ -635,7 +644,10 @@ - (void)viewWillDisappear:(BOOL)animated - (void)saveFiles { [bowserHistory writeToFile:historyFilePath atomically:YES]; + /* [self.mediaPermissionURLs writeToFile:self.mediaPermissionsURLsFilePath atomically:YES]; + */ + NSLog(@"writing files!"); } @@ -648,8 +660,8 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender } else if ([segue.identifier isEqualToString:@"addBookmarkSegue"]) { UINavigationController *navController = segue.destinationViewController; AddBookmarkViewController *abvc = [navController viewControllers][0]; - abvc.bookmarkTitle = [self.browserView stringByEvaluatingJavaScriptFromString:@"document.title"]; - abvc.bookmarkURL = [self.browserView stringByEvaluatingJavaScriptFromString:@"document.URL"]; + abvc.bookmarkTitle = self.browserView.title; + abvc.bookmarkURL = [self.browserView.URL absoluteString]; } } diff --git a/bowser-ios/Bowser/BowserWebView.h b/bowser-ios/Bowser/BowserWebView.h index 9f5cd88..bf65f0b 100644 --- a/bowser-ios/Bowser/BowserWebView.h +++ b/bowser-ios/Bowser/BowserWebView.h @@ -28,7 +28,9 @@ // #import +#import +/* @protocol BowserWebViewDelegate @optional @@ -37,18 +39,19 @@ - (void)newVideoRect:(CGRect)rect forSelfView:(BOOL)rectIsSelfView; @end -@interface BowserWebView : UIWebView -{ - int resourceCount; - int resourceCompletedCount; -} + */ -@property (assign) id bowserDelegate; -@property (nonatomic) BOOL webGLEnabled; -- (BOOL)isOnPageWithURL:(NSString *)urlString; +@interface BowserWebView : OpenWebRTCWebView + +//@property (assign) id bowserDelegate; +//@property (nonatomic) BOOL webGLEnabled; + +//- (BOOL)isOnPageWithURL:(NSString *)urlString; + - (void)shrink; - (void)restore; -- (NSString *)getCurrentHost; + +//- (NSString *)getCurrentHost; @end diff --git a/bowser-ios/Bowser/BowserWebView.m b/bowser-ios/Bowser/BowserWebView.m index a4ff13b..5d37615 100644 --- a/bowser-ios/Bowser/BowserWebView.m +++ b/bowser-ios/Bowser/BowserWebView.m @@ -40,6 +40,7 @@ - (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString @implementation BowserWebView +/* - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; @@ -50,12 +51,15 @@ - (id)initWithFrame:(CGRect)frame } return self; } + */ +/* - (BOOL)isOnPageWithURL: (NSString*) urlString { return ([[self stringByEvaluatingJavaScriptFromString:@"window.location.href"] rangeOfString:urlString].location != NSNotFound); } + - (NSString *)getCurrentHost { return [self stringByEvaluatingJavaScriptFromString:@"window.location.host"]; @@ -71,7 +75,7 @@ - (void)webView:(id)view resource:(id)resource didFailLoadingWithError:(id)error { [super webView:view resource:resource didFailLoadingWithError:error fromDataSource:dataSource]; resourceCompletedCount++; -/* NSLog(@"completed fail: %d, total: %d", resourceCompletedCount, resourceCount);*/ + NSLog(@"completed fail: %d, total: %d", resourceCompletedCount, resourceCount); [self setProgress:resourceCompletedCount ofTotal:resourceCount]; } @@ -93,11 +97,11 @@ - (void)setProgress:(int)done ofTotal:(int) total } else { progress = ((float)done)/((float)total); } - if ([self.delegate respondsToSelector:@selector(webviewProgress:)]) { - [self.bowserDelegate webviewProgress:progress]; + if ([self.owrDelegate respondsToSelector:@selector(webviewProgress:)]) { + [self.owrDelegate webviewProgress:progress]; } - } +*/ - (void)shrink { @@ -125,9 +129,10 @@ - (void)webView:(UIWebView *)sender runJavaScriptAlertPanelWithMessage:(NSString CGFloat width = [[messageComps objectAtIndex:4] floatValue] - x; CGFloat height = [[messageComps objectAtIndex:5] floatValue] - y; CGRect newRect = CGRectMake(x * sf, y * sf, width * sf, height * sf); - [self.bowserDelegate newVideoRect:newRect forSelfView:[[messageComps objectAtIndex:1] boolValue]]; + [self.owrDelegate newVideoRect:newRect forSelfView:[[messageComps objectAtIndex:1] boolValue]]; } else { - [super webView:sender runJavaScriptAlertPanelWithMessage:message initiatedByFrame:frame]; + //[super webView:sender runJavaScriptAlertPanelWithMessage:message initiatedByFrame:frame]; + NSLog(@"WARNING! owr-message:video-rect NOT handled"); } } diff --git a/bowser-ios/Bowser/en.lproj/MainStoryboard_iPhone.storyboard b/bowser-ios/Bowser/en.lproj/MainStoryboard_iPhone.storyboard index 73cfdee..5c7918b 100644 --- a/bowser-ios/Bowser/en.lproj/MainStoryboard_iPhone.storyboard +++ b/bowser-ios/Bowser/en.lproj/MainStoryboard_iPhone.storyboard @@ -1,11 +1,11 @@ - + - + - + @@ -20,6 +20,7 @@ + @@ -30,6 +31,7 @@ +