@@ -129,41 +129,43 @@ private final class GiftAuctionViewSheetContent: CombinedComponent {
129129 }
130130 self . giftUpgradeAttributes = attributes
131131
132- let randomModels = Array ( attributes. filter ( { attribute in
133- if case . model = attribute {
134- return true
135- } else {
136- return false
137- }
138- } ) . shuffled ( ) . prefix ( 5 ) )
139- self . previewModels = randomModels
140-
141- let randomBackdrops = Array ( attributes. filter ( { attribute in
142- if case . backdrop = attribute {
143- return true
144- } else {
145- return false
132+ if self . previewModels. isEmpty {
133+ let randomModels = Array ( attributes. filter ( { attribute in
134+ if case . model = attribute {
135+ return true
136+ } else {
137+ return false
138+ }
139+ } ) . shuffled ( ) . prefix ( 5 ) )
140+ self . previewModels = randomModels
141+
142+ let randomBackdrops = Array ( attributes. filter ( { attribute in
143+ if case . backdrop = attribute {
144+ return true
145+ } else {
146+ return false
147+ }
148+ } ) . shuffled ( ) )
149+ self . previewBackdrops = randomBackdrops
150+
151+ let randomSymbols = Array ( attributes. filter ( { attribute in
152+ if case . pattern = attribute {
153+ return true
154+ } else {
155+ return false
156+ }
157+ } ) . shuffled ( ) . prefix ( 5 ) )
158+ self . previewSymbols = randomSymbols
159+
160+ for case let . model( _, file, _) in self . previewModels where !self . fetchedFiles. contains ( file. fileId. id) {
161+ self . disposables. add ( freeMediaFileResourceInteractiveFetched ( account: context. account, userLocation: . other, fileReference: . standalone( media: file) , resource: file. resource) . start ( ) )
162+ self . fetchedFiles. insert ( file. fileId. id)
146163 }
147- } ) . shuffled ( ) )
148- self . previewBackdrops = randomBackdrops
149-
150- let randomSymbols = Array ( attributes. filter ( { attribute in
151- if case . pattern = attribute {
152- return true
153- } else {
154- return false
164+
165+ for case let . pattern( _, file, _) in self . previewSymbols where !self . fetchedFiles. contains ( file. fileId. id) {
166+ self . disposables. add ( freeMediaFileResourceInteractiveFetched ( account: context. account, userLocation: . other, fileReference: . standalone( media: file) , resource: file. resource) . start ( ) )
167+ self . fetchedFiles. insert ( file. fileId. id)
155168 }
156- } ) . shuffled ( ) . prefix ( 5 ) )
157- self . previewSymbols = randomSymbols
158-
159- for case let . model( _, file, _) in self . previewModels where !self . fetchedFiles. contains ( file. fileId. id) {
160- self . disposables. add ( freeMediaFileResourceInteractiveFetched ( account: context. account, userLocation: . other, fileReference: . standalone( media: file) , resource: file. resource) . start ( ) )
161- self . fetchedFiles. insert ( file. fileId. id)
162- }
163-
164- for case let . pattern( _, file, _) in self . previewSymbols where !self . fetchedFiles. contains ( file. fileId. id) {
165- self . disposables. add ( freeMediaFileResourceInteractiveFetched ( account: context. account, userLocation: . other, fileReference: . standalone( media: file) , resource: file. resource) . start ( ) )
166- self . fetchedFiles. insert ( file. fileId. id)
167169 }
168170
169171 self . updated ( )
0 commit comments