From 353af9991c21c6810fd7bb02ea63ccd8f6f2b795 Mon Sep 17 00:00:00 2001 From: coby5502 <57849386+coby5502@users.noreply.github.com> Date: Thu, 22 Dec 2022 12:01:42 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[FEAT]=20UIRefreshControl=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manito/Screens/Main/MainViewController.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 3dde747ae..a7d39040c 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -38,6 +38,8 @@ final class MainViewController: BaseViewController { } } } + + private var refreshControl = UIRefreshControl() // MARK: - property @@ -78,6 +80,7 @@ final class MainViewController: BaseViewController { forCellWithReuseIdentifier: CreateRoomCollectionViewCell.className) return collectionView }() + private let maCharacterImageView = GIFImageView() private let niCharacterImageView = GIFImageView() private let ttoCharacterImageView = GIFImageView() @@ -97,6 +100,7 @@ final class MainViewController: BaseViewController { setupGifImage() setupGuideArea() renderGuideArea() + setupRefreshControl() } override func viewWillAppear(_ animated: Bool) { @@ -185,6 +189,15 @@ final class MainViewController: BaseViewController { navigationItem.rightBarButtonItem = settingButtonView } + private func setupRefreshControl() { + let action = UIAction { [weak self] _ in + self?.requestManittoList() + } + refreshControl.addAction(action, for: .valueChanged) + refreshControl.tintColor = .grey001 + listCollectionView.refreshControl = refreshControl + } + // MARK: - API private func requestCommonMission() { @@ -210,6 +223,7 @@ final class MainViewController: BaseViewController { if let manittoList = data { rooms = manittoList.participatingRooms listCollectionView.reloadData() + refreshControl.endRefreshing() } } catch NetworkError.serverError { print("serverError") From 0cd4669a7a7fb4405d1c8c5e710d9bfe117fe5be Mon Sep 17 00:00:00 2001 From: coby5502 <57849386+coby5502@users.noreply.github.com> Date: Sun, 8 Jan 2023 22:02:10 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[CHORE]=20=EA=B3=B5=EB=B0=B1=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0=20(#355)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Main/MainViewController.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 8f073e973..70b909a52 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -86,7 +86,6 @@ final class MainViewController: BaseViewController { forCellWithReuseIdentifier: CreateRoomCollectionViewCell.className) return collectionView }() - private let maCharacterImageView = GIFImageView() private let niCharacterImageView = GIFImageView() private let ttoCharacterImageView = GIFImageView() From dff0dc128f4f128608761efa83ac65b775d65e45 Mon Sep 17 00:00:00 2001 From: coby5502 <57849386+coby5502@users.noreply.github.com> Date: Sun, 8 Jan 2023 22:17:18 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[CHORE]=20=EC=83=88=EB=A1=9C=EA=B3=A0?= =?UTF-8?q?=EC=B9=A8=20=EC=A2=85=EB=A3=8C=EC=8B=9C=EA=B0=84=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20(#355)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Main/MainViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index 70b909a52..a1ab29e14 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -203,6 +203,10 @@ final class MainViewController: BaseViewController { private func setupRefreshControl() { let action = UIAction { [weak self] _ in self?.requestManittoList() + + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { + self?.refreshControl.endRefreshing() + } } refreshControl.addAction(action, for: .valueChanged) refreshControl.tintColor = .grey001 @@ -234,7 +238,6 @@ final class MainViewController: BaseViewController { if let manittoList = data { rooms = manittoList.participatingRooms listCollectionView.reloadData() - refreshControl.endRefreshing() } } catch NetworkError.serverError { print("serverError") From 36836678c9c414f159e9080f22634470a7b0467a Mon Sep 17 00:00:00 2001 From: coby5502 <57849386+coby5502@users.noreply.github.com> Date: Thu, 12 Jan 2023 10:52:29 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[CHORE]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81=20(#351)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Manito/Manito/Screens/Main/MainViewController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Manito/Manito/Screens/Main/MainViewController.swift b/Manito/Manito/Screens/Main/MainViewController.swift index a1ab29e14..633138546 100644 --- a/Manito/Manito/Screens/Main/MainViewController.swift +++ b/Manito/Manito/Screens/Main/MainViewController.swift @@ -42,7 +42,7 @@ final class MainViewController: BaseViewController { } } - private var refreshControl = UIRefreshControl() + private let refreshControl = UIRefreshControl() // MARK: - property @@ -109,7 +109,7 @@ final class MainViewController: BaseViewController { override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) requestCommonMission() - requestManittoList() + requestManittoRoomList() } override func render() { @@ -202,7 +202,7 @@ final class MainViewController: BaseViewController { private func setupRefreshControl() { let action = UIAction { [weak self] _ in - self?.requestManittoList() + self?.requestManittoRoomList() DispatchQueue.main.asyncAfter(deadline: .now() + 1) { self?.refreshControl.endRefreshing() @@ -230,7 +230,7 @@ final class MainViewController: BaseViewController { } } - private func requestManittoList() { + private func requestManittoRoomList() { Task { do { let data = try await mainService.fetchManittoList()