GV Connect
GV Connect 是一款适用于 iPhone、iPod touch 和 iPad 的 Google Voice 客户端。Protocol Launcher 可以生成官方 GV Connect URL scheme 链接。
GV Connect 文档说明这些 handlers 区分大小写,并且都需要正确 URL 编码。多数 handlers 还可以添加可选的 account 参数,以便在多账号配置中指定账号。
对于 SMS 群发收件人,GV Connect 文档限定最多五个号码,并用逗号分隔。
使用方式
有两种使用此库的方式:
- 按需导入(On-Demand):从子路径导入支持 tree-shaking,保持较小的打包体积。
- 完整导入(Full Import):从根包导入更方便,但会包含所有应用模块。
生产构建建议选择按需导入;快速脚本或演示可以使用完整导入。
选择安装方式
按需加载
推荐使用。生产环境优化。
全量导入
使用便捷。适合快速脚本。
打开 GV Connect
ts
import { open } from 'protocol-launcher/gv-connect'
const url = open()打开标签页
ts
import { openTab, openCallTab, openSmsTab, openVoicemailTab, openHistory, openSettings } from 'protocol-launcher/gv-connect'
const historyUrl = openTab({
tab: 'history',
})
const callTabUrl = openCallTab()
const smsTabUrl = openSmsTab()
const voicemailUrl = openVoicemailTab()
const recentHistoryUrl = openHistory()
const settingsUrl = openSettings({
account: 'Work Voice',
})填入拨号号码
ts
import { dial } from 'protocol-launcher/gv-connect'
const url = dial({
number: '+15551234567',
})
const favoritesUrl = dial({
number: 'FAVORITES',
})发起呼叫
ts
import { call } from 'protocol-launcher/gv-connect'
const url = call({
number: '+15551234567',
callMethod: 'DirectCall',
})编写 SMS
ts
import { sms, smsRecipient } from 'protocol-launcher/gv-connect'
const recipientOnlyUrl = smsRecipient({
number: '+15551234567',
})
const url = sms({
number: ['+15551234567', '+15557654321'],
message: 'On my way',
})Quick Setting
ts
import { quickSetting } from 'protocol-launcher/gv-connect'
const url = quickSetting({
name: 'Office',
account: 'Work Voice',
})生成的 URL
ts
open()
// => 'gvconnect://'
openTab({ tab: 'history' })
// => 'gvconnect://history'
openCallTab()
// => 'gvconnect://call'
openSmsTab()
// => 'gvconnect://sms'
openVoicemailTab()
// => 'gvconnect://vm'
openHistory()
// => 'gvconnect://history'
openSettings({ account: 'Work Voice' })
// => 'gvconnect://settings?account=Work%20Voice'
dial({ number: '+15551234567' })
// => 'gvconnect://call?%2B15551234567'
call({ number: '+15551234567', callMethod: 'DirectCall' })
// => 'gvconnect://call?number=%2B15551234567&callmethod=DirectCall'
smsRecipient({ number: ['+15551234567', '+15557654321'] })
// => 'gvconnect://sms?%2B15551234567%2C%2B15557654321'
sms({ number: '+15551234567', message: 'On my way' })
// => 'gvconnect://sms?number=%2B15551234567&message=On%20my%20way'
quickSetting({ name: 'Office' })
// => 'gvconnect://quicksetting?Office'