diff --git a/Riot/AppDelegate.m b/Riot/AppDelegate.m
index efed5f883..46d0ed6c9 100644
--- a/Riot/AppDelegate.m
+++ b/Riot/AppDelegate.m
@@ -4476,22 +4476,27 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Leave the GDPR consent right now
[self dismissGDPRConsent];
+
+ BOOL botCreationEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"enableBotCreation"];
- // And create the room with riot bot in //
- self.onBoardingManager = [[OnBoardingManager alloc] initWithSession:session];
-
- MXWeakify(self);
- void (^createRiotBotDMcompletion)(void) = ^() {
- MXStrongifyAndReturnIfNil(self);
+ if (botCreationEnabled)
+ {
+ // And create the room with riot bot in //
+ self.onBoardingManager = [[OnBoardingManager alloc] initWithSession:session];
+
+ MXWeakify(self);
+ void (^createRiotBotDMcompletion)(void) = ^() {
+ MXStrongifyAndReturnIfNil(self);
- self.onBoardingManager = nil;
- };
-
- [self.onBoardingManager createRiotBotDirectMessageIfNeededWithSuccess:^{
- createRiotBotDMcompletion();
- } failure:^(NSError * _Nonnull error) {
- createRiotBotDMcompletion();
- }];
+ self.onBoardingManager = nil;
+ };
+
+ [self.onBoardingManager createRiotBotDirectMessageIfNeededWithSuccess:^{
+ createRiotBotDMcompletion();
+ } failure:^(NSError * _Nonnull error) {
+ createRiotBotDMcompletion();
+ }];
+ }
}
#pragma mark - Identity server service terms
diff --git a/Riot/Assets/Riot-Defaults.plist b/Riot/Assets/Riot-Defaults.plist
index ac1c19365..a631b9f60 100644
--- a/Riot/Assets/Riot-Defaults.plist
+++ b/Riot/Assets/Riot-Defaults.plist
@@ -86,5 +86,7 @@
matrix.org
+ enableBotCreation
+
diff --git a/Riot/Modules/Authentication/AuthenticationViewController.m b/Riot/Modules/Authentication/AuthenticationViewController.m
index 05b0c7a27..f4cd6dcb3 100644
--- a/Riot/Modules/Authentication/AuthenticationViewController.m
+++ b/Riot/Modules/Authentication/AuthenticationViewController.m
@@ -1108,8 +1108,10 @@
MXKAccount *account = [[MXKAccountManager sharedManager] accountForUserId:userId];
MXSession *session = account.mxSession;
+ BOOL botCreationEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:@"enableBotCreation"];
+
// Create DM with Riot-bot on new account creation.
- if (self.authType == MXKAuthenticationTypeRegister)
+ if (self.authType == MXKAuthenticationTypeRegister && botCreationEnabled)
{
MXRoomCreationParameters *roomCreationParameters = [MXRoomCreationParameters parametersForDirectRoomWithUser:@"@riot-bot:matrix.org"];
[session createRoomWithParameters:roomCreationParameters success:nil failure:^(NSError *error) {