File tree 4 files changed +19
-7
lines changed
4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 1
1
# capacitor-plugin-call
2
2
3
- Call number plugin for Capacitor apps
3
+ Call number plugin for Capacitor apps (Capacitor 5 only).
4
+
5
+ ## Supported platforms
6
+
7
+ - Android
8
+ - iOS
4
9
5
10
## Install
6
11
Original file line number Diff line number Diff line change 4
4
// Define the plugin using the CAP_PLUGIN Macro, and
5
5
// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
6
6
CAP_PLUGIN (CallPlugin, " Call" ,
7
- CAP_PLUGIN_METHOD (echo , CAPPluginReturnPromise);
7
+ CAP_PLUGIN_METHOD (call , CAPPluginReturnPromise);
8
8
)
Original file line number Diff line number Diff line change
1
+ import Foundation
1
2
import Capacitor
2
3
3
4
/**
@@ -14,13 +15,19 @@ public class CallPlugin: CAPPlugin {
14
15
return
15
16
}
16
17
17
- if formattedNumber. starts ( with: " tel: " ) {
18
+ if ! formattedNumber. starts ( with: " tel: " ) {
18
19
formattedNumber = " tel: " + formattedNumber
19
20
}
20
21
21
22
formattedNumber = formattedNumber. replacingOccurrences ( of: " # " , with: " %23 " )
22
- guard let number = URL ( string: formattedNumber) else { return }
23
- UIApplication . shared. open ( number)
24
- call. resolve ( )
23
+ guard let number = URL ( string: formattedNumber)
24
+ else {
25
+ call. reject ( " error-call-failed " )
26
+ return
27
+ }
28
+ DispatchQueue . main. async {
29
+ UIApplication . shared. open ( number)
30
+ call. resolve ( )
31
+ }
25
32
}
26
33
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " capacitor-plugin-call" ,
3
- "version" : " 5.0.0 " ,
3
+ "version" : " 5.0.1 " ,
4
4
"description" : " Call number plugin for Capacitor apps" ,
5
5
"main" : " dist/plugin.cjs.js" ,
6
6
"module" : " dist/esm/index.js" ,
You can’t perform that action at this time.
0 commit comments