Integrating deletion of threads.

pull/1/head
Frederic Jacobs 11 years ago
parent d73e42beff
commit b58d2fb864

@ -349,8 +349,6 @@
B684A46D19C3446200B11029 /* PushManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B684A46C19C3446200B11029 /* PushManagerTest.m */; };
B6850E5A1995A4710068E715 /* whisperFake.cer in Resources */ = {isa = PBXBuildFile; fileRef = B6850E591995A4710068E715 /* whisperFake.cer */; };
B69CD25119773E79005CE69A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B69CD25019773E79005CE69A /* XCTest.framework */; };
B6AE33B91A1EB0AF003DF39D /* DemoDataFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = B6AE33B61A1EB0AF003DF39D /* DemoDataFactory.m */; };
B6AE33BA1A1EB0AF003DF39D /* DemoDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B6AE33B81A1EB0AF003DF39D /* DemoDataModel.m */; };
B6AE33BD1A1EB121003DF39D /* GroupModel.m in Sources */ = {isa = PBXBuildFile; fileRef = B6AE33BC1A1EB121003DF39D /* GroupModel.m */; };
B6B095E41A1D25C5008BFAA6 /* CryptographyTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = B6B095DE1A1D25C5008BFAA6 /* CryptographyTests.mm */; };
B6B095E51A1D25C5008BFAA6 /* TextSecureKitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B095DF1A1D25C5008BFAA6 /* TextSecureKitTests.m */; };
@ -504,7 +502,6 @@
FCB11D931A12A4AA002F93FB /* FullImageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCB11D921A12A4AA002F93FB /* FullImageViewController.m */; };
FCF72A081A01A765006BC849 /* ContactsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCF72A071A01A765006BC849 /* ContactsTableViewController.m */; };
FCF72A131A02D27F006BC849 /* ContactDetailTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCF72A111A02D27F006BC849 /* ContactDetailTableViewController.m */; };
FCF72A161A02D2BB006BC849 /* ContactDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FCF72A151A02D2BB006BC849 /* ContactDetailCell.m */; };
FCFA64B41A24F3880007FB87 /* UIColor+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */; };
FCFA64B71A24F6730007FB87 /* UIFont+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFA64B61A24F6730007FB87 /* UIFont+OWS.m */; };
FCFD256F1A151BCB00F4C644 /* NewGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FCFD256E1A151BCB00F4C644 /* NewGroupViewController.m */; };
@ -985,10 +982,6 @@
B684A46C19C3446200B11029 /* PushManagerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PushManagerTest.m; path = Signal/test/push/PushManagerTest.m; sourceTree = SOURCE_ROOT; };
B6850E591995A4710068E715 /* whisperFake.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = whisperFake.cer; sourceTree = "<group>"; };
B69CD25019773E79005CE69A /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
B6AE33B51A1EB0AF003DF39D /* DemoDataFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoDataFactory.h; sourceTree = "<group>"; };
B6AE33B61A1EB0AF003DF39D /* DemoDataFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoDataFactory.m; sourceTree = "<group>"; };
B6AE33B71A1EB0AF003DF39D /* DemoDataModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DemoDataModel.h; sourceTree = "<group>"; };
B6AE33B81A1EB0AF003DF39D /* DemoDataModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DemoDataModel.m; sourceTree = "<group>"; };
B6AE33BB1A1EB121003DF39D /* GroupModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupModel.h; sourceTree = "<group>"; };
B6AE33BC1A1EB121003DF39D /* GroupModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupModel.m; sourceTree = "<group>"; };
B6B095DE1A1D25C5008BFAA6 /* CryptographyTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CryptographyTests.mm; sourceTree = "<group>"; };
@ -1201,15 +1194,15 @@
FCAC963419FEF4E20046DFC5 /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Storyboard.storyboard; path = Signal/src/Storyboard/Storyboard.storyboard; sourceTree = SOURCE_ROOT; };
FCAC963A19FEF9280046DFC5 /* SignalsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SignalsViewController.h; path = UITests/SignalsViewController.h; sourceTree = "<group>"; };
FCAC963B19FEF9280046DFC5 /* SignalsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SignalsViewController.m; path = UITests/SignalsViewController.m; sourceTree = "<group>"; };
FCAC963D19FEF99A0046DFC5 /* InboxTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InboxTableViewCell.h; sourceTree = "<group>"; };
FCAC963E19FEF99A0046DFC5 /* InboxTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InboxTableViewCell.m; sourceTree = "<group>"; };
FCAC963F19FEF99A0046DFC5 /* InboxTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InboxTableViewCell.xib; sourceTree = "<group>"; };
FCAC963D19FEF99A0046DFC5 /* InboxTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InboxTableViewCell.h; path = "../view controllers/InboxTableViewCell.h"; sourceTree = "<group>"; };
FCAC963E19FEF99A0046DFC5 /* InboxTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InboxTableViewCell.m; path = "../view controllers/InboxTableViewCell.m"; sourceTree = "<group>"; };
FCAC963F19FEF99A0046DFC5 /* InboxTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = InboxTableViewCell.xib; path = "../../view controllers/InboxTableViewCell.xib"; sourceTree = "<group>"; };
FCAC964F19FF0A6E0046DFC5 /* MessagesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagesViewController.h; sourceTree = "<group>"; };
FCAC965019FF0A6E0046DFC5 /* MessagesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessagesViewController.m; sourceTree = "<group>"; };
FCAFC33D1A0F948F00AE5136 /* ActionContactDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionContactDetailCell.h; sourceTree = "<group>"; };
FCAFC33E1A0F948F00AE5136 /* ActionContactDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ActionContactDetailCell.m; sourceTree = "<group>"; };
FCB11D881A1284BB002F93FB /* SettingsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SettingsTableViewCell.h; sourceTree = "<group>"; };
FCB11D891A1284BB002F93FB /* SettingsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SettingsTableViewCell.m; sourceTree = "<group>"; };
FCAFC33D1A0F948F00AE5136 /* ActionContactDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ActionContactDetailCell.h; path = "../view controllers/ActionContactDetailCell.h"; sourceTree = "<group>"; };
FCAFC33E1A0F948F00AE5136 /* ActionContactDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ActionContactDetailCell.m; path = "../view controllers/ActionContactDetailCell.m"; sourceTree = "<group>"; };
FCB11D881A1284BB002F93FB /* SettingsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SettingsTableViewCell.h; path = "../view controllers/SettingsTableViewCell.h"; sourceTree = "<group>"; };
FCB11D891A1284BB002F93FB /* SettingsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SettingsTableViewCell.m; path = "../view controllers/SettingsTableViewCell.m"; sourceTree = "<group>"; };
FCB11D8B1A129A76002F93FB /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
FCB11D911A12A4AA002F93FB /* FullImageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullImageViewController.h; sourceTree = "<group>"; };
FCB11D921A12A4AA002F93FB /* FullImageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FullImageViewController.m; sourceTree = "<group>"; };
@ -1217,8 +1210,6 @@
FCF72A071A01A765006BC849 /* ContactsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactsTableViewController.m; sourceTree = "<group>"; };
FCF72A111A02D27F006BC849 /* ContactDetailTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailTableViewController.m; sourceTree = "<group>"; };
FCF72A121A02D27F006BC849 /* ContactDetailTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailTableViewController.h; sourceTree = "<group>"; };
FCF72A141A02D2BB006BC849 /* ContactDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailCell.h; sourceTree = "<group>"; };
FCF72A151A02D2BB006BC849 /* ContactDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailCell.m; sourceTree = "<group>"; };
FCFA64B21A24F3880007FB87 /* UIColor+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+OWS.h"; sourceTree = "<group>"; };
FCFA64B31A24F3880007FB87 /* UIColor+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+OWS.m"; sourceTree = "<group>"; };
FCFA64B51A24F6730007FB87 /* UIFont+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIFont+OWS.h"; path = "util/UIFont+OWS.h"; sourceTree = "<group>"; };
@ -1347,7 +1338,6 @@
isa = PBXGroup;
children = (
FCAC963419FEF4E20046DFC5 /* Storyboard.storyboard */,
FCAC963919FEF8A00046DFC5 /* UI Tests */,
76EB03C218170B33006006FC /* AppDelegate.h */,
76EB03C318170B33006006FC /* AppDelegate.m */,
76EB03D918170B33006006FC /* audio */,
@ -1854,6 +1844,11 @@
76EB04FE18170B33006006FC /* view controllers */ = {
isa = PBXGroup;
children = (
FCFD25791A1543D500F4C644 /* Signup */,
FC3196321A08142D0094C78E /* Signals */,
FC3196331A0814360094C78E /* Contacts */,
FC3196311A08141D0094C78E /* Settings */,
FCAC963919FEF8A00046DFC5 /* UI Tests */,
B97CBFA518860EA3008E0DE9 /* CountryCodeViewController.h */,
B97CBFA618860EA3008E0DE9 /* CountryCodeViewController.m */,
76EB050518170B33006006FC /* DialerViewController.h */,
@ -1881,6 +1876,12 @@
76EB052B18170B33006006FC /* views */ = {
isa = PBXGroup;
children = (
FCAC963D19FEF99A0046DFC5 /* InboxTableViewCell.h */,
FCAC963E19FEF99A0046DFC5 /* InboxTableViewCell.m */,
FCAFC33D1A0F948F00AE5136 /* ActionContactDetailCell.h */,
FCAFC33E1A0F948F00AE5136 /* ActionContactDetailCell.m */,
FCB11D881A1284BB002F93FB /* SettingsTableViewCell.h */,
FCB11D891A1284BB002F93FB /* SettingsTableViewCell.m */,
76EB052E18170B33006006FC /* ContactTableViewCell.h */,
76EB052F18170B33006006FC /* ContactTableViewCell.m */,
B97CBFAC1886100E008E0DE9 /* CountryCodeTableViewCell.h */,
@ -1901,6 +1902,7 @@
children = (
76EB053A18170B33006006FC /* ContactTableViewCell.xib */,
B97CBFB018861023008E0DE9 /* CountryCodeTableViewCell.xib */,
FCAC963F19FEF99A0046DFC5 /* InboxTableViewCell.xib */,
);
path = xibs;
sourceTree = "<group>";
@ -2575,10 +2577,6 @@
children = (
B6AE33BB1A1EB121003DF39D /* GroupModel.h */,
B6AE33BC1A1EB121003DF39D /* GroupModel.m */,
B6AE33B51A1EB0AF003DF39D /* DemoDataFactory.h */,
B6AE33B61A1EB0AF003DF39D /* DemoDataFactory.m */,
B6AE33B71A1EB0AF003DF39D /* DemoDataModel.h */,
B6AE33B81A1EB0AF003DF39D /* DemoDataModel.m */,
);
name = temp;
sourceTree = "<group>";
@ -3022,38 +3020,8 @@
isa = PBXGroup;
children = (
B6AE33B41A1EB0A0003DF39D /* temp */,
FCAC964E19FF061C0046DFC5 /* ViewControllers */,
FCAC964D19FF06110046DFC5 /* Views */,
);
name = "UI Tests";
path = "view controllers";
sourceTree = "<group>";
};
FCAC964D19FF06110046DFC5 /* Views */ = {
isa = PBXGroup;
children = (
FCF72A141A02D2BB006BC849 /* ContactDetailCell.h */,
FCF72A151A02D2BB006BC849 /* ContactDetailCell.m */,
FCAC963D19FEF99A0046DFC5 /* InboxTableViewCell.h */,
FCAC963E19FEF99A0046DFC5 /* InboxTableViewCell.m */,
FCAC963F19FEF99A0046DFC5 /* InboxTableViewCell.xib */,
FCAFC33D1A0F948F00AE5136 /* ActionContactDetailCell.h */,
FCAFC33E1A0F948F00AE5136 /* ActionContactDetailCell.m */,
FCB11D881A1284BB002F93FB /* SettingsTableViewCell.h */,
FCB11D891A1284BB002F93FB /* SettingsTableViewCell.m */,
);
name = Views;
sourceTree = "<group>";
};
FCAC964E19FF061C0046DFC5 /* ViewControllers */ = {
isa = PBXGroup;
children = (
FCFD25791A1543D500F4C644 /* Signup */,
FC3196321A08142D0094C78E /* Signals */,
FC3196331A0814360094C78E /* Contacts */,
FC3196311A08141D0094C78E /* Settings */,
);
name = ViewControllers;
sourceTree = "<group>";
};
FCFA64B11A24F29E0007FB87 /* UI Categories */ = {
@ -3429,7 +3397,6 @@
76EB063E18170B33006006FC /* Operation.m in Sources */,
76EB05F618170B33006006FC /* CallConnectUtil.m in Sources */,
76EB061218170B33006006FC /* LoggingUtil.m in Sources */,
B6AE33B91A1EB0AF003DF39D /* DemoDataFactory.m in Sources */,
76EB060E18170B33006006FC /* DecayingSampleEstimator.m in Sources */,
76EB05BA18170B33006006FC /* CommitPacket.m in Sources */,
76EB060218170B33006006FC /* InitiatorSessionDescriptor.m in Sources */,
@ -3483,7 +3450,6 @@
76EB05F218170B33006006FC /* PhoneNumber.m in Sources */,
E197B61718BBEC1A00F073E5 /* AnonymousAudioCallbackHandler.m in Sources */,
76EB05BC18170B33006006FC /* ConfirmAckPacket.m in Sources */,
B6AE33BA1A1EB0AF003DF39D /* DemoDataModel.m in Sources */,
76EB060C18170B33006006FC /* CategorizingLogger.m in Sources */,
76EB058A18170B33006006FC /* Release.m in Sources */,
76EB061018170B33006006FC /* EventWindow.m in Sources */,
@ -3525,7 +3491,6 @@
FCF72A081A01A765006BC849 /* ContactsTableViewController.m in Sources */,
FC31962D1A06A2190094C78E /* FingerprintViewController.m in Sources */,
76EB061418170B33006006FC /* AnonymousConditionLogger.m in Sources */,
FCF72A161A02D2BB006BC849 /* ContactDetailCell.m in Sources */,
76EB05C018170B33006006FC /* DhPacket.m in Sources */,
765052A1182945EF008313E1 /* LocalizableCustomFontLabel.m in Sources */,
FC3196301A0814130094C78E /* SettingsTableViewController.m in Sources */,

@ -97,8 +97,8 @@
</barButtonItem>
</navigationItem>
<connections>
<outlet property="_tableView" destination="PaA-ol-uQT" id="XGR-5F-9H0"/>
<outlet property="segmentedControl" destination="3zh-Df-ewk" id="WwI-JF-Y2X"/>
<outlet property="tableView" destination="PaA-ol-uQT" id="nQU-tR-wbL"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dE8-zB-mtF" userLabel="First Responder" sceneMemberID="firstResponder"/>

@ -38,4 +38,7 @@
- (BOOL)isTextSecureContact;
- (BOOL)isRedPhoneContact;
- (NSArray*)textSecureIdentifiers;
- (NSArray*)redPhoneIdentifiers;
@end

@ -95,9 +95,35 @@ static NSString *const DEFAULTS_KEY_DATE = @"DefaultsKeyDate";
return isRecipient;
}
- (NSArray*)textSecureIdentifiers{
__block NSMutableArray *identifiers = [NSMutableArray array];
[[TSStorageManager sharedManager].dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
for (PhoneNumber *number in self.parsedPhoneNumbers) {
if ([TSRecipient recipientWithTextSecureIdentifier:number.toE164 withTransaction:transaction]) {
[identifiers addObject:number.toE164];
}
}
}];
return identifiers;
}
- (BOOL)isRedPhoneContact{
ContactsManager *contactManager = [Environment getCurrent].contactsManager;
return [contactManager isContactRegisteredWithRedPhone:self];
}
- (NSArray *)redPhoneIdentifiers{
__block NSMutableArray *identifiers = [NSMutableArray array];
ContactsManager *contactManager = [Environment getCurrent].contactsManager;
for (PhoneNumber *number in self.parsedPhoneNumbers) {
if ([contactManager isPhoneNumberRegisteredWithRedPhone:number]) {
[identifiers addObject:number.toE164];
}
}
return identifiers;
}
@end

@ -29,6 +29,8 @@ typedef void(^ABReloadRequestCompletionBlock)(NSArray *contacts);
-(ObservableValue *) getObservableContacts;
-(ObservableValue *) getObservableRedPhoneUsers;
- (BOOL)isPhoneNumberRegisteredWithRedPhone:(PhoneNumber*)phoneNumber;
-(NSArray*) getContactsFromAddressBook:(ABAddressBookRef)addressBook;
-(Contact*) latestContactWithRecordId:(ABRecordID)recordId;
-(Contact*) latestContactForPhoneNumber:(PhoneNumber *)phoneNumber;
@ -38,13 +40,15 @@ typedef void(^ABReloadRequestCompletionBlock)(NSArray *contacts);
+(BOOL)name:(NSString *)nameString matchesQuery:(NSString *)queryString;
+(BOOL)phoneNumber:(PhoneNumber *)phoneNumber matchesQuery:(NSString *)queryString;
-(BOOL)isContactRegisteredWithRedPhone:(Contact*) contact;
-(void) doAfterEnvironmentInitSetup;
- (NSArray*)allContacts;
- (NSArray*)textSecureContacts;
- (BOOL)isContactRegisteredWithRedPhone:(Contact*)contact;
- (BOOL)isContactRegisteredWithTextSecure:(Contact*)contact;
-(void)doAfterEnvironmentInitSetup;
- (NSString*)nameStringForPhoneIdentifier:(NSString*)identifier;
@end

@ -411,7 +411,7 @@ void onAddressBookChanged(ABAddressBookRef notifyAddressBook, CFDictionaryRef in
return newSet.allObjects;
}
- (BOOL)isContactRegisteredWithRedPhone:(Contact*) contact {
- (BOOL)isContactRegisteredWithRedPhone:(Contact*)contact {
for(PhoneNumber *phoneNumber in contact.parsedPhoneNumbers){
if ( [self isPhoneNumberRegisteredWithRedPhone:phoneNumber]) {
return YES;

@ -43,6 +43,7 @@
@property (getter=isBlocked) BOOL blocked;
@property (nonatomic) uint64_t lastMessageId;
- (NSDate*)lastMessageDate;
@end

@ -78,7 +78,7 @@ static NSString *const kContactDetailSegue = @"DetailSegue";
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell * cell;
UITableViewCell *cell;
switch (indexPath.row) {
case kNameMainNumberCellIndexPath:

@ -1,19 +0,0 @@
//
// DemoDataFactory.h
// Signal
//
// Created by Dylan Bourgeois on 27/10/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
//
#import "DemoDataModel.h"
#import <Foundation/Foundation.h>
@interface DemoDataFactory : NSObject
+(NSArray*)data;
+(NSArray*)makeFakeContacts;
+(NSArray*)makeFakeCalls;
@end

@ -1,41 +0,0 @@
//
// DemoDataFactory.m
// Signal
//
// Created by Dylan Bourgeois on 27/10/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
//
#import "DemoDataFactory.h"
@implementation DemoDataFactory
+(NSArray*)data {
NSMutableArray* _mutableArray = [[NSMutableArray alloc]init];
for (NSUInteger i=0;i<5;i++)
[_mutableArray addObject:[DemoDataModel initModel:i]];
return (NSArray*)_mutableArray;
}
+(NSArray*)makeFakeContacts
{
NSMutableArray* _mutableArray = [[NSMutableArray alloc]init];
for (NSUInteger i=0;i<5;i++)
[_mutableArray addObject:[DemoDataModel initFakeContacts:i]];
return (NSArray*)_mutableArray;
}
+(NSArray*)makeFakeCalls
{
NSMutableArray* _mutableArray = [[NSMutableArray alloc]init];
for (NSUInteger i=0;i<5;i++)
[_mutableArray addObject:[DemoDataModel initRecentCall:i]];
return (NSArray*)_mutableArray;
}
@end

@ -1,48 +0,0 @@
//
// DemoDataModel.h
// Signal
//
// Created by Dylan Bourgeois on 27/10/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import "JSQMessages.h"
#import "Contact.h"
#import "RecentCall.h"
static NSString * const kJSQDemoAvatarDisplayNameDylan = @"Dylan Bourgeois";
static NSString * const kJSQDemoAvatarDisplayNameFred = @"Frederic Jacobs";
static NSString * const kJSQDemoAvatarDisplayNameMoxie = @"Moxie Marlinspike";
static NSString * const kJSQDemoAvatarIdDylan = @"053496-4509-289";
static NSString * const kJSQDemoAvatarIdFred = @"468-768355-23123";
static NSString * const kJSQDemoAvatarIdMoxie = @"707-8956784-57";
@interface DemoDataModel : NSObject
@property (strong, nonatomic) NSMutableArray *messages;
@property (strong, nonatomic) JSQMessagesBubbleImage *outgoingBubbleImageData;
@property (strong, nonatomic) JSQMessagesBubbleImage *incomingBubbleImageData;
@property (strong, nonatomic) NSDictionary *users;
@property (nonatomic, strong) NSString * _sender ;
@property (nonatomic, strong) NSString * _snippet ;
@property (nonatomic, strong) NSArray * _conversation;
@property (nonatomic, strong) NSString * lastActionString;
+(DemoDataModel*)initModel:(NSUInteger)modelNumber;
+(Contact*)initFakeContacts:(NSUInteger)modelNumber;
+(RecentCall*)initRecentCall:(NSUInteger)modelNumber;
@end

@ -1,157 +0,0 @@
//
// DemoDataModel.m
// Signal
//
// Created by Dylan Bourgeois on 27/10/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
//
#import "DemoDataModel.h"
#import "Contact.h"
#import "RecentCall.h"
#import "PhoneNumber.h"
#import "JSQCall.h"
enum {kDemoDataModelCase0, kDemoDataModelCase1,kDemoDataModelCase2, kDemoDataModelCase3, kDemoDataModelCase4};
@implementation DemoDataModel
- (instancetype)init
{
self = [super init];
if (self)
{
[self loadFakeMessages];
}
return self;
}
- (void)loadFakeMessages
{
/**
* Load some fake messages for demo.
*
* You should have a mutable array or orderedSet, or something.
*/
self.messages = [[NSMutableArray alloc] initWithObjects:
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdDylan
senderDisplayName:kJSQDemoAvatarDisplayNameDylan
date:[NSDate distantPast]
text:@"Welcome to JSQMessages: A messaging UI framework for iOS."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdDylan
senderDisplayName:kJSQDemoAvatarDisplayNameDylan
date:[NSDate distantPast]
text:@"It even has data detectors. You can call me tonight. My cell number is 123-456-7890. My website is www.hexedbits.com."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdMoxie
senderDisplayName:kJSQDemoAvatarDisplayNameMoxie
date:[NSDate date]
text:@"JSQMessagesViewController is nearly an exact replica of the iOS Messages App. And perhaps, better."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdFred
senderDisplayName:kJSQDemoAvatarDisplayNameFred
date:[NSDate date]
text:@"It is unit-tested, free, open-source, and documented."],
[[JSQMessage alloc] initWithSenderId:kJSQDemoAvatarIdDylan
senderDisplayName:kJSQDemoAvatarDisplayNameDylan
date:[NSDate date]
text:@"Now with media messages!"],
[[JSQCall alloc] initWithCallerId:kJSQDemoAvatarIdMoxie
callerDisplayName:kJSQDemoAvatarDisplayNameMoxie
date:[NSDate date]
duration:127
status:kCallIncoming],
[[JSQCall alloc] initWithCallerId:kJSQDemoAvatarIdFred
callerDisplayName:kJSQDemoAvatarDisplayNameFred
date:[NSDate date]
duration:0
status:kCallMissed],
[[JSQCall alloc] initWithCallerId:kJSQDemoAvatarIdFred
callerDisplayName:kJSQDemoAvatarDisplayNameFred
date:[NSDate date]
duration:0
status:kCallFailed],
nil];
}
+(DemoDataModel*)initModel:(NSUInteger)modelNumber
{
DemoDataModel * _demoModel = [[DemoDataModel alloc] init];
switch (modelNumber) {
case kDemoDataModelCase0:
_demoModel._sender = @"Dylan Bourgeois";
_demoModel._snippet = @"OpenSSL takes forever to build dude.";
_demoModel.lastActionString = @"unread";
break;
case kDemoDataModelCase1:
_demoModel._sender = @"Frederic Jacobs";
_demoModel._snippet = @"Bro, you're such an artist.";
_demoModel.lastActionString = @"replied";
break;
case kDemoDataModelCase2:
_demoModel._sender = @"Romain Ruetschi";
_demoModel._snippet = @"Missed Call";
_demoModel.lastActionString = @"missedCall";
break;
case kDemoDataModelCase3:
_demoModel._sender = @"Stephen Colbert";
_demoModel._snippet = @"Outgoing Call";
_demoModel.lastActionString = @"outgoingCall";
break;
case kDemoDataModelCase4:
_demoModel._sender = @"Johnny Ramone";
_demoModel._snippet = @"Rock on...";
_demoModel.lastActionString = @"read";
break;
default:
break;
}
return _demoModel;
}
+(Contact*)initFakeContacts:(NSUInteger)modelNumber
{
Contact * _demoContact;
return _demoContact;
}
+(RecentCall*)initRecentCall:(NSUInteger)modelNumber
{
RecentCall * _demoCall;
switch (modelNumber) {
case kDemoDataModelCase0:
_demoCall = [RecentCall recentCallWithContactID:0 andNumber:[PhoneNumber phoneNumberFromUserSpecifiedText:@"954-394-9043"] andCallType:RPRecentCallTypeMissed];
break;
case kDemoDataModelCase1:
_demoCall = [RecentCall recentCallWithContactID:0 andNumber:[PhoneNumber phoneNumberFromUserSpecifiedText:@"954-304-9043"] andCallType:RPRecentCallTypeIncoming];
break;
case kDemoDataModelCase2:
_demoCall = [RecentCall recentCallWithContactID:0 andNumber:[PhoneNumber phoneNumberFromUserSpecifiedText:@"954-124-9043"] andCallType:RPRecentCallTypeOutgoing];
break;
case kDemoDataModelCase3:
_demoCall = [RecentCall recentCallWithContactID:0 andNumber:[PhoneNumber phoneNumberFromUserSpecifiedText:@"954-454-9043"] andCallType:RPRecentCallTypeIncoming];
break;
case kDemoDataModelCase4:
_demoCall = [RecentCall recentCallWithContactID:0 andNumber:[PhoneNumber phoneNumberFromUserSpecifiedText:@"954-394-9043"] andCallType:RPRecentCallTypeIncoming];
break;
default:
break;
}
return _demoCall;
}
@end

@ -7,7 +7,6 @@
//
#import <UIKit/UIKit.h>
#import "DemoDataModel.h"
#import "NextResponderScrollView.h"
#import "TSThread.h"

@ -101,7 +101,7 @@
[attributedString addAttribute:NSFontAttributeName
value:[UIUtil helveticaLightWithSize:TIME_LABEL_SIZE]
value:[UIFont ows_lightFontWithSize:TIME_LABEL_SIZE]
range:NSMakeRange(0, timeString.length)];

@ -8,7 +8,6 @@
#import <UIKit/UIKit.h>
#import "DemoDataFactory.h"
#import "Contact.h"
#import "JSQMessagesToolbarContentView.h"

@ -138,7 +138,7 @@
UINavigationController* nav = (UINavigationController*)[tb.childViewControllers objectAtIndex:1];
SignalsViewController* s = (SignalsViewController*)nav.topViewController;
s.contactFromCompose = [self contactForIndexPath:indexPath];
s.contactIdentifierFromCompose = [[[self contactForIndexPath:indexPath] textSecureIdentifiers] firstObject];
[self dismissViewControllerAnimated:YES completion:^(){
[s performSegueWithIdentifier:@"showSegue" sender:nil];

@ -9,8 +9,6 @@
#import "JSQMessagesViewController.h"
#import "JSQMessages.h"
#import "DemoDataModel.h"
@class TSThread;
@interface MessagesViewController : JSQMessagesViewController <UIImagePickerControllerDelegate,UINavigationControllerDelegate>

@ -82,7 +82,7 @@ typedef enum : NSUInteger {
self.title = self.senderTitleString;
self.senderId = @"self";
self.senderDisplayName = kJSQDemoAvatarDisplayNameDylan;
self.senderDisplayName = @"self";
self.automaticallyScrollsToMostRecentMessage = YES;
@ -374,8 +374,8 @@ typedef enum : NSUInteger {
__unused UIImage *snapshot = [[UIImage alloc] initWithCGImage:snapshotRef];
JSQVideoMediaItem * videoItem = [[JSQVideoMediaItem alloc] initWithFileURL:videoURL isReadyToPlay:YES];
JSQMessage * videoMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdDylan
displayName:kJSQDemoAvatarDisplayNameDylan
JSQMessage * videoMessage = [JSQMessage messageWithSenderId:self.senderId
displayName:self.senderDisplayName
media:videoItem];
[self finishSendingMessage];
@ -384,8 +384,8 @@ typedef enum : NSUInteger {
//Is a photo
JSQPhotoMediaItem *photoItem = [[JSQPhotoMediaItem alloc] initWithImage:picture_camera];
JSQMessage *photoMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdDylan
displayName:kJSQDemoAvatarDisplayNameDylan
JSQMessage *photoMessage = [JSQMessage messageWithSenderId:self.senderId
displayName:self.senderDisplayName
media:photoItem];
[self finishSendingMessage];

@ -13,7 +13,6 @@
#import "Environment.h"
#import "Contact.h"
#import "DemoDataFactory.h"
#import "GroupModel.h"
#import "UIUtil.h"

@ -9,11 +9,12 @@
#include "InboxTableViewCell.h"
#import <UIKit/UIKit.h>
#import "Contact.h"
#import "GroupModel.h"
@interface SignalsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, TableViewCellDelegate>
@property (nonatomic) Contact *contactFromCompose;
@property (nonatomic) NSString *contactIdentifierFromCompose;
@property (nonatomic) GroupModel *groupFromCompose;
@property (nonatomic, retain) IBOutlet UITableView *tableView;

@ -7,7 +7,6 @@
//
#import "UIUtil.h"
#import "DemoDataFactory.h"
#import "InboxTableViewCell.h"
#import "MessagesViewController.h"
@ -36,8 +35,8 @@ static NSString *const kSegueIndentifier = @"showSegue";
NSUInteger numberOfCells;
}
@property (strong, nonatomic) UILabel * emptyViewLabel;
@property (strong, nonatomic) DemoDataModel *demoData;
@property (nonatomic, strong) YapDatabaseConnection *uiDatabaseConnection;
@property (nonatomic, strong) YapDatabaseViewMappings *threadMappings;
@ -141,15 +140,19 @@ static NSString *const kSegueIndentifier = @"showSegue";
#pragma mark - HomeFeedTableViewCellDelegate
- (void)tableViewCellTappedDelete:(InboxTableViewCell*)cell {
NSLog(@"Delete");
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
TSThread *thread = [self threadForIndexPath:indexPath];
[[TSStorageManager sharedManager].dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[thread removeWithTransaction:transaction];
}];
}
- (void)tableViewCellTappedArchive:(InboxTableViewCell*)cell {
NSLog(@"Archive");
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{
[self performSegueWithIdentifier:kSegueIndentifier sender:self];
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
@ -160,19 +163,16 @@ static NSString *const kSegueIndentifier = @"showSegue";
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:kSegueIndentifier])
{
if ([segue.identifier isEqualToString:kSegueIndentifier]){
MessagesViewController * vc = [segue destinationViewController];
NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
vc.thread = [self threadForIndexPath:selectedIndexPath];
if (!vc.thread) {
[TSStorageManager.sharedManager.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
vc.thread = [TSContactThread threadWithContactId:[self.contactFromCompose.userTextPhoneNumbers firstObject] transaction:transaction];
NSLog(@"Thread:%@", vc.thread);
vc.thread = [TSContactThread threadWithContactId:self.contactIdentifierFromCompose transaction:transaction];
}];
}
}
}
@ -211,18 +211,16 @@ static NSString *const kSegueIndentifier = @"showSegue";
}
- (void)yapDatabaseModified:(NSNotification *)notification {
NSArray *notifications = notification.userInfo[@"notifications"];
NSArray *notifications = [self.uiDatabaseConnection beginLongLivedReadTransaction];
NSArray *sectionChanges = nil;
NSArray *rowChanges = nil;
NSArray *rowChanges = nil;
[[self.uiDatabaseConnection ext:TSThreadDatabaseViewExtensionName] getSectionChanges:&sectionChanges
rowChanges:&rowChanges
forNotifications:notifications
withMappings:self.threadMappings];
if ([sectionChanges count] == 0 && [rowChanges count] == 0){
return;
}

@ -18,5 +18,4 @@
- (void)configureWithContact:(Contact *)contact;
@end

Loading…
Cancel
Save