Files
singlechat/ios/YpChat/Core/AppServices.swift
Torsten Schulz (local) 810b084e10 Refactor application structure and configuration
- Updated the application namespace and ID from "net.ypchat.app" to "de.ypchat.android" for better alignment with branding.
- Increased Gradle heap size settings to optimize build performance.
- Disabled dependency constraints to simplify dependency management.
- Removed obsolete files related to the previous application structure, including MainActivity, YpChatApp, and various core components, streamlining the codebase.

These changes collectively enhance the application's configuration and structure, improving maintainability and performance.
2026-05-12 14:25:55 +02:00

39 lines
1.3 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import Combine
import Foundation
/// DI-Container light analog `AppContainer.kt` inkl. `ChatRepository`.
final class AppServices: ObservableObject {
let api: RestAPIClient
let socket: SocketClient
let profileStore: ProfileStore
let repository: ChatRepository
private var cancellables = Set<AnyCancellable>()
init() {
let config = URLSessionConfiguration.default
config.httpCookieStorage = .shared
config.httpCookieAcceptPolicy = .always
config.httpShouldSetCookies = true
config.timeoutIntervalForRequest = 15
config.timeoutIntervalForResource = 30
let urlSession = URLSession(configuration: config)
let api = RestAPIClient(baseURLString: AppConfig.baseURL, session: urlSession)
let socket = SocketClient(baseURL: AppConfig.baseURL)
let profileStore = ProfileStore()
self.api = api
self.socket = socket
self.profileStore = profileStore
self.repository = ChatRepository(api: api, socket: socket, profileStore: profileStore)
repository.objectWillChange
.receive(on: RunLoop.main)
.sink { [weak self] _ in
self?.objectWillChange.send()
}
.store(in: &cancellables)
}
}