Skip to content

Commit

Permalink
170829 기타 이슈
Browse files Browse the repository at this point in the history
  • Loading branch information
wooooooong committed Aug 29, 2017
1 parent d39d671 commit 77ba00a
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 120 deletions.
153 changes: 59 additions & 94 deletions iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions iOSProject/pyunrihae/pyunrihae/DataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ class DataManager{
let storageRef = storage.reference(forURL: "gs://pyeonrehae.appspot.com")
let imagesRef = storageRef.child("images/" + autoId + ".jpeg")
var update = ["bad": 0, "useful": 0, "user": user, "user_image": user_image, "brand": brand, "category": category, "comment": review, "grade": grade, "price": priceLevel, "flavor": flavorLevel, "quantity": quantityLevel, "product_image": product_image,"p_id": p_id, "p_name": p_name, "p_price": p_price, "timestamp": today, "id": autoId] as [String : Any]
if let data = UIImageJPEGRepresentation(p_image, 0.3) {
if let data = UIImageJPEGRepresentation(p_image, 0.1) {
imagesRef.putData(data, metadata: nil, completion: {
(metadata, error) in
if error != nil { // 에러가 난 경우
Expand Down Expand Up @@ -563,7 +563,7 @@ class DataManager{
let storageRef = storage.reference(forURL: "gs://pyeonrehae.appspot.com")
let imagesRef = storageRef.child("images/" + user.id + ".jpeg")

if let data = UIImageJPEGRepresentation(profile, 0.3) {
if let data = UIImageJPEGRepresentation(profile, 0.1) {
imagesRef.putData(data, metadata: nil, completion: {
(metadata, error) in
if error != nil {
Expand Down
22 changes: 15 additions & 7 deletions iOSProject/pyunrihae/pyunrihae/LikeProductViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,24 @@ class LikeProductViewController: UIViewController {
tableView.dataSource = self
NotificationCenter.default.addObserver(self, selector: #selector(getLikeProductList), name: NSNotification.Name("likeListChanged"), object: nil)
// Do any additional setup after loading the view.
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
swipeRight.direction = UISwipeGestureRecognizerDirection.right
self.view.addGestureRecognizer(swipeRight)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func respondToSwipeGesture(gesture: UIGestureRecognizer) {
if let swipeGesture = gesture as? UISwipeGestureRecognizer {
switch swipeGesture.direction {
case UISwipeGestureRecognizerDirection.right: self.navigationController?.popToRootViewController(animated: true)
default: break
}
}
}
@IBAction func onTouchCloseButton(_ sender: Any) {
navigationController?.popViewController(animated: true)
dismiss(animated: true, completion: nil)
self.navigationController?.popToRootViewController(animated: true)
}
func getLikeProductList(){
likeProductList = []
Expand Down Expand Up @@ -74,12 +84,10 @@ extension LikeProductViewController: UITableViewDataSource, UITableViewDelegate
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if likeProductList.count > 0 {
let product = likeProductList[indexPath.row]
NotificationCenter.default.post(name: NSNotification.Name("showProduct"), object: self, userInfo: ["product" : product])
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "mainNavigationController") as! UINavigationController
self.present(vc, animated: true, completion: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "ProductDetailViewController") as! ProductDetailViewController
vc.productId = product.id
self.navigationController?.pushViewController(vc, animated: true)
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
}
}
4 changes: 1 addition & 3 deletions iOSProject/pyunrihae/pyunrihae/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ class MainViewController: UIViewController {
// Dispose of any resources that can be recreated.
}
func showLoginPopup(_ notification: Notification) {
if notification.userInfo?["validator"] as! Int == 0{
Pyunrihae.showLoginOptionPopup(_ : self)
}
Pyunrihae.showLoginOptionPopup(_ : self)
}
func showDetailProduct(_ notification: Notification) {
if notification.userInfo?["validator"] as! Int == 0{
Expand Down
4 changes: 2 additions & 2 deletions iOSProject/pyunrihae/pyunrihae/MypageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,12 @@ extension MypageViewController: UITableViewDataSource, UITableViewDelegate {
// 내가 찜한 상품 뷰
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "LikeProductViewController") as! LikeProductViewController
self.present(vc, animated: true, completion: nil)
self.navigationController?.pushViewController(vc, animated: true)
}
} else if indexPath.row == 1 {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "PyunrihaeInfoViewController") as! PyunrihaeInfoViewController
self.present(vc, animated: true, completion: nil)
self.navigationController?.pushViewController(vc, animated: true)
} else if indexPath.row == 2 {
if labelList[2] == "회원가입 / 로그인" {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
Expand Down
1 change: 0 additions & 1 deletion iOSProject/pyunrihae/pyunrihae/Popup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class Popup{
}
popup.btnsView.addSubview(btns)
view.addSubview(popup)
btns.validator = validator
btns.badBtn.isEnabled = false
btns.usefulBtn.isEnabled = false
Button.deleteBorder(btn: btns.usefulBtn)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ProductDetailViewController: UIViewController {
NotificationCenter.default.addObserver(self, selector: #selector(reviewUpload), name: NSNotification.Name("reviewUpload"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(startUploading), name: NSNotification.Name("startUploading"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(showAllergy), name: NSNotification.Name("showAllergy"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(showLoginPopup), name: NSNotification.Name("showLoginPopup"), object: nil)
let tap = UITapGestureRecognizer(target: self, action: #selector(self.handleTap(_:)))
self.view.addGestureRecognizer(tap)
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
Expand All @@ -65,6 +66,9 @@ class ProductDetailViewController: UIViewController {
}
}
}
func showLoginPopup(_ notification: Notification) {
Pyunrihae.showLoginOptionPopup(_ : self)
}
func handleTap(_ sender: UITapGestureRecognizer) { // 탭해주면 리뷰 작성 버튼 뜸
if hidden == true {
writingReviewBtn.isHidden = false
Expand Down Expand Up @@ -150,7 +154,7 @@ class ProductDetailViewController: UIViewController {
}
}
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { // 밑으로 내리면 리뷰작성 버튼 사라지고, 올리면 다시 뜸
if velocity.y > 0 {
if velocity.y >= 0 {
if hidden == false {
hidden = true
UIView.animate(withDuration: 0.7, delay: 0, animations: {
Expand Down
16 changes: 11 additions & 5 deletions iOSProject/pyunrihae/pyunrihae/PyunrihaeInfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@
import UIKit
class PyunrihaeInfoViewController: UIViewController {
@IBAction func onTouchCloseBtn(_ sender: Any) {
navigationController?.popViewController(animated: true)
dismissKeyboard()
dismiss(animated: true, completion: nil)
self.navigationController?.popToRootViewController(animated: true)
}
override func viewDidLoad() {
super.viewDidLoad()
let swipeRight = UISwipeGestureRecognizer(target: self, action: #selector(self.respondToSwipeGesture))
swipeRight.direction = UISwipeGestureRecognizerDirection.right
self.view.addGestureRecognizer(swipeRight)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func dismissKeyboard() {
view.endEditing(true)
func respondToSwipeGesture(gesture: UIGestureRecognizer) {
if let swipeGesture = gesture as? UISwipeGestureRecognizer {
switch swipeGesture.direction {
case UISwipeGestureRecognizerDirection.right: self.navigationController?.popToRootViewController(animated: true)
default: break
}
}
}
}
4 changes: 4 additions & 0 deletions iOSProject/pyunrihae/pyunrihae/ReviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ReviewViewController: UIViewController {
NotificationCenter.default.addObserver(self, selector: #selector(showDetailProduct), name: NSNotification.Name("showDetailProduct"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(reloadReview), name: NSNotification.Name("reloadReview"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(getReviewList), name: NSNotification.Name("getReviewList"), object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(showLoginPopup), name: NSNotification.Name("showLoginPopup"), object: nil)
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
Expand All @@ -59,6 +60,9 @@ class ReviewViewController: UIViewController {
self.tableView.reloadData()
}
}
func showLoginPopup(_ notification: Notification) {
Pyunrihae.showLoginOptionPopup(_ : self)
}
func showDetailProduct(_ notification: Notification) {
if notification.userInfo?["validator"] as! Int == 1{
let storyboard = UIStoryboard(name: "Main", bundle: nil)
Expand Down
1 change: 1 addition & 0 deletions iOSProject/pyunrihae/pyunrihae/TabBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class TabBarViewController: UIViewController,NVActivityIndicatorViewable {
brandBtns[previousBrandIndex].isSelected = false
Button.select(btn: sender) // 선택된 버튼에 따라 뷰 보여주기
mainViewController.selectedBrandIndexFromTab = selectedBrandIndex // 선택된 브랜드 index를 main에 넘겨주기
mainViewController.reviewScrollView.contentOffset.x = 0
reviewViewController.selectedBrandIndexFromTab = selectedBrandIndex // 선택된 브랜드 index를 review 에 넘겨주기
reviewViewController.tableView.contentOffset.y = 0
rankingViewController.selectedBrandIndexFromTab = selectedBrandIndex // 선택된 브랜드 index를 ranking에 넘겨주기
Expand Down
4 changes: 2 additions & 2 deletions iOSProject/pyunrihae/pyunrihae/UsefulBadBtn.xib
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
</view>
</objects>
<resources>
<image name="bad.png" width="512" height="512"/>
<image name="useful.png" width="512" height="512"/>
<image name="bad.png" width="50" height="50"/>
<image name="useful.png" width="50" height="50"/>
</resources>
</document>
5 changes: 2 additions & 3 deletions iOSProject/pyunrihae/pyunrihae/UsefulBadBtnView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ class UsefulBadBtnView: UIView {
@IBOutlet weak var badNumLabel: UILabel!
var reviewList = [Review]()
var reviewId = ""
var validator = 0
@IBAction func tabUsefulBtn(_ sender: UIButton) {
if User.sharedInstance.email == "" {
NotificationCenter.default.post(name: NSNotification.Name("showLoginPopup"), object: self, userInfo: ["validator": validator])
NotificationCenter.default.post(name: NSNotification.Name("showLoginPopup"), object: self)
} else {
var reviewStatus = User.sharedInstance.review_like_list[reviewId]
let uid = User.sharedInstance.id
Expand Down Expand Up @@ -78,7 +77,7 @@ class UsefulBadBtnView: UIView {
}
@IBAction func tabBadBtn(_ sender: UIButton) {
if User.sharedInstance.email == "" {
NotificationCenter.default.post(name: NSNotification.Name("showLoginPopup"), object: self, userInfo: ["validator": validator])
NotificationCenter.default.post(name: NSNotification.Name("showLoginPopup"), object: self)
} else {
let uid = User.sharedInstance.id
var reviewStatus = User.sharedInstance.review_like_list[reviewId]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ extension WritingReviewViewController: UITextViewDelegate {
func textViewDidBeginEditing(_ textView: UITextView) {
UIView.animate(withDuration: 1.0, delay: 0.0, usingSpringWithDamping: 3.0, initialSpringVelocity: 3.0, options: UIViewAnimationOptions.curveEaseInOut, animations: ({
self.scrollView.frame.origin.y = -self.reviewTextView.frame.origin.y
self.scrollView.contentOffset.y = 0
self.detailReview.frame.size.height = UIScreen.main.bounds.size.height * 3 / 11
}), completion: nil)
addedImageView.isHidden = true
Expand Down

0 comments on commit 77ba00a

Please sign in to comment.