feat: Implement chat list and search functionality

- Added ChatListViewModel to manage chat list state and server search.
- Created ChatRowView for displaying individual chat rows.
- Developed SearchView and SearchViewModel for user search functionality.
- Introduced MainTabView for tab-based navigation between chats and settings.
- Implemented OnboardingPager for onboarding experience.
- Created SettingsView and SettingsViewModel for user settings management.
- Added SplashView for initial app launch experience.
This commit is contained in:
2026-02-25 21:27:41 +05:00
parent 7fb57fffba
commit 99a35302fa
54 changed files with 5818 additions and 213 deletions

View File

@@ -1,14 +1,57 @@
import SwiftUI
import Lottie
struct LottieView: UIViewRepresentable {
// MARK: - Animation Cache
final class LottieAnimationCache {
static let shared = LottieAnimationCache()
private var cache: [String: LottieAnimation] = [:]
private let lock = NSLock()
private init() {}
func animation(named name: String) -> LottieAnimation? {
lock.lock()
defer { lock.unlock() }
if let cached = cache[name] {
return cached
}
if let animation = LottieAnimation.named(name) {
cache[name] = animation
return animation
}
return nil
}
func preload(_ names: [String]) {
for name in names {
_ = animation(named: name)
}
}
}
// MARK: - LottieView
struct LottieView: UIViewRepresentable, Equatable {
let animationName: String
var loopMode: LottieLoopMode = .playOnce
var animationSpeed: CGFloat = 1.5
var isPlaying: Bool = true
static func == (lhs: LottieView, rhs: LottieView) -> Bool {
lhs.animationName == rhs.animationName &&
lhs.loopMode == rhs.loopMode &&
lhs.animationSpeed == rhs.animationSpeed &&
lhs.isPlaying == rhs.isPlaying
}
func makeUIView(context: Context) -> LottieAnimationView {
let animationView = LottieAnimationView(name: animationName)
let animationView: LottieAnimationView
if let cached = LottieAnimationCache.shared.animation(named: animationName) {
animationView = LottieAnimationView(animation: cached)
} else {
animationView = LottieAnimationView(name: animationName)
}
animationView.contentMode = .scaleAspectFit
animationView.loopMode = loopMode
animationView.animationSpeed = animationSpeed
@@ -21,13 +64,14 @@ struct LottieView: UIViewRepresentable {
}
func updateUIView(_ uiView: LottieAnimationView, context: Context) {
uiView.loopMode = loopMode
uiView.animationSpeed = animationSpeed
if isPlaying && !uiView.isAnimationPlaying {
uiView.play()
} else if !isPlaying {
uiView.stop()
if isPlaying {
if !uiView.isAnimationPlaying {
uiView.play()
}
} else {
if uiView.isAnimationPlaying {
uiView.stop()
}
}
}
}