[jira] [Commented] (CB-13535) Add app events for connecting and disconnecting calls
[ https://issues.apache.org/jira/browse/CB-13535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245659#comment-16245659 ] ASF GitHub Bot commented on CB-13535: - SpencerEJameson closed pull request #348: CB-13535: (ios) Add CallStart/CallEnd events to fire with Resign/Active events URL: https://github.com/apache/cordova-ios/pull/348 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/CordovaLib/Classes/Public/CDVViewController.m b/CordovaLib/Classes/Public/CDVViewController.m index d0c05865a..b06fa1767 100644 --- a/CordovaLib/Classes/Public/CDVViewController.m +++ b/CordovaLib/Classes/Public/CDVViewController.m @@ -28,6 +28,10 @@ Licensed to the Apache Software Foundation (ASF) under one #import "CDVLocalStorage.h" #import "CDVCommandDelegateImpl.h" #import +#import +#import +#import +#import @interface CDVViewController () { NSInteger _userAgentLockToken; @@ -39,6 +43,7 @@ @interface CDVViewController () { @property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames; @property (nonatomic, readwrite, strong) NSDictionary* pluginsMap; @property (nonatomic, readwrite, strong) id webViewEngine; +@property (nonatomic, readwrite, strong) CXCallObserver* callObserver; @property (readwrite, assign) BOOL initialized; @@ -74,6 +79,11 @@ - (void)__init [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:) name:UIApplicationDidEnterBackgroundNotification object:nil]; + if (IsAtLeastiOSVersion(@"10.0")) { + CXCallObserver *callObserver = [[CXCallObserver alloc] init]; + [callObserver setDelegate:self queue:nil]; + self.callObserver = callObserver; + } // read from UISupportedInterfaceOrientations (or UISupportedInterfaceOrientations~iPad, if its iPad) from -Info.plist self.supportedOrientations = [self parseInterfaceOrientations: [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]]; @@ -343,9 +353,9 @@ - (void)viewDidLoad } } }]; - + // / - + NSString* bgColorString = [self.settings cordovaSettingForKey:@"BackgroundColor"]; UIColor* bgColor = [self colorFromColorString:bgColorString]; [self.webView setBackgroundColor:bgColor]; @@ -405,16 +415,16 @@ - (UIColor*)colorFromColorString:(NSString*)colorString if (!colorString) { return nil; } - + // Validate format NSError* error = NULL; NSRegularExpression* regex = [NSRegularExpression regularExpressionWithPattern:@"^(#[0-9A-F]{3}|(0x|#)([0-9A-F]{2})?[0-9A-F]{6})$" options:NSRegularExpressionCaseInsensitive error:]; NSUInteger countMatches = [regex numberOfMatchesInString:colorString options:0 range:NSMakeRange(0, [colorString length])]; - + if (!countMatches) { return nil; } - + // #FAB to #FFAABB if ([colorString hasPrefix:@"#"] && [colorString length] == 4) { NSString* r = [colorString substringWithRange:NSMakeRange(1, 1)]; @@ -422,22 +432,22 @@ - (UIColor*)colorFromColorString:(NSString*)colorString NSString* b = [colorString substringWithRange:NSMakeRange(3, 1)]; colorString = [NSString stringWithFormat:@"#%@%@%@%@%@%@", r, r, g, g, b, b]; } - + // #RRGGBB to 0xRRGGBB colorString = [colorString stringByReplacingOccurrencesOfString:@"#" withString:@"0x"]; - + // 0xRRGGBB to 0xAARRGGBB if ([colorString hasPrefix:@"0x"] && [colorString length] == 8) { colorString = [@"0xFF" stringByAppendingString:[colorString substringFromIndex:2]]; } - + // 0xAARRGGBB to int unsigned colorValue = 0; NSScanner *scanner = [NSScanner scannerWithString:colorString]; if (![scanner scanHexInt:]) { return nil; } - + // int to UIColor return [UIColor colorWithRed:((float)((colorValue & 0x00FF) >> 16))/255.0 green:((float)((colorValue & 0xFF00) >> 8))/255.0 @@ -480,9 +490,9 @@ - (BOOL)shouldAutorotate } // CB-12098 -#if __IPHONE_OS_VERSION_MAX_ALLOWED < 9 -- (NSUInteger)supportedInterfaceOrientations -#else +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 9 +- (NSUInteger)supportedInterfaceOrientations +#else - (UIInterfaceOrientationMask)supportedInterfaceOrientations #endif { @@ -728,6 +738,16 @@ - (void)onAppWillResignActive:(NSNotification*)notification { // NSLog(@"%@",@"applicationWillResignActive"); [self.commandDelegate evalJs:@"cordova.fireDocumentEvent('resign');"
[jira] [Commented] (CB-13535) Add app events for connecting and disconnecting calls
[ https://issues.apache.org/jira/browse/CB-13535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245658#comment-16245658 ] ASF GitHub Bot commented on CB-13535: - SpencerEJameson commented on issue #348: CB-13535: (ios) Add CallStart/CallEnd events to fire with Resign/Active events URL: https://github.com/apache/cordova-ios/pull/348#issuecomment-343157832 @shazron Totally, that makes sense. Thanks for providing the feedback! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add app events for connecting and disconnecting calls > - > > Key: CB-13535 > URL: https://issues.apache.org/jira/browse/CB-13535 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-ios >Reporter: Spencer Jameson >Assignee: Suraj Pindoria > > The app resign/active events that Cordova fires trigger for multiple phone > events. Example: connecting a call and locking the screen app both trigger > the *resign* event, while disconnecting a call and unlocking the screen > trigger the *active* event. It would be convenient to have distinct events > that fire for calls connecting and ending to tie into, aside from the generic > *active* and *resign* events. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-13535) Add app events for connecting and disconnecting calls
[ https://issues.apache.org/jira/browse/CB-13535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16245182#comment-16245182 ] ASF GitHub Bot commented on CB-13535: - shazron commented on issue #348: CB-13535: (ios) Add CallStart/CallEnd events to fire with Resign/Active events URL: https://github.com/apache/cordova-ios/pull/348#issuecomment-343043491 This shouldn't be in the platform but in a plugin, since adding new platform features should either be: 1. cross-platform (all relevant platforms support it, and this has to be decided by consensus on the dev list) 2. part of a standard spec, i.e w3c (but still decided by point 1 above). Not all apps need this functionality thus it should be optional in a plugin, and this can be achieved in a plugin. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add app events for connecting and disconnecting calls > - > > Key: CB-13535 > URL: https://issues.apache.org/jira/browse/CB-13535 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-ios >Reporter: Spencer Jameson >Assignee: Suraj Pindoria > > The app resign/active events that Cordova fires trigger for multiple phone > events. Example: connecting a call and locking the screen app both trigger > the *resign* event, while disconnecting a call and unlocking the screen > trigger the *active* event. It would be convenient to have distinct events > that fire for calls connecting and ending to tie into, aside from the generic > *active* and *resign* events. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-13535) Add app events for connecting and disconnecting calls
[ https://issues.apache.org/jira/browse/CB-13535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16237814#comment-16237814 ] ASF GitHub Bot commented on CB-13535: - codecov-io commented on issue #348: CB-13535: (ios) Add CallStart/CallEnd events to fire with Resign/Active events URL: https://github.com/apache/cordova-ios/pull/348#issuecomment-341746898 # [Codecov](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=h1) Report > Merging [#348](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=desc) into [master](https://codecov.io/gh/apache/cordova-ios/commit/aaf229b0370ff315b571ea8b7c4648c315fb322d?src=pr=desc) will **not change** coverage. > The diff coverage is `n/a`. [![Impacted file tree graph](https://codecov.io/gh/apache/cordova-ios/pull/348/graphs/tree.svg?height=150=650=pr=WomDD5jInz)](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=tree) ```diff @@ Coverage Diff @@ ## master #348 +/- ## === Coverage 63.43% 63.43% === Files 14 14 Lines1690 1690 Branches 283 283 === Hits 1072 1072 Misses618 618 ``` -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=footer). Last update [aaf229b...1d95501](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add app events for connecting and disconnecting calls > - > > Key: CB-13535 > URL: https://issues.apache.org/jira/browse/CB-13535 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-ios >Reporter: Spencer Jameson >Assignee: Suraj Pindoria >Priority: Normal > > The app resign/active events that Cordova fires trigger for multiple phone > events. Example: connecting a call and locking the screen app both trigger > the *resign* event, while disconnecting a call and unlocking the screen > trigger the *active* event. It would be convenient to have distinct events > that fire for calls connecting and ending to tie into, aside from the generic > *active* and *resign* events. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-13535) Add app events for connecting and disconnecting calls
[ https://issues.apache.org/jira/browse/CB-13535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16237813#comment-16237813 ] ASF GitHub Bot commented on CB-13535: - codecov-io commented on issue #348: CB-13535: (ios) Add CallStart/CallEnd events to fire with Resign/Active events URL: https://github.com/apache/cordova-ios/pull/348#issuecomment-341746898 # [Codecov](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=h1) Report > Merging [#348](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=desc) into [master](https://codecov.io/gh/apache/cordova-ios/commit/aaf229b0370ff315b571ea8b7c4648c315fb322d?src=pr=desc) will **not change** coverage. > The diff coverage is `n/a`. [![Impacted file tree graph](https://codecov.io/gh/apache/cordova-ios/pull/348/graphs/tree.svg?token=WomDD5jInz=650=150=pr)](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=tree) ```diff @@ Coverage Diff @@ ## master #348 +/- ## === Coverage 63.43% 63.43% === Files 14 14 Lines1690 1690 Branches 283 283 === Hits 1072 1072 Misses618 618 ``` -- [Continue to review full report at Codecov](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=continue). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=footer). Last update [aaf229b...1d95501](https://codecov.io/gh/apache/cordova-ios/pull/348?src=pr=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add app events for connecting and disconnecting calls > - > > Key: CB-13535 > URL: https://issues.apache.org/jira/browse/CB-13535 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-ios >Reporter: Spencer Jameson >Assignee: Suraj Pindoria >Priority: Normal > > The app resign/active events that Cordova fires trigger for multiple phone > events. Example: connecting a call and locking the screen app both trigger > the *resign* event, while disconnecting a call and unlocking the screen > trigger the *active* event. It would be convenient to have distinct events > that fire for calls connecting and ending to tie into, aside from the generic > *active* and *resign* events. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-13535) Add app events for connecting and disconnecting calls
[ https://issues.apache.org/jira/browse/CB-13535?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16237695#comment-16237695 ] ASF GitHub Bot commented on CB-13535: - SpencerEJameson opened a new pull request #348: CB-13535: (ios) Add CallStart/CallEnd events to fire with Resign/Active events URL: https://github.com/apache/cordova-ios/pull/348 ### Platforms affected iOS ### What does this PR do? Adds new events to trigger alongside the current resign/active events to specifically denote when a call started and ended. The new events are **callstart** and **callend** ### What testing has been done on this change? Tested against iOS 10.x+ and verified that upon calls connecting and disconnecting the events were triggering correctly. I did not have an iOS device less than 10.x to test with. ### Usage in App `document.addEventListener("callstart", function() { console.log("Call Start"); });` `document.addEventListener("callend", function() { console.log("Call End); });` ### Checklist - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [X] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB- is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add app events for connecting and disconnecting calls > - > > Key: CB-13535 > URL: https://issues.apache.org/jira/browse/CB-13535 > Project: Apache Cordova > Issue Type: Improvement > Components: cordova-ios >Reporter: Spencer Jameson >Assignee: Suraj Pindoria >Priority: Normal > > The app resign/active events that Cordova fires trigger for multiple phone > events. Example: connecting a call and locking the screen app both trigger > the *resign* event, while disconnecting a call and unlocking the screen > trigger the *active* event. It would be convenient to have distinct events > that fire for calls connecting and ending to tie into, aside from the generic > *active* and *resign* events. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org