Skip to content

Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.

3.3 KB
Raw Blame
//! Settings → Experimental: RustCord features still being tried out, each
//! with its own switch. Spam Warnings starts on; the rest start off.

use crate::app::RustCord;
use crate::style::Theme;
use eframe::egui::{self, RichText, Ui};

impl RustCord {
    pub(super) fn experimental_tab(&mut self, ui: &mut Ui, t: &Theme) {
        super::settings::heading(ui, t, "Experimental");
        ui.add(egui::Label::new(RichText::new("RustCord features that are still being tried out. They may change, misbehave or go away.").size(14.0).color(t.text_muted)).wrap());
        ui.add_space(24.0);

        let ex = self.prefs.experiments.clone();
        let mut changed = false;

        let desc = "Warns you when what you're doing looks like spam or a bot to Discord: sending messages very fast, the same text over and over, lots of friend requests, new DMs or server joins in a short time, heavy use of Discord's API, or Discord answering \"too many requests\". Discord suspends accounts for these patterns. Nothing is sent anywhere; RustCord only watches its own requests.";
        if let Some(v) = super::settings::toggle_row(ui, t, "Spam Warnings", desc, ex.spam_warnings) {
            self.prefs.experiments.spam_warnings = v;
            changed = true;
        }

        let desc = "A small player above your username that controls Spotify on your PC (or whichever device is playing): play and pause, next and previous, shuffle, repeat, the seek bar, and your playlists. The music still plays in Spotify. Needs Spotify connected to your Discord account (Settings → Connections) and Spotify Premium, which Spotify requires for being controlled from other apps.";
        if let Some(v) = super::settings::toggle_row(ui, t, "Spotify Controller", desc, ex.spotify_player) {
            self.prefs.experiments.spotify_player = v;
            self.spotify_panel = Default::default();
            changed = true;
        }

        let desc = "Tells Discord which emoji you send and react with, so Frequently Used is the same in RustCord and in Discord's apps (RustCord always reads Discord's list; this also writes to it). Sent half a minute after your last emoji, the way Discord's app sends it.";
        if let Some(v) = super::settings::toggle_row(ui, t, "Sync Frequently Used emoji", desc, ex.emoji_sync) {
            self.prefs.experiments.emoji_sync = v;
            changed = true;
        }

        let desc = "Records every request RustCord sends (to Discord's API, Spotify, and for pictures and media) and lists them live in a window you can keep open while you use RustCord, with how many went out in the last minute. Kept in memory only, never saved, and forgotten when switched off.";
        if let Some(v) = super::settings::toggle_row(ui, t, "Request Log", desc, ex.request_log) {
            self.prefs.experiments.request_log = v;
            self.request_log.open = v;
            changed = true;
        }
        if self.prefs.experiments.request_log {
            let label = if self.request_log.open { "Close Request Log" } else { "Open Request Log" };
            if super::settings::secondary_button(ui, t, label).on_hover_cursor(egui::CursorIcon::PointingHand).clicked() {
                self.request_log.open = !self.request_log.open;
            }
        }
        if changed {
            self.save_prefs();
        }
    }
}