Further improvements for backup import/export
This commit is contained in:
parent
b9cd858ec7
commit
d5f44c1b8f
24 changed files with 539 additions and 201 deletions
|
@ -87,17 +87,27 @@ export function formatCallEvent(callEvent: CallEventDetails): string {
|
|||
type,
|
||||
mode,
|
||||
ringerId,
|
||||
startedById,
|
||||
timestamp,
|
||||
} = callEvent;
|
||||
const peerIdLog = peerIdToLog(peerId, mode);
|
||||
return `CallEvent (${callId}, ${peerIdLog}, ${mode}, ${event}, ${direction}, ${type}, ${mode}, ${timestamp}, ${ringerId}, ${eventSource})`;
|
||||
return `CallEvent (${callId}, ${peerIdLog}, ${mode}, ${event}, ${direction}, ${type}, ${mode}, ${timestamp}, ${ringerId}, ${startedById}, ${eventSource})`;
|
||||
}
|
||||
|
||||
export function formatCallHistory(callHistory: CallHistoryDetails): string {
|
||||
const { callId, peerId, direction, status, type, mode, timestamp, ringerId } =
|
||||
callHistory;
|
||||
const {
|
||||
callId,
|
||||
peerId,
|
||||
direction,
|
||||
status,
|
||||
type,
|
||||
mode,
|
||||
timestamp,
|
||||
ringerId,
|
||||
startedById,
|
||||
} = callHistory;
|
||||
const peerIdLog = peerIdToLog(peerId, mode);
|
||||
return `CallHistory (${callId}, ${peerIdLog}, ${mode}, ${status}, ${direction}, ${type}, ${mode}, ${timestamp}, ${ringerId})`;
|
||||
return `CallHistory (${callId}, ${peerIdLog}, ${mode}, ${status}, ${direction}, ${type}, ${mode}, ${timestamp}, ${ringerId}, ${startedById})`;
|
||||
}
|
||||
|
||||
export function formatCallHistoryGroup(
|
||||
|
@ -245,6 +255,8 @@ export function getCallEventForProto(
|
|||
callId,
|
||||
peerId,
|
||||
ringerId: null,
|
||||
startedById: null,
|
||||
endedTimestamp: null,
|
||||
mode,
|
||||
type,
|
||||
direction,
|
||||
|
@ -493,6 +505,7 @@ export function getCallDetailsFromDirectCall(
|
|||
? CallDirection.Incoming
|
||||
: CallDirection.Outgoing,
|
||||
timestamp: Date.now(),
|
||||
endedTimestamp: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -507,10 +520,12 @@ export function getCallDetailsFromEndedDirectCall(
|
|||
callId,
|
||||
peerId,
|
||||
ringerId,
|
||||
startedById: ringerId,
|
||||
mode: CallMode.Direct,
|
||||
type: wasVideoCall ? CallType.Video : CallType.Audio,
|
||||
direction: getCallDirectionFromRingerId(ringerId),
|
||||
timestamp,
|
||||
endedTimestamp: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -522,10 +537,12 @@ export function getCallDetailsFromGroupCallMeta(
|
|||
callId: groupCallMeta.callId,
|
||||
peerId,
|
||||
ringerId: groupCallMeta.ringerId,
|
||||
startedById: groupCallMeta.ringerId,
|
||||
mode: CallMode.Group,
|
||||
type: CallType.Group,
|
||||
direction: getCallDirectionFromRingerId(groupCallMeta.ringerId),
|
||||
timestamp: Date.now(),
|
||||
endedTimestamp: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -537,12 +554,14 @@ export function getCallDetailsForAdhocCall(
|
|||
callId,
|
||||
peerId,
|
||||
ringerId: null,
|
||||
startedById: null,
|
||||
mode: CallMode.Adhoc,
|
||||
type: CallType.Adhoc,
|
||||
// Direction is only outgoing when your action causes ringing for others.
|
||||
// As Adhoc calls do not support ringing, this is always incoming for now
|
||||
direction: CallDirection.Incoming,
|
||||
timestamp: Date.now(),
|
||||
endedTimestamp: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -564,7 +583,16 @@ export function transitionCallHistory(
|
|||
callHistory: CallHistoryDetails | null,
|
||||
callEvent: CallEventDetails
|
||||
): CallHistoryDetails {
|
||||
const { callId, peerId, ringerId, mode, type, direction, event } = callEvent;
|
||||
const {
|
||||
callId,
|
||||
peerId,
|
||||
ringerId,
|
||||
startedById,
|
||||
mode,
|
||||
type,
|
||||
direction,
|
||||
event,
|
||||
} = callEvent;
|
||||
|
||||
if (callHistory != null) {
|
||||
strictAssert(callHistory.callId === callId, 'callId must be same');
|
||||
|
@ -575,6 +603,12 @@ export function transitionCallHistory(
|
|||
callHistory.ringerId === ringerId,
|
||||
'ringerId must be same if it exists'
|
||||
);
|
||||
strictAssert(
|
||||
startedById == null ||
|
||||
callHistory.startedById == null ||
|
||||
callHistory.startedById === startedById,
|
||||
'startedById must be same if it exists'
|
||||
);
|
||||
strictAssert(callHistory.direction === direction, 'direction must be same');
|
||||
strictAssert(callHistory.type === type, 'type must be same');
|
||||
strictAssert(callHistory.mode === mode, 'mode must be same');
|
||||
|
@ -614,11 +648,13 @@ export function transitionCallHistory(
|
|||
callId,
|
||||
peerId,
|
||||
ringerId,
|
||||
startedById,
|
||||
mode,
|
||||
type,
|
||||
direction,
|
||||
timestamp,
|
||||
status,
|
||||
endedTimestamp: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue