Skip to content

Commit

Permalink
Merge pull request #3788 from vector-im/fix_room_placeholder
Browse files Browse the repository at this point in the history
RoomInputToolBar: Prevent long placeholder to be displayed on small devices
  • Loading branch information
SBiOSoftWhare authored Nov 5, 2020
2 parents 86c4427 + b9acb8f commit 944342a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Changes to be released in next version

🐛 Bugfix
* Fix analytics in order to track performance improvements.
* Fix long placeholder cropping in room input toolbar. Prevent long placeholder to be displayed on small devices (#3790).

⚠️ API Changes
* Xcode 12 is now mandatory to build the project.
Expand Down
25 changes: 2 additions & 23 deletions Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,7 @@ - (void)setIsEncryptionEnabled:(BOOL)isEncryptionEnabled
{
_isEncryptionEnabled = isEncryptionEnabled;

// Consider the default placeholder
NSString *placeholder= NSLocalizedStringFromTable(@"room_message_short_placeholder", @"Vector", nil);

if (_isEncryptionEnabled)
{
// 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
{
// 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);
}
}


self.placeholder = placeholder;
[self updatePlaceholder];
}

- (void)setSendMode:(RoomInputToolbarViewSendMode)sendMode
Expand Down Expand Up @@ -192,7 +171,7 @@ - (void)updatePlaceholder
NSString *placeholder;

// Check the device screen size before using large placeholder
BOOL shouldDisplayLargePlaceholder = [GBDeviceInfo deviceInfo].family == GBDeviceFamilyiPad || [GBDeviceInfo deviceInfo].displayInfo.display >= GBDeviceDisplay4p7Inch;
BOOL shouldDisplayLargePlaceholder = [GBDeviceInfo deviceInfo].family == GBDeviceFamilyiPad || [GBDeviceInfo deviceInfo].displayInfo.display >= GBDeviceDisplay5p8Inch;

if (!shouldDisplayLargePlaceholder)
{
Expand Down

0 comments on commit 944342a

Please sign in to comment.