This change introduces a standalone module for our protocol buffers as CommonJS
module incl. TypeScript type definitions.
**Rationale:** In order to exclude voice messages from the media gallery,
I needed to get a reference of `AttachmentPointer.Flags.VOICE_MESSAGE`.
Currently, the only way is to use `textsecure.protobuf` which is only accessible
as a global.
* [x] Add `Attachment.isVoiceMessage` as a way to test standalone
Protocol Buffers.
* [x] Add latest version of `protobufjs`. Leave existing version in place to
keep this change less disruptive and since it’s been stable. Hopefully we
can move over to standalone protobufs over time to improve modularity and
maybe even startup performance.
* [x] Add `yarn build-protobuf` command to compile `SignalService.proto` into
standalone CommonJS module and accompanying TypeScript definitions.
~~Included compiled output for ease of use for other developers.
Can revisit if changes become more frequent.~~
Now built as part of `yarn grunt`.
* [x] Update style guide references and make sure they work!
* [x] ⚠️ Change type definition for `Attachment::file` to include `null` as
that’s apparently a valid value for legacy Android voice messages.
This does not work with `ArrayBuffer` out of the box and will need to be
investigated and tested more before switching.
Some APIs also seemed to have changed:
- Before (OOP): `new textsecure.protobuf.WebSocketMessage(…).encode();`
- After (functional):
```
textsecure.protobuf.WebSocketMessage.encode(
new textsecure.protobuf.WebSocketMessage(…)
);
```
This reverts commit d758119d9de4f99742ea941e86180b1d600c2f22.
Expand auto-formatting to CSS, SCSS, and JSON:
* [x] Ignore symlinked SCSS file from `components`.
* [x] Ignore package manifest files, `package.json` and `bower.json`,
as they are already formatted by their package manager.
* [x] Skip locale JSON files (already managed by Transifex tools).
* [x] Format all stylesheets.