Partially fix remaining UI issues

pull/16/head
Niels Andriesse 6 years ago
parent 2e8d62b3ee
commit 750a25622b

@ -19,4 +19,5 @@
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalServiceKit/SSKAsserts.h>
#import <SignalServiceKit/OWSAnalytics.h>
#import <SignalServiceKit/NSObject.h>
#endif

@ -406,7 +406,7 @@ typedef enum : NSUInteger {
name:UIKeyboardDidChangeFrameNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(resetContentAndLayout)
selector:@selector(handleThreadFriendRequestStatusChangedNotification:)
name:@"threadFriendRequestStatusChanged"
object:nil];
}
@ -472,6 +472,14 @@ typedef enum : NSUInteger {
[self ensureBannerState];
}
- (void)handleThreadFriendRequestStatusChangedNotification:(NSNotification *)notification
{
[self.thread reload];
[self.viewItems.lastObject clearCachedLayoutState]; // Presumably a cell with a friend request view
[self resetContentAndLayout];
[self updateInputToolbar];
}
- (void)peekSetup
{
_peek = YES;

@ -402,11 +402,12 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
&& previousLayoutItem.interaction.interactionType == OWSInteractionType_IncomingMessage) {
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)self.interaction;
TSIncomingMessage *previousIncomingMessage = (TSIncomingMessage *)previousLayoutItem.interaction;
if ([incomingMessage.authorId isEqualToString:previousIncomingMessage.authorId]) {
if ([incomingMessage.authorId isEqualToString:previousIncomingMessage.authorId] && !previousIncomingMessage.isFriendRequest) {
return 2.f;
}
} else if (self.interaction.interactionType == OWSInteractionType_OutgoingMessage
&& previousLayoutItem.interaction.interactionType == OWSInteractionType_OutgoingMessage) {
&& previousLayoutItem.interaction.interactionType == OWSInteractionType_OutgoingMessage
&& !([previousLayoutItem.interaction isKindOfClass:TSOutgoingMessage.class] && ((TSOutgoingMessage *)previousLayoutItem.interaction).isFriendRequest)) {
return 2.f;
}

@ -0,0 +1,6 @@
@interface NSObject (Casting)
- (instancetype)as:(Class)cls;
@end

@ -0,0 +1,10 @@
#import "NSObject.h"
@implementation NSObject (Casting)
- (instancetype)as:(Class)cls {
if ([self isKindOfClass:cls]) { return self; }
return nil;
}
@end

@ -12,6 +12,7 @@ static const NSUInteger ddLogLevel = DDLogLevelAll;
static const NSUInteger ddLogLevel = DDLogLevelInfo;
#endif
#import "OWSAnalytics.h"
#import "NSObject.h"
#import "SSKAsserts.h"
#import "TSConstants.h"
#import <SignalCoreKit/NSObject+OWS.h>

Loading…
Cancel
Save