Skip to content

Commit b905e30

Browse files
memory improvements
1 parent c2a6f8c commit b905e30

File tree

7 files changed

+102
-15
lines changed

7 files changed

+102
-15
lines changed

DemoAppSwiftUI/DemoAppSwiftUIApp.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import StreamChatSwiftUI
99
@main
1010
struct DemoAppSwiftUIApp: App {
1111

12-
@StateObject var launchAnimationState = LaunchAnimationState()
12+
// @StateObject var launchAnimationState = LaunchAnimationState()
1313

1414
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
1515
@Injected(\.chatClient) public var chatClient: ChatClient
1616

1717
var body: some Scene {
1818
WindowGroup {
19-
if launchAnimationState.showAnimation {
20-
StreamLogoLaunch()
21-
} else {
22-
ChatChannelListView()
23-
}
24-
// ChatChannelListView()
19+
// if launchAnimationState.showAnimation {
20+
// StreamLogoLaunch()
21+
// } else {
22+
// ChatChannelListView()
23+
// }
24+
ChatChannelListView()
2525
/*
2626
//Example of custom query filters.
2727
ChatChannelListView(

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct ChatChannelView<Factory: ViewFactory>: View {
4040
onScrollToBottom: viewModel.scrollToLastMessage,
4141
onLongPress: { displayInfo in
4242
withAnimation {
43-
self.messageDisplayInfo = displayInfo
43+
messageDisplayInfo = displayInfo
4444
viewModel.showReactionOverlay()
4545
}
4646
}

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ public class ChatChannelViewModel: ObservableObject, ChatChannelControllerDelega
163163
}
164164

165165
private func checkForNewMessages(index: Int) {
166-
if index < channelController.messages.count - 10 {
166+
if index < channelController.messages.count - 25 {
167167
return
168168
}
169169

170170
if _loadingPreviousMessages.compareAndSwap(old: false, new: true) {
171-
channelController.loadPreviousMessages(completion: { [weak self] _ in
171+
channelController.loadPreviousMessages(limit: 250, completion: { [weak self] _ in
172172
guard let self = self else { return }
173173
self.loadingPreviousMessages = false
174174
})

Sources/StreamChatSwiftUI/ChatChannel/MessageList/ImageAttachmentView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ struct LazyLoadingImage: View {
229229
}
230230
}
231231
}
232+
.onDisappear(.reset)
232233
.processors([ImageProcessors.Resize(width: width)])
233234
.priority(.high)
234235
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1310"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "8465FCBB27468B6900AF091E"
18+
BuildableName = "DemoAppSwiftUI.app"
19+
BlueprintName = "DemoAppSwiftUI"
20+
ReferencedContainer = "container:StreamChatSwiftUI.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "8465FCBB27468B6900AF091E"
48+
BuildableName = "DemoAppSwiftUI.app"
49+
BlueprintName = "DemoAppSwiftUI"
50+
ReferencedContainer = "container:StreamChatSwiftUI.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Debug"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "8465FCBB27468B6900AF091E"
65+
BuildableName = "DemoAppSwiftUI.app"
66+
BlueprintName = "DemoAppSwiftUI"
67+
ReferencedContainer = "container:StreamChatSwiftUI.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

StreamChatSwiftUI.xcodeproj/xcuserdata/martinmitrevski.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,41 @@
77
<key>DemoAppSwiftUI.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>1</integer>
10+
<integer>0</integer>
1111
</dict>
1212
<key>Stream (Playground) 1.xcscheme</key>
1313
<dict>
1414
<key>isShown</key>
1515
<false/>
1616
<key>orderHint</key>
17-
<integer>2</integer>
17+
<integer>3</integer>
1818
</dict>
1919
<key>Stream (Playground) 2.xcscheme</key>
2020
<dict>
2121
<key>isShown</key>
2222
<false/>
2323
<key>orderHint</key>
24-
<integer>3</integer>
24+
<integer>4</integer>
2525
</dict>
2626
<key>Stream (Playground).xcscheme</key>
2727
<dict>
2828
<key>isShown</key>
2929
<false/>
3030
<key>orderHint</key>
31-
<integer>1</integer>
31+
<integer>2</integer>
3232
</dict>
3333
<key>StreamChatSwiftUI.xcscheme_^#shared#^_</key>
3434
<dict>
3535
<key>orderHint</key>
36-
<integer>0</integer>
36+
<integer>1</integer>
37+
</dict>
38+
</dict>
39+
<key>SuppressBuildableAutocreation</key>
40+
<dict>
41+
<key>8465FCBB27468B6900AF091E</key>
42+
<dict>
43+
<key>primary</key>
44+
<true/>
3745
</dict>
3846
</dict>
3947
</dict>

0 commit comments

Comments
 (0)