Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-v0.6.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
giomfo committed Jun 1, 2016
2 parents 147d0f4 + 232a19a commit 15f6a17
Show file tree
Hide file tree
Showing 34 changed files with 980 additions and 367 deletions.
14 changes: 14 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Changes in Matrix iOS SDK in 0.6.8 (2016-06-01)
===============================================

Improvements:
* Push rules update: Listen to account_data to get push rules updates.
* SDK Tests improvements: Prevent the test suite from breaking because one test fails.
* MXRoomState: disambiguate the display name for the invited room member too.

Bug fixes:
* Ignored users: kMXSessionIgnoredUsersDidChangeNotification was sometimes not sent.
* Recents: All blank after upgrade.
* Fixed implementation of userAccountData in MXMemoryStore and MXNoStore.
* MXSession: Detect when the access token is no more valid.

Changes in Matrix iOS SDK in 0.6.7 (2016-05-04)
===============================================

Expand Down
4 changes: 2 additions & 2 deletions MatrixSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "MatrixSDK"
s.version = "0.6.7"
s.version = "0.6.8"
s.summary = "The iOS SDK to build apps compatible with Matrix (http://www.matrix.org)"

s.description = <<-DESC
Expand All @@ -19,7 +19,7 @@ Pod::Spec.new do |s|

s.platform = :ios, "7.0"

s.source = { :git => "https://github.com/matrix-org/matrix-ios-sdk.git", :tag => "v0.6.7" }
s.source = { :git => "https://github.com/matrix-org/matrix-ios-sdk.git", :tag => "v0.6.8" }
s.source_files = "MatrixSDK", "MatrixSDK/**/*.{h,m}"
s.resources = "MatrixSDK/Data/Store/MXCoreDataStore/*.xcdatamodeld"

