mirror of
https://gitee.com/openharmony/applications_call
synced 2024-11-23 06:19:44 +00:00
commit
c6f5686452
@ -95,7 +95,6 @@ export default struct IncomingCom {
|
||||
content = typeName
|
||||
HiLog.i(TAG, "sendMessage resourceManager.getResourceManager : ");
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (globalThis.sendPermissionFlag) {
|
||||
sms.sendMessage({
|
||||
slotId: slotId,
|
||||
destinationHost: destinationHost,
|
||||
@ -114,7 +113,6 @@ export default struct IncomingCom {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
})
|
||||
})
|
||||
@ -164,7 +162,6 @@ export default struct IncomingCom {
|
||||
let Err: string = "";
|
||||
let Message: string = ""
|
||||
this.sendMessage(obj)
|
||||
if (globalThis.sendPermissionFlag) {
|
||||
if (this.SendResult) {
|
||||
resourceManager.getResourceManager().then(result => {
|
||||
result.getString($r("app.string.SMS_Sent")
|
||||
@ -189,17 +186,6 @@ export default struct IncomingCom {
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
resourceManager.getResourceManager().then(result => {
|
||||
result.getString($r("app.string.SMS_Authorization_Notification").id, (err, typeName) => {
|
||||
Message = typeName
|
||||
prompt.showToast({
|
||||
message: Message,
|
||||
duration: 2000,
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,9 +128,7 @@ export default class CallManager {
|
||||
* @param { Object } callData -Object
|
||||
*/
|
||||
async update(callData) {
|
||||
if (globalThis.permissionFlag) {
|
||||
await this.contactManager.getContactInfo(callData)
|
||||
}
|
||||
this.mCallDataManager.update(callData);
|
||||
call.formatPhoneNumber(callData.accountNumber, (err, data) => {
|
||||
if (data === undefined) {
|
||||
|
@ -105,42 +105,9 @@ export default struct Index {
|
||||
this.appInactiveState = false;
|
||||
this.notificationManager.cancelNotification();
|
||||
this.notificationManager.sendCapsuleNotification(this.callData, false);
|
||||
this.initPermissions()
|
||||
HiLog.i(TAG, "onPageShow end : ")
|
||||
}
|
||||
|
||||
async initPermissions() {
|
||||
let requestPermissions: Array<string> = ["ohos.permission.READ_CONTACTS", "ohos.permission.SEND_MESSAGES"];
|
||||
HiLog.i(TAG, "initPermissions requestPermissions : " + requestPermissions.length)
|
||||
if (requestPermissions.length > 0) {
|
||||
let context = featureAbility.getContext()
|
||||
context.requestPermissionsFromUser(requestPermissions, 2345, (results) => {
|
||||
let data:any = results;
|
||||
for (let i = 0;i < data.authResults.length; i++) {
|
||||
if(data.permissions[i] === "ohos.permission.READ_CONTACTS"){
|
||||
if (data.authResults[i] === 0) {
|
||||
globalThis.permissionFlag = true
|
||||
globalThis.callManager.update(this.callData)
|
||||
} else {
|
||||
globalThis.permissionFlag = false
|
||||
globalThis.sendPermissionFlag = true
|
||||
}
|
||||
}
|
||||
if(data.permissions[i] === "ohos.permission.SEND_MESSAGES"){
|
||||
if (data.authResults[i] === 0) {
|
||||
globalThis.sendPermissionFlag = true
|
||||
} else {
|
||||
globalThis.permissionFlag = true
|
||||
globalThis.callManager.update(this.callData)
|
||||
globalThis.sendPermissionFlag = false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
HiLog.i(TAG, "Application requestPermissionsFromUser end")
|
||||
}
|
||||
|
||||
onPageHide() {
|
||||
HiLog.i(TAG, "onPageHide :")
|
||||
this.appInactiveState = true;
|
||||
|
Loading…
Reference in New Issue
Block a user