move groupContextType to sub classes of Closedgroup

pull/1197/head
Audric Ackermann 5 years ago
parent df028b7ac6
commit a43abfd436
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -25,8 +25,12 @@ export class ClosedGroupChatMessage extends ClosedGroupMessage {
return this.getDefaultTTL();
}
protected groupContextType(): SignalService.GroupContext.Type {
return SignalService.GroupContext.Type.DELIVER;
protected groupContext(): SignalService.GroupContext {
// use the parent method to fill id correctly
const groupContext = super.groupContext();
groupContext.type = SignalService.GroupContext.Type.DELIVER;
return groupContext;
}
protected dataProto(): SignalService.DataMessage {

@ -13,7 +13,12 @@ export class ClosedGroupLeaveMessage extends ClosedGroupMessage {
});
}
protected groupContextType(): SignalService.GroupContext.Type {
return SignalService.GroupContext.Type.QUIT;
protected groupContext(): SignalService.GroupContext {
// use the parent method to fill id correctly
const groupContext = super.groupContext();
groupContext.type = SignalService.GroupContext.Type.QUIT;
return groupContext;
}
}

@ -23,13 +23,10 @@ export abstract class ClosedGroupMessage extends DataMessage {
return this.getDefaultTTL();
}
protected abstract groupContextType(): SignalService.GroupContext.Type;
protected groupContext(): SignalService.GroupContext {
const id = new Uint8Array(StringUtils.encode(this.groupId.key, 'utf8'));
const type = this.groupContextType();
return new SignalService.GroupContext({ id, type });
return new SignalService.GroupContext({ id });
}
protected dataProto(): SignalService.DataMessage {

@ -13,7 +13,11 @@ export class ClosedGroupRequestInfoMessage extends ClosedGroupMessage {
});
}
protected groupContextType(): SignalService.GroupContext.Type {
return SignalService.GroupContext.Type.REQUEST_INFO;
protected groupContext(): SignalService.GroupContext {
// use the parent method to fill id correctly
const groupContext = super.groupContext();
groupContext.type = SignalService.GroupContext.Type.REQUEST_INFO;
return groupContext;
}
}

@ -52,14 +52,12 @@ export abstract class ClosedGroupUpdateMessage extends ClosedGroupMessage {
this.avatar = params.avatar;
}
protected groupContextType(): SignalService.GroupContext.Type {
return SignalService.GroupContext.Type.UPDATE;
}
protected groupContext(): SignalService.GroupContext {
// use the parent method to fill id and type correctly
// use the parent method to fill id correctly
const groupContext = super.groupContext();
groupContext.type = SignalService.GroupContext.Type.UPDATE;
if (this.name) {
groupContext.name = this.name;
}

Loading…
Cancel
Save