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

Email invitation #78

Merged
merged 13 commits into from
Feb 8, 2016
Merged
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
4 changes: 4 additions & 0 deletions Vector.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
325F6A471C21D4C100C12F51 /* chevron.png in Resources */ = {isa = PBXBuildFile; fileRef = 325F6A441C21D4C100C12F51 /* chevron.png */; };
325F6A481C21D4C100C12F51 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 325F6A451C21D4C100C12F51 /* [email protected] */; };
325F6A491C21D4C100C12F51 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 325F6A461C21D4C100C12F51 /* [email protected] */; };
327F8DB51C64DB9D00581CA3 /* VectorDesignValues.m in Sources */ = {isa = PBXBuildFile; fileRef = 327F8DB41C64DB9C00581CA3 /* VectorDesignValues.m */; };
32AAC3E61C3525DE007A3B5B /* RoomSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 32AAC3E51C3525DE007A3B5B /* RoomSearchViewController.m */; };
32AAC3E91C353CEA007A3B5B /* RoomSearchDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 32AAC3E81C353CEA007A3B5B /* RoomSearchDataSource.m */; };
32D200831C15C56A00A4E396 /* search_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 32D200801C15C56A00A4E396 /* search_bg.png */; };
Expand Down Expand Up @@ -223,6 +224,7 @@
325F6A441C21D4C100C12F51 /* chevron.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = chevron.png; sourceTree = "<group>"; };
325F6A451C21D4C100C12F51 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
325F6A461C21D4C100C12F51 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
327F8DB41C64DB9C00581CA3 /* VectorDesignValues.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VectorDesignValues.m; sourceTree = "<group>"; };
32AAC3E41C3525DE007A3B5B /* RoomSearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomSearchViewController.h; sourceTree = "<group>"; };
32AAC3E51C3525DE007A3B5B /* RoomSearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RoomSearchViewController.m; sourceTree = "<group>"; };
32AAC3E71C353CEA007A3B5B /* RoomSearchDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoomSearchDataSource.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -688,6 +690,7 @@
71352D571C10569F001D50B0 /* AvatarGenerator.h */,
71352D581C10569F001D50B0 /* AvatarGenerator.m */,
71C5F2991C077007004C094B /* VectorDesignValues.h */,
327F8DB41C64DB9C00581CA3 /* VectorDesignValues.m */,
F08BE09C1B87025B00C480FB /* EventFormatter.h */,
F08BE09D1B87025B00C480FB /* EventFormatter.m */,
);
Expand Down Expand Up @@ -1281,6 +1284,7 @@
F0C34B631C15C28300C36F09 /* RoomOutgoingAttachmentWithoutSenderInfoBubbleCell.m in Sources */,
F09EE0061C5134BE0078712F /* RoomOutgoingTextMsgWithoutSenderNameBubbleCell.m in Sources */,
F09EE0081C5134BE0078712F /* RoomOutgoingTextMsgWithPaginationTitleWithoutSenderNameBubbleCell.m in Sources */,
327F8DB51C64DB9D00581CA3 /* VectorDesignValues.m in Sources */,
F094AA371B78E42600B1FBBF /* RoomViewController.m in Sources */,
F00C478B1BFF854400DBABC9 /* RecentsDataSource.m in Sources */,
717928451C03852C00407D96 /* TableViewCellSeparator.m in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Vector/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// Override point for customization after application launch.

// define the navigation bar text color
[[UINavigationBar appearance] setTintColor:VECTOR_GREEN_COLOR];
[[UINavigationBar appearance] setTintColor:kVectorColorGreen];

// Customize the localized string table
[NSBundle mxk_customizeLocalizedStringTableName:@"Vector"];
Expand Down
2 changes: 2 additions & 0 deletions Vector/Assets/en.lproj/Vector.strings
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
"room_participants_remove_prompt_msg" = "Are you sure you want to remove %@ from this chat?";
"room_participants_admin_name" = "%@ (admin)";
"room_participants_invite_another_user" = "Invite another user";
"room_participants_invite_malformed_id_title" = "Invite Error";
"room_participants_invite_malformed_id" = "Malformed ID. Should be an email address or a Matrix ID like '@localpart:domain'";

"room_participants_active" = "Active";
"room_participants_invite" = "Invite";
Expand Down
6 changes: 3 additions & 3 deletions Vector/Categories/MXKRoomBubbleTableViewCell+Vector.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (void)addTimestampLabelForComponent:(NSUInteger)componentIndex

dateTimeLabel.text = [self.bubbleData.eventFormatter timeStringFromDate:component.date];
dateTimeLabel.textAlignment = NSTextAlignmentRight;
dateTimeLabel.textColor = VECTOR_TEXT_GRAY_COLOR;
dateTimeLabel.textColor = kVectorTextColorGray;
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)])
{
dateTimeLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightLight];
Expand Down Expand Up @@ -290,8 +290,8 @@ - (void)addEditButtonForComponent:(NSUInteger)componentIndex completion:(void (^

[editButton setTitle:NSLocalizedStringFromTable(@"room_event_action_edit", @"Vector", nil) forState:UIControlStateNormal];
[editButton setTitle:NSLocalizedStringFromTable(@"room_event_action_edit", @"Vector", nil) forState:UIControlStateSelected];
[editButton setTitleColor:VECTOR_GREEN_COLOR forState:UIControlStateNormal];
[editButton setTitleColor:VECTOR_GREEN_COLOR forState:UIControlStateSelected];
[editButton setTitleColor:kVectorColorGree forState:UIControlStateNormal];
[editButton setTitleColor:kVectorColorGree forState:UIControlStateSelected];

// Align button label on the right border of the bubbleInfoContainer
editButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
Expand Down
2 changes: 1 addition & 1 deletion Vector/Model/RoomList/RecentsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ - (UIView *)viewForHeaderInSection:(NSInteger)section withFrame:(CGRect)frame

label.text = [NSString stringWithFormat:@" %@", text];
label.font = [UIFont boldSystemFontOfSize:15.0];
label.backgroundColor = VECTOR_LIGHT_GRAY_COLOR;
label.backgroundColor = kVectorColorLightGrey;

return label;
}
Expand Down
8 changes: 8 additions & 0 deletions Vector/Utils/AvatarGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
*/
@interface AvatarGenerator : NSObject

