From 3a7a5c34373c2cfa102278f1f65a36437debf129 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 27 Apr 2022 15:38:56 -0700 Subject: [PATCH] Enable Groups, Automate Experiment --- src/imp.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/imp.rs b/src/imp.rs index 8e5dd11..4fbb5e6 100644 --- a/src/imp.rs +++ b/src/imp.rs @@ -18,9 +18,13 @@ pub enum NewContactPolicy { pub struct Behaviour { /// The bot will enable experimental feautres (required for any experiments to be used) pub proto_experiments: bool, - /// The bot will use the file sharing experiment + + /// The bot will enable the file sharing experiment pub proto_experiment_fileshare: bool, + /// The bot will enable the groups experiment + pub proto_experiment_groups: bool, + /// The profile name the bot will share with accepted conversations pub profile_name: String, /// The profile pic the bot with share with accepted conversations IF the file share exoeriment is enabled @@ -40,6 +44,7 @@ impl BehaviourBuilder { behaviour: Behaviour { proto_experiments: false, proto_experiment_fileshare: false, + proto_experiment_groups: false, new_contant_policy: NewContactPolicy::Ignore, profile_name: "".to_string(), profile_pic_path: None, @@ -51,8 +56,15 @@ impl BehaviourBuilder { self.behaviour } + pub fn groups(mut self, val: bool) -> Self { + self.behaviour.proto_experiment_groups = val; + self.behaviour.proto_experiments = true; + self + } + pub fn fileshare(mut self, val: bool) -> Self { self.behaviour.proto_experiment_fileshare = val; + self.behaviour.proto_experiments = true; self } @@ -151,6 +163,11 @@ impl Imp { .Experiments .insert(Experiments::FileSharingExperiment.to_key_string(), true); } + if self.behaviour.proto_experiment_groups { + settings + .Experiments + .insert(Experiments::GroupExperiment.to_key_string(), true); + } match settings.save(self.cwtch.as_ref()) { Ok(_) => (), Err(e) => println!("ERROR: could not save settings: {}", e),