Now we've got everything prettified!

This commit is contained in:
Scott Nonnenberg
2018-05-02 09:51:22 -07:00
parent 754d65ae2e
commit a0ed993b42
30 changed files with 3562 additions and 2873 deletions

View File

@@ -1,29 +1,42 @@
;(function() {
'use strict';
window.textsecure = window.textsecure || {};
window.textsecure.protobuf = {};
(function() {
'use strict';
window.textsecure = window.textsecure || {};
window.textsecure.protobuf = {};
function loadProtoBufs(filename) {
return dcodeIO.ProtoBuf.loadProtoFile({root: window.PROTO_ROOT, file: filename}, function(error, result) {
if (error) {
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ') '
+ (error && error.stack ? error.stack : error);
console.log(text);
throw error;
}
var protos = result.build('signalservice');
if (!protos) {
var text = 'Error loading protos from ' + filename + ' (root: ' + window.PROTO_ROOT + ')';
console.log(text);
throw new Error(text);
}
for (var protoName in protos) {
textsecure.protobuf[protoName] = protos[protoName];
}
});
};
function loadProtoBufs(filename) {
return dcodeIO.ProtoBuf.loadProtoFile(
{ root: window.PROTO_ROOT, file: filename },
function(error, result) {
if (error) {
var text =
'Error loading protos from ' +
filename +
' (root: ' +
window.PROTO_ROOT +
') ' +
(error && error.stack ? error.stack : error);
console.log(text);
throw error;
}
var protos = result.build('signalservice');
if (!protos) {
var text =
'Error loading protos from ' +
filename +
' (root: ' +
window.PROTO_ROOT +
')';
console.log(text);
throw new Error(text);
}
for (var protoName in protos) {
textsecure.protobuf[protoName] = protos[protoName];
}
}
);
}
loadProtoBufs('SignalService.proto');
loadProtoBufs('SubProtocol.proto');
loadProtoBufs('DeviceMessages.proto');
loadProtoBufs('SignalService.proto');
loadProtoBufs('SubProtocol.proto');
loadProtoBufs('DeviceMessages.proto');
})();