/**
Create an UIImage with the text and the background color.
@param text the text.
@param color the background color.
@return the avatar image.
*/
+ (UIImage *)imageFromText:(NSString*)text withBackgroundColor:(UIColor*)color;

/**
Generate an avatar for a room.
@param roomId the id of the room.
Expand Down
15 changes: 5 additions & 10 deletions Vector/Utils/AvatarGenerator.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,14 @@

#import "AvatarGenerator.h"

#import "VectorDesignValues.h"

@implementation AvatarGenerator

static NSMutableDictionary *imageByKeyDict = nil;
static NSMutableArray* colorsList = nil;
static UILabel* backgroundLabel = nil;

#define UIColorFromRGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \
blue:((float)((rgbValue & 0x0000FF) >> 0))/255.0 \
alpha:1.0]


/**
Init the generated avatar colors.
Should be the same as the webclient.
Expand All @@ -38,9 +33,9 @@ + (void)initColorList
if (!colorsList)
{
colorsList = [[NSMutableArray alloc] init];
[colorsList addObject:UIColorFromRGB(0x76cfa6)];
[colorsList addObject:UIColorFromRGB(0x50e2c2)];
[colorsList addObject:UIColorFromRGB(0xf4c371)];
[colorsList addObject:kVectorColorGreen];
[colorsList addObject:kVectorColorLightGreen];
[colorsList addObject:kVectorColorOrange];
}
}

Expand Down
10 changes: 5 additions & 5 deletions Vector/Utils/EventFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ - (instancetype)initWithMatrixSession:(MXSession *)matrixSession

localTimeZone = [NSTimeZone localTimeZone];

self.defaultTextColor = VECTOR_TEXT_BLACK_COLOR;
self.subTitleTextColor = VECTOR_TEXT_GRAY_COLOR;
self.prefixTextColor = VECTOR_TEXT_GRAY_COLOR;
self.bingTextColor = VECTOR_GREEN_COLOR;
self.sendingTextColor = VECTOR_TEXT_GRAY_COLOR;
self.defaultTextColor = kVectorTextColorBlack;
self.subTitleTextColor = kVectorTextColorGray;
self.prefixTextColor = kVectorTextColorGray;
self.bingTextColor = kVectorColorGreen;
self.sendingTextColor = kVectorTextColorGray;
self.errorTextColor = [UIColor redColor];

self.defaultTextFont = [UIFont systemFontOfSize:15];
Expand Down
29 changes: 17 additions & 12 deletions Vector/Utils/VectorDesignValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,29 @@
#import <MatrixKit/MatrixKit.h>

/**
`VectorDesignValues` class manages the Vector design parameters
Convert a RGB hexadecimal value into a UIColor.
*/
@interface VectorDesignValues : NSObject
#define UIColorFromRGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \
blue:((float)((rgbValue & 0x0000FF) >> 0))/255.0 \
alpha:1.0]

#pragma mark - Vector Colors

#define VECTOR_GREEN_COLOR [UIColor colorWithRed:(98.0/256.0) green:(206.0/256.0) blue:(156.0/256.0) alpha:1.0]

