element-ios/Riot/Modules/Common/Recents/Service/RecentsListServiceProtocol.swift

103 lines
2.9 KiB
Swift
Raw Normal View History

2021-10-04 14:28:21 +00:00
//
// Copyright 2021 New Vector 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
@objc
public protocol RecentsListServiceProtocol {
2021-10-05 10:29:41 +00:00
// MARK: - Properties
/// Current mode
2021-10-04 14:28:21 +00:00
var mode: RecentsDataSourceMode { get }
2021-10-05 10:29:41 +00:00
/// Query to filter rooms
2021-10-04 14:28:21 +00:00
var query: String? { get }
2021-10-05 10:29:41 +00:00
/// Current space
2021-10-04 14:28:21 +00:00
var space: MXSpace? { get }
2021-10-05 10:29:41 +00:00
// MARK: - Data
/// Invited rooms for current mode
2021-10-04 14:28:21 +00:00
var invitedRoomListData: MXRoomListData? { get }
2021-10-05 10:29:41 +00:00
/// Favorited rooms for current mode
2021-10-04 14:28:21 +00:00
var favoritedRoomListData: MXRoomListData? { get }
2021-10-05 10:29:41 +00:00
/// Direct rooms for current mode
2021-10-04 14:28:21 +00:00
var peopleRoomListData: MXRoomListData? { get }
2021-10-05 10:29:41 +00:00
/// Rooms for current mode
2021-10-04 14:28:21 +00:00
var conversationRoomListData: MXRoomListData? { get }
2021-10-05 10:29:41 +00:00
/// Low priority rooms for current mode
2021-10-04 14:28:21 +00:00
var lowPriorityRoomListData: MXRoomListData? { get }
2021-10-05 10:29:41 +00:00
/// Server notice rooms for current mode
2021-10-04 14:28:21 +00:00
var serverNoticeRoomListData: MXRoomListData? { get }
2021-10-05 10:29:41 +00:00
/// Suggested rooms for current mode
2021-10-04 14:28:21 +00:00
var suggestedRoomListData: MXRoomListData? { get }
// MARK: Discussion counts
2021-10-05 10:29:41 +00:00
/// Counts for favorite screen
2021-10-04 14:28:21 +00:00
var favoritedMissedDiscussionsCount: DiscussionsCount { get }
2021-10-05 10:29:41 +00:00
/// Counts for people screen
2021-10-04 14:28:21 +00:00
var peopleMissedDiscussionsCount: DiscussionsCount { get }
2021-10-05 10:29:41 +00:00
/// Counts for rooms screen
2021-10-04 14:28:21 +00:00
var conversationMissedDiscussionsCount: DiscussionsCount { get }
2021-10-05 10:29:41 +00:00
/// Total number of rooms visible in one screen. Can be used to display an empty view
2021-10-04 14:28:21 +00:00
var totalVisibleItemCount: Int { get }
// MARK: - Methods
2021-10-05 10:29:41 +00:00
/// Upte mode function
/// - Parameter mode: new mode
2021-10-04 14:28:21 +00:00
func updateMode(_ mode: RecentsDataSourceMode)
2021-10-05 10:29:41 +00:00
/// Update query to filter rooms
/// - Parameter query: new query
2021-10-04 14:28:21 +00:00
func updateQuery(_ query: String?)
2021-10-05 10:29:41 +00:00
/// Update current space
/// - Parameter space: new space
2021-10-04 14:28:21 +00:00
func updateSpace(_ space: MXSpace?)
2021-10-05 10:29:41 +00:00
/// Refresh recents
2021-10-04 14:28:21 +00:00
func refresh()
2021-10-05 10:29:41 +00:00
/// Stop service. Do not use after stopping.
2021-10-04 14:28:21 +00:00
func stop()
// MARK: - Delegate
2021-10-05 10:29:41 +00:00
/// Add delegate instance for the service
/// - Parameter delegate: new delegate
2021-10-04 14:28:21 +00:00
func addDelegate(_ delegate: RecentsListServiceDelegate)
2021-10-05 10:29:41 +00:00
/// Remove given delegate instance
/// - Parameter delegate: delegate to be removed
2021-10-04 14:28:21 +00:00
func removeDelegate(_ delegate: RecentsListServiceDelegate)
2021-10-05 10:29:41 +00:00
/// Remove all delegates
2021-10-04 14:28:21 +00:00
func removeAllDelegates()
}