File tree Expand file tree Collapse file tree 4 files changed +19
-7
lines changed
Expand file tree Collapse file tree 4 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 11# capacitor-plugin-call
22
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
49
510## Install
611
Original file line number Diff line number Diff line change 44// Define the plugin using the CAP_PLUGIN Macro, and
55// each method the plugin supports using the CAP_PLUGIN_METHOD macro.
66CAP_PLUGIN (CallPlugin, " Call" ,
7- CAP_PLUGIN_METHOD (echo , CAPPluginReturnPromise);
7+ CAP_PLUGIN_METHOD (call , CAPPluginReturnPromise);
88)
Original file line number Diff line number Diff line change 1+ import Foundation
12import Capacitor
23
34/**
@@ -14,13 +15,19 @@ public class CallPlugin: CAPPlugin {
1415 return
1516 }
1617
17- if formattedNumber. starts ( with: " tel: " ) {
18+ if ! formattedNumber. starts ( with: " tel: " ) {
1819 formattedNumber = " tel: " + formattedNumber
1920 }
2021
2122 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+ }
2532 }
2633}
Original file line number Diff line number Diff line change 11{
22 "name" : " capacitor-plugin-call" ,
3- "version" : " 5.0.0 " ,
3+ "version" : " 5.0.1 " ,
44 "description" : " Call number plugin for Capacitor apps" ,
55 "main" : " dist/plugin.cjs.js" ,
66 "module" : " dist/esm/index.js" ,
You can’t perform that action at this time.
0 commit comments