Support additional sticker states

Co-authored-by: scott@signal.org
Co-authored-by: ken@signal.org
This commit is contained in:
Ken Powers 2019-05-23 18:27:42 -07:00 committed by Scott Nonnenberg
parent 41880cfe66
commit be5d0837f8
35 changed files with 925 additions and 249 deletions

View file

@ -9,6 +9,7 @@ const { map, isArrayBuffer, isString } = require('lodash');
const PATH = 'attachments.noindex';
const STICKER_PATH = 'stickers.noindex';
const TEMP_PATH = 'temp';
exports.getAllAttachments = async userDataPath => {
const dir = exports.getPath(userDataPath);
@ -42,6 +43,20 @@ exports.getStickersPath = userDataPath => {
return path.join(userDataPath, STICKER_PATH);
};
// getTempPath :: AbsolutePath -> AbsolutePath
exports.getTempPath = userDataPath => {
if (!isString(userDataPath)) {
throw new TypeError("'userDataPath' must be a string");
}
return path.join(userDataPath, TEMP_PATH);
};
// clearTempPath :: AbsolutePath -> AbsolutePath
exports.clearTempPath = userDataPath => {
const tempPath = exports.getTempPath(userDataPath);
return fse.emptyDir(tempPath);
};
// createReader :: AttachmentsPath ->
// RelativePath ->
// IO (Promise ArrayBuffer)