Load protobufs asynchronously. Fixes #223
This commit is contained in:
parent
b8c5bc293c
commit
fe1d78b5fa
2 changed files with 24 additions and 34 deletions
|
@ -38322,27 +38322,22 @@ axolotlInternal.RecipientRecord = function() {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
;(function() {
|
;(function() {
|
||||||
|
'use strict';
|
||||||
|
window.textsecure = window.textsecure || {};
|
||||||
|
window.textsecure.protobuf = {};
|
||||||
|
|
||||||
function loadProtoBufs(filename) {
|
function loadProtoBufs(filename) {
|
||||||
return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}).build('textsecure');
|
return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}, function(error, result) {
|
||||||
|
var protos = result.build('textsecure');
|
||||||
|
for (var protoName in protos) {
|
||||||
|
textsecure.protobuf[protoName] = protos[protoName];
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var pushMessages = loadProtoBufs('IncomingPushMessageSignal.proto');
|
loadProtoBufs('IncomingPushMessageSignal.proto');
|
||||||
var subProtocolMessages = loadProtoBufs('SubProtocol.proto');
|
loadProtoBufs('SubProtocol.proto');
|
||||||
var deviceMessages = loadProtoBufs('DeviceMessages.proto');
|
loadProtoBufs('DeviceMessages.proto');
|
||||||
|
|
||||||
window.textsecure = window.textsecure || {};
|
|
||||||
window.textsecure.protobuf = {
|
|
||||||
IncomingPushMessageSignal : pushMessages.IncomingPushMessageSignal,
|
|
||||||
PushMessageContent : pushMessages.PushMessageContent,
|
|
||||||
ProvisioningUuid : deviceMessages.ProvisioningUuid,
|
|
||||||
ProvisionEnvelope : deviceMessages.ProvisionEnvelope,
|
|
||||||
ProvisionMessage : deviceMessages.ProvisionMessage,
|
|
||||||
DeviceControl : deviceMessages.DeviceControl,
|
|
||||||
WebSocketResponseMessage : subProtocolMessages.WebSocketResponseMessage,
|
|
||||||
WebSocketRequestMessage : subProtocolMessages.WebSocketRequestMessage,
|
|
||||||
WebSocketMessage : subProtocolMessages.WebSocketMessage
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
/* vim: ts=4:sw=4:expandtab
|
/* vim: ts=4:sw=4:expandtab
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
;(function() {
|
;(function() {
|
||||||
|
'use strict';
|
||||||
|
window.textsecure = window.textsecure || {};
|
||||||
|
window.textsecure.protobuf = {};
|
||||||
|
|
||||||
function loadProtoBufs(filename) {
|
function loadProtoBufs(filename) {
|
||||||
return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}).build('textsecure');
|
return dcodeIO.ProtoBuf.loadProtoFile({root: '/protos', file: filename}, function(error, result) {
|
||||||
|
var protos = result.build('textsecure');
|
||||||
|
for (var protoName in protos) {
|
||||||
|
textsecure.protobuf[protoName] = protos[protoName];
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var pushMessages = loadProtoBufs('IncomingPushMessageSignal.proto');
|
loadProtoBufs('IncomingPushMessageSignal.proto');
|
||||||
var subProtocolMessages = loadProtoBufs('SubProtocol.proto');
|
loadProtoBufs('SubProtocol.proto');
|
||||||
var deviceMessages = loadProtoBufs('DeviceMessages.proto');
|
loadProtoBufs('DeviceMessages.proto');
|
||||||
|
|
||||||
window.textsecure = window.textsecure || {};
|
|
||||||
window.textsecure.protobuf = {
|
|
||||||
IncomingPushMessageSignal : pushMessages.IncomingPushMessageSignal,
|
|
||||||
PushMessageContent : pushMessages.PushMessageContent,
|
|
||||||
ProvisioningUuid : deviceMessages.ProvisioningUuid,
|
|
||||||
ProvisionEnvelope : deviceMessages.ProvisionEnvelope,
|
|
||||||
ProvisionMessage : deviceMessages.ProvisionMessage,
|
|
||||||
DeviceControl : deviceMessages.DeviceControl,
|
|
||||||
WebSocketResponseMessage : subProtocolMessages.WebSocketResponseMessage,
|
|
||||||
WebSocketRequestMessage : subProtocolMessages.WebSocketRequestMessage,
|
|
||||||
WebSocketMessage : subProtocolMessages.WebSocketMessage
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in a new issue