Expand Down
12 changes: 12 additions & 0 deletions MatrixSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
325653831A2E14ED00CC0423 /* MXStoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 325653821A2E14ED00CC0423 /* MXStoreTests.m */; };
326056851C76FDF2009D44AD /* MXEventTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = 326056831C76FDF1009D44AD /* MXEventTimeline.h */; };
326056861C76FDF2009D44AD /* MXEventTimeline.m in Sources */ = {isa = PBXBuildFile; fileRef = 326056841C76FDF1009D44AD /* MXEventTimeline.m */; };
3264DB911CEC528D00B99881 /* MXAccountData.h in Headers */ = {isa = PBXBuildFile; fileRef = 3264DB8F1CEC528D00B99881 /* MXAccountData.h */; };
3264DB921CEC528D00B99881 /* MXAccountData.m in Sources */ = {isa = PBXBuildFile; fileRef = 3264DB901CEC528D00B99881 /* MXAccountData.m */; };
3264DB941CECA72900B99881 /* MXAccountDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3264DB931CECA72900B99881 /* MXAccountDataTests.m */; };
3264E2A21BDF8D1500F89A86 /* MXCoreDataRoomState.h in Headers */ = {isa = PBXBuildFile; fileRef = 3264E29E1BDF8D1500F89A86 /* MXCoreDataRoomState.h */; };
3264E2A31BDF8D1500F89A86 /* MXCoreDataRoomState.m in Sources */ = {isa = PBXBuildFile; fileRef = 3264E29F1BDF8D1500F89A86 /* MXCoreDataRoomState.m */; };
3264E2A41BDF8D1500F89A86 /* MXCoreDataRoomState+CoreDataProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 3264E2A01BDF8D1500F89A86 /* MXCoreDataRoomState+CoreDataProperties.h */; };
Expand Down Expand Up @@ -213,6 +216,9 @@
325653821A2E14ED00CC0423 /* MXStoreTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXStoreTests.m; sourceTree = "<group>"; };
326056831C76FDF1009D44AD /* MXEventTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXEventTimeline.h; sourceTree = "<group>"; };
326056841C76FDF1009D44AD /* MXEventTimeline.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXEventTimeline.m; sourceTree = "<group>"; };
3264DB8F1CEC528D00B99881 /* MXAccountData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXAccountData.h; sourceTree = "<group>"; };
3264DB901CEC528D00B99881 /* MXAccountData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXAccountData.m; sourceTree = "<group>"; };
3264DB931CECA72900B99881 /* MXAccountDataTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXAccountDataTests.m; sourceTree = "<group>"; };
3264E29E1BDF8D1500F89A86 /* MXCoreDataRoomState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXCoreDataRoomState.h; sourceTree = "<group>"; };
3264E29F1BDF8D1500F89A86 /* MXCoreDataRoomState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXCoreDataRoomState.m; sourceTree = "<group>"; };
3264E2A01BDF8D1500F89A86 /* MXCoreDataRoomState+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MXCoreDataRoomState+CoreDataProperties.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -339,6 +345,8 @@
329FB1741A0A3A1600A5E88E /* MXRoomMember.m */,
327F8DB01C6112BA00581CA3 /* MXRoomThirdPartyInvite.h */,
327F8DB11C6112BA00581CA3 /* MXRoomThirdPartyInvite.m */,
3264DB8F1CEC528D00B99881 /* MXAccountData.h */,
3264DB901CEC528D00B99881 /* MXAccountData.m */,
329FB17D1A0B665800A5E88E /* MXUser.h */,
329FB17E1A0B665800A5E88E /* MXUser.m */,
327137251A24D50A00DB6757 /* MXMyUser.h */,
Expand Down Expand Up @@ -551,6 +559,7 @@
323C5A071A70E53500FB0549 /* MXToolsTests.m */,
32DC15D61A8DFF0D006F9AD3 /* MXNotificationCenterTests.m */,
329571921B0240CE00ABB3BA /* MXVoIPTests.m */,
3264DB931CECA72900B99881 /* MXAccountDataTests.m */,
);
path = MatrixSDKTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -647,6 +656,7 @@
323B2AE11BCD4CB600B11F34 /* MXCoreDataAccount.h in Headers */,
3220094519EFBF30008DE41D /* MXSessionEventListener.h in Headers */,
32BED28F1B00A23F00E668FE /* MXCallStack.h in Headers */,
3264DB911CEC528D00B99881 /* MXAccountData.h in Headers */,
323B2AF81BCE8AC800B11F34 /* MXCoreDataRoom.h in Headers */,
329FB1751A0A3A1600A5E88E /* MXRoomMember.h in Headers */,
323B2ACF1BCD3EF000B11F34 /* MXCoreDataStore.h in Headers */,
Expand Down Expand Up @@ -823,6 +833,7 @@
327137281A24D50A00DB6757 /* MXMyUser.m in Sources */,
32114A901A262ECB00FF2EC4 /* MXNoStore.m in Sources */,
32CE6FB91A409B1F00317F1E /* MXFileStoreMetaData.m in Sources */,
3264DB921CEC528D00B99881 /* MXAccountData.m in Sources */,
323E0C5C1A306D7A00A31D73 /* MXEvent.m in Sources */,
323B2AFF1BCE9B6700B11F34 /* MXCoreDataEvent+CoreDataProperties.m in Sources */,
32CAB10C1A925B41008C5BB9 /* MXHTTPOperation.m in Sources */,
Expand Down Expand Up @@ -877,6 +888,7 @@
32FCAB4D19E578860049C555 /* MXRestClientTests.m in Sources */,
329FB17C1A0A963700A5E88E /* MXRoomMemberTests.m in Sources */,
3246BDC51A1A0789000A7D62 /* MXRoomStateDynamicTests.m in Sources */,
3264DB941CECA72900B99881 /* MXAccountDataTests.m in Sources */,
323EF7471C7CB4C7000DC98C /* MXEventTimelineTests.m in Sources */,
32169AA21BD4D1B00077868B /* MXCoreDataStore.xcdatamodeld in Sources */,
);
Expand Down
41 changes: 41 additions & 0 deletions MatrixSDK/Data/MXAccountData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
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 <Foundation/Foundation.h>

/**
`MXAccountData` holds the user account data.
Account data contains infomation like the push rules and the ignored users list.
It is fully or partially updated on homeserver `/sync` response.
The main purpose of this class is to maintain the data with partial update.
*/
@interface MXAccountData : NSObject

/**
Update the account data with the passed event.
@param event one event of the "account_data" field of a `/sync` response.
*/
- (void)updateWithEvent:(NSDictionary*)event;

/**
The account data as sent by the homeserver /sync response.
*/
@property (nonatomic, readonly) NSDictionary *accountData;

@end
59 changes: 59 additions & 0 deletions MatrixSDK/Data/MXAccountData.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
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 "MXAccountData.h"

@interface MXAccountData ()
{
/**
This dictionary stores "account_data" data in a flat manner.
*/
NSMutableDictionary *accountDataDict;
}
@end

@implementation MXAccountData

- (instancetype)init
{
self = [super init];
if (self)
{
accountDataDict = [NSMutableDictionary dictionary];
}
return self;
}

- (void)updateWithEvent:(NSDictionary *)event
{
accountDataDict[event[@"type"]] = event[@"content"];
}

- (NSDictionary *)accountData
{
// Rebuild the dictionary as sent by the homeserver
NSMutableArray *events = [NSMutableArray array];
for (NSString *type in accountDataDict)
{
[events addObject:@{
@"type": type,
@"content": accountDataDict[type]
}];
}
return @{@"events": events};
}

