Use more exact type for addCallHistory
This commit is contained in:
parent
d7f3b39fec
commit
0d83076799
2 changed files with 9 additions and 15 deletions
|
@ -7,6 +7,7 @@ import {
|
||||||
ConversationAttributesType,
|
ConversationAttributesType,
|
||||||
VerificationOptions,
|
VerificationOptions,
|
||||||
} from '../model-types.d';
|
} from '../model-types.d';
|
||||||
|
import { CallHistoryDetailsType } from '../types/Calling';
|
||||||
import { CallbackResultType, GroupV2InfoType } from '../textsecure/SendMessage';
|
import { CallbackResultType, GroupV2InfoType } from '../textsecure/SendMessage';
|
||||||
import {
|
import {
|
||||||
ConversationType,
|
ConversationType,
|
||||||
|
@ -1843,7 +1844,7 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
}
|
}
|
||||||
|
|
||||||
async addCallHistory(
|
async addCallHistory(
|
||||||
callHistoryDetails: Record<string, unknown>
|
callHistoryDetails: CallHistoryDetailsType
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { acceptedTime, endedTime, wasDeclined } = callHistoryDetails;
|
const { acceptedTime, endedTime, wasDeclined } = callHistoryDetails;
|
||||||
const message = ({
|
const message = ({
|
||||||
|
|
|
@ -26,11 +26,7 @@ import {
|
||||||
CallDetailsType,
|
CallDetailsType,
|
||||||
} from '../state/ducks/calling';
|
} from '../state/ducks/calling';
|
||||||
import { EnvelopeClass } from '../textsecure.d';
|
import { EnvelopeClass } from '../textsecure.d';
|
||||||
import {
|
import { AudioDevice, MediaDeviceSettings } from '../types/Calling';
|
||||||
AudioDevice,
|
|
||||||
CallHistoryDetailsType,
|
|
||||||
MediaDeviceSettings,
|
|
||||||
} from '../types/Calling';
|
|
||||||
import { ConversationModel } from '../models/conversations';
|
import { ConversationModel } from '../models/conversations';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -868,36 +864,34 @@ export class CallingClass {
|
||||||
acceptedTime = Date.now();
|
acceptedTime = Date.now();
|
||||||
}
|
}
|
||||||
|
|
||||||
const callHistoryDetails: CallHistoryDetailsType = {
|
conversation.addCallHistory({
|
||||||
wasIncoming: call.isIncoming,
|
wasIncoming: call.isIncoming,
|
||||||
wasVideoCall: call.isVideoCall,
|
wasVideoCall: call.isVideoCall,
|
||||||
wasDeclined,
|
wasDeclined,
|
||||||
acceptedTime,
|
acceptedTime,
|
||||||
endedTime: Date.now(),
|
endedTime: Date.now(),
|
||||||
};
|
});
|
||||||
conversation.addCallHistory(callHistoryDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private addCallHistoryForFailedIncomingCall(
|
private addCallHistoryForFailedIncomingCall(
|
||||||
conversation: ConversationModel,
|
conversation: ConversationModel,
|
||||||
wasVideoCall: boolean
|
wasVideoCall: boolean
|
||||||
) {
|
) {
|
||||||
const callHistoryDetails: CallHistoryDetailsType = {
|
conversation.addCallHistory({
|
||||||
wasIncoming: true,
|
wasIncoming: true,
|
||||||
wasVideoCall,
|
wasVideoCall,
|
||||||
// Since the user didn't decline, make sure it shows up as a missed call instead
|
// Since the user didn't decline, make sure it shows up as a missed call instead
|
||||||
wasDeclined: false,
|
wasDeclined: false,
|
||||||
acceptedTime: undefined,
|
acceptedTime: undefined,
|
||||||
endedTime: Date.now(),
|
endedTime: Date.now(),
|
||||||
};
|
});
|
||||||
conversation.addCallHistory(callHistoryDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private addCallHistoryForAutoEndedIncomingCall(
|
private addCallHistoryForAutoEndedIncomingCall(
|
||||||
conversation: ConversationModel,
|
conversation: ConversationModel,
|
||||||
_reason: CallEndedReason
|
_reason: CallEndedReason
|
||||||
) {
|
) {
|
||||||
const callHistoryDetails: CallHistoryDetailsType = {
|
conversation.addCallHistory({
|
||||||
wasIncoming: true,
|
wasIncoming: true,
|
||||||
// We don't actually know, but it doesn't seem that important in this case,
|
// We don't actually know, but it doesn't seem that important in this case,
|
||||||
// but we could maybe plumb this info through RingRTC
|
// but we could maybe plumb this info through RingRTC
|
||||||
|
@ -906,8 +900,7 @@ export class CallingClass {
|
||||||
wasDeclined: false,
|
wasDeclined: false,
|
||||||
acceptedTime: undefined,
|
acceptedTime: undefined,
|
||||||
endedTime: Date.now(),
|
endedTime: Date.now(),
|
||||||
};
|
});
|
||||||
conversation.addCallHistory(callHistoryDetails);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue