Skip to content

Commit

Permalink
Merge branch 'release/0.24.0/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Oct 4, 2022
2 parents 4442142 + f7236b2 commit cc89463
Show file tree
Hide file tree
Showing 87 changed files with 3,024 additions and 1,158 deletions.
27 changes: 27 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## Changes in 0.24.0 (2022-10-04)

🙌 Improvements

- Crypto: Enable group session cache by default ([#1575](https://github.com/matrix-org/matrix-ios-sdk/pull/1575))
- Crypto: Extract key backup engine ([#1578](https://github.com/matrix-org/matrix-ios-sdk/pull/1578))
- MXSession: Set client information data if needed on resume. ([#1582](https://github.com/matrix-org/matrix-ios-sdk/pull/1582))
- MXDevice: Move to dedicated file and implement MSC-3852. ([#1583](https://github.com/matrix-org/matrix-ios-sdk/pull/1583))
- Add `enableNewClientInformationFeature` sdk option, disabled by default (PSG-799). ([#1588](https://github.com/matrix-org/matrix-ios-sdk/pull/1588))
- Remove MXRoom's partialTextMessage support ([#6670](https://github.com/vector-im/element-ios/issues/6670))
- CryptoV2: Key backups ([#6769](https://github.com/vector-im/element-ios/issues/6769))
- CryptoV2: Key gossiping ([#6773](https://github.com/vector-im/element-ios/issues/6773))
- User sessions: Add support for MSC3881 ([#6787](https://github.com/vector-im/element-ios/issues/6787))

🧱 Build

- Disable codecov/patch. ([#1579](https://github.com/matrix-org/matrix-ios-sdk/pull/1579))

⚠️ API Changes

- Upgrade minimum iOS and OSX deployment target to 13.0 and 10.15 respectively ([#1574](https://github.com/matrix-org/matrix-ios-sdk/pull/1574))

Others

- Avoid main thread assertion if we can't get the application ([#6754](https://github.com/vector-im/element-ios/issues/6754))


## Changes in 0.23.19 (2022-09-28)

🐛 Bugfixes
Expand Down
12 changes: 6 additions & 6 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.23.19"
s.version = "0.24.0"
s.summary = "The iOS SDK to build apps compatible with Matrix (https://www.matrix.org)"

s.description = <<-DESC
Expand All @@ -22,13 +22,13 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.swift_versions = ['5.1', '5.2']

s.ios.deployment_target = "11.0"
s.osx.deployment_target = "10.12"
s.ios.deployment_target = "13.0"
s.osx.deployment_target = "10.15"

s.default_subspec = 'Core'
s.subspec 'Core' do |ss|
ss.ios.deployment_target = "11.0"
ss.osx.deployment_target = "10.12"
ss.ios.deployment_target = "13.0"
ss.osx.deployment_target = "10.15"

ss.source_files = "MatrixSDK", "MatrixSDK/**/*.{h,m}", "MatrixSDK/**/*.{swift}"
ss.osx.exclude_files = "MatrixSDK/VoIP/MXiOSAudioOutputRoute*.swift"
Expand All @@ -49,7 +49,7 @@ Pod::Spec.new do |s|
end

s.subspec 'JingleCallStack' do |ss|
ss.ios.deployment_target = "12.0"
ss.ios.deployment_target = "13.0"

ss.source_files = "MatrixSDKExtensions/VoIP/Jingle/**/*.{h,m}"

Expand Down
148 changes: 137 additions & 11 deletions MatrixSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

9 changes: 0 additions & 9 deletions MatrixSDK/Background/MXBackgroundStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,6 @@ class MXBackgroundStore: NSObject, MXStore {
func deleteGroup(_ groupId: String) {
}

@available(*, deprecated, message: "use storePartialAttributedTextMessage")
func storePartialTextMessage(forRoom roomId: String, partialTextMessage: String) {
}

@available(*, deprecated, message: "use partialAttributedTextMessage")
func partialTextMessage(ofRoom roomId: String) -> String? {
return nil
}

func storePartialAttributedTextMessage(forRoom roomId: String, partialAttributedTextMessage: NSAttributedString) {
}

Expand Down
95 changes: 95 additions & 0 deletions MatrixSDK/ClientInformation/MXClientInformationService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// Copyright 2022 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 Foundation

@objcMembers
public class MXClientInformationService: NSObject {

private weak var session: MXSession?
private let bundle: Bundle

public init(withSession session: MXSession,
bundle: Bundle) {
self.session = session
self.bundle = bundle
}

public func updateData() {
guard let session = session else {
return
}

guard MXSDKOptions.sharedInstance().enableNewClientInformationFeature else {
return removeDataIfNeeded(on: session)
}

guard let updatedInfo = createClientInformation() else {
return
}

let type = accountDataType(for: session)
let currentInfo = session.accountData.accountData(forEventType: type)

guard !NSDictionary(dictionary: updatedInfo).isEqual(to: currentInfo ?? [:]) else {
MXLog.debug("[MXClientInformationService] refresh: no need to update")
return
}

session.setAccountData(updatedInfo, forType: type) {
MXLog.debug("[MXClientInformationService] refresh: updated successfully")
} failure: { error in
MXLog.debug("[MXClientInformationService] refresh: update failed: \(String(describing: error))")
}
}

private func removeDataIfNeeded(on session: MXSession) {
let type = accountDataType(for: session)

guard let currentInfo = session.accountData.accountData(forEventType: type),
!currentInfo.isEmpty else {
// not exists, no need to do anything
MXLog.debug("[MXClientInformationService] removeDataIfNeeded: no need to remove")
return
}

session.setAccountData([:], forType: type) {
MXLog.debug("[MXClientInformationService] removeDataIfNeeded: removed successfully")
} failure: { error in
MXLog.debug("[MXClientInformationService] removeDataIfNeeded: remove failed: \(String(describing: error))")
}
}

private func createClientInformation() -> [AnyHashable: String]? {
guard let name = bundle.object(forInfoDictionaryKey: "CFBundleDisplayName")
?? bundle.object(forInfoDictionaryKey: "CFBundleName") as? String,
let version = bundle.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String else {
return nil
}

return [
"name": "\(name) iOS",
"version": version
]
}

private func accountDataType(for session: MXSession) -> String {
guard let deviceId = session.myDeviceId else {
fatalError("[MXClientInformationService] No device id")
}
return "\(kMXAccountDataTypeClientInformation).\(deviceId)"
}
}
1 change: 0 additions & 1 deletion MatrixSDK/Contrib/Swift/Data/MXRoom.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public extension MXRoom {
/**
The current list of members of the room using async API.
*/
@available(iOS 13.0.0, macOS 10.15.0, *)
func members() async throws -> MXRoomMembers? {
try await performCallbackRequest {
members(completion: $0)
Expand Down
9 changes: 9 additions & 0 deletions MatrixSDK/Contrib/Swift/JSONModels/MXJSONModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public enum MXLoginFlowType: Equatable, Hashable {
public enum MXPusherKind: Equatable, Hashable {
case http, none, custom(String)

public init(value: String?) {
guard let value = value else {
self = .none
return
}

self = value == "http" ? .http : .custom(value)
}

public var objectValue: NSObject {
switch self {
case .http: return "http" as NSString
Expand Down
1 change: 0 additions & 1 deletion MatrixSDK/Contrib/Swift/MXResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ internal func uncurryResponse<T>(_ response: MXResponse<T>, success: @escaping (
/// room.members($0)
/// }
/// ```
@available(iOS 13.0.0, macOS 10.15.0, *)
internal func performCallbackRequest<T>(_ request: (@escaping (MXResponse<T>) -> Void) -> Void) async throws -> T {
return try await withCheckedThrowingContinuation { continuation in
request {
Expand Down
19 changes: 16 additions & 3 deletions MatrixSDK/Contrib/Swift/MXRestClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,15 @@ public extension MXRestClient {
- profileTag: The profile tag for this device. Identifies this device in push rules.
- lang: The user's preferred language for push, eg. 'en' or 'en-US'
- data: Dictionary of data as required by your push gateway (generally the notification URI and aps-environment for APNS).
- append: If `true`, the homeserver should add another pusher with the given pushkey and App ID in addition to any others with different user IDs.
- enabled: Whether the pusher should actively create push notifications
- completion: A block object called when the operation succeeds.
- response: indicates whether the request succeeded or not.

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func setPusher(pushKey: String, kind: MXPusherKind, appId: String, appDisplayName: String, deviceDisplayName: String, profileTag: String, lang: String, data: [String: Any], append: Bool, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
return __setPusherWithPushkey(pushKey, kind: kind.objectValue, appId: appId, appDisplayName: appDisplayName, deviceDisplayName: deviceDisplayName, profileTag: profileTag, lang: lang, data: data, append: append, success: currySuccess(completion), failure: curryFailure(completion))
@nonobjc @discardableResult func setPusher(pushKey: String, kind: MXPusherKind, appId: String, appDisplayName: String, deviceDisplayName: String, profileTag: String, lang: String, data: [String: Any], append: Bool, enabled: Bool = true, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
return __setPusherWithPushkey(pushKey, kind: kind.objectValue, appId: appId, appDisplayName: appDisplayName, deviceDisplayName: deviceDisplayName, profileTag: profileTag, lang: lang, data: data, append: append, enabled: enabled, success: currySuccess(completion), failure: curryFailure(completion))
}
// TODO: setPusherWithPushKey - futher refinement
/*
Expand All @@ -392,7 +394,18 @@ public extension MXRestClient {
Something like "MXPusherDescriptor"?
*/


/**
Gets all currently active pushers for the authenticated user.

- parameters:
- response: indicates whether the request succeeded or not.

- returns: a `MXHTTPOperation` instance.
*/
@nonobjc @discardableResult func pushers(completion: @escaping (_ response: MXResponse<[MXPusher]>) -> Void) -> MXHTTPOperation {
return __pushers(currySuccess(completion), failure: curryFailure(completion))
}

/**
Get all push notifications rules.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Foundation

/// Convenience struct which transforms `MatrixSDKCrypto` cross signing info formats
/// into `MatrixSDK` `MXCrossSigningInfo` formats.
@available(iOS 13.0.0, *)
struct MXCrossSigningInfoSource {
private let source: MXCryptoUserIdentitySource

Expand Down
1 change: 0 additions & 1 deletion MatrixSDK/Crypto/CrossSigning/MXCrossSigningV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import Foundation
/// A work-in-progress subclass of `MXCrossSigning` instantiated and used by `MXCryptoV2`.
///
/// Note: `MXCrossSigning` will be defined as a protocol in the future to avoid subclasses.
@available(iOS 13.0.0, *)
class MXCrossSigningV2: MXCrossSigning {
enum Error: Swift.Error {
case missingAuthSession
Expand Down
Loading

0 comments on commit cc89463

Please sign in to comment.