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

Always end call for everyone in one to one conversations #1629

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 21 additions & 10 deletions NextcloudTalk/CallViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ - (void)providerDidEndCall:(NSNotification *)notification
return;
}

[self hangupForAll:NO];
[self hangupForAll:_room.type == kNCRoomTypeOneToOne];
}

- (void)providerWantsToUpgradeToVideoCall:(NSNotification *)notification
Expand Down Expand Up @@ -884,21 +884,32 @@ - (void)adjustTopBar
if (([self->_room canModerate] || self->_room.type == kNCRoomTypeOneToOne) &&
[[NCDatabaseManager sharedInstance] serverHasTalkCapability:kCapabilityPublishingPermissions]) {
__weak typeof(self) weakSelf = self;
UIAction *hangupForAllAction = [UIAction actionWithTitle:NSLocalizedString(@"End call for everyone", @"") image:[UIImage systemImageNamed:@"phone.down.fill"] identifier:nil handler:^(UIAction *action) {
[weakSelf hangupForAll:YES];
}];

hangupForAllAction.attributes = UIMenuElementAttributesDestructive;

self.hangUpButton.menu = [UIMenu menuWithTitle:@"" children:@[hangupForAllAction]];
UIAction *alternativeHangUpAction = nil;
// One to one calls
if (self->_room.type == kNCRoomTypeOneToOne) {
alternativeHangUpAction = [UIAction actionWithTitle:NSLocalizedString(@"Leave call", @"") image:[UIImage systemImageNamed:@"phone.down.fill"] identifier:nil handler:^(UIAction *action) {
[weakSelf hangupForAll:NO];
}];
// Moderators in group calls
} else if ([self->_room canModerate]) {
alternativeHangUpAction = [UIAction actionWithTitle:NSLocalizedString(@"End call for everyone", @"") image:[UIImage systemImageNamed:@"phone.down.fill"] identifier:nil handler:^(UIAction *action) {
[weakSelf hangupForAll:YES];
}];
}
// Add alternative hang up button
if (alternativeHangUpAction) {
alternativeHangUpAction.attributes = UIMenuElementAttributesDestructive;
self.hangUpButton.menu = [UIMenu menuWithTitle:@"" children:@[alternativeHangUpAction]];
}
}
});
}

- (void)setHangUpButtonWithTitle:(BOOL)title
{
if (title) {
[_hangUpButton setTitle:NSLocalizedString(@"End call", nil) forState:UIControlStateNormal];
NSString *buttonTitle = _room.type == kNCRoomTypeOneToOne ? NSLocalizedString(@"End call", @"") : NSLocalizedString(@"Leave call", @"");
[_hangUpButton setTitle:buttonTitle forState:UIControlStateNormal];
[_hangUpButton setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
[_hangUpButton setContentEdgeInsets:UIEdgeInsetsMake(0, 16, 0, 24)];
[_hangUpButton setTitleEdgeInsets:UIEdgeInsetsMake(0, 8, 0, -8)];
Expand Down Expand Up @@ -1490,7 +1501,7 @@ - (void)setSpeakerButtonWithAirplayButton

- (IBAction)hangupButtonPressed:(id)sender
{
[self hangupForAll:NO];
[self hangupForAll:_room.type == kNCRoomTypeOneToOne];
}

- (void)hangupForAll:(BOOL)allParticipants
Expand Down
3 changes: 3 additions & 0 deletions NextcloudTalk/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,9 @@
/* No comment provided by engineer. */
"Leave" = "Leave";

/* No comment provided by engineer. */
"Leave call" = "Leave call";

/* No comment provided by engineer. */
"Leave conversation" = "Leave conversation";

Expand Down
Loading