Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement - Create DM with Riot-bot on new account creation. #1512

Merged
merged 1 commit into from
Sep 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Riot/ViewController/AuthenticationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,27 @@ - (void)authenticationViewController:(MXKAuthenticationViewController *)authenti
// Hide the custom server details in order to save customized inputs
[self hideCustomServers:YES];

// Create DM with Riot-bot on new account creation.
if (self.authType == MXKAuthenticationTypeRegister)
{
MXKAccount *account = [[MXKAccountManager sharedManager] accountForUserId:userId];

[account.mxSession createRoom:nil
visibility:kMXRoomDirectoryVisibilityPrivate
roomAlias:nil
topic:nil
invite:@[@"@riot-bot:matrix.org"]
invite3PID:nil
isDirect:YES
preset:kMXRoomPresetTrustedPrivateChat
success:nil
failure:^(NSError *error) {

NSLog(@"[AuthenticationVC] Create chat with riot-bot failed");

}];
}

// Remove auth view controller on successful login
if (self.navigationController)
{
Expand Down