Skip to content

Commit

Permalink
Merge branch 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
YuigaWada committed Apr 7, 2020
2 parents 4232a56 + 21a022a commit 66e8432
Show file tree
Hide file tree
Showing 23 changed files with 807 additions and 257 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Change Log

## [1.0.5] - 2020-04-08
### Added
- URLプレビュー機能を追加
- 他人のリアクション取り消しの検知するように
- 他人が投稿を削除したのを検知するように

### Changed
- TLを軽量化
- プロフィールの上部ボタンを見やすいように変更
- リプライ/引用RN時の投稿画面のデザインを変更

### Fixed
- 自分の投稿にリアクションできないように修正
- 多重にリアクションできる不具合を修正
- reloadが重複してしまう不具合を修正
- 下タブが正常に動作するように修正
- 投稿削除ボタンを押すとアラートの応答内容に拘らず、必ず投稿が消えてしまう不具合を修正


## [1.0.4] - 2020-04-06
### Added
Expand Down
24 changes: 20 additions & 4 deletions MissCat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
8DAF301B241B599B0041BB85 /* LicenseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DAF301A241B599B0041BB85 /* LicenseViewController.swift */; };
8DBC7A45241245A800D8FEA5 /* AVKit+MissCat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DBC7A44241245A800D8FEA5 /* AVKit+MissCat.swift */; };
8DC16154238BBD0C007793B7 /* NoteModel+MissCat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC16153238BBD0C007793B7 /* NoteModel+MissCat.swift */; };
8DC27D96243BF2DF0037E610 /* UrlPreviewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8DC27D95243BF2DF0037E610 /* UrlPreviewer.xib */; };
8DC27D98243BF4FB0037E610 /* UrlPreviewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC27D97243BF4FA0037E610 /* UrlPreviewer.swift */; };
8DC27D9A243BF57A0037E610 /* UrlPreviewerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC27D99243BF57A0037E610 /* UrlPreviewerViewModel.swift */; };
8DC27D9C243BF6DD0037E610 /* UrlPreviewerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC27D9B243BF6DD0037E610 /* UrlPreviewerModel.swift */; };
8DC95AF723B0BD3C0013CABC /* NotificationBanner.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8DC95AF623B0BD3C0013CABC /* NotificationBanner.xib */; };
8DC95AF923B0BD450013CABC /* NotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DC95AF823B0BD450013CABC /* NotificationBanner.swift */; };
8DD8898B23935CC400D22910 /* PostDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DD8898A23935CC400D22910 /* PostDetailViewModel.swift */; };
Expand Down Expand Up @@ -227,6 +231,10 @@
8DAF301A241B599B0041BB85 /* LicenseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseViewController.swift; sourceTree = "<group>"; };
8DBC7A44241245A800D8FEA5 /* AVKit+MissCat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AVKit+MissCat.swift"; sourceTree = "<group>"; };
8DC16153238BBD0C007793B7 /* NoteModel+MissCat.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NoteModel+MissCat.swift"; sourceTree = "<group>"; };
8DC27D95243BF2DF0037E610 /* UrlPreviewer.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UrlPreviewer.xib; sourceTree = "<group>"; };
8DC27D97243BF4FA0037E610 /* UrlPreviewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = UrlPreviewer.swift; path = /Users/yuigawada/Desktop/Development/iOS/MissCat/MissCat/View/Reusable/NoteCell/UrlPreviewer.swift; sourceTree = "<absolute>"; };
8DC27D99243BF57A0037E610 /* UrlPreviewerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UrlPreviewerViewModel.swift; sourceTree = "<group>"; };
8DC27D9B243BF6DD0037E610 /* UrlPreviewerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UrlPreviewerModel.swift; sourceTree = "<group>"; };
8DC95AF623B0BD3C0013CABC /* NotificationBanner.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NotificationBanner.xib; sourceTree = "<group>"; };
8DC95AF823B0BD450013CABC /* NotificationBanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationBanner.swift; sourceTree = "<group>"; };
8DD0D80B23B47CA8003F02ED /* YanagiText.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = YanagiText.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -401,6 +409,7 @@
8DE8882624276512002CC9DE /* NoteCell.FileView.swift */,
8D6139192427B9B0003B5BEF /* FileContainer.swift */,
8D61391F2427CAED003B5BEF /* FileContainerCell.swift */,
8DC27D97243BF4FA0037E610 /* UrlPreviewer.swift */,
);
path = NoteCell;
sourceTree = "<group>";
Expand All @@ -412,6 +421,7 @@
8D502D53237D8BEC00525A96 /* ReactionCell.xib */,
8D4754F8240E21F800BAD410 /* PollView.xib */,
8D61391D2427CA0C003B5BEF /* FileContainerCell.xib */,
8DC27D95243BF2DF0037E610 /* UrlPreviewer.xib */,
);
path = nib;
sourceTree = "<group>";
Expand Down Expand Up @@ -512,6 +522,7 @@
8D8863A82383F8A900A7A5A8 /* NoteCellViewModel.swift */,
8DA06A13238A86B80093A718 /* NotificationCellViewModel.swift */,
8D61391B2427C1B3003B5BEF /* FileContainerViewModel.swift */,
8DC27D99243BF57A0037E610 /* UrlPreviewerViewModel.swift */,
);
path = Reusable;
sourceTree = "<group>";
Expand All @@ -522,6 +533,7 @@
8DAEA1382382E6D00083AA69 /* ReactionGenModel.swift */,
8D8863AA2383F96C00A7A5A8 /* NoteCellModel.swift */,
8DA06A15238A86DC0093A718 /* NotificationCellModel.swift */,
8DC27D9B243BF6DD0037E610 /* UrlPreviewerModel.swift */,
);
path = Reusable;
sourceTree = "<group>";
Expand Down Expand Up @@ -639,6 +651,7 @@
8D502D54237D8BEC00525A96 /* ReactionCell.xib in Resources */,
8DA536AC23AC8B70005EB1B5 /* AttachmentCell.xib in Resources */,
8D065B19237AC826003DFB7C /* NoteCell.xib in Resources */,
8DC27D96243BF2DF0037E610 /* UrlPreviewer.xib in Resources */,
8D8863B4238493FA00A7A5A8 /* RenoteeCell.xib in Resources */,
8D61391E2427CA0C003B5BEF /* FileContainerCell.xib in Resources */,
8DAEA1352382E4F00083AA69 /* EmojiView.xib in Resources */,
Expand Down Expand Up @@ -726,6 +739,7 @@
8D0F7D0F2398F21F009B45E1 /* ReactionGenPanel.swift in Sources */,
8DEFF31E239BD4F200142802 /* ProfileModel.swift in Sources */,
8D47FAD8243388B100549A0B /* TosViewController.swift in Sources */,
8DC27D9A243BF57A0037E610 /* UrlPreviewerViewModel.swift in Sources */,
8D63BFC3242BBF03009C3ADE /* HomeViewModel.swift in Sources */,
8D065B1B237ACA68003DFB7C /* NoteCell.swift in Sources */,
8D8863AB2383F96C00A7A5A8 /* NoteCellModel.swift in Sources */,
Expand Down Expand Up @@ -779,6 +793,7 @@
8D8863B02384147100A7A5A8 /* UIColor+MissCat.swift in Sources */,
8D42C3A8238076B600337DD2 /* Double+MissCat.swift in Sources */,
8D98C268242E0AD600BB8049 /* PostDetailModel.swift in Sources */,
8DC27D9C243BF6DD0037E610 /* UrlPreviewerModel.swift in Sources */,
8D8863A92383F8A900A7A5A8 /* NoteCellViewModel.swift in Sources */,
8D310191243AE9AB004F8E55 /* MFMImageView.swift in Sources */,
8D0D47AA23A74EC80095361D /* UIViewController+PhotoEditor.swift in Sources */,
Expand All @@ -789,6 +804,7 @@
8D8863B62384951300A7A5A8 /* RenoteeCell.swift in Sources */,
8D6139202427CAED003B5BEF /* FileContainerCell.swift in Sources */,
8DEFF31C239BD45700142802 /* ProfileViewModel.swift in Sources */,
8DC27D98243BF4FB0037E610 /* UrlPreviewer.swift in Sources */,
8DE8882724276512002CC9DE /* NoteCell.FileView.swift in Sources */,
8DA06A12238A58A20093A718 /* NSMutableAttributedString+MissCat.swift in Sources */,
8D502D58238024B700525A96 /* HomeViewController.swift in Sources */,
Expand Down Expand Up @@ -967,7 +983,7 @@
CODE_SIGN_ENTITLEMENTS = MissCat/MissCat.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.0.4;
CURRENT_PROJECT_VERSION = 1.0.5;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 4LMTSU8RLS;
Expand All @@ -982,7 +998,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.4;
MARKETING_VERSION = 1.0.5;
OTHER_LDFLAGS = (
"$(inherited)",
"-l\"xml2\"",
Expand Down Expand Up @@ -1046,7 +1062,7 @@
CODE_SIGN_ENTITLEMENTS = MissCat/MissCat.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.0.4;
CURRENT_PROJECT_VERSION = 1.0.5;
DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 4LMTSU8RLS;
Expand All @@ -1061,7 +1077,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.4;
MARKETING_VERSION = 1.0.5;
OTHER_LDFLAGS = (
"$(inherited)",
"-l\"xml2\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "PostViewController.viewDidLoad():PostViewController.swift">
<PersistentStrings>
<PersistentString
value = "targetNote">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "GIFImageView.isGif(url:):GIFImageView+MissCat.swift">
<PersistentStrings>
Expand Down Expand Up @@ -1128,6 +1136,14 @@
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "NoteCellViewModel.searchUrl(from:):NoteCellViewModel.swift">
<PersistentStrings>
<PersistentString
value = "item.note">
</PersistentString>
</PersistentStrings>
</ContextState>
<ContextState
contextName = "AuthWebViewController.setupSignup(misskeyInstance:appSecret:):AuthWebViewController.swift">
<PersistentStrings>
Expand Down
103 changes: 60 additions & 43 deletions MissCat/MFMEngine/MFMImageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,40 @@ import SVGKit
import UIKit

class MFMImageView: UIImageView {
private lazy var apngView: APNGImageView = {
// MARK: Views

private var apngView: APNGImageView?
private var gifView: GIFImageView?

// MARK: LifeCycle

override init(frame: CGRect) {
super.init(frame: frame)
apngView = setupApngView()
gifView = setupGifView()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
apngView = setupApngView()
gifView = setupGifView()
}

private func setupApngView() -> APNGImageView {
let apngView = APNGImageView()
apngView.translatesAutoresizingMaskIntoConstraints = false
self.addSubview(apngView)
self.setAutoLayout(to: apngView)
addSubview(apngView)
setAutoLayout(to: apngView)
return apngView
}()
}

private lazy var gifView: GIFImageView = {
private func setupGifView() -> GIFImageView {
let gifView = GIFImageView()
gifView.translatesAutoresizingMaskIntoConstraints = false
self.addSubview(gifView)
self.setAutoLayout(to: gifView)
addSubview(gifView)
setAutoLayout(to: gifView)
return gifView
}()
}

// MARK: Publics

Expand All @@ -44,14 +63,13 @@ class MFMImageView: UIImageView {
}
}


/// セルを再利用する際に呼ぶ
func prepareForReuse() {
gifView.prepareForReuse()
gifView.gifImage = nil
gifView.image = nil
apngView.image = nil
apngView.stopAnimating()
gifView?.prepareForReuse()
gifView?.gifImage = nil
gifView?.image = nil
apngView?.image = nil
apngView?.stopAnimating()
image = nil
backgroundColor = .darkGray
}
Expand All @@ -61,62 +79,61 @@ class MFMImageView: UIImageView {
/// フォーマットを識別してImageをsetする
/// - Parameter data: Data
private func setImage(data: Data) {
let format = getImageFormat(data)
switch format {
case .gif:
setGifuImage(with: data)
case .apng:
setApngImage(with: data)
case .png:
setUIImage(with: data)
case .other:
setUIImage(with: data)
DispatchQueue.global().async {
let format = self.getImageFormat(data)
switch format {
case .gif:
self.setGifuImage(with: data)
case .apng:
self.setApngImage(with: data)
case .png:
self.setUIImage(with: data)
case .other:
self.setUIImage(with: data)
}
}
}


/// ApngフォーマットのImageをset
/// - Parameter data: Data
private func setApngImage(with data: Data) {
DispatchQueue.main.async {
let apngImage = APNGImage(data: data)
self.apngView.image = apngImage
self.apngView.startAnimating()
let apngImage = APNGImage(data: data, progressive: true)
self.apngView?.image = apngImage
self.apngView?.startAnimating()
self.backgroundColor = .clear
}
}

/// アニメーションGifに対応するため、非同期にGifuへ画像をsetする
/// アニメーションGifに対応するためGifuへ画像をsetする
/// - Parameters:
/// - data: 画像データ
/// - imageView: set対象のGIFImageView
private func setGifuImage(with data: Data) {
DispatchQueue.main.async {
self.gifView.animate(withGIFData: data) {
self.gifView?.animate(withGIFData: data) {
DispatchQueue.main.async {
self.backgroundColor = .clear
}
}
}
}

/// 非同期で画像をimageViewにsetする
/// 画像をimageViewにsetする
/// - Parameters:
/// - data: 画像データ
/// - imageView: set対象のGIFImageView
private func setUIImage(with data: Data) {
DispatchQueue.global().async {
if let image = UIImage(data: data) {
DispatchQueue.main.async {
self.backgroundColor = .clear
self.image = image
}
} else { // Type: SVG
guard let svgKitImage = SVGKImage(data: data), let svgImage = svgKitImage.uiImage else { return }
DispatchQueue.main.async {
self.backgroundColor = .clear
self.image = svgImage
}
if let image = UIImage(data: data) {
DispatchQueue.main.async {
self.backgroundColor = .clear
self.image = image
}
} else { // Type: SVG
guard let svgKitImage = SVGKImage(data: data), let svgImage = svgKitImage.uiImage else { return }
DispatchQueue.main.async {
self.backgroundColor = .clear
self.image = svgImage
}
}
}
Expand Down
29 changes: 29 additions & 0 deletions MissCat/Model/Reusable/UrlPreviewerModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// UrlPreviewerModel.swift
// MissCat
//
// Created by Yuiga Wada on 2020/04/07.
// Copyright © 2020 Yuiga Wada. All rights reserved.
//

import SwiftLinkPreview

class UrlPreviewerModel {
func getPreview(of url: String, handler: @escaping (Response) -> Void) {
if let cache = Cache.shared.getUrlPreview(on: url) {
DispatchQueue.main.async { handler(cache) }
return
}

let slp = SwiftLinkPreview(session: URLSession.shared,
workQueue: DispatchQueue.global(),
responseQueue: DispatchQueue.main)

slp.preview(url, onSuccess: { res in
Cache.shared.saveUrlPreview(response: res, on: url)
handler(res)
}, onError: handleError)
}

private func handleError(_ error: PreviewError) {}
}
Loading

0 comments on commit 66e8432

Please sign in to comment.