Skip to content

[Refactor] #529 - 앱 메모리 최적화(솝탬프, 콕찌르기, 마이페이지, 홈캘린더) #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 3, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -227,27 +227,27 @@ extension AppMyPageVC {

// TODO: - (@승호): 적절히 객체에 위임하기
private func addTabGestureOnListItems() {
self.servicePolicySectionGroup.addTapGestureRecognizer {
self.onPolicyItemTap?()
self.servicePolicySectionGroup.addTapGestureRecognizer { [weak self] in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어쩐지 마이페이지만 진입하면 앱 메모리가 증가한다 했었는데~!

self?.onPolicyItemTap?()
}

self.termsOfUseListItem.addTapGestureRecognizer {
self.onTermsOfUseItemTap?()
self.termsOfUseListItem.addTapGestureRecognizer { [weak self] in
self?.onTermsOfUseItemTap?()
}

self.sendFeedbackListItem.addTapGestureRecognizer {
openExternalLink(urlStr: ExternalURL.KakaoTalk.serviceProposal)
}

self.alertListItem.addTapGestureRecognizer {
self.onAlertButtonTap?(UIApplication.openSettingsURLString)
self.alertListItem.addTapGestureRecognizer { [weak self] in
self?.onAlertButtonTap?(UIApplication.openSettingsURLString)
}

self.editOnelineSentenceListItem.addTapGestureRecognizer {
self.onEditOnelineSentenceItemTap?()
self.editOnelineSentenceListItem.addTapGestureRecognizer { [weak self] in
self?.onEditOnelineSentenceItemTap?()
}

self.resetStampListItem.addTapGestureRecognizer {
self.resetStampListItem.addTapGestureRecognizer { [weak self] in
AlertUtils.presentAlertVC(
type: .titleDescription,
theme: .main,
Expand All @@ -261,7 +261,7 @@ extension AppMyPageVC {
)
}

self.logoutListItem.addTapGestureRecognizer {
self.logoutListItem.addTapGestureRecognizer { [weak self] in
AlertUtils.presentAlertVC(
type: .titleDescription,
theme: .main,
Expand All @@ -275,12 +275,12 @@ extension AppMyPageVC {
)
}

self.withDrawalListItem.addTapGestureRecognizer {
self.onWithdrawalItemTap?(self.userType)
self.withDrawalListItem.addTapGestureRecognizer { [weak self] in
self?.onWithdrawalItemTap?(self?.userType ?? .visitor)
}

self.loginListItem.addTapGestureRecognizer {
self.onShowLogin?()
self.loginListItem.addTapGestureRecognizer { [weak self] in
self?.onShowLogin?()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ final class HomeCalendarDetailVC: UIViewController, HomeCalendarDetailViewContro

// MARK: UI Components

private lazy var naviBar = OPNavigationBar(self,
type: .oneLeftButton,
private lazy var naviBar = OPNavigationBar(self, type: .oneLeftButton,
backgroundColor: DSKitAsset.Colors.semanticBackground.color)
.addMiddleLabel(title: I18N.Home.CalendarDetail.navigationTitle, font: DSKitFontFamily.Suit.medium.font(size: 16))

Expand Down Expand Up @@ -142,7 +141,7 @@ extension HomeCalendarDetailVC {
private func bindViewModels() {
let input = HomeCalendarDetailViewModel.Input(
viewDidLoad: Just<Void>(()).asDriver(),
naviBackButtonTap: self.naviBar.leftButtonTapped.asDriver(),
naviBackButtonTap: self.naviBar.leftButtonTapped,
onAttendanceButtonTap: self.attendanceButton
.publisher(for: .touchUpInside)
.withUnretained(self)
Expand All @@ -157,7 +156,7 @@ extension HomeCalendarDetailVC {
.sink { owner, calendarDetailInfo in
owner.calendarDetailInfo = calendarDetailInfo
owner.collectionView.reloadData()
self.scrollToRecentSchedule()
owner.scrollToRecentSchedule()
}.store(in: cancelBag)

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ final class PokeCoordinator: DefaultCoordinator {

pokeMain.vm.onPokeButtonTapped = { [weak self] userModel in
guard let self else { return .empty() }
return self.showMessageBottomSheet(userModel: userModel, on: pokeMain.vc.viewController)
return self.showMessageBottomSheet(userModel: userModel, on: self.rootController)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

같은 뷰를 갖고 있었던 솝마디도 똑같은 부분에서 누수가 있었어유. 굿굿

}

pokeMain.vm.onNewFriendMade = { [weak self] friendName in
guard let self else { return }
let pokeMakingFriendCompletedVC = self.factory.makePokeMakingFriendCompleted(friendName: friendName).viewController
pokeMakingFriendCompletedVC.modalPresentationStyle = .overFullScreen
pokeMain.vc.viewController.present(pokeMakingFriendCompletedVC, animated: false)
self.rootController?.present(pokeMakingFriendCompletedVC, animated: false)
}

pokeMain.vm.onAnonymousFriendUpgrade = { [weak self] user in
guard let self else { return }
let pokeAnonymousFriendUpgradeVC = self.factory.makePokeAnonymousFriendUpgrade(user: user).viewController
pokeAnonymousFriendUpgradeVC.modalPresentationStyle = .overFullScreen
pokeMain.vc.viewController.present(pokeAnonymousFriendUpgradeVC, animated: false)
self.rootController?.present(pokeAnonymousFriendUpgradeVC, animated: false)
}

pokeMain.vm.switchToOnboarding = { [weak self] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ public final class PokeMainVC: UIViewController, PokeMainViewControllable {

public override func viewDidLoad() {
super.viewDidLoad()
self.setUI()
self.setDelegate()
self.setStackView()
self.setLayout()
self.bindViewModel()
setUI()
setDelegate()
setStackView()
setLayout()
bindViewModel()
}
}

Expand Down Expand Up @@ -298,8 +298,9 @@ extension PokeMainVC {
}.store(in: cancelBag)

output.isLoading
.sink { [weak self] isLoading in
isLoading ? self?.showLoading() : self?.stopLoading()
}.store(in: self.cancelBag)
.withUnretained(self)
.sink { owner, isLoading in
isLoading ? owner.showLoading() : owner.stopLoading()
}.store(in: cancelBag)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension StampBuilder: StampFeatureViewBuildable {
public func makeMissionListVC(sceneType: MissionListSceneType) -> MissionListViewControllable {
let useCase = DefaultMissionListUseCase(repository: missionListRepository)
let viewModel = MissionListViewModel(useCase: useCase, sceneType: sceneType)
let missionListVC = MissionListVC()
let missionListVC = MissionListVC(viewModel: viewModel)
missionListVC.viewModel = viewModel
return missionListVC
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ extension MissionListVC {
static let standardWidth = UIScreen.main.bounds.width - 40.adjusted

func createLayout() -> UICollectionViewLayout {
return UICollectionViewCompositionalLayout { (sectionIndex, layoutEnvironment) -> NSCollectionLayoutSection? in
return UICollectionViewCompositionalLayout { [weak self] (sectionIndex, layoutEnvironment) -> NSCollectionLayoutSection? in
switch MissionListSection.type(sectionIndex) {
case .sentence: return self.createSentenceSection()
case .missionList: return self.createMissionListSection()
case .sentence: return self?.createSentenceSection()
case .missionList: return self?.createMissionListSection()
}
}
}
Expand Down
Loading