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
72 changes: 72 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" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"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" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"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.
17 changes: 17 additions & 0 deletions Mixin/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,23 @@
"chat_pick_from_library" = "Pick from Library";
"chat_manage_photo_auth" = "Manage";
"chat_photo_select_more" = "Select More Photos";
"chat_media_preview_select_photos" = "Selected %d Photos";
"chat_media_preview_select_photo" = "Selected 1 Photo";
"chat_media_preview_select_videos" = "Selected %d Videos";
"chat_media_preview_select_video" = "Selected 1 Video";
"chat_media_preview_select_items" = "Selected %d Items";
"chat_media_preview_select_item" = "Selected 1 Item";
"chat_media_preview_select_no_item" = "No Items Selected";
"chat_media_preview_send_photos" = "Send %d Photos";
"chat_media_preview_send_photo" = "Send 1 Photo";
"chat_media_preview_send_videos" = "Send %d Videos";
"chat_media_preview_send_video" = "Send 1 Video";
"chat_media_preview_send_items" = "Send %d Items";
"chat_media_preview_send_item" = "Send 1 Item";
"chat_media_preview_send_files" = "Send as Files";
"chat_media_preview_send_file" = "Send as File";
"chat_media_send_count" = "Send(%d)";
"chat_photo_preview_count" = "%d Photos";

// Pin
"chat_pinned_general_message" = "%@ pinned a message";
Expand Down
17 changes: 17 additions & 0 deletions Mixin/Resources/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,23 @@
"chat_pick_from_library" = "打开相册";
"chat_manage_photo_auth" = "更改设置";
"chat_photo_select_more" = "选择更多照片";
"chat_media_preview_select_photos" = "已选择 %d 张图片";
"chat_media_preview_select_photo" = "已选择 1 张图片";
"chat_media_preview_select_videos" = "已选择 %d 个视频";
"chat_media_preview_select_video" = "已选择 1 个视频";
"chat_media_preview_select_items" = "已选择 %d 项";
"chat_media_preview_select_item" = "已选择 1 项";
"chat_media_preview_select_no_item" = "未选定项目";
"chat_media_preview_send_photos" = "发送 %d 张图片";
"chat_media_preview_send_photo" = "发送 1 张图片";
"chat_media_preview_send_videos" = "发送 %d 个视频";
"chat_media_preview_send_video" = "发送 1 个视频";
"chat_media_preview_send_items" = "发送 %d 项";
"chat_media_preview_send_item" = "发送 1 项";
"chat_media_preview_send_files" = "发送为文件";
"chat_media_preview_send_file" = "发送为文件";
"chat_media_send_count" = "发送(%d)";
"chat_photo_preview_count" = "%d 张图片";

// Pin
"chat_pinned_general_message" = "%@置顶了一条消息";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ class PhotoInputGridCell: UICollectionViewCell {
@IBOutlet weak var imageWrapperView: UIView!
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var mediaTypeView: MediaTypeOverlayView!
@IBOutlet weak var badge: BadgeView!
@IBOutlet weak var overlayView: UIView!

let cornerRadius: CGFloat = 8

Expand All @@ -18,6 +20,8 @@ class PhotoInputGridCell: UICollectionViewCell {
contentView.layer.shadowColor = UIColor.shadow.cgColor
contentView.layer.shadowOpacity = 0.29
contentView.layer.shadowRadius = 5
badge.cornerRadius = 10
badge.textColor = .white
}

override func layoutSubviews() {
Expand All @@ -28,6 +32,23 @@ class PhotoInputGridCell: UICollectionViewCell {
override func prepareForReuse() {
super.prepareForReuse()
imageView.image = nil
overlayView.isHidden = true
}

func updateSelectedIndex(_ index: Int?) {
if let index = index {
badge.text = "\(index + 1)"
badge.borderWidth = 0
badge.borderColor = .clear
badge.badgeColor = .theme
overlayView.isHidden = false
} else {
badge.text = nil
badge.borderWidth = 1
badge.borderColor = .white
badge.badgeColor = .black.withAlphaComponent(0.16)
overlayView.isHidden = true
}
}

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

class SelectedMediaCell: UICollectionViewCell {

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

var onRemove: (() -> Void)?

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
}

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
}
}
PHImageManager.default().requestImage(for: asset, targetSize: size * UIScreen.main.scale, contentMode: .aspectFill, options: imageRequestOptions) { [weak self] (image, info) in
guard let self = self, let image = image else {
return
}
self.imageView.image = image
}
}

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

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

class StackedPhotoMessageCell: ImageMessageCell {

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)
messageContentView.addSubview(trailingInfoBackgroundView)
updateAppearance(highlight: false, animated: false)
super.prepare()
messageContentView.addSubview(selectedOverlapView)
selectedOverlapView.layer.cornerRadius = 13
backgroundImageView.removeFromSuperview()
statusImageView.isHidden = true
stackedPhotoView.backgroundColor = .clear
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ class ConversationInputViewController: UIViewController {
if minimize {
setPreferredContentHeightAnimated(.minimized)
}
photoViewController.dismissMediasPreviewControllerIfNeeded()
UIView.animate(withDuration: 0.5, delay: 0, options: .overdampedCurve) {
self.customInputContainerView.alpha = 0
} completion: { _ in
Expand Down
Loading