Enable Groups, Automate Experiment

This commit is contained in:
Sarah Jamie Lewis 2022-04-27 15:38:56 -07:00
parent 3c18214507
commit 3a7a5c3437
1 changed files with 18 additions and 1 deletions

View File

@ -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),