Skip to content

Commit

Permalink
Add listAll
Browse files Browse the repository at this point in the history
  • Loading branch information
rlepinski committed Sep 30, 2024
1 parent c5f90e1 commit e459d88
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public class LiveUpdatesManagerProxy(private val managerProvider: () -> LiveUpda
return this.manager.getAllActiveUpdates().filter { it.type == request.type }.map { LiveUpdateProxy(it) }
}

public suspend fun listAll(): List<LiveUpdateProxy> {
return this.manager.getAllActiveUpdates().map { LiveUpdateProxy(it) }
}

public fun create(request: LiveUpdateRequest.Create) {
this.manager.start(
name = request.name,
Expand Down
20 changes: 10 additions & 10 deletions ios/AirshipFrameworkProxy/LiveActivity/LiveActivityManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,19 @@ public actor LiveActivityManager: Sendable {
}
}

public func list(_ request: LiveActivityRequest.List?) async throws -> [LiveActivityInfo] {
public func listAll() async throws -> [LiveActivityInfo] {
try await waitForSetup()

if let type = request?.attributesType {
return try self.findEntry(attributesType: type).list()
} else {
var liveActivities: [LiveActivityInfo] = []
for handler in self.entries.values {
liveActivities.append(contentsOf: try handler.list())
}

return liveActivities
var liveActivities: [LiveActivityInfo] = []
for handler in self.entries.values {
liveActivities.append(contentsOf: try handler.list())
}
return liveActivities
}

public func list(_ request: LiveActivityRequest.List) async throws -> [LiveActivityInfo] {
try await waitForSetup()
return try self.findEntry(attributesType: request.attributesType).list()
}

private func waitForSetup() async throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import AirshipCore
public struct LiveActivityRequest: Sendable, Equatable {

public struct List: Sendable, Equatable, Codable {
public var attributesType: String?
public var attributesType: String


public init(attributesType: String) {
Expand Down

0 comments on commit e459d88

Please sign in to comment.