mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean up present & dismiss animations for image attachment view.
// FREEBIE
This commit is contained in:
parent
6a3b462541
commit
593c3d53d4
|
@ -274,14 +274,19 @@
|
|||
presentViewController:self
|
||||
animated:NO
|
||||
completion:^{
|
||||
[UIView animateWithDuration:0.4f
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
self.imageView.frame = [self.view convertRect:self.originRect
|
||||
fromView:window];
|
||||
|
||||
[UIView animateWithDuration:0.25f
|
||||
delay:0
|
||||
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
|
||||
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseOut
|
||||
animations:^() {
|
||||
self.view.alpha = 1.0f;
|
||||
self.imageView.frame = [self resizedFrameForImageView:self.image.size];
|
||||
self.imageView.center =
|
||||
CGPointMake(self.view.bounds.size.width / 2.0f, self.view.bounds.size.height / 2.0f);
|
||||
CGPointMake(self.view.bounds.size.width / 2.0f,
|
||||
self.view.bounds.size.height / 2.0f);
|
||||
}
|
||||
completion:^(BOOL completed) {
|
||||
self.scrollView.frame = self.view.bounds;
|
||||
|
@ -296,9 +301,9 @@
|
|||
|
||||
- (void)dismiss {
|
||||
self.view.userInteractionEnabled = NO;
|
||||
[UIView animateWithDuration:0.4f
|
||||
[UIView animateWithDuration:0.25f
|
||||
delay:0
|
||||
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseInOut
|
||||
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveLinear
|
||||
animations:^() {
|
||||
self.backgroundView.backgroundColor = [UIColor clearColor];
|
||||
self.scrollView.alpha = 0;
|
||||
|
@ -315,7 +320,6 @@
|
|||
[self updateLayouts];
|
||||
}
|
||||
|
||||
|
||||
- (void)updateLayouts {
|
||||
if (_isPresenting) {
|
||||
return;
|
||||
|
@ -327,7 +331,6 @@
|
|||
self.scrollView.contentInset = [self contentInsetForScrollView:self.scrollView.zoomScale];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Resizing
|
||||
|
||||
- (CGRect)resizedFrameForImageView:(CGSize)imageSize {
|
||||
|
|
|
@ -1165,9 +1165,12 @@ typedef enum : NSUInteger {
|
|||
if(tappedImage == nil) {
|
||||
DDLogWarn(@"tapped TSPhotoAdapter with nil image");
|
||||
} else {
|
||||
CGRect convertedRect =
|
||||
[self.collectionView convertRect:[collectionView cellForItemAtIndexPath:indexPath].frame
|
||||
toView:nil];
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
JSQMessagesCollectionViewCell *cell = (JSQMessagesCollectionViewCell *) [collectionView cellForItemAtIndexPath:indexPath];
|
||||
OWSAssert([cell isKindOfClass:[JSQMessagesCollectionViewCell class]]);
|
||||
CGRect convertedRect = [cell.mediaView convertRect:cell.mediaView.bounds
|
||||
toView:window];
|
||||
|
||||
__block TSAttachment *attachment = nil;
|
||||
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
attachment =
|
||||
|
@ -1193,9 +1196,12 @@ typedef enum : NSUInteger {
|
|||
if(tappedImage == nil) {
|
||||
DDLogWarn(@"tapped TSAnimatedAdapter with nil image");
|
||||
} else {
|
||||
CGRect convertedRect =
|
||||
[self.collectionView convertRect:[collectionView cellForItemAtIndexPath:indexPath].frame
|
||||
toView:nil];
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
JSQMessagesCollectionViewCell *cell = (JSQMessagesCollectionViewCell *) [collectionView cellForItemAtIndexPath:indexPath];
|
||||
OWSAssert([cell isKindOfClass:[JSQMessagesCollectionViewCell class]]);
|
||||
CGRect convertedRect = [cell.mediaView convertRect:cell.mediaView.bounds
|
||||
toView:window];
|
||||
|
||||
__block TSAttachment *attachment = nil;
|
||||
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
attachment =
|
||||
|
|
Loading…
Reference in a new issue