mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix crash
This commit is contained in:
parent
81b29394ec
commit
f12d18f90e
|
@ -7,6 +7,7 @@
|
||||||
// • Slight paging glitch
|
// • Slight paging glitch
|
||||||
// • Scrolling bug
|
// • Scrolling bug
|
||||||
// • Scroll button bug
|
// • Scroll button bug
|
||||||
|
// • Image detail VC transition glitch
|
||||||
|
|
||||||
final class ConversationVC : BaseVC, ConversationViewModelDelegate, UITableViewDataSource, UITableViewDelegate {
|
final class ConversationVC : BaseVC, ConversationViewModelDelegate, UITableViewDataSource, UITableViewDelegate {
|
||||||
let thread: TSThread
|
let thread: TSThread
|
||||||
|
|
|
@ -113,6 +113,10 @@ final class LinkPreviewViewV2 : UIView {
|
||||||
private func update() {
|
private func update() {
|
||||||
cancelButton.removeFromSuperview()
|
cancelButton.removeFromSuperview()
|
||||||
guard let linkPreviewState = linkPreviewState else { return }
|
guard let linkPreviewState = linkPreviewState else { return }
|
||||||
|
var image = linkPreviewState.image()
|
||||||
|
if image == nil && (linkPreviewState is LinkPreviewDraft || linkPreviewState is LinkPreviewSent) {
|
||||||
|
image = UIImage(named: "Link")?.withTint(isLightMode ? .black : .white)
|
||||||
|
}
|
||||||
// Image view
|
// Image view
|
||||||
let imageViewContainerSize: CGFloat = (linkPreviewState is LinkPreviewSent) ? 100 : 80
|
let imageViewContainerSize: CGFloat = (linkPreviewState is LinkPreviewSent) ? 100 : 80
|
||||||
imageViewContainerWidthConstraint.constant = imageViewContainerSize
|
imageViewContainerWidthConstraint.constant = imageViewContainerSize
|
||||||
|
@ -123,10 +127,11 @@ final class LinkPreviewViewV2 : UIView {
|
||||||
} else {
|
} else {
|
||||||
imageViewContainer.backgroundColor = isDarkMode ? .black : UIColor.black.withAlphaComponent(0.06)
|
imageViewContainer.backgroundColor = isDarkMode ? .black : UIColor.black.withAlphaComponent(0.06)
|
||||||
}
|
}
|
||||||
imageView.image = linkPreviewState.image()
|
imageView.image = image
|
||||||
|
imageView.contentMode = (linkPreviewState.image() == nil) ? .center : .scaleAspectFill
|
||||||
// Loader
|
// Loader
|
||||||
loader.alpha = (linkPreviewState.image() != nil) ? 0 : 1
|
loader.alpha = (image != nil) ? 0 : 1
|
||||||
if linkPreviewState.image() != nil { loader.stopAnimating() } else { loader.startAnimating() }
|
if image != nil { loader.stopAnimating() } else { loader.startAnimating() }
|
||||||
// Title
|
// Title
|
||||||
let isSent = (linkPreviewState is LinkPreviewSent)
|
let isSent = (linkPreviewState is LinkPreviewSent)
|
||||||
let isOutgoing = (viewItem?.interaction.interactionType() == .outgoingMessage)
|
let isOutgoing = (viewItem?.interaction.interactionType() == .outgoingMessage)
|
||||||
|
|
|
@ -111,8 +111,6 @@ public class LinkPreviewDraft: NSObject, LinkPreviewState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func image() -> UIImage? {
|
public func image() -> UIImage? {
|
||||||
assert(imageState() == .loaded)
|
|
||||||
|
|
||||||
guard let jpegImageData = linkPreviewDraft.jpegImageData else {
|
guard let jpegImageData = linkPreviewDraft.jpegImageData else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -197,10 +195,7 @@ public class LinkPreviewSent: NSObject, LinkPreviewState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func image() -> UIImage? {
|
public func image() -> UIImage? {
|
||||||
assert(imageState() == .loaded)
|
|
||||||
|
|
||||||
guard let attachmentStream = imageAttachment as? TSAttachmentStream else {
|
guard let attachmentStream = imageAttachment as? TSAttachmentStream else {
|
||||||
owsFailDebug("Could not load image.")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
guard attachmentStream.isImage,
|
guard attachmentStream.isImage,
|
||||||
|
|
12
Session/Meta/Images.xcassets/Session/Link.imageset/Contents.json
vendored
Normal file
12
Session/Meta/Images.xcassets/Session/Link.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"filename" : "Link.pdf",
|
||||||
|
"idiom" : "universal"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
182
Session/Meta/Images.xcassets/Session/Link.imageset/Link.pdf
vendored
Normal file
182
Session/Meta/Images.xcassets/Session/Link.imageset/Link.pdf
vendored
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
%PDF-1.7
|
||||||
|
|
||||||
|
1 0 obj
|
||||||
|
<< /BBox [ 0.000000 0.000000 24.000000 24.000000 ]
|
||||||
|
/Resources << >>
|
||||||
|
/Subtype /Form
|
||||||
|
/Length 2 0 R
|
||||||
|
/Group << /Type /Group
|
||||||
|
/S /Transparency
|
||||||
|
>>
|
||||||
|
/Type /XObject
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
/DeviceRGB CS
|
||||||
|
/DeviceRGB cs
|
||||||
|
q
|
||||||
|
1.000000 0.000000 -0.000000 1.000000 0.000000 -1.389473 cm
|
||||||
|
0.000000 0.000000 0.000000 scn
|
||||||
|
15.309964 16.699244 m
|
||||||
|
18.110605 13.895697 18.072166 9.400900 15.326838 6.640337 c
|
||||||
|
15.321682 6.634712 15.315589 6.628616 15.309964 6.622992 c
|
||||||
|
12.159963 3.472992 l
|
||||||
|
9.381680 0.694710 4.861571 0.695086 2.083711 3.472992 c
|
||||||
|
-0.694571 6.250805 -0.694571 10.771430 2.083711 13.549243 c
|
||||||
|
3.823056 15.288588 l
|
||||||
|
4.284306 15.749838 5.078650 15.443274 5.102462 14.791431 c
|
||||||
|
5.132837 13.960712 5.281806 13.126102 5.556681 12.320134 c
|
||||||
|
5.649775 12.047228 5.583260 11.745353 5.379353 11.541447 c
|
||||||
|
4.765900 10.927994 l
|
||||||
|
3.452181 9.614275 3.410977 7.475180 4.711759 6.148617 c
|
||||||
|
6.025384 4.808975 8.184541 4.801008 9.508245 6.124712 c
|
||||||
|
12.658244 9.274244 l
|
||||||
|
13.979698 10.595697 13.974167 12.731603 12.658244 14.047524 c
|
||||||
|
12.484760 14.220681 12.310010 14.355212 12.173510 14.449197 c
|
||||||
|
12.076943 14.515509 11.997212 14.603470 11.940674 14.706064 c
|
||||||
|
11.884135 14.808659 11.852356 14.923047 11.847870 15.040103 c
|
||||||
|
11.829308 15.535432 12.004807 16.045853 12.396214 16.437260 c
|
||||||
|
13.383121 17.424213 l
|
||||||
|
13.641917 17.683010 14.047901 17.714790 14.347995 17.505354 c
|
||||||
|
14.691668 17.265377 15.013565 16.995634 15.309964 16.699244 c
|
||||||
|
15.309964 16.699244 l
|
||||||
|
h
|
||||||
|
21.916294 23.305902 m
|
||||||
|
19.138433 26.083809 14.618324 26.084185 11.840042 23.305902 c
|
||||||
|
8.690041 20.155901 l
|
||||||
|
8.684416 20.150276 8.678322 20.144184 8.673166 20.138557 c
|
||||||
|
5.927884 17.377995 5.889400 12.883197 8.690041 10.079649 c
|
||||||
|
8.986423 9.783272 9.308305 9.513546 9.651963 9.273586 c
|
||||||
|
9.952058 9.064150 10.358088 9.095978 10.616838 9.354727 c
|
||||||
|
11.603745 10.341681 l
|
||||||
|
11.995152 10.733087 12.170650 11.243508 12.152088 11.738837 c
|
||||||
|
12.147602 11.855893 12.115823 11.970282 12.059285 12.072876 c
|
||||||
|
12.002747 12.175470 11.923014 12.263433 11.826448 12.329744 c
|
||||||
|
11.689948 12.423729 11.515198 12.558260 11.341714 12.731416 c
|
||||||
|
10.025791 14.047338 10.020260 16.183245 11.341714 17.504698 c
|
||||||
|
14.491714 20.654230 l
|
||||||
|
15.815417 21.977934 17.974527 21.969965 19.288198 20.630323 c
|
||||||
|
20.588980 19.303761 20.547825 17.164665 19.234058 15.850946 c
|
||||||
|
18.620605 15.237494 l
|
||||||
|
18.416700 15.033587 18.350183 14.731712 18.443277 14.458806 c
|
||||||
|
18.718151 13.652838 18.867121 12.818229 18.897495 11.987510 c
|
||||||
|
18.921356 11.335666 19.715652 11.029102 20.176903 11.490353 c
|
||||||
|
21.916246 13.229697 l
|
||||||
|
24.694574 16.007463 24.694576 20.528090 21.916294 23.305902 c
|
||||||
|
21.916294 23.305902 l
|
||||||
|
h
|
||||||
|
f
|
||||||
|
n
|
||||||
|
Q
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
|
||||||
|
2 0 obj
|
||||||
|
2367
|
||||||
|
endobj
|
||||||
|
|
||||||
|
3 0 obj
|
||||||
|
<< /BBox [ 0.000000 0.000000 24.000000 24.000000 ]
|
||||||
|
/Resources << >>
|
||||||
|
/Subtype /Form
|
||||||
|
/Length 4 0 R
|
||||||
|
/Group << /Type /Group
|
||||||
|
/S /Transparency
|
||||||
|
>>
|
||||||
|
/Type /XObject
|
||||||
|
>>
|
||||||
|
stream
|
||||||
|
/DeviceRGB CS
|
||||||
|
/DeviceRGB cs
|
||||||
|
q
|
||||||
|
1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
|
||||||
|
0.000000 0.000000 0.000000 scn
|
||||||
|
0.000000 24.000000 m
|
||||||
|
24.000000 24.000000 l
|
||||||
|
24.000000 0.000000 l
|
||||||
|
0.000000 0.000000 l
|
||||||
|
0.000000 24.000000 l
|
||||||
|
h
|
||||||
|
f
|
||||||
|
n
|
||||||
|
Q
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
|
||||||
|
4 0 obj
|
||||||
|
232
|
||||||
|
endobj
|
||||||
|
|
||||||
|
5 0 obj
|
||||||
|
<< /XObject << /X1 1 0 R >>
|
||||||
|
/ExtGState << /E1 << /SMask << /Type /Mask
|
||||||
|
/G 3 0 R
|
||||||
|
/S /Alpha
|
||||||
|
>>
|
||||||
|
/Type /ExtGState
|
||||||
|
>> >>
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
6 0 obj
|
||||||
|
<< /Length 7 0 R >>
|
||||||
|
stream
|
||||||
|
/DeviceRGB CS
|
||||||
|
/DeviceRGB cs
|
||||||
|
q
|
||||||
|
/E1 gs
|
||||||
|
/X1 Do
|
||||||
|
Q
|
||||||
|
|
||||||
|
endstream
|
||||||
|
endobj
|
||||||
|
|
||||||
|
7 0 obj
|
||||||
|
46
|
||||||
|
endobj
|
||||||
|
|
||||||
|
8 0 obj
|
||||||
|
<< /Annots []
|
||||||
|
/Type /Page
|
||||||
|
/MediaBox [ 0.000000 0.000000 24.000000 24.000000 ]
|
||||||
|
/Resources 5 0 R
|
||||||
|
/Contents 6 0 R
|
||||||
|
/Parent 9 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
9 0 obj
|
||||||
|
<< /Kids [ 8 0 R ]
|
||||||
|
/Count 1
|
||||||
|
/Type /Pages
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
10 0 obj
|
||||||
|
<< /Type /Catalog
|
||||||
|
/Pages 9 0 R
|
||||||
|
>>
|
||||||
|
endobj
|
||||||
|
|
||||||
|
xref
|
||||||
|
0 11
|
||||||
|
0000000000 65535 f
|
||||||
|
0000000010 00000 n
|
||||||
|
0000002625 00000 n
|
||||||
|
0000002648 00000 n
|
||||||
|
0000003128 00000 n
|
||||||
|
0000003150 00000 n
|
||||||
|
0000003448 00000 n
|
||||||
|
0000003550 00000 n
|
||||||
|
0000003571 00000 n
|
||||||
|
0000003744 00000 n
|
||||||
|
0000003818 00000 n
|
||||||
|
trailer
|
||||||
|
<< /ID [ (some) (id) ]
|
||||||
|
/Root 10 0 R
|
||||||
|
/Size 11
|
||||||
|
>>
|
||||||
|
startxref
|
||||||
|
3878
|
||||||
|
%%EOF
|
Loading…
Reference in a new issue