mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Stories
This commit is contained in:
parent
a11401b352
commit
0564463540
@ -790,6 +790,44 @@ public final class PeerStoryListContext {
|
|||||||
finalUpdatedState = updatedState
|
finalUpdatedState = updatedState
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if case let .item(item) = item {
|
||||||
|
if let media = item.media {
|
||||||
|
var updatedState = finalUpdatedState ?? self.stateValue
|
||||||
|
updatedState.items[index] = EngineStoryItem(
|
||||||
|
id: item.id,
|
||||||
|
timestamp: item.timestamp,
|
||||||
|
expirationTimestamp: item.expirationTimestamp,
|
||||||
|
media: EngineMedia(media),
|
||||||
|
text: item.text,
|
||||||
|
entities: item.entities,
|
||||||
|
views: item.views.flatMap { views in
|
||||||
|
return EngineStoryItem.Views(
|
||||||
|
seenCount: views.seenCount,
|
||||||
|
seenPeers: views.seenPeerIds.compactMap { id -> EnginePeer? in
|
||||||
|
return peers[id].flatMap(EnginePeer.init)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
privacy: item.privacy.flatMap(EngineStoryPrivacy.init),
|
||||||
|
isPinned: item.isPinned,
|
||||||
|
isExpired: item.isExpired,
|
||||||
|
isPublic: item.isPublic,
|
||||||
|
isPending: false,
|
||||||
|
isCloseFriends: item.isCloseFriends,
|
||||||
|
isContacts: item.isContacts,
|
||||||
|
isSelectedContacts: item.isSelectedContacts,
|
||||||
|
isForwardingDisabled: item.isForwardingDisabled,
|
||||||
|
isEdited: item.isEdited
|
||||||
|
)
|
||||||
|
finalUpdatedState = updatedState
|
||||||
|
} else {
|
||||||
|
var updatedState = finalUpdatedState ?? self.stateValue
|
||||||
|
updatedState.items.remove(at: index)
|
||||||
|
updatedState.totalCount = max(0, updatedState.totalCount - 1)
|
||||||
|
finalUpdatedState = updatedState
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !self.isArchived {
|
if !self.isArchived {
|
||||||
@ -830,6 +868,42 @@ public final class PeerStoryListContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if case let .item(item) = item {
|
||||||
|
if let media = item.media {
|
||||||
|
var updatedState = finalUpdatedState ?? self.stateValue
|
||||||
|
updatedState.items.append(EngineStoryItem(
|
||||||
|
id: item.id,
|
||||||
|
timestamp: item.timestamp,
|
||||||
|
expirationTimestamp: item.expirationTimestamp,
|
||||||
|
media: EngineMedia(media),
|
||||||
|
text: item.text,
|
||||||
|
entities: item.entities,
|
||||||
|
views: item.views.flatMap { views in
|
||||||
|
return EngineStoryItem.Views(
|
||||||
|
seenCount: views.seenCount,
|
||||||
|
seenPeers: views.seenPeerIds.compactMap { id -> EnginePeer? in
|
||||||
|
return peers[id].flatMap(EnginePeer.init)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
},
|
||||||
|
privacy: item.privacy.flatMap(EngineStoryPrivacy.init),
|
||||||
|
isPinned: item.isPinned,
|
||||||
|
isExpired: item.isExpired,
|
||||||
|
isPublic: item.isPublic,
|
||||||
|
isPending: false,
|
||||||
|
isCloseFriends: item.isCloseFriends,
|
||||||
|
isContacts: item.isContacts,
|
||||||
|
isSelectedContacts: item.isSelectedContacts,
|
||||||
|
isForwardingDisabled: item.isForwardingDisabled,
|
||||||
|
isEdited: item.isEdited
|
||||||
|
))
|
||||||
|
updatedState.items.sort(by: { lhs, rhs in
|
||||||
|
return lhs.timestamp > rhs.timestamp
|
||||||
|
})
|
||||||
|
finalUpdatedState = updatedState
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1850,7 +1850,12 @@ public final class PeerInfoStoryPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
|
|||||||
let isSelecting = self._itemInteraction?.selectedIds != nil
|
let isSelecting = self._itemInteraction?.selectedIds != nil
|
||||||
self.itemGrid.pinchEnabled = !isSelecting
|
self.itemGrid.pinchEnabled = !isSelecting
|
||||||
|
|
||||||
self.view.disablesInteractiveTransitionGestureRecognizer = isSelecting
|
var enableDismissGesture = true
|
||||||
|
if let items = self.items, items.items.isEmpty {
|
||||||
|
} else if isSelecting {
|
||||||
|
enableDismissGesture = false
|
||||||
|
}
|
||||||
|
self.view.disablesInteractiveTransitionGestureRecognizer = enableDismissGesture
|
||||||
|
|
||||||
if isSelecting {
|
if isSelecting {
|
||||||
if self.gridSelectionGesture == nil {
|
if self.gridSelectionGesture == nil {
|
||||||
|
@ -677,12 +677,13 @@ public final class StoryPeerListComponent: Component {
|
|||||||
|
|
||||||
let calculateOverscrollEffectFraction: (CGFloat, CGFloat) -> CGFloat = { maxFraction, bounceFraction in
|
let calculateOverscrollEffectFraction: (CGFloat, CGFloat) -> CGFloat = { maxFraction, bounceFraction in
|
||||||
var expandEffectFraction: CGFloat = max(0.0, min(1.0, maxFraction))
|
var expandEffectFraction: CGFloat = max(0.0, min(1.0, maxFraction))
|
||||||
expandEffectFraction = 1.0 - pow(1.0 - expandEffectFraction, 2.0)
|
expandEffectFraction = pow(expandEffectFraction, 1.0)
|
||||||
|
|
||||||
let overscrollEffectFraction = max(0.0, maxFraction - 1.0)
|
let overscrollEffectFraction = max(0.0, maxFraction - 1.0)
|
||||||
expandEffectFraction += overscrollEffectFraction * 0.1
|
expandEffectFraction += overscrollEffectFraction * 0.12
|
||||||
|
|
||||||
expandEffectFraction += pow(bounceFraction, 1.4) * 0.2 * maxFraction
|
let reverseBounceFraction = 1.0 - pow(1.0 - bounceFraction, 2.4)
|
||||||
|
expandEffectFraction += reverseBounceFraction * 0.09 * maxFraction
|
||||||
|
|
||||||
return expandEffectFraction
|
return expandEffectFraction
|
||||||
}
|
}
|
||||||
@ -1269,6 +1270,8 @@ public final class StoryPeerListComponent: Component {
|
|||||||
titleContentOffset = titleMinContentOffset.interpolate(to: ((itemLayout.containerSize.width - collapsedState.titleWidth) * 0.5) as CGFloat, amount: min(1.0, collapsedState.maxFraction) * (1.0 - collapsedState.activityFraction))
|
titleContentOffset = titleMinContentOffset.interpolate(to: ((itemLayout.containerSize.width - collapsedState.titleWidth) * 0.5) as CGFloat, amount: min(1.0, collapsedState.maxFraction) * (1.0 - collapsedState.activityFraction))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
titleContentOffset += -expandBoundsFraction * 4.0
|
||||||
|
|
||||||
var titleIndicatorSize: CGSize?
|
var titleIndicatorSize: CGSize?
|
||||||
if collapsedState.activityFraction != 0.0 {
|
if collapsedState.activityFraction != 0.0 {
|
||||||
let collapsedItemMinX = collapsedContentOrigin - collapsedItemWidth * 0.5
|
let collapsedItemMinX = collapsedContentOrigin - collapsedItemWidth * 0.5
|
||||||
|
@ -113,7 +113,7 @@ private func calculateMergingCircleShape(center: CGPoint, leftCenter: CGPoint?,
|
|||||||
}
|
}
|
||||||
|
|
||||||
var startAngle = segmentSpacingAngle * 0.5 - CGFloat.pi * 0.5 + CGFloat(i) * (segmentSpacingAngle + segmentAngle)
|
var startAngle = segmentSpacingAngle * 0.5 - CGFloat.pi * 0.5 + CGFloat(i) * (segmentSpacingAngle + segmentAngle)
|
||||||
startAngle += -1.0 * (1.0 - rotationFraction) * CGFloat.pi * 2.0 * 0.5
|
startAngle += -1.0 * (1.0 - rotationFraction) * CGFloat.pi * 2.0 * 0.25
|
||||||
|
|
||||||
let endAngle = startAngle + segmentAngle
|
let endAngle = startAngle + segmentAngle
|
||||||
path.move(to: CGPoint(x: center.x + cos(startAngle) * radius, y: center.y + sin(startAngle) * radius))
|
path.move(to: CGPoint(x: center.x + cos(startAngle) * radius, y: center.y + sin(startAngle) * radius))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user