Commit 3037dabb authored by Kateryna Kostiuk's avatar Kateryna Kostiuk
Browse files

swarm: adapt to API changes

- rename to JAMI
- use data transfer for account

Change-Id: Id241eb7150a6353456f080a2901e40bc0d05343b
parent 43536147
...@@ -71,7 +71,7 @@ CGFloat const VIEW_INSET = 40; ...@@ -71,7 +71,7 @@ CGFloat const VIEW_INSET = 40;
- (void) setSelectedAccount:(const QString&) account { - (void) setSelectedAccount:(const QString&) account {
selectedAccountID = account; selectedAccountID = account;
const auto& accountInfo = accountModel->getAccountInfo(selectedAccountID); const auto& accountInfo = accountModel->getAccountInfo(selectedAccountID);
if (accountInfo.profileInfo.type == lrc::api::profile::Type::RING) { if (accountInfo.profileInfo.type == lrc::api::profile::Type::JAMI) {
accountGeneralVC = ringGeneralVC; accountGeneralVC = ringGeneralVC;
accountGeneralVC.delegate = self; accountGeneralVC.delegate = self;
accountAdvancedVC = ringAdvancedVC; accountAdvancedVC = ringAdvancedVC;
......
...@@ -359,7 +359,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNet ...@@ -359,7 +359,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNet
- (void) showMainWindow - (void) showMainWindow
{ {
if(self.ringWindowController == nil) { if(self.ringWindowController == nil) {
self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow" bundle: nil accountModel:&lrc->getAccountModel() dataTransferModel:&lrc->getDataTransferModel() behaviourController:&lrc->getBehaviorController() avModel: &lrc->getAVModel() pluginModel: &lrc->getPluginModel()]; self.ringWindowController = [[RingWindowController alloc] initWithWindowNibName:@"RingWindow" bundle: nil accountModel:&lrc->getAccountModel() behaviourController:&lrc->getBehaviorController() avModel: &lrc->getAVModel() pluginModel: &lrc->getPluginModel()];
} }
[[NSApplication sharedApplication] removeWindowsItem:self.wizard.window]; [[NSApplication sharedApplication] removeWindowsItem:self.wizard.window];
self.wizard = nil; self.wizard = nil;
......
...@@ -232,7 +232,7 @@ NSMutableDictionary* menuItemsTags; ...@@ -232,7 +232,7 @@ NSMutableDictionary* menuItemsTags;
case lrc::api::profile::Type::SIP: case lrc::api::profile::Type::SIP:
[itemView.accountTypeLabel setStringValue:@"SIP"]; [itemView.accountTypeLabel setStringValue:@"SIP"];
break; break;
case lrc::api::profile::Type::RING: case lrc::api::profile::Type::JAMI:
[itemView.accountTypeLabel setStringValue:@"Jami"]; [itemView.accountTypeLabel setStringValue:@"Jami"];
break; break;
default: default:
......
...@@ -317,8 +317,6 @@ CVPixelBufferRef pixelBufferPreview; ...@@ -317,8 +317,6 @@ CVPixelBufferRef pixelBufferPreview;
} }
lrc::api::conversation::Info& conv = *convOpt; lrc::api::conversation::Info& conv = *convOpt;
auto& contact = accountInfo_->contactModel->getContact(conv.participants[0]); auto& contact = accountInfo_->contactModel->getContact(conv.participants[0]);
if (contact.profileInfo.type == lrc::api::profile::Type::RING && contact.profileInfo.uri == contactUri)
accountInfo_->conversationModel->makePermanent(convUid_);
[contactPhoto setImage: [self getContactImageOfSize:120.0 withDefaultAvatar:YES]]; [contactPhoto setImage: [self getContactImageOfSize:120.0 withDefaultAvatar:YES]];
[self.delegate conversationInfoUpdatedFor:convUid_]; [self.delegate conversationInfoUpdatedFor:convUid_];
[self setBackground]; [self setBackground];
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
//lrc //lrc
#import <api/datatransfermodel.h> #import <api/datatransfermodel.h>
#import <api/avmodel.h> #import <api/avmodel.h>
#import <api/newaccountmodel.h>
#if ENABLE_SPARKLE #if ENABLE_SPARKLE
#import <Sparkle/Sparkle.h> #import <Sparkle/Sparkle.h>
...@@ -50,14 +51,13 @@ ...@@ -50,14 +51,13 @@
@implementation GeneralPrefsVC @implementation GeneralPrefsVC
@synthesize dataTransferModel;
@synthesize avModel; @synthesize avModel;
@synthesize accountModel;
-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:( lrc::api::NewAccountModel*) accountModel avModel: (lrc::api::AVModel*)avModel {
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil dataTransferModel:(lrc::api::DataTransferModel*) dataTransferModel avModel:(lrc::api::AVModel*) avModel {
if (self = [self initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) if (self = [self initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
{ {
self.dataTransferModel = dataTransferModel; self.accountModel = accountModel;
self.avModel = avModel; self.avModel = avModel;
} }
return self; return self;
...@@ -88,8 +88,8 @@ ...@@ -88,8 +88,8 @@
[conversationStackView setHidden:YES]; [conversationStackView setHidden:YES];
heightToReduice += (downloadFolder.frame.size.height + recordingFolder.frame.size.height + 25); heightToReduice += (downloadFolder.frame.size.height + recordingFolder.frame.size.height + 25);
} else { } else {
if (dataTransferModel) { if (accountModel) {
downloadFolder.title = [dataTransferModel->downloadDirectory.toNSString() lastPathComponent]; downloadFolder.title = [self.accountModel->downloadDirectory.toNSString() lastPathComponent];
} }
if (avModel) { if (avModel) {
auto name1 = avModel->getRecordPath(); auto name1 = avModel->getRecordPath();
...@@ -112,8 +112,8 @@ ...@@ -112,8 +112,8 @@
if ([panel runModal] != NSFileHandlingPanelOKButton) return; if ([panel runModal] != NSFileHandlingPanelOKButton) return;
if ([[panel URLs] lastObject] == nil) return; if ([[panel URLs] lastObject] == nil) return;
NSString * path = [[[[panel URLs] lastObject] path] stringByAppendingString:@"/"]; NSString * path = [[[[panel URLs] lastObject] path] stringByAppendingString:@"/"];
dataTransferModel->downloadDirectory = QString::fromNSString(path); self.accountModel->downloadDirectory = QString::fromNSString(path);
downloadFolder.title = [dataTransferModel->downloadDirectory.toNSString() lastPathComponent]; downloadFolder.title = [self.accountModel->downloadDirectory.toNSString() lastPathComponent];
[[NSUserDefaults standardUserDefaults] setObject:path forKey:Preferences::DownloadFolder]; [[NSUserDefaults standardUserDefaults] setObject:path forKey:Preferences::DownloadFolder];
} }
......
...@@ -29,14 +29,12 @@ namespace lrc { ...@@ -29,14 +29,12 @@ namespace lrc {
@protocol LrcModelsProtocol @protocol LrcModelsProtocol
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil dataTransferModel:(const lrc::api::DataTransferModel*) dataTransferModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel avModel:(const lrc::api::AVModel*) avModel;
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil dataTransferModel:(const lrc::api::DataTransferModel*) dataTransferModel avModel:(const lrc::api::AVModel*) avModel;
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil pluginModel:(const lrc::api::PluginModel*) pluginModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil pluginModel:(const lrc::api::PluginModel*) pluginModel;
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil avModel:(const lrc::api::AVModel*) avModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil avModel:(const lrc::api::AVModel*) avModel;
-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(const lrc::api::NewAccountModel*) accountModel; -(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountmodel:(const lrc::api::NewAccountModel*) accountModel;
-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel dataTransferModel:(const lrc::api::DataTransferModel*)dataTransferModel behaviourController:(const lrc::api::BehaviorController*) behaviorController; -(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(lrc::api::NewAccountModel*)accountModel avModel: ( lrc::api::AVModel*)avModel;
-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel dataTransferModel:(const lrc::api::DataTransferModel*)dataTransferModel behaviourController:(const lrc::api::BehaviorController*) behaviorController avModel: (const lrc::api::AVModel*)avModel; -(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel behaviourController:(const lrc::api::BehaviorController*) behaviorController avModel: (const lrc::api::AVModel*)avModel pluginModel: (const lrc::api::PluginModel*)pluginModel;
-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(const lrc::api::NewAccountModel*)accountModel dataTransferModel:(const lrc::api::DataTransferModel*)dataTransferModel behaviourController:(const lrc::api::BehaviorController*) behaviorController avModel: (const lrc::api::AVModel*)avModel pluginModel: (const lrc::api::PluginModel*)pluginModel;
@property lrc::api::DataTransferModel* dataTransferModel; @property lrc::api::DataTransferModel* dataTransferModel;
@property lrc::api::NewAccountModel* accountModel; @property lrc::api::NewAccountModel* accountModel;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
NSViewController *currentVC; NSViewController *currentVC;
} }
@synthesize dataTransferModel, accountModel, behaviorController, avModel, pluginModel; @synthesize accountModel, behaviorController, avModel, pluginModel;
// Identifiers used in PreferencesWindow.xib for tabs // Identifiers used in PreferencesWindow.xib for tabs
static auto const kGeneralPrefsIdentifier = @"GeneralPrefsIdentifier"; static auto const kGeneralPrefsIdentifier = @"GeneralPrefsIdentifier";
...@@ -57,12 +57,11 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer"; ...@@ -57,12 +57,11 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer";
[tb setAllowsUserCustomization:NO]; [tb setAllowsUserCustomization:NO];
} }
-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(lrc::api::NewAccountModel*)accountModel dataTransferModel:(lrc::api::DataTransferModel*)dataTransferModel behaviourController:(lrc::api::BehaviorController*)behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel -(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:(lrc::api::NewAccountModel*)accountModel behaviourController:(lrc::api::BehaviorController*)behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel
{ {
if (self = [self initWithWindowNibName:nibNameOrNil]) if (self = [self initWithWindowNibName:nibNameOrNil])
{ {
self.accountModel = accountModel; self.accountModel = accountModel;
self.dataTransferModel = dataTransferModel;
self.behaviorController = behaviorController; self.behaviorController = behaviorController;
self.avModel = avModel; self.avModel = avModel;
self.pluginModel = pluginModel; self.pluginModel = pluginModel;
...@@ -74,7 +73,7 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer"; ...@@ -74,7 +73,7 @@ static auto const kPluginPrefsIdentifer = @"PluginPrefsIdentifer";
{ {
[[prefsContainer subviews] [[prefsContainer subviews]
makeObjectsPerformSelector:@selector(removeFromSuperview)]; makeObjectsPerformSelector:@selector(removeFromSuperview)];
currentVC = [[GeneralPrefsVC alloc] initWithNibName:@"GeneralPrefs" bundle:nil dataTransferModel: self.dataTransferModel avModel: self.avModel]; currentVC = [[GeneralPrefsVC alloc] initWithNibName:@"GeneralPrefs" bundle:nil accountModel: self.accountModel avModel: self.avModel];
[self addCurrentVC]; [self addCurrentVC];
} }
......
...@@ -87,15 +87,14 @@ typedef NS_ENUM(NSInteger, ViewState) { ...@@ -87,15 +87,14 @@ typedef NS_ENUM(NSInteger, ViewState) {
IBOutlet ChooseAccountVC* chooseAccountVC; IBOutlet ChooseAccountVC* chooseAccountVC;
} }
@synthesize dataTransferModel, accountModel, behaviorController, avModel, pluginModel; @synthesize accountModel, behaviorController, avModel, pluginModel;
@synthesize wizard; @synthesize wizard;
-(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:( lrc::api::NewAccountModel*)accountModel dataTransferModel:( lrc::api::DataTransferModel*)dataTransferModel behaviourController:( lrc::api::BehaviorController*) behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel -(id) initWithWindowNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil accountModel:( lrc::api::NewAccountModel*)accountModel behaviourController:( lrc::api::BehaviorController*) behaviorController avModel: (lrc::api::AVModel*)avModel pluginModel: (lrc::api::PluginModel*)pluginModel
{ {
if (self = [self initWithWindowNibName:nibNameOrNil]) if (self = [self initWithWindowNibName:nibNameOrNil])
{ {
self.accountModel = accountModel; self.accountModel = accountModel;
self.dataTransferModel = dataTransferModel;
self.behaviorController = behaviorController; self.behaviorController = behaviorController;
self.avModel = avModel; self.avModel = avModel;
self.pluginModel = pluginModel; self.pluginModel = pluginModel;
...@@ -208,7 +207,7 @@ typedef NS_ENUM(NSInteger, ViewState) { ...@@ -208,7 +207,7 @@ typedef NS_ENUM(NSInteger, ViewState) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
path = [[paths objectAtIndex:0] stringByAppendingString:@"/"]; path = [[paths objectAtIndex:0] stringByAppendingString:@"/"];
} }
self.dataTransferModel->downloadDirectory = QString::fromNSString(path); self.accountModel->downloadDirectory = QString::fromNSString(path);
if(appSandboxed()) { if(appSandboxed()) {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
avModel->setRecordPath(QString::fromNSString([paths objectAtIndex:0])); avModel->setRecordPath(QString::fromNSString([paths objectAtIndex:0]));
...@@ -412,7 +411,7 @@ typedef NS_ENUM(NSInteger, ViewState) { ...@@ -412,7 +411,7 @@ typedef NS_ENUM(NSInteger, ViewState) {
[ringIDLabel setStringValue:@""]; [ringIDLabel setStringValue:@""];
if(account.profileInfo.type != lrc::api::profile::Type::RING) { if(account.profileInfo.type != lrc::api::profile::Type::JAMI) {
self.notRingAccount = YES; self.notRingAccount = YES;
self.isSIPAccount = YES; self.isSIPAccount = YES;
return; return;
...@@ -568,7 +567,7 @@ typedef NS_ENUM(NSInteger, ViewState) { ...@@ -568,7 +567,7 @@ typedef NS_ENUM(NSInteger, ViewState) {
return; return;
} }
preferencesWC = [[PreferencesWC alloc] initWithWindowNibName: @"PreferencesWindow" bundle: nil accountModel:self.accountModel dataTransferModel:self.dataTransferModel behaviourController:self.behaviorController avModel: self.avModel pluginModel: self.pluginModel]; preferencesWC = [[PreferencesWC alloc] initWithWindowNibName: @"PreferencesWindow" bundle: nil accountModel:self.accountModel behaviourController:self.behaviorController avModel: self.avModel pluginModel: self.pluginModel];
[preferencesWC.window makeKeyAndOrderFront:preferencesWC.window]; [preferencesWC.window makeKeyAndOrderFront:preferencesWC.window];
} }
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
NSString *pin = backupFile ? @"" : (self.pinValue ? self.pinValue : @""); NSString *pin = backupFile ? @"" : (self.pinValue ? self.pinValue : @"");
NSString *archivePath = backupFile ? [backupFile path] : @""; NSString *archivePath = backupFile ? [backupFile path] : @"";
NSString *pathword = self.passwordValue ? self.passwordValue : @""; NSString *pathword = self.passwordValue ? self.passwordValue : @"";
accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::RING, accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::JAMI,
"", "",
QString::fromNSString(archivePath), QString::fromNSString(archivePath),
QString::fromNSString(pathword), QString::fromNSString(pathword),
......
...@@ -302,7 +302,7 @@ BOOL isRendevous = false; ...@@ -302,7 +302,7 @@ BOOL isRendevous = false;
[self display:loadingView]; [self display:loadingView];
[progressBar startAnimation:nil]; [progressBar startAnimation:nil];
accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::RING, QString::fromNSString(displayNameField.stringValue),"",QString::fromNSString(passwordField.stringValue), ""); accountToCreate = self.accountModel->createNewAccount(lrc::api::profile::Type::JAMI, QString::fromNSString(displayNameField.stringValue),"",QString::fromNSString(passwordField.stringValue), "");
} }
/** /**
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
lrc::api::ConversationModel* convModel_; lrc::api::ConversationModel* convModel_;
QString selectedUid_; QString selectedUid_;
lrc::api::profile::Type currentFilterType; lrc::api::FilterType currentFilterType;
__unsafe_unretained IBOutlet RingWindowController *delegate; __unsafe_unretained IBOutlet RingWindowController *delegate;
} }
...@@ -107,7 +107,7 @@ NSInteger const REQUEST_SEG = 1; ...@@ -107,7 +107,7 @@ NSInteger const REQUEST_SEG = 1;
[smartView setShortcutsDelegate:self]; [smartView setShortcutsDelegate:self];
[smartView setDataSource: self]; [smartView setDataSource: self];
currentFilterType = lrc::api::profile::Type::RING; currentFilterType = lrc::api::FilterType::JAMI;
selectorIsPresent = true; selectorIsPresent = true;
NSFont *searchBarFont = [NSFont systemFontOfSize: 12.0 weight: NSFontWeightLight]; NSFont *searchBarFont = [NSFont systemFontOfSize: 12.0 weight: NSFontWeightLight];
NSColor *color = [NSColor secondaryLabelColor]; NSColor *color = [NSColor secondaryLabelColor];
...@@ -162,16 +162,16 @@ NSInteger const REQUEST_SEG = 1; ...@@ -162,16 +162,16 @@ NSInteger const REQUEST_SEG = 1;
return; return;
} }
auto ringConversations = convModel_->getFilteredConversations(lrc::api::profile::Type::RING); auto ringConversations = convModel_->getFilteredConversations(lrc::api::FilterType::JAMI);
int totalUnreadMessages = 0; int totalUnreadMessages = 0;
std::for_each(ringConversations.get().begin(), ringConversations.get().end(), std::for_each(ringConversations.get().begin(), ringConversations.get().end(),
[&totalUnreadMessages, self] (const auto& conversation) { [&totalUnreadMessages, self] (const auto& conversation) {
totalUnreadMessages += convModel_->getNumberOfUnreadMessagesFor(conversation.get().uid); totalUnreadMessages += conversation.get().unreadMessages;
}); });
[totalMsgsCount setHidden:(totalUnreadMessages == 0)]; [totalMsgsCount setHidden:(totalUnreadMessages == 0)];
[totalMsgsCount setIntValue:totalUnreadMessages]; [totalMsgsCount setIntValue:totalUnreadMessages];
auto totalRequests = [self chosenAccount].contactModel->pendingRequestCount(); auto totalRequests = [self chosenAccount].conversationModel->pendingRequestCount();
[totalInvites setHidden:(totalRequests == 0)]; [totalInvites setHidden:(totalRequests == 0)];
[totalInvites setIntValue:totalRequests]; [totalInvites setIntValue:totalRequests];
} }
...@@ -192,8 +192,8 @@ NSInteger const REQUEST_SEG = 1; ...@@ -192,8 +192,8 @@ NSInteger const REQUEST_SEG = 1;
[self reloadSelectorNotifications]; [self reloadSelectorNotifications];
if (!convModel_->owner.contactModel->hasPendingRequests()) { if (!convModel_->owner.conversationModel->hasPendingRequests()) {
if (currentFilterType == lrc::api::profile::Type::PENDING) { if (currentFilterType == lrc::api::FilterType::REQUEST) {
[self selectConversationList]; [self selectConversationList];
} }
if (selectorIsPresent) { if (selectorIsPresent) {
...@@ -304,7 +304,7 @@ NSInteger const REQUEST_SEG = 1; ...@@ -304,7 +304,7 @@ NSInteger const REQUEST_SEG = 1;
}); });
newConversationConnection_ = QObject::connect(convModel_, &lrc::api::ConversationModel::newConversation, newConversationConnection_ = QObject::connect(convModel_, &lrc::api::ConversationModel::newConversation,
[self] (const QString& convUid) { [self] (const QString& convUid) {
[self reloadData]; [self reloadData];
[self updateConversationForNewContact:convUid.toNSString()]; [self updateConversationForNewContact:convUid.toNSString()];
}); });
conversationRemovedConnection_ = QObject::connect(convModel_, &lrc::api::ConversationModel::conversationRemoved, conversationRemovedConnection_ = QObject::connect(convModel_, &lrc::api::ConversationModel::conversationRemoved,
...@@ -389,17 +389,17 @@ NSInteger const REQUEST_SEG = 1; ...@@ -389,17 +389,17 @@ NSInteger const REQUEST_SEG = 1;
NSInteger selectedItem = [sender selectedSegment]; NSInteger selectedItem = [sender selectedSegment];
switch (selectedItem) { switch (selectedItem) {
case CONVERSATION_SEG: case CONVERSATION_SEG:
if (currentFilterType != lrc::api::profile::Type::RING) { if (currentFilterType != lrc::api::FilterType::JAMI) {
convModel_->setFilter(lrc::api::profile::Type::RING); currentFilterType = lrc::api::FilterType::JAMI;
convModel_->setFilter(currentFilterType);
[delegate listTypeChanged]; [delegate listTypeChanged];
currentFilterType = lrc::api::profile::Type::RING;
} }
break; break;
case REQUEST_SEG: case REQUEST_SEG:
if (currentFilterType != lrc::api::profile::Type::PENDING) { if (currentFilterType != lrc::api::FilterType::REQUEST) {
convModel_->setFilter(lrc::api::profile::Type::PENDING); currentFilterType = lrc::api::FilterType::REQUEST;
convModel_->setFilter(currentFilterType);
[delegate listTypeChanged]; [delegate listTypeChanged];
currentFilterType = lrc::api::profile::Type::PENDING;
} }
break; break;
default: default:
...@@ -409,25 +409,25 @@ NSInteger const REQUEST_SEG = 1; ...@@ -409,25 +409,25 @@ NSInteger const REQUEST_SEG = 1;
-(void) selectConversationList -(void) selectConversationList
{ {
if (currentFilterType == lrc::api::profile::Type::RING) if (currentFilterType == lrc::api::FilterType::JAMI)
return; return;
[listTypeSelector setSelectedSegment:CONVERSATION_SEG]; [listTypeSelector setSelectedSegment:CONVERSATION_SEG];
// Do not invert order of the next two lines or stack overflow // Do not invert order of the next two lines or stack overflow
// may happen on -(void) reloadData call if filter is currently set to PENDING // may happen on -(void) reloadData call if filter is currently set to PENDING
currentFilterType = lrc::api::profile::Type::RING; currentFilterType = lrc::api::FilterType::JAMI;
convModel_->setFilter(lrc::api::profile::Type::RING); convModel_->setFilter(currentFilterType);
convModel_->setFilter(""); convModel_->setFilter("");
} }
-(void) selectPendingList -(void) selectPendingList
{ {
if (currentFilterType == lrc::api::profile::Type::PENDING) if (currentFilterType == lrc::api::FilterType::REQUEST)
return; return;
[listTypeSelector setSelectedSegment:REQUEST_SEG]; [listTypeSelector setSelectedSegment:REQUEST_SEG];
currentFilterType = lrc::api::profile::Type::PENDING; currentFilterType = lrc::api::FilterType::REQUEST;
convModel_->setFilter(lrc::api::profile::Type::PENDING); convModel_->setFilter(currentFilterType);
convModel_->setFilter(""); convModel_->setFilter("");
} }
...@@ -831,7 +831,7 @@ NSInteger const REQUEST_SEG = 1; ...@@ -831,7 +831,7 @@ NSInteger const REQUEST_SEG = 1;
return nil; return nil;
} }
else if (contact.profileInfo.type == lrc::api::profile::Type::RING && contact.isTrusted == true) { else if (contact.profileInfo.type == lrc::api::profile::Type::JAMI && contact.isTrusted == true) {
isRingContact = true; isRingContact = true;
} }
auto conversationUD = conversation.uid; auto conversationUD = conversation.uid;
......
...@@ -112,7 +112,7 @@ namespace Interfaces { ...@@ -112,7 +112,7 @@ namespace Interfaces {
{ {
if (!contact.profileInfo.alias.isEmpty()) { if (!contact.profileInfo.alias.isEmpty()) {
return contact.profileInfo.alias.at(0).toUpper(); return contact.profileInfo.alias.at(0).toUpper();
} else if((contact.profileInfo.type == lrc::api::profile::Type::RING || } else if((contact.profileInfo.type == lrc::api::profile::Type::JAMI ||
contact.profileInfo.type == lrc::api::profile::Type::PENDING) && contact.profileInfo.type == lrc::api::profile::Type::PENDING) &&
!contact.registeredName.isEmpty()) { !contact.registeredName.isEmpty()) {
return contact.registeredName.at(0).toUpper(); return contact.registeredName.at(0).toUpper();
...@@ -193,7 +193,7 @@ namespace Interfaces { ...@@ -193,7 +193,7 @@ namespace Interfaces {
auto trimmed = contact.profileInfo.alias.trimmed().replace("\r","").replace("\n",""); auto trimmed = contact.profileInfo.alias.trimmed().replace("\r","").replace("\n","");
if (!trimmed.isEmpty()) { if (!trimmed.isEmpty()) {
return drawDefaultUserPixmap(size, color.toLatin1(), trimmed.at(0).toUpper().toLatin1()); return drawDefaultUserPixmap(size, color.toLatin1(), trimmed.at(0).toUpper().toLatin1());
} else if((contact.profileInfo.type == lrc::api::profile::Type::RING || } else if((contact.profileInfo.type == lrc::api::profile::Type::JAMI ||
contact.profileInfo.type == lrc::api::profile::Type::PENDING) && contact.profileInfo.type == lrc::api::profile::Type::PENDING) &&
!contact.registeredName.isEmpty()) { !contact.registeredName.isEmpty()) {
trimmed = contact.registeredName.trimmed().replace("\r","").replace("\n",""); trimmed = contact.registeredName.trimmed().replace("\r","").replace("\n","");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment