Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
813a30dd
Commit
813a30dd
authored
Jun 28, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 权限申请更换方式
parent
7da8a914
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
ConfideWebServiceImpl.kt
m-confide/src/main/java/com/ydl/confide/home/modular/service/ConfideWebServiceImpl.kt
+22
-16
No files found.
m-confide/src/main/java/com/ydl/confide/home/modular/service/ConfideWebServiceImpl.kt
View file @
813a30dd
package
com.ydl.confide.home.modular.service
package
com.ydl.confide.home.modular.service
import
android.Manifest
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.Context
import
android.content.Context
...
@@ -7,8 +8,7 @@ import android.content.Intent
...
@@ -7,8 +8,7 @@ import android.content.Intent
import
android.net.Uri
import
android.net.Uri
import
android.text.TextUtils
import
android.text.TextUtils
import
com.alibaba.android.arouter.launcher.ARouter
import
com.alibaba.android.arouter.launcher.ARouter
import
com.hjq.permissions.OnPermissionCallback
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.hjq.permissions.XXPermissions
import
com.ydl.audioim.IntentConstants
import
com.ydl.audioim.IntentConstants
import
com.ydl.audioim.YDLavManager
import
com.ydl.audioim.YDLavManager
import
com.ydl.audioim.bean.ExpertInfoBean
import
com.ydl.audioim.bean.ExpertInfoBean
...
@@ -35,6 +35,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
...
@@ -35,6 +35,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.disposables.Disposable
import
io.reactivex.disposables.Disposable
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
/**
/**
* Created by haorui on 2019-10-10.
* Created by haorui on 2019-10-10.
* Des: 对应主项目中的WebServiceImpl
* Des: 对应主项目中的WebServiceImpl
...
@@ -188,27 +189,32 @@ class ConfideWebServiceImpl {
...
@@ -188,27 +189,32 @@ class ConfideWebServiceImpl {
/**
/**
* 检查权限
* 检查权限
* */
* */
@SuppressLint
(
"CheckResult"
)
private
fun
checkPermission
(
id
:
Int
,
type
:
Int
,
activity
:
Activity
,
callType
:
String
?)
{
private
fun
checkPermission
(
id
:
Int
,
type
:
Int
,
activity
:
Activity
,
callType
:
String
?)
{
try
{
try
{
//申请音频权限
val
rxPermissions
=
RxPermissions
(
activity
)
XXPermissions
.
with
(
activity
)
// 申请单个权限
rxPermissions
.
requestEach
(
Manifest
.
permission
.
RECORD_AUDIO
).
subscribe
{
permission
->
.
permission
(
com
.
hjq
.
permissions
.
Permission
.
RECORD_AUDIO
)
when
{
.
request
(
object
:
OnPermissionCallback
{
//权限已申请 进行通话
override
fun
onGranted
(
p0
:
MutableList
<
String
>?,
p1
:
Boolean
)
{
permission
.
granted
->
{
listenDial
(
id
,
type
,
activity
,
callType
)
listenDial
(
id
,
type
,
activity
,
callType
)
AliYunRichLogsHelper
.
getInstance
()
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"请求音频权限通过"
)
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"请求音频权限通过"
)
}
}
//权限未申请 重新申请
override
fun
onDenied
(
permissions
:
MutableList
<
String
>?,
never
:
Boolean
)
{
permission
.
shouldShowRequestPermissionRationale
->
{
listenDial
(
id
,
type
,
activity
,
"1"
);
checkPermission
(
id
,
type
,
activity
,
callType
)
// 拒绝权限操作发送给服务端
AliYunRichLogsHelper
.
getInstance
()
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"拒绝请求音频权限"
)
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"权限未申请 重新申请"
)
}
//跳转设置界面
else
->
{
listenDial
(
id
,
type
,
activity
,
"1"
)
AliYunRichLogsHelper
.
getInstance
()
.
sendRichLog
(
AliYunLogConfig
.
AGORA
,
"权限拒绝 转axb"
)
}
}
}
}
})
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
listenDial
(
id
,
type
,
activity
,
"1"
);
listenDial
(
id
,
type
,
activity
,
"1"
);
AliYunRichLogsHelper
.
getInstance
()
AliYunRichLogsHelper
.
getInstance
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment