Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/0.15.8/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
SBiOSoftWhare committed Aug 26, 2021
2 parents 1432ec1 + 1202b6b commit 9aed34a
Show file tree
Hide file tree
Showing 19 changed files with 141 additions and 46 deletions.
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## Changes in 0.15.8 (2021-08-26)

🙌 Improvements

- Upgrade MatrixSDK version ([v0.19.8](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.19.8)).
- Notifications: Add notificationBodyLocalizationKey to MXKAppSettings to customise the default notification payload. ([#4132](https://github.com/vector-im/element-ios/issues/4132))

🐛 Bugfixes

- MXKViewControllerHandling: Use processing local cache session state to show an activity indicator. ([#4471](https://github.com/vector-im/element-ios/issues/4471))
- MXKRoomBubbleComponent: Only consider messages and attachments when computing whether to show a warning badge (fixes misaligned messages in the timeline). ([#4510](https://github.com/vector-im/element-ios/issues/4510))


## Changes in 0.15.7 (2021-08-11)

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

s.name = "MatrixKit"
s.version = "0.15.7"
s.version = "0.15.8"
s.summary = "The Matrix reusable UI library for iOS based on MatrixSDK."

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

s.swift_version = '5.0'

s.dependency 'MatrixSDK', "= 0.19.7"
s.dependency 'MatrixSDK', "= 0.19.8"
s.dependency 'HPGrowingTextView', '~> 1.1'
s.dependency 'libPhoneNumber-iOS', '~> 0.9.13'
s.dependency 'DTCoreText', '~> 1.6.25'
Expand Down
6 changes: 6 additions & 0 deletions MatrixKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
B1668AC021072F93002B14F1 /* MXKSlashCommands.m in Sources */ = {isa = PBXBuildFile; fileRef = B1668ABF21072F93002B14F1 /* MXKSlashCommands.m */; };
CE14CA661E80122600E329A3 /* MXKAttachmentAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = CE14CA631E80122600E329A3 /* MXKAttachmentAnimator.m */; };
CE14CA671E80122600E329A3 /* MXKAttachmentInteractionController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE14CA651E80122600E329A3 /* MXKAttachmentInteractionController.m */; };
EC12E229268DD94100934C7D /* MXSession+MatrixKit.m in Sources */ = {isa = PBXBuildFile; fileRef = EC12E228268DD94100934C7D /* MXSession+MatrixKit.m */; };
EC6DC7BB24F9562600B6C40F /* MarkdownToHTMLRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC6DC7BA24F9562600B6C40F /* MarkdownToHTMLRenderer.swift */; };
EC9010C825308312004DC138 /* MXKPasteboardManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC9010C725308312004DC138 /* MXKPasteboardManager.swift */; };
F0026B661C91EED1001D2C04 /* MXKWebViewViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F0026B651C91EED1001D2C04 /* MXKWebViewViewController.m */; };
Expand Down Expand Up @@ -404,6 +405,8 @@
CE14CA641E80122600E329A3 /* MXKAttachmentInteractionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MXKAttachmentInteractionController.h; sourceTree = "<group>"; };
CE14CA651E80122600E329A3 /* MXKAttachmentInteractionController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MXKAttachmentInteractionController.m; sourceTree = "<group>"; };
E5AB7F3690B214D676BB9B72 /* Pods-MatrixKitSamplePods-MatrixKitSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MatrixKitSamplePods-MatrixKitSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MatrixKitSamplePods-MatrixKitSample/Pods-MatrixKitSamplePods-MatrixKitSample.debug.xcconfig"; sourceTree = "<group>"; };
EC12E227268DD94100934C7D /* MXSession+MatrixKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MXSession+MatrixKit.h"; sourceTree = "<group>"; };
EC12E228268DD94100934C7D /* MXSession+MatrixKit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MXSession+MatrixKit.m"; sourceTree = "<group>"; };
EC6DC7BA24F9562600B6C40F /* MarkdownToHTMLRenderer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkdownToHTMLRenderer.swift; sourceTree = "<group>"; };
EC9010C725308312004DC138 /* MXKPasteboardManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MXKPasteboardManager.swift; sourceTree = "<group>"; };
EC9010C92530875E004DC138 /* MXKSwiftHeader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MXKSwiftHeader.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1325,6 +1328,8 @@
32B046712101EB5E002A24A1 /* MXRoom+Sync.m */,
B12C56F02396D75500FAC6DE /* UITextView+MatrixKit.h */,
B12C56F12396D75500FAC6DE /* UITextView+MatrixKit.m */,
EC12E227268DD94100934C7D /* MXSession+MatrixKit.h */,
EC12E228268DD94100934C7D /* MXSession+MatrixKit.m */,
);
path = Categories;
sourceTree = "<group>";
Expand Down Expand Up @@ -2009,6 +2014,7 @@
F0CF98E11B0B7FDC00EAE373 /* MXKTableViewCellWithLabelAndSwitch.m in Sources */,
F01439451F067929006E5D8C /* MXKReadReceiptTableViewCell.m in Sources */,
F02528961C1092D300E1FE1B /* MXKCollectionViewCell.m in Sources */,
EC12E229268DD94100934C7D /* MXSession+MatrixKit.m in Sources */,
F0F148A61AB08F48005F5D4A /* MXKSampleJSQRoomDataSource.m in Sources */,
F096A3BF1B0B3DAA00AF1357 /* MXKAccountDetailsViewController.m in Sources */,
B1668AC021072F93002B14F1 /* MXKSlashCommands.m in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"call_voice_with_user" = "Połączenie głosowe z %@";
"call_more_actions_dialpad" = "Klawiatura numeryczna";
"call_more_actions_transfer" = "Transferuj";
"call_more_actions_audio_use_device" = "Użyj wyjścia audio urządzenia";
"call_more_actions_audio_use_device" = "Wyjście audio";
"call_more_actions_audio_use_headset" = "Użyj zestawu głosowego";
"call_more_actions_change_audio_device" = "Zmień urządzenie dźwiękowe";
"call_more_actions_unhold" = "Wznów";
Expand Down
28 changes: 28 additions & 0 deletions MatrixKit/Categories/MXSession+MatrixKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Copyright 2020 The Matrix.org Foundation C.I.C
//
// 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 <MatrixSDK/MatrixSDK.h>

NS_ASSUME_NONNULL_BEGIN

@interface MXSession (MatrixKit)

/// Flag to indicate whether the session is in a suitable state to show some activity indicators on UI.
@property (nonatomic, readonly) BOOL shouldShowActivityIndicator;

@end

NS_ASSUME_NONNULL_END
34 changes: 34 additions & 0 deletions MatrixKit/Categories/MXSession+MatrixKit.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Copyright 2020 The Matrix.org Foundation C.I.C
//
// 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 "MXSession+MatrixKit.h"

@implementation MXSession (MatrixKit)

- (BOOL)shouldShowActivityIndicator
{
switch (self.state)
{
case MXSessionStateInitialised:
case MXSessionStateProcessingBackgroundSyncCache:
case MXSessionStateSyncInProgress:
return YES;
default:
return NO;
}
}

@end
9 changes: 3 additions & 6 deletions MatrixKit/Controllers/MXKTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#import "UIViewController+MatrixKit.h"
#import "UIScrollView+MatrixKit.h"
#import "MXSession+MatrixKit.h"

@interface MXKTableViewController ()
{
Expand Down Expand Up @@ -443,11 +444,7 @@ - (void)onMatrixSessionChange
else
{
allHomeserverNotReachable = NO;

if (mxSession.state == MXSessionStateSyncInProgress || mxSession.state == MXSessionStateInitialised)
{
isActivityInProgress = YES;
}
isActivityInProgress = mxSession.shouldShowActivityIndicator;
}

index ++;
Expand Down Expand Up @@ -535,7 +532,7 @@ - (void)stopActivityIndicator
BOOL isActivityInProgress = NO;
for (MXSession *mxSession in mxSessionArray)
{
if (mxSession.state == MXSessionStateSyncInProgress || mxSession.state == MXSessionStateInitialised)
if (mxSession.shouldShowActivityIndicator)
{
isActivityInProgress = YES;
}
Expand Down
9 changes: 3 additions & 6 deletions MatrixKit/Controllers/MXKViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "MXKViewController.h"

#import "UIViewController+MatrixKit.h"
#import "MXSession+MatrixKit.h"

const CGFloat MXKViewControllerMaxExternalKeyboardHeight = 80;

Expand Down Expand Up @@ -460,11 +461,7 @@ - (void)onMatrixSessionChange
else
{
allHomeserverNotReachable = NO;

if (mxSession.state == MXSessionStateSyncInProgress || mxSession.state == MXSessionStateInitialised)
{
isActivityInProgress = YES;
}
isActivityInProgress = mxSession.shouldShowActivityIndicator;
}

index++;
Expand Down Expand Up @@ -548,7 +545,7 @@ - (void)stopActivityIndicator
BOOL isActivityInProgress = NO;
for (MXSession *mxSession in mxSessionArray)
{
if (mxSession.state == MXSessionStateSyncInProgress || mxSession.state == MXSessionStateInitialised)
if (mxSession.shouldShowActivityIndicator)
{
isActivityInProgress = YES;
}
Expand Down
6 changes: 3 additions & 3 deletions MatrixKit/Controllers/MXKViewControllerHandling.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@

/**
Activity indicator view.
By default this activity indicator is centered inside the view controller view. It is automatically
start on the following matrix session states: `MXSessionStateInitialised` and `MXSessionStateSyncInProgress`.
By default this activity indicator is centered inside the view controller view. It automatically
starts if `shouldShowActivityIndicator `returns true for the session.
It is stopped on other states.
Set nil to disable activity indicator animation.
*/
Expand Down Expand Up @@ -131,7 +131,7 @@
This method is called to refresh the display when the view controller will appear too.
By default view controller appearance is updated according to the state of associated sessions:
- starts activity indicator as soon as at least one session state is `MXSessionStateInitialised` or `MXSessionStateSyncInProgress`.
- starts activity indicator as soon as when `shouldShowActivityIndicator `returns true for the session.
- switches in red the navigation bar tintColor when all sessions are in `MXSessionStateHomeserverNotReachable` state.
- switches in orange the navigation bar tintColor when at least one session is in `MXSessionStateHomeserverNotReachable` state.
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/MatrixKitVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

#import <Foundation/Foundation.h>

NSString *const MatrixKitVersion = @"0.15.7";
NSString *const MatrixKitVersion = @"0.15.8";
4 changes: 3 additions & 1 deletion MatrixKit/Models/Account/MXKAccount.m
Original file line number Diff line number Diff line change
Expand Up @@ -1241,10 +1241,12 @@ - (void)enableAPNSPusher:(BOOL)enabled success:(void (^)(void))success failure:(
NSString *appId = [[NSUserDefaults standardUserDefaults] objectForKey:@"pusherAppIdProd"];
#endif

NSString *locKey = MXKAppSettings.standardAppSettings.notificationBodyLocalizationKey;

NSDictionary *pushData = @{
@"url": self.pushGatewayURL,
@"format": @"event_id_only",
@"default_payload": @{@"aps": @{@"mutable-content": @(1), @"alert": @{@"loc-key": @"MESSAGE", @"loc-args": @[]}}}
@"default_payload": @{@"aps": @{@"mutable-content": @(1), @"alert": @{@"loc-key": locKey, @"loc-args": @[]}}}
};

[self enablePusher:enabled appId:appId token:[MXKAccountManager sharedManager].apnsDeviceToken pushData:pushData success:^{
Expand Down
13 changes: 12 additions & 1 deletion MatrixKit/Models/MXKAppSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,22 @@ typedef NS_ENUM(NSUInteger, MXKKeyPreSharingStrategy)
*/
@property (nonatomic) UIColor *presenceColorForOfflineUser;

#pragma mark - Push
#pragma mark - Notifications

/// Flag to allow PushKit pushers or not. Default value is `NO`.
@property (nonatomic, assign) BOOL allowPushKitPushers;

/**
A localization key used when registering the default notification payload.
This key will be translated and displayed for APNS notifications as the body
content, unless it is modified locally by a Notification Service Extension.
The default value for this setting is "MESSAGE". Changes are *not* persisted.
Updating the value after MXKAccount has called `enableAPNSPusher:success:failure:`
will have no effect.
*/
@property (nonatomic) NSString *notificationBodyLocalizationKey;

#pragma mark - Calls

/**
Expand Down
1 change: 1 addition & 0 deletions MatrixKit/Models/MXKAppSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ -(instancetype)init
httpsLinkScheme = @"https";

_allowPushKitPushers = NO;
_notificationBodyLocalizationKey = @"MESSAGE";
enableCallKit = YES;

eventsFilterForMessages = [NSMutableArray arrayWithArray:@[
Expand Down
37 changes: 23 additions & 14 deletions MatrixKit/Models/Room/MXKRoomBubbleComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,42 +96,51 @@ - (NSString *)textMessage

- (BOOL)shouldShowWarningBadgeForEvent:(MXEvent*)event roomState:(MXRoomState*)roomState session:(MXSession*)session
{
// Warning badges are unnecessary in unencrypted rooms
if (!roomState.isEncrypted)
{
return NO;
}

BOOL shouldShowWarningBadge = NO;
// Not all events are encrypted (e.g. state/reactions/redactions) and we only have encrypted cell subclasses for messages and attachments.
if (event.eventType != MXEventTypeRoomMessage && !event.isMediaAttachment)
{
return NO;
}

// Always show a warning badge if there was a decryption error.
if (event.decryptionError)
{
return YES;
}

// Unencrypted message events should show a warning unless they're pending local echoes
if (!event.isEncrypted)
{
if (event.isLocalEvent
|| event.isState
|| event.contentHasBeenEdited) // Local echo for an edit is clear but uses a true event id, the one of the edited event
{
shouldShowWarningBadge = NO;
}
else
{
shouldShowWarningBadge = YES;
return NO;
}

return YES;
}
else if (event.decryptionError)
{
shouldShowWarningBadge = YES;
}
else if (event.sender)

// The encryption is in a good state.
// Only show a warning badge if there are trust issues.
if (event.sender)
{
MXUserTrustLevel *userTrustLevel = [session.crypto trustLevelForUser:event.sender];
MXDeviceInfo *deviceInfo = [session.crypto eventDeviceInfo:event];

if (userTrustLevel.isVerified && !deviceInfo.trustLevel.isVerified)
{
shouldShowWarningBadge = YES;
return YES;
}
}

return shouldShowWarningBadge;
// Everything was fine
return NO;
}

@end
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ abstract_target 'MatrixKitSamplePods' do

# Different flavours of pods to Matrix SDK
# The tagged version on which this version of MatrixKit has been built
pod 'MatrixSDK', '= 0.19.7'
pod 'MatrixSDK', '= 0.19.8'

# The lastest release available on the CocoaPods repository
#pod 'MatrixSDK'
Expand Down
14 changes: 7 additions & 7 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ PODS:
- JSQSystemSoundPlayer (2.0.1)
- libbase58 (0.1.4)
- libPhoneNumber-iOS (0.9.15)
- MatrixSDK (0.19.7):
- MatrixSDK/Core (= 0.19.7)
- MatrixSDK/Core (0.19.7):
- MatrixSDK (0.19.8):
- MatrixSDK/Core (= 0.19.8)
- MatrixSDK/Core (0.19.8):
- AFNetworking (~> 4.0.0)
- GZIP (~> 1.3.0)
- libbase58 (~> 0.1.4)
Expand All @@ -64,7 +64,7 @@ DEPENDENCIES:
- HPGrowingTextView (~> 1.1)
- JSQMessagesViewController (~> 7.3.5)
- libPhoneNumber-iOS (~> 0.9.13)
- MatrixSDK (= 0.19.7)
- MatrixSDK (= 0.19.8)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -94,11 +94,11 @@ SPEC CHECKSUMS:
JSQSystemSoundPlayer: c5850e77a4363ffd374cd851154b9af93264ed8d
libbase58: 7c040313537b8c44b6e2d15586af8e21f7354efd
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
MatrixSDK: c0bbec5b67cc8771cffdf3b494d622bce0a51ceb
MatrixSDK: 4d4679b499b4802a11a90b3652f83be496bfaec1
OLMKit: 2d73cd67d149b5c3e3a8eb8ecae93d0b429d8a02
Realm: ed860452717c8db8f4bf832b6807f7f2ce708839
SwiftyBeaver: 84069991dd5dca07d7069100985badaca7f0ce82

PODFILE CHECKSUM: 36671d5cc91fcca64648f864868f3a215c4a5051
PODFILE CHECKSUM: 9a17ebe688081716e819adfbdee225d172592260

COCOAPODS: 1.10.1
COCOAPODS: 1.10.2
1 change: 0 additions & 1 deletion changelog.d/4393.build

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/4393.doc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/pr-873.build

This file was deleted.

0 comments on commit 9aed34a

Please sign in to comment.