Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop' into master (#87)
Browse files Browse the repository at this point in the history
* Update/go sdk (#73)
* go-sdk: update 'NINLowLevelClient.framework'
* user-agent: add support for 'user-agent' header
* fix: resolve comments and bugs
- Update to fix #61 bug in some cases.

* fix: the issue with audio output (#75)
* fix rendering issue by using UTF16 instead of UTF8 (#77)
* fix issue by adding 'enqueud' event type to the observer (#78)
* fix: reported crash (#82).
* fix issue 52: fix problem in ordering received messages.
* fix compose messages padding issues (#85)
- fix issue with long texts for buttons
- fix issue with "send" button's bottom padding
* add dark mode support
* fix reported issues about compose view rendering problems.
* Update NINQueueViewController.m and remove retain cycle issue

* fix rendeing issues:
- fix long titles for composite messages
- add more precise comapring algorithm for non-channel messages to improve ordering.

Co-authored-by: Antti Laakso <[email protected]>
  • Loading branch information
Hassan Shahbazi and Antti Laakso authored Feb 19, 2020
1 parent 10c91fc commit 9b8c363
Show file tree
Hide file tree
Showing 16 changed files with 101 additions and 98 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ xcuserdata
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore


## Build generated
build/
DerivedData/
Expand All @@ -49,6 +50,9 @@ xcuserdata/
*.dSYM.zip
*.dSYM

# AppCode
.idea/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
Expand Down
4 changes: 0 additions & 4 deletions NinchatSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
7483ABD02305B0C0006D69E9 /* NINComposeMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7483ABCE2305B0C0006D69E9 /* NINComposeMessageView.m */; };
7483ABD423103A3A006D69E9 /* NINSiteConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 7483ABD223103A3A006D69E9 /* NINSiteConfiguration.h */; };
7483ABD523103A3A006D69E9 /* NINSiteConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 7483ABD323103A3A006D69E9 /* NINSiteConfiguration.m */; };
749E70DE22F9AED90031FEEB /* NINChannelMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 749E70DC22F9AED90031FEEB /* NINChannelMessage.h */; };
749E70E222FC2E460031FEEB /* NINUIComposeMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 749E70E022FC2E460031FEEB /* NINUIComposeMessage.h */; };
749E70E322FC2E460031FEEB /* NINUIComposeMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 749E70E122FC2E460031FEEB /* NINUIComposeMessage.m */; };
7EA5647BD4220552EE115E16 /* Pods_NinchatSDKTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA3047E6C0F0E96D595DED5B /* Pods_NinchatSDKTests.framework */; };
Expand Down Expand Up @@ -301,7 +300,6 @@
7483ABCE2305B0C0006D69E9 /* NINComposeMessageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NINComposeMessageView.m; sourceTree = "<group>"; };
7483ABD223103A3A006D69E9 /* NINSiteConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NINSiteConfiguration.h; sourceTree = "<group>"; };
7483ABD323103A3A006D69E9 /* NINSiteConfiguration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NINSiteConfiguration.m; sourceTree = "<group>"; };
749E70DC22F9AED90031FEEB /* NINChannelMessage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NINChannelMessage.h; sourceTree = "<group>"; };
749E70E022FC2E460031FEEB /* NINUIComposeMessage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NINUIComposeMessage.h; sourceTree = "<group>"; };
749E70E122FC2E460031FEEB /* NINUIComposeMessage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NINUIComposeMessage.m; sourceTree = "<group>"; };
A7F7699C7352569AF2E37C05 /* Pods-NinchatSDK.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NinchatSDK.debug.xcconfig"; path = "Pods/Target Support Files/Pods-NinchatSDK/Pods-NinchatSDK.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -648,7 +646,6 @@
49140B7520F2748800A00EA8 /* NINTextMessage.m */,
749E70E022FC2E460031FEEB /* NINUIComposeMessage.h */,
749E70E122FC2E460031FEEB /* NINUIComposeMessage.m */,
749E70DC22F9AED90031FEEB /* NINChannelMessage.h */,
49F5FA3720F781D600A4A526 /* NINQueue.h */,
49F5FA3820F781D600A4A526 /* NINQueue.m */,
49622FAB214FCD3700570D59 /* NINFileInfo.h */,
Expand Down Expand Up @@ -739,7 +736,6 @@
buildActionMask = 2147483647;
files = (
49CD0780216205C600046AB9 /* NINVideoThumbnailManager.h in Headers */,
749E70DE22F9AED90031FEEB /* NINChannelMessage.h in Headers */,
49D77F262156497600900224 /* UITextView+Ninchat.h in Headers */,
4930441B2158D90700DECB0C /* NINChatMetaMessage.h in Headers */,
49721CD721295C7F00695F33 /* NINChatBubbleCell.h in Headers */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#import "NINQueue.h"
#import "NINChatSession.h"
#import "NINChatMessage.h"
#import "NINChannelMessage.h"
#import "NINTextMessage.h"
#import "NINUIComposeMessage.h"
#import "NINChatMetaMessage.h"
Expand Down Expand Up @@ -619,13 +618,12 @@ -(void) addNewChatMessage:(id<NINChatMessage>)message {
// Check if the previous (normal) message was sent by the same user, ie. is the
// message part of a series
NSObject<NINChannelMessage>* channelMessage = (NSObject<NINChannelMessage>*)message;

// Guard against the same message getting added multiple times
// should only happen if the client makes extraneous load_history calls elsewhere
for (id<NINChatMessage> oldMessage in _chatMessages) {
if (![oldMessage conformsToProtocol:@protocol(NINChannelMessage)]) {
continue;
}
if (![oldMessage conformsToProtocol:@protocol(NINChannelMessage)]) { continue; }

if ([channelMessage.messageID isEqualToString:((NSObject<NINChannelMessage>*)oldMessage).messageID]) {
NSLog(@"Attempted to add an already existing message with id %@", channelMessage.messageID);
return;
Expand All @@ -651,7 +649,9 @@ -(void) addNewChatMessage:(id<NINChatMessage>)message {

[_chatMessages insertObject:message atIndex:0];
[_chatMessages sortUsingComparator:^NSComparisonResult(id<NINChatMessage> _Nonnull msg1, id<NINChatMessage> _Nonnull msg2) {
return [msg1.timestamp compare:msg2.timestamp] == NSOrderedAscending;
if ([msg1 conformsToProtocol:@protocol(NINChannelMessage)] && [msg2 conformsToProtocol:@protocol(NINChannelMessage)])
return [((NSObject <NINChannelMessage> *) msg1).messageID compare:((NSObject <NINChannelMessage> *) msg2).messageID] == NSOrderedAscending;
return [NSCalendar.currentCalendar compareDate:msg1.timestamp toDate:msg2.timestamp toUnitGranularity:NSCalendarUnitNanosecond] == NSOrderedAscending;
}];

postNotification(kChannelMessageNotification, @{@"action":@"insert", @"index":@([_chatMessages indexOfObject:message])});
Expand Down Expand Up @@ -1086,9 +1086,7 @@ -(void) joinQueueWithId:(NSString*)joinQueueID progress:(queueProgressCallback _
-(void) leaveCurrentQueueWithCompletionCallback:(callbackWithErrorBlock _Nonnull)completion {
if (self.currentQueueID == nil) {
[self.ninchatSession sdklog:@"Error: tried to leave current queue but not in queue currently!"];
return;
}

[self.ninchatSession sdklog:@"Leaving current queue."];

// Stop the queue observers
Expand Down
5 changes: 4 additions & 1 deletion NinchatSDK/NINChatSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ -(nonnull UIViewController*) viewControllerWithNavigationController:(BOOL)withNa
initialViewController.sessionManager = self.sessionManager;

if (withNavigationController) {
/// `https://github.com/somia/ninchat-sdk-ios/issues/62`
if (@available(iOS 13.0, *))
[navigationController setOverrideUserInterfaceStyle:UIUserInterfaceStyleLight];
return navigationController;
} else {
return initialViewController;
Expand Down Expand Up @@ -233,7 +236,7 @@ -(void) startWithCallback:(nonnull startCallbackBlock)callbackBlock {
NSArray<NSString*>* queueIds = [weakSelf.sessionManager.siteConfiguration valueForKey:@"audienceQueues"];

if (queueIds != nil && self.queueID != nil) {
// If the queueID we've been initialized with isnt in the config's set of
// If the queueID we've been initialized with isn't in the config's set of
// audienceQueues, add it's ID to the list and we'll see if it exists
[self sdklog:@"Adding my queueID %@", self.queueID];
queueIds = [queueIds arrayByAddingObject:self.queueID];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#import "NINChatBubbleCell.h"
#import "NINUtils.h"
#import "NINChatView.h"
#import "NINChannelMessage.h"
#import "NINTextMessage.h"
#import "NINUIComposeMessage.h"
#import "NINUserTypingMessage.h"
Expand Down Expand Up @@ -412,6 +411,7 @@ -(void) populateWithChannelMessage:(NSObject<NINChannelMessage>*)message siteCon
} else if ([message isKindOfClass:NINUIComposeMessage.class]) {
self.messageTextView.text = @"";
[self resetImageLayout];
[self.composeMessageView clear];
self.videoPlayImageView.hidden = YES;
self.composeMessageView.hidden = NO;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
Expand All @@ -28,7 +28,7 @@
<rect key="frame" x="0.0" y="0.0" width="50" height="141"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" image="icon_avatar_other" translatesAutoresizingMaskIntoConstraints="NO" id="5wH-wE-D5T">
<rect key="frame" x="5" y="12" width="40" height="40"/>
<rect key="frame" x="5" y="12" width="40" height="40.000000000000114"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" secondItem="5wH-wE-D5T" secondAttribute="height" id="zjq-ox-Xmq"/>
Expand All @@ -47,7 +47,7 @@
<rect key="frame" x="462" y="0.0" width="50" height="141"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" image="icon_avatar_mine" translatesAutoresizingMaskIntoConstraints="NO" id="afl-L6-jcA">
<rect key="frame" x="5" y="12" width="40" height="40"/>
<rect key="frame" x="5" y="12" width="40" height="40.000000000000114"/>
<color key="tintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" secondItem="afl-L6-jcA" secondAttribute="height" id="QlZ-sP-CdQ"/>
Expand All @@ -66,13 +66,13 @@
<rect key="frame" x="50" y="0.0" width="412" height="36"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="999" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Dr Koistinen" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cyP-g1-3PU">
<rect key="frame" x="5" y="16.5" width="353.5" height="16.5"/>
<rect key="frame" x="5" y="15" width="357.5" height="18"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="14"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" text="17:18" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oRX-UO-W1X">
<rect key="frame" x="366.5" y="16.5" width="35.5" height="16.5"/>
<rect key="frame" x="370.5" y="15" width="31.5" height="18"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="SourceSansPro-Regular" family="Source Sans Pro" pointSize="14"/>
<color key="textColor" red="0.45490196078431372" green="0.5725490196078431" blue="0.66666666666666663" alpha="1" colorSpace="calibratedRGB"/>
Expand Down Expand Up @@ -100,7 +100,7 @@
<rect key="frame" x="20" y="0.0" width="392" height="105"/>
<subviews>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="uba-VT-R7U">
<rect key="frame" x="10" y="15" width="372" height="44.5"/>
<rect key="frame" x="10" y="15" width="372" height="43.5"/>
<color key="backgroundColor" red="0.45776203440000002" green="0.89454518299999997" blue="0.91693240399999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="OBY-Vp-eda"/>
Expand All @@ -112,7 +112,7 @@
</variation>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_play" translatesAutoresizingMaskIntoConstraints="NO" id="GOj-1m-Klp">
<rect key="frame" x="175" y="16.5" width="42" height="42"/>
<rect key="frame" x="175" y="16" width="42" height="42"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
Expand All @@ -121,7 +121,7 @@
</constraints>
</imageView>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" scrollEnabled="NO" editable="NO" text="Bubble chat message content text" translatesAutoresizingMaskIntoConstraints="NO" id="9Og-bJ-chR">
<rect key="frame" x="126" y="59.5" width="256" height="35.5"/>
<rect key="frame" x="146.5" y="58.5" width="235.5" height="36.5"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" id="Vvi-H4-0gp"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#import "NINChatView.h"
#import "NINUtils.h"
#import "NINChannelMessage.h"
#import "NINChatMetaMessage.h"
#import "NINUserTypingMessage.h"
#import "NINChatBubbleCell.h"
Expand Down
Loading

0 comments on commit 9b8c363

Please sign in to comment.