mirror of https://github.com/oxen-io/session-ios
Integrating deletion of threads.
parent
d73e42beff
commit
b58d2fb864
@ -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
|
Loading…
Reference in New Issue