Bug Fix: iOS should have 'Send a message (encrypted)' in placeholder

#1207
This commit is contained in:
Giom Foret 2017-05-19 14:46:30 +02:00
parent 4203f46548
commit fcf6a590b7
3 changed files with 33 additions and 13 deletions

View file

@ -153,7 +153,7 @@
"directory_search_results_title" = "Browse directory results"; "directory_search_results_title" = "Browse directory results";
"directory_search_results" = "%tu results found for %@"; "directory_search_results" = "%tu results found for %@";
"directory_search_results_more_than" = ">%tu results found for %@"; "directory_search_results_more_than" = ">%tu results found for %@";
"directory_searching_title" = "Searching directory..."; "directory_searching_title" = "Searching directory";
"directory_search_fail" = "Failed to fetch data"; "directory_search_fail" = "Failed to fetch data";
// Contacts // Contacts
@ -210,10 +210,12 @@
// Chat // Chat
"room_new_message_notification" = "%d new message"; "room_new_message_notification" = "%d new message";
"room_new_messages_notification" = "%d new messages"; "room_new_messages_notification" = "%d new messages";
"room_one_user_is_typing" = "%@ is typing..."; "room_one_user_is_typing" = "%@ is typing…";
"room_two_users_are_typing" = "%@ & %@ are typing..."; "room_two_users_are_typing" = "%@ & %@ are typing…";
"room_many_users_are_typing" = "%@, %@ & others are typing..."; "room_many_users_are_typing" = "%@, %@ & others are typing…";
"room_message_placeholder" = "Type a message..."; "room_message_placeholder" = "Send a message (unencrypted)…";
"encrypted_room_message_placeholder" = "Send an encrypted message…";
"room_message_short_placeholder" = "Send a message…";
"room_offline_notification" = "Connectivity to the server has been lost."; "room_offline_notification" = "Connectivity to the server has been lost.";
"room_unsent_messages_notification" = "Messages not sent. %@ or %@ now?"; "room_unsent_messages_notification" = "Messages not sent. %@ or %@ now?";
"room_unsent_messages_unknown_devices_notification" = "Message not sent due to unknown devices being present. %@ or %@ now?"; "room_unsent_messages_unknown_devices_notification" = "Message not sent due to unknown devices being present. %@ or %@ now?";
@ -246,7 +248,7 @@
"unknown_devices_send_anyway" = "Send Anyway"; "unknown_devices_send_anyway" = "Send Anyway";
"unknown_devices_call_anyway" = "Call Anyway"; "unknown_devices_call_anyway" = "Call Anyway";
"unknown_devices_answer_anyway" = "Answer Anyway"; "unknown_devices_answer_anyway" = "Answer Anyway";
"unknown_devices_verify" = "Verify..."; "unknown_devices_verify" = "Verify";
"unknown_devices_title" = "Unknown devices"; "unknown_devices_title" = "Unknown devices";
// Room Title // Room Title

View file

@ -2390,15 +2390,13 @@
completion (finished); completion (finished);
} }
// Here the placeholder may have been defined temporarily to display IRC command usage. // Consider here the saved placeholder only if no new placeholder has been defined during the height animation.
// The original placeholder (savedInputToolbarPlaceholder) will be restored during the handling of the next typing notification
if (!toolbarView.placeholder) if (!toolbarView.placeholder)
{ {
// Restore the placeholder if any // Restore the placeholder if any
toolbarView.placeholder = savedInputToolbarPlaceholder.length ? savedInputToolbarPlaceholder : nil; toolbarView.placeholder = savedInputToolbarPlaceholder.length ? savedInputToolbarPlaceholder : nil;
savedInputToolbarPlaceholder = nil;
} }
savedInputToolbarPlaceholder = nil;
}]; }];
} }
} }

View file

@ -19,6 +19,8 @@
#import "RiotDesignValues.h" #import "RiotDesignValues.h"
#import "GBDeviceInfo_iOS.h"
#import "UINavigationController+Riot.h" #import "UINavigationController+Riot.h"
#import <MediaPlayer/MediaPlayer.h> #import <MediaPlayer/MediaPlayer.h>
@ -82,7 +84,7 @@
growingTextView.textColor = kRiotTextColorBlack; growingTextView.textColor = kRiotTextColorBlack;
growingTextView.tintColor = kRiotColorGreen; growingTextView.tintColor = kRiotColorGreen;
self.placeholder = NSLocalizedStringFromTable(@"room_message_placeholder", @"Vector", nil); self.isEncryptionEnabled = _isEncryptionEnabled;
} }
- (void)setSupportCallOption:(BOOL)supportCallOption - (void)setSupportCallOption:(BOOL)supportCallOption
@ -106,16 +108,34 @@
- (void)setIsEncryptionEnabled:(BOOL)isEncryptionEnabled - (void)setIsEncryptionEnabled:(BOOL)isEncryptionEnabled
{ {
if (isEncryptionEnabled) _isEncryptionEnabled = isEncryptionEnabled;
// Consider the default placeholder
NSString *placeholder= NSLocalizedStringFromTable(@"room_message_short_placeholder", @"Vector", nil);
if (_isEncryptionEnabled)
{ {
self.encryptedRoomIcon.image = [UIImage imageNamed:@"e2e_verified"]; self.encryptedRoomIcon.image = [UIImage imageNamed:@"e2e_verified"];
// Check the device screen size before using large placeholder
if ([GBDeviceInfo deviceInfo].family == GBDeviceFamilyiPad || [GBDeviceInfo deviceInfo].displayInfo.display >= GBDeviceDisplay4p7Inch)
{
placeholder = NSLocalizedStringFromTable(@"encrypted_room_message_placeholder", @"Vector", nil);
}
} }
else else
{ {
self.encryptedRoomIcon.image = [UIImage imageNamed:@"e2e_unencrypted"]; self.encryptedRoomIcon.image = [UIImage imageNamed:@"e2e_unencrypted"];
// Check the device screen size before using large placeholder
if ([GBDeviceInfo deviceInfo].family == GBDeviceFamilyiPad || [GBDeviceInfo deviceInfo].displayInfo.display >= GBDeviceDisplay4p7Inch)
{
placeholder = NSLocalizedStringFromTable(@"room_message_placeholder", @"Vector", nil);
}
} }
_isEncryptionEnabled = isEncryptionEnabled;
self.placeholder = placeholder;
} }
- (void)setActiveCall:(BOOL)activeCall - (void)setActiveCall:(BOOL)activeCall