mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
SDK Bump to 1.0.80 and push notifications filtering (#1131)
* filtering nil notifications * updated the sdk
This commit is contained in:
@@ -5004,7 +5004,7 @@
|
|||||||
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
|
||||||
requirement = {
|
requirement = {
|
||||||
kind = exactVersion;
|
kind = exactVersion;
|
||||||
version = "1.0.79-alpha";
|
version = "1.0.80-alpha";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
96495DD8554E2F39D3954354 /* XCRemoteSwiftPackageReference "posthog-ios" */ = {
|
||||||
|
|||||||
@@ -111,8 +111,8 @@
|
|||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
"location" : "https://github.com/matrix-org/matrix-rust-components-swift",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "59c10bfd0b2dee9b5bf41b536ffac472d4fc49db",
|
"revision" : "d34b870ed9e954b446a8f6db6afa7fa9d8f6c06a",
|
||||||
"version" : "1.0.79-alpha"
|
"version" : "1.0.80-alpha"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -181,7 +181,7 @@
|
|||||||
{
|
{
|
||||||
"identity" : "swift-snapshot-testing",
|
"identity" : "swift-snapshot-testing",
|
||||||
"kind" : "remoteSourceControl",
|
"kind" : "remoteSourceControl",
|
||||||
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
|
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
|
||||||
"state" : {
|
"state" : {
|
||||||
"revision" : "cef5b3f6f11781dd4591bdd1dd0a3d22bd609334",
|
"revision" : "cef5b3f6f11781dd4591bdd1dd0a3d22bd609334",
|
||||||
"version" : "1.11.0"
|
"version" : "1.11.0"
|
||||||
|
|||||||
@@ -249,10 +249,10 @@ class SDKClientMock: SDKClientProtocol {
|
|||||||
}
|
}
|
||||||
public var getNotificationItemRoomIdEventIdReceivedArguments: (`roomId`: String, `eventId`: String)?
|
public var getNotificationItemRoomIdEventIdReceivedArguments: (`roomId`: String, `eventId`: String)?
|
||||||
public var getNotificationItemRoomIdEventIdReceivedInvocations: [(`roomId`: String, `eventId`: String)] = []
|
public var getNotificationItemRoomIdEventIdReceivedInvocations: [(`roomId`: String, `eventId`: String)] = []
|
||||||
public var getNotificationItemRoomIdEventIdReturnValue: NotificationItem!
|
public var getNotificationItemRoomIdEventIdReturnValue: NotificationItem?
|
||||||
public var getNotificationItemRoomIdEventIdClosure: ((String, String) throws -> NotificationItem)?
|
public var getNotificationItemRoomIdEventIdClosure: ((String, String) throws -> NotificationItem?)?
|
||||||
|
|
||||||
public func `getNotificationItem`(`roomId`: String, `eventId`: String) throws -> NotificationItem {
|
public func `getNotificationItem`(`roomId`: String, `eventId`: String) throws -> NotificationItem? {
|
||||||
if let error = getNotificationItemRoomIdEventIdThrowableError {
|
if let error = getNotificationItemRoomIdEventIdThrowableError {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ class NotificationServiceExtension: UNNotificationServiceExtension {
|
|||||||
do {
|
do {
|
||||||
let userSession = try NSEUserSession(credentials: credentials)
|
let userSession = try NSEUserSession(credentials: credentials)
|
||||||
|
|
||||||
let itemProxy = try await userSession.notificationItemProxy(roomID: roomId, eventID: eventId)
|
guard let itemProxy = try await userSession.notificationItemProxy(roomID: roomId, eventID: eventId) else {
|
||||||
|
MXLog.info("\(tag) no notification for this event")
|
||||||
|
return discard()
|
||||||
|
}
|
||||||
|
|
||||||
// After the first processing, update the modified content
|
// After the first processing, update the modified content
|
||||||
modifiedContent = try await itemProxy.process(mediaProvider: nil)
|
modifiedContent = try await itemProxy.process(mediaProvider: nil)
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ final class NSEUserSession {
|
|||||||
try client.restoreSession(session: credentials.restorationToken.session)
|
try client.restoreSession(session: credentials.restorationToken.session)
|
||||||
}
|
}
|
||||||
|
|
||||||
func notificationItemProxy(roomID: String, eventID: String) async throws -> NotificationItemProxyProtocol {
|
func notificationItemProxy(roomID: String, eventID: String) async throws -> NotificationItemProxyProtocol? {
|
||||||
let userID = try client.userId()
|
let userID = try client.userId()
|
||||||
return await Task.dispatch(on: .global()) {
|
return await Task.dispatch(on: .global()) {
|
||||||
do {
|
do {
|
||||||
let notification = try self.client.getNotificationItem(roomId: roomID, eventId: eventID)
|
guard let notification = try self.client.getNotificationItem(roomId: roomID, eventId: eventID) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return NotificationItemProxy(notificationItem: notification, receiverID: userID)
|
return NotificationItemProxy(notificationItem: notification, receiverID: userID)
|
||||||
} catch {
|
} catch {
|
||||||
MXLog.error("NSE: Could not get notification's content creating an empty notification instead, error: \(error)")
|
MXLog.error("NSE: Could not get notification's content creating an empty notification instead, error: \(error)")
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
@testable import ElementX
|
@testable import ElementX
|
||||||
|
|
||||||
|
import Combine
|
||||||
import Foundation
|
import Foundation
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
@@ -39,7 +41,8 @@ class BugReportServiceTests: XCTestCase {
|
|||||||
includeCrashLog: true,
|
includeCrashLog: true,
|
||||||
githubLabels: [],
|
githubLabels: [],
|
||||||
files: [])
|
files: [])
|
||||||
let response = try await bugReportService.submitBugReport(bugReport, progressListener: nil).get()
|
let progressSubject = CurrentValueSubject<Double, Never>(0.0)
|
||||||
|
let response = try await bugReportService.submitBugReport(bugReport, progressListener: progressSubject).get()
|
||||||
XCTAssertFalse(response.reportUrl.isEmpty)
|
XCTAssertFalse(response.reportUrl.isEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +67,8 @@ class BugReportServiceTests: XCTestCase {
|
|||||||
includeCrashLog: true,
|
includeCrashLog: true,
|
||||||
githubLabels: [],
|
githubLabels: [],
|
||||||
files: [])
|
files: [])
|
||||||
let response = try await service.submitBugReport(bugReport, progressListener: nil).get()
|
let progressSubject = CurrentValueSubject<Double, Never>(0.0)
|
||||||
|
let response = try await service.submitBugReport(bugReport, progressListener: progressSubject).get()
|
||||||
|
|
||||||
XCTAssertEqual(response.reportUrl, "https://example.com/123")
|
XCTAssertEqual(response.reportUrl, "https://example.com/123")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Filtering out push notifications for encrypted rooms based on the room push context.
|
||||||
+1
-1
@@ -44,7 +44,7 @@ include:
|
|||||||
packages:
|
packages:
|
||||||
MatrixRustSDK:
|
MatrixRustSDK:
|
||||||
url: https://github.com/matrix-org/matrix-rust-components-swift
|
url: https://github.com/matrix-org/matrix-rust-components-swift
|
||||||
exactVersion: 1.0.79-alpha
|
exactVersion: 1.0.80-alpha
|
||||||
# path: ../matrix-rust-sdk
|
# path: ../matrix-rust-sdk
|
||||||
DesignKit:
|
DesignKit:
|
||||||
path: DesignKit
|
path: DesignKit
|
||||||
|
|||||||
Reference in New Issue
Block a user