mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Display the store sizes under the developer options menu
This commit is contained in:
committed by
Stefan Ceriu
parent
8a1d0fe8b1
commit
53a20f2a89
+25
-4
@@ -18,11 +18,32 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(developerOptions: DeveloperOptionsProtocol, elementCallBaseURL: URL, appHooks: AppHooks) {
|
||||
let bindings = DeveloperOptionsScreenViewStateBindings(developerOptions: developerOptions)
|
||||
let state = DeveloperOptionsScreenViewState(elementCallBaseURL: elementCallBaseURL, appHooks: appHooks, bindings: bindings)
|
||||
init(developerOptions: DeveloperOptionsProtocol, elementCallBaseURL: URL, appHooks: AppHooks, clientProxy: ClientProxyProtocol) {
|
||||
super.init(initialViewState: .init(elementCallBaseURL: elementCallBaseURL,
|
||||
appHooks: appHooks,
|
||||
bindings: .init(developerOptions: developerOptions)))
|
||||
|
||||
super.init(initialViewState: state)
|
||||
Task {
|
||||
if case let .success(sizes) = await clientProxy.storeSizes() {
|
||||
let formatter = ByteCountFormatStyle(style: .file)
|
||||
|
||||
var components = [DeveloperOptionsScreenViewState.StoreSize]()
|
||||
if let cryptoStore = sizes.cryptoStore {
|
||||
components.append(.init(name: "CryptoStore", size: formatter.format(Int64(cryptoStore))))
|
||||
}
|
||||
if let stateStore = sizes.stateStore {
|
||||
components.append(.init(name: "StateStore", size: formatter.format(Int64(stateStore))))
|
||||
}
|
||||
if let eventCacheStore = sizes.eventCacheStore {
|
||||
components.append(.init(name: "EventCacheStore", size: formatter.format(Int64(eventCacheStore))))
|
||||
}
|
||||
if let mediaStore = sizes.mediaStore {
|
||||
components.append(.init(name: "MediaStore", size: formatter.format(Int64(mediaStore))))
|
||||
}
|
||||
|
||||
state.storeSizes = components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func process(viewAction: DeveloperOptionsScreenViewAction) {
|
||||
|
||||
Reference in New Issue
Block a user