Skip to content

Commit

Permalink
Merge pull request #10 from doximity/v0.1.2
Browse files Browse the repository at this point in the history
v0.1.2 -> master
  • Loading branch information
ataibarkai committed May 4, 2017
2 parents eb94257 + 60606ad commit ca2ad87
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CallWithDoxDialer.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CallWithDoxDialer"
s.version = "0.1.1"
s.version = "0.1.2"
s.summary = "A µLibrary for initiating calls through Doximity's Dialer app."
s.description = <<-DESC
Doximity's Dialer app lets healthcare professionals make
Expand Down
23 changes: 18 additions & 5 deletions CallWithDoxDialer/DoxDialerCaller.m
Expand Up @@ -15,6 +15,8 @@ @interface DoxDialerCaller() {
UIImage *_dialerIcon;
UIImage *_dialerIconAsTemplate;
}
@property (nonnull, readonly) NSString *dialerScheme;

@end


Expand All @@ -38,10 +40,15 @@ +(instancetype _Nonnull)shared {
#pragma mark Methods
-(void)dialPhoneNumber:(nonnull NSString *)phoneNumber {
if (self.isDialerInstalled) {
NSString *urlEscapedPhoneNumber = [phoneNumber stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
NSURL *launchDialerURL = [NSURL URLWithString:[NSString stringWithFormat:@"/call?targetNumber=%@", urlEscapedPhoneNumber]
relativeToURL:self.dialerSchemeURL];
[self openURL:launchDialerURL];

NSURLComponents *launchDialerURLComponents = [[NSURLComponents alloc] init];
launchDialerURLComponents.scheme = self.dialerScheme;
launchDialerURLComponents.host = @"";
launchDialerURLComponents.path = @"/call";
launchDialerURLComponents.queryItems = @[
[[NSURLQueryItem alloc] initWithName:@"targetNumber" value:phoneNumber]
];
[self openURL:launchDialerURLComponents.URL];
}
else {
[self openURL:self.openDialerInAppStoreURL];
Expand Down Expand Up @@ -75,9 +82,15 @@ -(nonnull UIImage *)dialerIconAsTemplate {
#pragma mark - Private Internal Properties -

#pragma mark Lazy Properties
-(nonnull NSString *)dialerScheme {
return @"DoximityDialer";
}
-(nonnull NSURL *)dialerSchemeURL {
if(!_dialerSchemeURL) {
_dialerSchemeURL = [NSURL URLWithString:@"DoximityDialer://"];
NSURLComponents *dialerSchemeURLComponents = [[NSURLComponents alloc] init];
dialerSchemeURLComponents.scheme = self.dialerScheme;
dialerSchemeURLComponents.host = @"";
_dialerSchemeURL = dialerSchemeURLComponents.URL;
}
return _dialerSchemeURL;
}
Expand Down
2 changes: 1 addition & 1 deletion CallWithDoxDialer/Info.plist
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.1</string>
<string>0.1.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down

0 comments on commit ca2ad87

Please sign in to comment.