Skip to content

Commit

Permalink
Updated screenshot for appstore
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchiles committed Nov 6, 2014
1 parent b402def commit 98205e8
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Expand Up @@ -4,9 +4,6 @@
[submodule "Submodules/XMPPFramework"]
path = Submodules/XMPPFramework
url = git@github.com:ChatSecure/XMPPFramework.git
[submodule "Submodules/iOS-Screenshot-Automater"]
path = Submodules/iOS-Screenshot-Automater
url = git@github.com:ChatSecure/iOS-Screenshot-Automator.git
[submodule "Submodules/ChatSecure-Metadata"]
path = Submodules/ChatSecure-Metadata
url = git@github.com:ChatSecure/ChatSecure-Metadata.git
Expand All @@ -22,3 +19,6 @@
[submodule "Submodules/YapDatabase"]
path = Submodules/YapDatabase
url = git@github.com:chrisballinger/YapDatabase.git
[submodule "Submodules/rScreenshooter"]
path = Submodules/rScreenshooter
url = git@github.com:ChatSecure/rScreenshooter.git
3 changes: 3 additions & 0 deletions ChatSecure.xcodeproj/project.pbxproj
Expand Up @@ -87,6 +87,7 @@
6383196818EB938300862B25 /* OTRManagedAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = 6397535D18CA8221005D6063 /* OTRManagedAccount.m */; };
638F2C8F1947C32A00EB5239 /* OTRMessagesCollectionViewCellOutgoing.xib in Resources */ = {isa = PBXBuildFile; fileRef = 638F2C8E1947C32A00EB5239 /* OTRMessagesCollectionViewCellOutgoing.xib */; };
638F2C911947C98200EB5239 /* OTRMessagesCollectionViewCellIncoming.xib in Resources */ = {isa = PBXBuildFile; fileRef = 638F2C901947C98200EB5239 /* OTRMessagesCollectionViewCellIncoming.xib */; };
639510951A09A78D0082A924 /* OTRChatDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = 63D55DDA196CB5AE004A5435 /* OTRChatDemo.m */; };
639752EB18CA7B23005D6063 /* OTRCertificatesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 639752EA18CA7B23005D6063 /* OTRCertificatesViewController.m */; };
6397530A18CA7CB0005D6063 /* OTRProtocolManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6397530918CA7CB0005D6063 /* OTRProtocolManager.m */; };
6397531F18CA7E1C005D6063 /* OTRSettingsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6397531E18CA7E1C005D6063 /* OTRSettingsManager.m */; };
Expand Down Expand Up @@ -1658,6 +1659,7 @@
6397538D18CA8222005D6063 /* OTRvCardTemp.m in Sources */,
63D72B3719145CC2005F3428 /* OTROnboardingPushAccountLoginViewController.m in Sources */,
6397538A18CA8222005D6063 /* OTRManagedXMPPTorAccount.m in Sources */,
639510951A09A78D0082A924 /* OTRChatDemo.m in Sources */,
639C60AB18CA984500CC4DF4 /* OTRBuddyViewController.m in Sources */,
634357F519143F8A0062FD26 /* OTROnboardingStepsController.m in Sources */,
63CAF8FA18FF268000C3337E /* OTRAppDelegate.m in Sources */,
Expand Down Expand Up @@ -1837,6 +1839,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "ChatSecure/ChatSecure-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
CHATSECURE_DEMO,
_GCRYPT_IN_LIBGCRYPT,
"$(inherited)",
USE_BUFFEREVENTS,
Expand Down
2 changes: 1 addition & 1 deletion ChatSecure/OTRAppDelegate.m
Expand Up @@ -113,7 +113,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(


#if CHATSECURE_DEMO
[self performSelector:@selector(loadDemoData) withObject:nil afterDelay:10];
[self performSelector:@selector(loadDemoData) withObject:nil afterDelay:0.0];
#endif
}

Expand Down
87 changes: 50 additions & 37 deletions ChatSecure/OTRChatDemo.m
Expand Up @@ -17,28 +17,29 @@ @implementation OTRChatDemo

