mirror of
https://gitee.com/openharmony/applications_call
synced 2024-11-23 06:19:44 +00:00
fixed crash
Signed-off-by: 18518779689 <litingting84@huawei.com>
This commit is contained in:
parent
2f50882f15
commit
3d4a477dfd
@ -31,6 +31,7 @@ export default class TelephonyApi {
|
||||
* @param { Function } callBack - inject an Function
|
||||
*/
|
||||
public registerCallStateCallback(callBack) {
|
||||
try {
|
||||
call.on('callDetailsChange', (data) => {
|
||||
if (!data) {
|
||||
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback")
|
||||
@ -39,12 +40,16 @@ export default class TelephonyApi {
|
||||
LogUtils.i(TAG, prefixLog + "call.on registerCallStateCallback callState: " + JSON.stringify(data.callState))
|
||||
callBack(data);
|
||||
});
|
||||
} catch (err) {
|
||||
LogUtils.i(TAG, "call.on registerCallStateCallback catch:" + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onRegister call state callback
|
||||
*/
|
||||
public unRegisterCallStateCallback() {
|
||||
try {
|
||||
call.off('callDetailsChange', (data) => {
|
||||
if (!data) {
|
||||
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
|
||||
@ -52,6 +57,9 @@ export default class TelephonyApi {
|
||||
}
|
||||
LogUtils.i(TAG, prefixLog + "call.off unRegisterCallStateCallback")
|
||||
});
|
||||
} catch (err) {
|
||||
LogUtils.i(TAG, "call.off unRegisterCallStateCallback catch:" + JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,11 +110,11 @@ struct Index {
|
||||
this.mCallDataManager = CallDataManager.getInstance();
|
||||
byTrace.finishTrace('aboutToAppear', 0);
|
||||
this.smListener = mediaQuery.matchMediaSync('(320vp<width<=520vp)');
|
||||
this.smListener.on("change", this.isBreakpointSM);
|
||||
this.smListener?.on("change", this.isBreakpointSM);
|
||||
this.mdListener = mediaQuery.matchMediaSync('(520vp<width<=840vp)');
|
||||
this.mdListener.on("change", this.isBreakpointMD);
|
||||
this.mdListener?.on("change", this.isBreakpointMD);
|
||||
this.lgListener = mediaQuery.matchMediaSync('(840vp<width)');
|
||||
this.lgListener.on("change", this.isBreakpointLG);
|
||||
this.lgListener?.on("change", this.isBreakpointLG);
|
||||
this.initAirPlaneMode();
|
||||
}
|
||||
|
||||
@ -171,9 +171,9 @@ struct Index {
|
||||
aboutToDisappear() {
|
||||
LogUtils.i(TAG, "aboutToDisappear");
|
||||
this.stopBackgroundRunning();
|
||||
this.smListener.off('change', this.isBreakpointSM);
|
||||
this.mdListener.off('change', this.isBreakpointMD);
|
||||
this.lgListener.off('change', this.isBreakpointLG);
|
||||
this.smListener?.off('change', this.isBreakpointSM);
|
||||
this.mdListener?.off('change', this.isBreakpointMD);
|
||||
this.lgListener?.off('change', this.isBreakpointLG);
|
||||
removeAirPlaneModeListener();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user