#define VECTOR_LIGHT_GRAY_COLOR [UIColor colorWithRed:(242.0 / 256.0) green:(242.0 / 256.0) blue:(242.0 / 256.0) alpha:1.0]

#define VECTOR_SILVER_COLOR [UIColor colorWithRed:(199.0 / 256.0) green:(199.0 / 256.0) blue:(204.0 / 256.0) alpha:1.0]

extern UIColor *kVectorColorGreen;
extern UIColor *kVectorColorLightGreen;
extern UIColor *kVectorColorLightGrey;
extern UIColor *kVectorColorSiver;
extern UIColor *kVectorColorOrange;

#pragma mark - Vector Text Colors
extern UIColor *kVectorTextColorBlack;
extern UIColor *kVectorTextColorGray;

#define VECTOR_TEXT_BLACK_COLOR [UIColor colorWithRed:(60.0 / 256.0) green:(60.0 / 256.0) blue:(60.0 / 256.0) alpha:1.0]

#define VECTOR_TEXT_GRAY_COLOR [UIColor colorWithRed:(157.0 / 256.0) green:(157.0 / 256.0) blue:(157.0 / 256.0) alpha:1.0]
/**
`VectorDesignValues` class manages the Vector design parameters
*/
@interface VectorDesignValues : NSObject

// to update the navigation bar buttons color
// [[AppDelegate theDelegate] recentsNavigationController].navigationBar.tintColor = [UIColor greenColor];
Expand Down
49 changes: 49 additions & 0 deletions Vector/Utils/VectorDesignValues.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
Copyright 2016 OpenMarket Ltd

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

#import "VectorDesignValues.h"

UIColor *kVectorColorGreen;
UIColor *kVectorColorLightGreen;
UIColor *kVectorColorLightGrey;
UIColor *kVectorColorSiver;
UIColor *kVectorColorOrange;

UIColor *kVectorTextColorBlack;
UIColor *kVectorTextColorGray;

@implementation VectorDesignValues

+ (void)load
{
[super load];

// Load colors at the app load time for the life of the app

// Colors as defined by the design
kVectorColorGreen = [UIColor colorWithRed:(98.0/255.0) green:(206.0/255.0) blue:(156.0/255.0) alpha:1.0];
kVectorColorLightGrey = [UIColor colorWithRed:(242.0 / 255.0) green:(242.0 / 255.0) blue:(242.0 / 255.0) alpha:1.0];
kVectorColorSiver = [UIColor colorWithRed:(199.0 / 255.0) green:(199.0 / 255.0) blue:(204.0 / 255.0) alpha:1.0];

kVectorTextColorBlack = [UIColor colorWithRed:(60.0 / 255.0) green:(60.0 / 255.0) blue:(60.0 / 255.0) alpha:1.0];
kVectorTextColorGray = [UIColor colorWithRed:(157.0 / 255.0) green:(157.0 / 255.0) blue:(157.0 / 255.0) alpha:1.0];

// Colors copied from Vector web
kVectorColorLightGreen = UIColorFromRGB(0x50e2c2);
kVectorColorOrange = UIColorFromRGB(0xf4c371);
}

@end
16 changes: 8 additions & 8 deletions Vector/ViewController/AuthenticationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,30 @@ - (void)viewDidLoad
self.rightBarButtonItem.title = NSLocalizedStringFromTable(@"auth_register", @"Vector", nil);

self.defaultHomeServerUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"homeserverurl"];
self.homeServerTextField.textColor = VECTOR_TEXT_BLACK_COLOR;
self.homeServerLabel.textColor = VECTOR_TEXT_GRAY_COLOR;
self.homeServerTextField.textColor = kVectorTextColorBlack;
self.homeServerLabel.textColor = kVectorTextColorGray;

self.defaultIdentityServerUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"identityserverurl"];
self.identityServerTextField.textColor = VECTOR_TEXT_BLACK_COLOR;
self.identityServerLabel.textColor = VECTOR_TEXT_GRAY_COLOR;
self.identityServerTextField.textColor = kVectorTextColorBlack;
self.identityServerLabel.textColor = kVectorTextColorGray;

self.welcomeImageView.image = [UIImage imageNamed:@"logo"];

[self.submitButton.layer setCornerRadius:5];
self.submitButton.clipsToBounds = YES;
self.submitButton.backgroundColor = VECTOR_GREEN_COLOR;
self.submitButton.backgroundColor = kVectorColorGreen;
[self.submitButton setTitle:NSLocalizedStringFromTable(@"auth_login", @"Vector", nil) forState:UIControlStateNormal];
[self.submitButton setTitle:NSLocalizedStringFromTable(@"auth_login", @"Vector", nil) forState:UIControlStateHighlighted];