+ (void)loadDemoChatInDatabase
{
NSArray *buddyNames = @[@"Tom",@"Susan",@"Julie"];
NSArray *buddyNames = @[@"Martin Hellman",@"Nikita Borisov",@"Whitfield Diffie"];
NSString *accountName = @"username@domain.com";
NSArray *messages = @[@"Where are you?",@"Hey!",@"Going to the zoo later?"];
NSArray *helloArray = @[@"Hello",
@"Bonjour",
@"Hallo",
@"你好",
@"Здравствуйте",
@"もしもし",
@"Merhaba",@"مرحبا",
@"Olá"];

[[OTRDatabaseManager sharedInstance].readWriteDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {

[transaction removeAllObjectsInAllCollections];

OTRXMPPAccount *account = [OTRXMPPAccount fetchAccountWithUsername:accountName protocolType:OTRProtocolTypeXMPP transaction:transaction];
if(!account)
{
account = [[OTRXMPPAccount alloc] initWithAccountType:OTRAccountTypeJabber];
account.username = accountName;
[account saveWithTransaction:transaction];
}



OTRXMPPAccount *account = [[OTRXMPPAccount alloc] initWithAccountType:OTRAccountTypeJabber];
account.username = accountName;
[account saveWithTransaction:transaction];

NSArray *avatarImageNames = @[@"avatar_fox",@"avatar_otter",@"avatar_badger"];

[buddyNames enumerateObjectsUsingBlock:^(NSString *name, NSUInteger idx, BOOL *stop) {
OTRXMPPBuddy *buddy = [OTRXMPPBuddy fetchBuddyForUsername:name accountName:accountName protocolType:OTRProtocolTypeXMPP transaction:transaction];
OTRXMPPBuddy * buddy = [OTRXMPPBuddy fetchBuddyForUsername:name accountName:accountName transaction:transaction];
if (!buddy) {
buddy = [[OTRXMPPBuddy alloc] init];
NSString *imageName = avatarImageNames[idx];
Expand All @@ -51,36 +52,48 @@ + (void)loadDemoChatInDatabase

buddy.status = (NSInteger)OTRBuddyStatusAvailable+idx;



OTRMessage *message = [[OTRMessage alloc] init];
message.text = messages[idx];
message.buddyUniqueId = buddy.uniqueId;
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setHour:(-1*idx)];
message.date = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:[NSDate date] options:0];

message.incoming = YES;
buddy.lastMessageDate = message.date;
NSArray *textArray = [self shuffleHelloArray:helloArray];

[buddy saveWithTransaction:transaction];
[message saveWithTransaction:transaction];

[textArray enumerateObjectsUsingBlock:^(NSString *text, NSUInteger index, BOOL *stop) {
OTRMessage *message = [[OTRMessage alloc] init];
message.text = text;
message.buddyUniqueId = buddy.uniqueId;
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
[dateComponents setHour:(-1*index)];
message.date = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:[NSDate date] options:0];

if (index % 2) {
message.incoming = YES;
}
else {
message.incoming = NO;
}

message.read = YES;
message.transportedSecurely = YES;
buddy.lastMessageDate = message.date;

[message saveWithTransaction:transaction];
}];

[buddy updateLastMessageDateWithTransaction:transaction];
[buddy saveWithTransaction:transaction];
}];
}];
[[OTRDatabaseManager sharedInstance].readWriteDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
OTRXMPPBuddy *buddy = [OTRXMPPBuddy fetchBuddyForUsername:@"Susan" accountName:@"username@domain.com" protocolType:OTRProtocolTypeXMPP transaction:transaction];
BOOL hasMessage = [buddy hasMessagesWithTransaction:transaction];
}];

[[OTRDatabaseManager sharedInstance].mainThreadReadOnlyDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
OTRXMPPBuddy *buddy = [OTRXMPPBuddy fetchBuddyForUsername:@"Susan" accountName:@"username@domain.com" protocolType:OTRProtocolTypeXMPP transaction:transaction];
BOOL hasMessage = [buddy hasMessagesWithTransaction:transaction];
}];

}

+ (NSArray *)shuffleHelloArray:(NSArray *)array
{
NSMutableArray *mutableArray = [array mutableCopy];
NSUInteger count = [mutableArray count];
for (NSUInteger i = 0; i < count; ++i) {
NSInteger remainingCount = count - i;
NSInteger exchangeIndex = i + arc4random_uniform((u_int32_t )remainingCount);
[mutableArray exchangeObjectAtIndex:i withObjectAtIndex:exchangeIndex];
}
return mutableArray;
}

@end
1 change: 1 addition & 0 deletions ChatSecure/OTRConversationViewController.m
Expand Up @@ -70,6 +70,7 @@ - (void)viewDidLoad
////////// Create TableView /////////////////

self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
self.tableView.accessibilityIdentifier = @"conversationTableView";
self.tableView.translatesAutoresizingMaskIntoConstraints = NO;
self.tableView.delegate = self;
self.tableView.dataSource = self;
Expand Down
1 change: 1 addition & 0 deletions ChatSecure/OTRNewAccountViewController.m
Expand Up @@ -50,6 +50,7 @@ - (void)viewDidLoad

self.title = NEW_ACCOUNT_STRING;
UITableView * tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStyleGrouped];
tableView.accessibilityIdentifier = @"newAccountTableView";
tableView.dataSource = self;
tableView.delegate = self;
tableView.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight;
Expand Down
1 change: 1 addition & 0 deletions ChatSecure/OTRSettingsViewController.m
Expand Up @@ -99,6 +99,7 @@ - (void)viewDidLoad


self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
self.tableView.accessibilityIdentifier = @"settingsTableView";
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;
Expand Down
1 change: 0 additions & 1 deletion Submodules/iOS-Screenshot-Automater
Submodule iOS-Screenshot-Automater deleted from 2c0754
1 change: 1 addition & 0 deletions Submodules/rScreenshooter
Submodule rScreenshooter added at 7f76cf

0 comments on commit 98205e8

Please sign in to comment.