@end
3 changes: 2 additions & 1 deletion MatrixSDK/Data/MXRoomState.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ A copy of the list of third party invites (actually MXRoomThirdPartyInvite insta

/**
Return a display name for a member.
It is his displayname member or, if nil, his userId
It is his displayname member or, if nil, his userId.
Disambiguate members who have the same displayname in the room by adding his userId.
*/
- (NSString*)memberName:(NSString*)userId;

Expand Down
34 changes: 18 additions & 16 deletions MatrixSDK/Data/MXRoomState.m
Original file line number Diff line number Diff line change
Expand Up @@ -518,35 +518,37 @@ - (NSString*)memberName:(NSString*)userId
{
// Get the user display name from the member list of the room
MXRoomMember *member = [self memberWithUserId:userId];

// Do not consider null displayname
if (member && member.displayname.length)

if (!member)
{
// The user may not have joined the room yet. So try to resolve display name from presence data
// Note: This data may not be available
MXUser* user = [mxSession userWithUserId:userId];
if (user && user.displayname.length)
{
displayName = user.displayname;
}
}
else if (member.displayname.length)
{
displayName = member.displayname;
}

// Do not consider null displayname
if (displayName)
{
// Disambiguate users who have the same displayname in the room
for (MXRoomMember* member in members.allValues)
{
if ([member.displayname isEqualToString:displayName] && ![member.userId isEqualToString:userId])
{
displayName = [NSString stringWithFormat:@"%@(%@)", displayName, userId];
displayName = [NSString stringWithFormat:@"%@ (%@)", displayName, userId];
break;
}
}
}

// The user may not have joined the room yet. So try to resolve display name from presence data
// Note: This data may not be available
if (!displayName)
else
{
MXUser* user = [mxSession userWithUserId:userId];

if (user) {
displayName = user.displayname;
}
}

if (!displayName) {
// By default, use the user ID
displayName = userId;
}
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/Data/Store/MXFileStore/MXFileStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#import "MXFileStoreMetaData.h"

NSUInteger const kMXFileVersion = 25;
NSUInteger const kMXFileVersion = 26;

NSString *const kMXFileStoreFolder = @"MXFileStore";
NSString *const kMXFileStoreMedaDataFile = @"MXFileStore";
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/Data/Store/MXMemoryStore/MXMemoryStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ @interface MXMemoryStore()

@implementation MXMemoryStore

@synthesize eventStreamToken;
@synthesize eventStreamToken, userAccountData;

- (instancetype)init
{
Expand Down
2 changes: 1 addition & 1 deletion MatrixSDK/Data/Store/MXNoStore/MXNoStore.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ @interface MXNoStore ()

@implementation MXNoStore

@synthesize eventStreamToken;
@synthesize eventStreamToken, userAccountData;

- (instancetype)init
{
Expand Down
5 changes: 5 additions & 0 deletions MatrixSDK/JSONModels/MXJSONModels.h
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,11 @@ FOUNDATION_EXPORT NSString *const kMXPushRuleScopeStringDevice;
*/
@property (nonatomic) NSUInteger lifetime;

/**
Indicate whether the invitation is for a video call.
*/
- (BOOL)isVideoCall;

@end

/**
Expand Down
18 changes: 18 additions & 0 deletions MatrixSDK/JSONModels/MXJSONModels.m
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,12 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary withScope:(NSString*)scope

@end

@interface MXPushRulesResponse ()
{
// The dictionary sent by the homeserver.
NSDictionary *JSONDictionary;
}
@end
@implementation MXPushRulesResponse

NSString *const kMXPushRuleScopeStringGlobal = @"global";
Expand All @@ -622,11 +628,18 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary
}

// TODO support device rules

pushRulesResponse->JSONDictionary = JSONDictionary;
}

return pushRulesResponse;
}

- (NSDictionary *)JSONDictionary
{
return JSONDictionary;
}

@end


Expand Down Expand Up @@ -1068,6 +1081,11 @@ + (id)modelFromJSON:(NSDictionary *)JSONDictionary
return callInviteEventContent;
}

- (BOOL)isVideoCall
{
return (NSNotFound != [self.offer.sdp rangeOfString:@"m=video"].location);
}

@end

@implementation MXCallCandidate
Expand Down
1 change: 1 addition & 0 deletions MatrixSDK/MXRestClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ FOUNDATION_EXPORT NSString *const kMXRoomVisibilityPrivate;
/**
Account data types
*/
FOUNDATION_EXPORT NSString *const kMXAccountDataPushRules;
FOUNDATION_EXPORT NSString *const kMXAccountDataTypeIgnoredUserList;

/**
Expand Down
1 change: 1 addition & 0 deletions MatrixSDK/MXRestClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
Account data types
*/
NSString *const kMXAccountDataTypeIgnoredUserList = @"m.ignored_user_list";
NSString *const kMXAccountDataPushRules = @"m.push_rules";

/**
Account data keys
Expand Down
Loading

0 comments on commit 15f6a17

Please sign in to comment.