-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial iOS support. Added dependency on CN1JSON.cn1lib.
- Loading branch information
Showing
33 changed files
with
14,983 additions
and
10 deletions.
There are no files selected for viewing
Submodule IosRtcPlugin
added at
1a078e
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
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,7 +1,7 @@ | ||
# | ||
#Fri Jul 24 08:09:37 PDT 2020 | ||
#Thu Aug 13 08:20:06 PDT 2020 | ||
CodeNameOneBuildClientJar=105 | ||
CodenameOne_SRCzip=137 | ||
CodenameOneJar=137 | ||
JavaSEJar=137 | ||
CodenameOne_SRCzip=140 | ||
CodenameOneJar=140 | ||
JavaSEJar=140 | ||
CLDC11Jar=108 |
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
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 @@ | ||
version=4 |
Binary file added
BIN
+492 Bytes
native/internal_tmp/com/codename1/webrtc/compat/cordova/CordovaNativeImpl.class
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
native/internal_tmp/com/codename1/webrtc/compat/cordova/CordovaNativeImpl.java
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,18 @@ | ||
package com.codename1.webrtc.compat.cordova; | ||
|
||
public class CordovaNativeImpl implements com.codename1.webrtc.compat.cordova.CordovaNative{ | ||
public boolean execute(String param, String param1, String param2) { | ||
return false; | ||
} | ||
|
||
public void pluginInitialize(com.codename1.ui.PeerComponent param) { | ||
} | ||
|
||
public void dispose() { | ||
} | ||
|
||
public boolean isSupported() { | ||
return false; | ||
} | ||
|
||
} |
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
18 changes: 18 additions & 0 deletions
18
webrtc/native/android/com/codename1/webrtc/compat/cordova/CordovaNativeImpl.java
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,18 @@ | ||
package com.codename1.webrtc.compat.cordova; | ||
|
||
public class CordovaNativeImpl { | ||
public boolean execute(String param, String param1, String param2) { | ||
return false; | ||
} | ||
|
||
public void pluginInitialize(android.view.View param) { | ||
} | ||
|
||
public void dispose() { | ||
} | ||
|
||
public boolean isSupported() { | ||
return false; | ||
} | ||
|
||
} |
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,29 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <Cordova/CDVCommandDelegate.h> | ||
|
||
@class CDVViewController; | ||
|
||
@interface IosrtcPluginCommandDelegateImpl : NSObject <CDVCommandDelegate>{ | ||
|
||
} | ||
|
||
@end |
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,129 @@ | ||
/* | ||
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. | ||
*/ | ||
|
||
#import "CDVCommandDelegateImpl.h" | ||
#import "CDVCommandQueue.h" | ||
#import "CDVPluginResult.h" | ||
#import "CDVViewController.h" | ||
#import "com_codename1_webrtc_compat_cordova_CordovaCallbackManager.h" | ||
|
||
@implementation IosrtcPluginCommandDelegateImpl : NSObject | ||
|
||
//@synthesize urlTransformer; | ||
|
||
|
||
- (NSString*)pathForResource:(NSString*)resourcepath | ||
{ | ||
return nil; | ||
} | ||
|
||
- (void)flushCommandQueueWithDelayedJs | ||
{ | ||
//_delayResponses = YES; | ||
//[_commandQueue executePending]; | ||
//_delayResponses = NO; | ||
} | ||
|
||
- (void)evalJsHelper2:(NSString*)js | ||
{ | ||
|
||
} | ||
|
||
- (void)evalJsHelper:(NSString*)js | ||
{ | ||
|
||
} | ||
|
||
- (BOOL)isValidCallbackId:(NSString*)callbackId | ||
{ | ||
|
||
return YES; | ||
} | ||
|
||
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId | ||
{ | ||
CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status); | ||
// This occurs when there is are no win/fail callbacks for the call. | ||
if ([@"INVALID" isEqualToString:callbackId]) { | ||
return; | ||
} | ||
// This occurs when the callback id is malformed. | ||
if (![self isValidCallbackId:callbackId]) { | ||
NSLog(@"Invalid callback id received by sendPluginResult"); | ||
return; | ||
} | ||
int status = [result.status intValue]; | ||
BOOL keepCallback = [result.keepCallback boolValue]; | ||
NSString* argumentsAsJSON = [result argumentsAsJSON]; | ||
BOOL debug = NO; | ||
BOOL isSuccess = [result.status intValue] == 0 || [result.status intValue] == 1; | ||
#ifdef DEBUG | ||
debug = YES; | ||
#endif | ||
|
||
//NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d, %d)", callbackId, status, argumentsAsJSON, keepCallback, debug]; | ||
|
||
//[self evalJsHelper:js]; | ||
//NSLog(@"Result %@", argumentsAsJSON); | ||
//public static void sendResult(String callbackId, boolean isSuccess, int status, String args, boolean keepCallback){ | ||
com_codename1_webrtc_compat_cordova_CordovaCallbackManager_sendResult___java_lang_String_boolean_int_java_lang_String_boolean( | ||
CN1_THREAD_GET_STATE_PASS_ARG | ||
fromNSString(CN1_THREAD_GET_STATE_PASS_ARG callbackId), | ||
isSuccess, | ||
[result.status intValue], | ||
fromNSString(CN1_THREAD_GET_STATE_PASS_ARG argumentsAsJSON), | ||
keepCallback | ||
); | ||
|
||
} | ||
|
||
- (void)evalJs:(NSString*)js | ||
{ | ||
//[self evalJs:js scheduledOnRunLoop:YES]; | ||
} | ||
|
||
- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop | ||
{ | ||
|
||
} | ||
|
||
- (id)getCommandInstance:(NSString*)pluginName | ||
{ | ||
//return [_viewController getCommandInstance:pluginName]; | ||
return nil; | ||
} | ||
|
||
- (void)runInBackground:(void (^)())block | ||
{ | ||
//dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block); | ||
} | ||
|
||
- (NSString*)userAgent | ||
{ | ||
//return [_viewController userAgent]; | ||
return nil; | ||
} | ||
|
||
- (NSDictionary*)settings | ||
{ | ||
//return _viewController.settings; | ||
return nil; | ||
} | ||
|
||
@end |
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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
#import "com_codename1_webrtc_WebRTCNativeImpl.h" | ||
|
||
|
||
@implementation com_codename1_webrtc_WebRTCNativeImpl | ||
|
||
-(void)requestPermissions:(NSString*)param param1:(BOOL)param1 param2:(BOOL)param2{ | ||
|
||
} | ||
|
||
-(BOOL)isSupported{ | ||
return NO; | ||
} | ||
|
||
|
||
@end |
13 changes: 13 additions & 0 deletions
13
webrtc/native/ios/com_codename1_webrtc_compat_cordova_CordovaNativeImpl.h
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,13 @@ | ||
#import <Foundation/Foundation.h> | ||
|
||
@class iosrtcPlugin; | ||
|
||
@interface com_codename1_webrtc_compat_cordova_CordovaNativeImpl : NSObject { | ||
|
||
iosrtcPlugin* _iosrtcPlugin; | ||
} | ||
-(void)pluginInitialize:(UIView*)param; | ||
-(void)dispose; | ||
-(BOOL)execute:(NSString*) callbackId param1:(NSString*)action param2:(NSString*)data; | ||
-(BOOL)isSupported; | ||
@end |
91 changes: 91 additions & 0 deletions
91
webrtc/native/ios/com_codename1_webrtc_compat_cordova_CordovaNativeImpl.m
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,91 @@ | ||
#import <Foundation/Foundation.h> | ||
#import "com_codename1_webrtc_compat_cordova_CordovaNativeImpl.h" | ||
#import "IosrtcPluginCommandDelegateImpl.h" | ||
#import <objc/message.h> | ||
#import <WebKit/WebKit.h> | ||
@import IosRtcPlugin; | ||
|
||
|
||
|
||
@implementation com_codename1_webrtc_compat_cordova_CordovaNativeImpl | ||
|
||
|
||
|
||
-(iosrtcPlugin*)getIosrtcPlugin { | ||
|
||
return _iosrtcPlugin; | ||
} | ||
|
||
|
||
-(void)pluginInitialize:(UIView*)param { | ||
WKWebView* webView = (WKWebView*)param; | ||
if (_iosrtcPlugin == nil) { | ||
_iosrtcPlugin = [[iosrtcPlugin alloc] init]; | ||
//[_iosrtcPlugin setValue:webView forKey:@"webView"]; | ||
[_iosrtcPlugin setWebView:webView]; | ||
_iosrtcPlugin.commandDelegate = [[IosrtcPluginCommandDelegateImpl alloc] init]; | ||
[_iosrtcPlugin pluginInitialize]; | ||
} | ||
} | ||
-(void)dispose { | ||
if (_iosrtcPlugin != nil) { | ||
[_iosrtcPlugin setWebView:nil]; | ||
_iosrtcPlugin.commandDelegate = nil; | ||
[_iosrtcPlugin dispose]; | ||
_iosrtcPlugin = nil; | ||
|
||
} | ||
} | ||
-(BOOL)execute:(NSString*) callbackId param1:(NSString*)param1 param2:(NSString*)param2{ | ||
//-(BOOL)execute:(NSString*)param param1:(NSString*)param1{ | ||
if (![NSThread isMainThread]) { | ||
dispatch_async(dispatch_get_main_queue(), ^{ | ||
[self execute:callbackId param1:param1 param2:param2]; | ||
|
||
}); | ||
return YES; | ||
} | ||
NSData* data = [param2 dataUsingEncoding:NSUTF8StringEncoding]; | ||
NSError *e; | ||
NSArray *array = nil; | ||
if (param2 == nil || [param2 length] == 0) { | ||
array = [NSArray array]; | ||
} else { | ||
array = [NSJSONSerialization JSONObjectWithData:data options:nil error:&e]; | ||
} | ||
CDVInvokedUrlCommand* command = [[CDVInvokedUrlCommand alloc] initWithArguments:array callbackId:callbackId className:@"iosrtcPlugin" methodName:param1]; | ||
return [self execute:command]; | ||
} | ||
|
||
- (BOOL)execute:(CDVInvokedUrlCommand*)command | ||
{ | ||
BOOL retVal = YES; | ||
double started = [[NSDate date] timeIntervalSince1970] * 1000.0; | ||
CDVPlugin* obj = [self getIosrtcPlugin]; | ||
NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName]; | ||
SEL normalSelector = NSSelectorFromString(methodName); | ||
if ([obj respondsToSelector:normalSelector]) { | ||
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command); | ||
} else { | ||
// There's no method to call, so throw an error. | ||
NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className); | ||
retVal = NO; | ||
} | ||
double elapsed = [[NSDate date] timeIntervalSince1970] * 1000.0 - started; | ||
if (elapsed > 10) { | ||
NSLog(@"THREAD WARNING: ['%@'] took '%f' ms. Plugin should use a background thread.", command.className, elapsed); | ||
} | ||
return retVal; | ||
} | ||
-(BOOL)isSupported{ | ||
return YES; | ||
} | ||
|
||
-(void)dealloc { | ||
if (_iosrtcPlugin != nil) { | ||
[_iosrtcPlugin dispose]; | ||
_iosrtcPlugin = nil; | ||
} | ||
[super dealloc]; | ||
} | ||
@end |
18 changes: 18 additions & 0 deletions
18
webrtc/native/j2me/com/codename1/webrtc/compat/cordova/CordovaNativeImpl.java
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,18 @@ | ||
package com.codename1.webrtc.compat.cordova; | ||
|
||
public class CordovaNativeImpl { | ||
public boolean execute(String param, String param1, String param2) { | ||
return false; | ||
} | ||
|
||
public void pluginInitialize(Object param) { | ||
} | ||
|
||
public void dispose() { | ||
} | ||
|
||
public boolean isSupported() { | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.