@@ -115,6 +115,8 @@ public final class ChatLayout: UICollectionViewLayout {
115
115
/// There is an issue in IOS 15.1 that proposed content offset is being ignored by the UICollectionView when user is scrolling.
116
116
/// This flag enables a hack to compensate this offset later. You can disable it if necessary.
117
117
/// Bug reported: https://feedbackassistant.apple.com/feedback/9727104
118
+ ///
119
+ /// PS: This issue was fixed in 15.2
118
120
public var enableIOS15_1Fix : Bool = true
119
121
120
122
// MARK: Internal Properties
@@ -183,7 +185,7 @@ public final class ChatLayout: UICollectionViewLayout {
183
185
// MARK: IOS 15.1 fix flags
184
186
185
187
private var needsIOS15_1IssueFix : Bool {
186
- return enableIOS15_1Fix && isIOS15_1orHigher && isUserInitiatedScrolling && !controller. isAnimatedBoundsChange
188
+ return enableIOS15_1Fix && isIOS15_1orHigher && !isIOS15_2orHigher && isUserInitiatedScrolling && !controller. isAnimatedBoundsChange
187
189
}
188
190
189
191
// MARK: Constructors
@@ -497,8 +499,7 @@ public final class ChatLayout: UICollectionViewLayout {
497
499
let isAboveBottomEdge = originalAttributes. frame. minY. rounded ( ) <= visibleBounds. maxY. rounded ( )
498
500
499
501
if heightDifference != 0 ,
500
- ( keepContentOffsetAtBottomOnBatchUpdates && controller. contentHeight ( at: state) . rounded ( ) + heightDifference > visibleBounds. height. rounded ( ) )
501
- || isUserInitiatedScrolling,
502
+ ( keepContentOffsetAtBottomOnBatchUpdates && controller. contentHeight ( at: state) . rounded ( ) + heightDifference > visibleBounds. height. rounded ( ) ) || isUserInitiatedScrolling,
502
503
isAboveBottomEdge {
503
504
context. contentOffsetAdjustment. y += heightDifference
504
505
invalidationActions. formUnion ( [ . shouldInvalidateOnBoundsChange] )
@@ -958,20 +959,26 @@ extension ChatLayout {
958
959
959
960
}
960
961
961
- @inline ( __always)
962
- var isIOS13orHigher : Bool {
962
+ var isIOS13orHigher : Bool = {
963
963
if #available( iOS 13 . 0 , * ) {
964
964
return true
965
965
} else {
966
966
return false
967
967
}
968
- }
968
+ } ( )
969
969
970
- @inline ( __always)
971
- var isIOS15_1orHigher : Bool {
970
+ var isIOS15_1orHigher : Bool = {
972
971
if #available( iOS 15 . 1 , * ) {
973
972
return true
974
973
} else {
975
974
return false
976
975
}
977
- }
976
+ } ( )
977
+
978
+ var isIOS15_2orHigher : Bool = {
979
+ if #available( iOS 15 . 2 , * ) {
980
+ return true
981
+ } else {
982
+ return false
983
+ }
984
+ } ( )
0 commit comments