Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Mixin.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_video_bold@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_video_bold@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions Mixin/Assets.xcassets/ic_media_close.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_media_close@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "ic_media_close_dark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_media_close@3x.png",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "ic_media_close_dark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Mixin/Assets.xcassets/ic_photo_checkmark.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_photo_checkmark@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_photo_checkmark@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions Mixin/Assets.xcassets/ic_photo_unselected.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_photo_unselected@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_photo_unselected@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_photo_unselected_narrow@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_photo_unselected_narrow@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class PhotoInputGridCell: UICollectionViewCell {
@IBOutlet weak var imageWrapperView: UIView!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var mediaTypeView: MediaTypeOverlayView!
@IBOutlet weak var statusImageView: UIImageView!
@IBOutlet weak var indexLabel: UILabel!
@IBOutlet weak var overlayView: UIView!

let cornerRadius: CGFloat = 8

Expand All @@ -30,6 +33,20 @@ class PhotoInputGridCell: UICollectionViewCell {
imageView.image = nil
}

func updateBadge(with index: Int?) {
if let index = index {
indexLabel.text = "\(index + 1)"
statusImageView.backgroundColor = .theme
statusImageView.image = nil
overlayView.isHidden = false
} else {
indexLabel.text = nil
statusImageView.backgroundColor = .clear
statusImageView.image = R.image.ic_photo_unselected_narrow()
overlayView.isHidden = true
}
}

private func updateShadowPathIfNeeded() {
guard imageWrapperView.frame != lastImageWrapperFrame else {
return
Expand Down
50 changes: 50 additions & 0 deletions Mixin/UserInterface/Controllers/Chat/Cells/SelectedMediaCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import UIKit
import Photos
import SDWebImage
import CoreServices
import MixinServices

class SelectedMediaCell: UICollectionViewCell {

@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var mediaTypeView: MediaTypeOverlayView!

var deselectAsset: (() -> Void)?

private var requestId: PHImageRequestID?
private lazy var imageRequestOptions: PHImageRequestOptions = {
let options = PHImageRequestOptions()
options.version = .current
options.deliveryMode = .opportunistic
options.isNetworkAccessAllowed = true
return options
}()

override func prepareForReuse() {
super.prepareForReuse()
imageView.image = nil
if let id = requestId {
PHCachingImageManager.default().cancelImageRequest(id)
}
}

func load(asset: PHAsset, size: CGSize) {
if asset.mediaType == .video {
mediaTypeView.style = .video(duration: asset.duration)
} else {
if let uti = asset.uniformTypeIdentifier, UTTypeConformsTo(uti as CFString, kUTTypeGIF) {
mediaTypeView.style = .gif
} else {
mediaTypeView.style = .hidden
}
}
requestId = PHImageManager.default().requestImage(for: asset, targetSize: size * UIScreen.main.scale, contentMode: .aspectFill, options: imageRequestOptions) { [weak self] (image, info) in
self?.imageView.image = image
}
}

@IBAction func closeAction(_ sender: Any) {
deselectAsset?()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import UIKit

class StackedPhotoMessageCell: ImageMessageCell {

static let contentCornerRadius: CGFloat = 13

private let stackedPhotoView = StackedPhotoView()

override func prepareForReuse() {
super.prepareForReuse()
stackedPhotoView.viewModels = []
}

override func render(viewModel: MessageViewModel) {
super.render(viewModel: viewModel)
if let viewModel = viewModel as? StackedPhotoMessageViewModel {
stackedPhotoView.viewModels = viewModel.photoMessageViewModels
stackedPhotoView.frame = viewModel.stackedPhotoViewFrame
selectedOverlapView.frame = viewModel.photoFrame
trailingInfoBackgroundView.frame = viewModel.trailingInfoBackgroundFrame
}
}

override func prepare() {
messageContentView.addSubview(stackedPhotoView)
updateAppearance(highlight: false, animated: false)
messageContentView.addSubview(trailingInfoBackgroundView)
super.prepare()
selectedOverlapView.layer.cornerRadius = Self.contentCornerRadius
backgroundImageView.removeFromSuperview()
stackedPhotoView.backgroundColor = .clear
statusImageView.alpha = 0.9
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,11 @@ class ConversationInputViewController: UIViewController {
self?.quote = nil
}

let recognizer = InteractiveResizeGestureRecognizer(target: self, action: #selector(interactiveResizeAction(_:)))
recognizer.delegate = self
view.addGestureRecognizer(recognizer)
if ScreenHeight.current > .short {
let recognizer = InteractiveResizeGestureRecognizer(target: self, action: #selector(interactiveResizeAction(_:)))
recognizer.delegate = self
view.addGestureRecognizer(recognizer)
}
}

func update(opponentUser user: UserItem) {
Expand All @@ -417,6 +419,7 @@ class ConversationInputViewController: UIViewController {
if minimize {
setPreferredContentHeightAnimated(.minimized)
}
photoViewController.dismissSelectedPhotoInputItemsViewControllerIfNeeded()
UIView.animate(withDuration: 0.5, delay: 0, options: .overdampedCurve) {
self.customInputContainerView.alpha = 0
} completion: { _ in
Expand Down
Loading