// Copyright 2015-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only /* global i18n, Whisper, $ */ // eslint-disable-next-line func-names (function () { window.Whisper = window.Whisper || {}; // This enum-like object describes the load state of `DebugLogView`. It's designed to be // unidirectional; `NotStarted` → `Started` → `LogsFetchedButNotInTextarea`, etc. const LoadState = { NotStarted: 0, Started: 1, LogsFetchedButNotInTextarea: 2, PuttingLogsInTextarea: 3, LogsInTextarea: 4, }; Whisper.LoadingFullLogsToast = Whisper.ToastView.extend({ render_attributes() { return { toastMessage: i18n('loading') }; }, }); Whisper.LinkedCopiedToast = Whisper.ToastView.extend({ render_attributes() { return { toastMessage: i18n('debugLogLinkCopied') }; }, }); Whisper.DebugLogLinkView = Whisper.View.extend({ template: () => $('#debug-log-link').html(), initialize(options) { this.url = options.url; }, events: { 'click .copy': 'copy', }, render_attributes() { return { url: this.url, reportIssue: i18n('reportIssue'), debugLogCopy: i18n('debugLogCopy'), debugLogCopyAlt: i18n('debugLogCopyAlt'), }; }, copy(e) { e.preventDefault(); window.copyText(e.currentTarget.href); Whisper.ToastView.show(Whisper.LinkedCopiedToast, document.body); }, }); /** * The bulk of the logic in this view involves grabbing the logs from disk and putting * them in a `