[self.forgotPasswordButton setTitle:NSLocalizedStringFromTable(@"auth_forgot_password", @"Vector", nil) forState:UIControlStateNormal];
[self.forgotPasswordButton setTitle:NSLocalizedStringFromTable(@"auth_forgot_password", @"Vector", nil) forState:UIControlStateHighlighted];
[self.forgotPasswordButton setTitleColor:VECTOR_TEXT_GRAY_COLOR forState:UIControlStateNormal];
[self.forgotPasswordButton setTitleColor:VECTOR_TEXT_GRAY_COLOR forState:UIControlStateHighlighted];
[self.forgotPasswordButton setTitleColor:kVectorTextColorGray forState:UIControlStateNormal];
[self.forgotPasswordButton setTitleColor:kVectorTextColorGray forState:UIControlStateHighlighted];

[self.serverOptionsTickButton setImage:[UIImage imageNamed:@"selection_untick"] forState:UIControlStateNormal];
[self.serverOptionsTickButton setImage:[UIImage imageNamed:@"selection_untick"] forState:UIControlStateHighlighted];

NSAttributedString *serverOptionsTitle = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"auth_use_server_options", @"Vector", nil) attributes:@{NSForegroundColorAttributeName : VECTOR_TEXT_GRAY_COLOR, NSFontAttributeName: [UIFont systemFontOfSize:14]}];
NSAttributedString *serverOptionsTitle = [[NSAttributedString alloc] initWithString:NSLocalizedStringFromTable(@"auth_use_server_options", @"Vector", nil) attributes:@{NSForegroundColorAttributeName : kVectorTextColorGray, NSFontAttributeName: [UIFont systemFontOfSize:14]}];
[self.serverOptionsTickButton setAttributedTitle:serverOptionsTitle forState:UIControlStateNormal];
[self.serverOptionsTickButton setAttributedTitle:serverOptionsTitle forState:UIControlStateHighlighted];

Expand Down
10 changes: 5 additions & 5 deletions Vector/ViewController/RecentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NS

}];

muteAction.backgroundColor = [MXKTools convertImageToPatternColor:isMuted ? @"unmute_icon" : @"mute_icon" backgroundColor:VECTOR_LIGHT_GRAY_COLOR patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
muteAction.backgroundColor = [MXKTools convertImageToPatternColor:isMuted ? @"unmute_icon" : @"mute_icon" backgroundColor:kVectorColorLightGrey patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
[actions insertObject:muteAction atIndex:0];

// favorites management
Expand Down Expand Up @@ -328,7 +328,7 @@ - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NS
[self updateRoomTagAtIndexPath:indexPath to:kMXRoomTagFavourite];
}];

action.backgroundColor = [MXKTools convertImageToPatternColor:@"favorite_icon" backgroundColor:VECTOR_LIGHT_GRAY_COLOR patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
action.backgroundColor = [MXKTools convertImageToPatternColor:@"favorite_icon" backgroundColor:kVectorColorLightGrey patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
[actions insertObject:action atIndex:0];
}

Expand All @@ -339,7 +339,7 @@ - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NS
[self updateRoomTagAtIndexPath:indexPath to:nil];
}];

action.backgroundColor = [MXKTools convertImageToPatternColor:nil backgroundColor:VECTOR_LIGHT_GRAY_COLOR patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
action.backgroundColor = [MXKTools convertImageToPatternColor:nil backgroundColor:kVectorColorLightGrey patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
[actions insertObject:action atIndex:0];
}

Expand All @@ -350,14 +350,14 @@ - (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NS
[self updateRoomTagAtIndexPath:indexPath to:kMXRoomTagLowPriority];
}];

action.backgroundColor = [MXKTools convertImageToPatternColor:@"low_priority_icon" backgroundColor:VECTOR_LIGHT_GRAY_COLOR patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
action.backgroundColor = [MXKTools convertImageToPatternColor:@"low_priority_icon" backgroundColor:kVectorColorLightGrey patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
[actions insertObject:action atIndex:0];
}

UITableViewRowAction *leaveAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:title handler:^(UITableViewRowAction *action, NSIndexPath *indexPath){
[self leaveRecentsAtIndexPath:indexPath];
}];
leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon" backgroundColor:VECTOR_LIGHT_GRAY_COLOR patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];
leaveAction.backgroundColor = [MXKTools convertImageToPatternColor:@"remove_icon" backgroundColor:kVectorColorLightGrey patternSize:CGSizeMake(74, 74) resourceSize:CGSizeMake(30, 30)];

[actions insertObject:leaveAction atIndex:0];
}
Expand Down
Loading