Skip to content

Commit

Permalink
✨ Implement Review feature (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHyun authored Mar 22, 2024
1 parent bf7d293 commit 7c3e156
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 1 deletion.
12 changes: 12 additions & 0 deletions PyeonHaeng-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
BAB5CF252B6B7C5A008B24BF /* Services.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB5CF242B6B7C5A008B24BF /* Services.swift */; };
BAB5CF272B6B7CF3008B24BF /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB5CF262B6B7CF3008B24BF /* HomeViewModel.swift */; };
BAB720342B9325F200C2CA1A /* PromotionSelectBottomSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB720332B9325F200C2CA1A /* PromotionSelectBottomSheetView.swift */; };
BAB8C3AD2BAC7A11003DF3CC /* LeaveReviewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB8C3AC2BAC7A11003DF3CC /* LeaveReviewView.swift */; };
BAE159D82B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */; };
BAE159DA2B65FC35002DCF94 /* HomeProductListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */; };
BAE159DE2B663A9A002DCF94 /* HomeProductSorterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */; };
Expand Down Expand Up @@ -123,6 +124,7 @@
BAB5CF242B6B7C5A008B24BF /* Services.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Services.swift; sourceTree = "<group>"; };
BAB5CF262B6B7CF3008B24BF /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = "<group>"; };
BAB720332B9325F200C2CA1A /* PromotionSelectBottomSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromotionSelectBottomSheetView.swift; sourceTree = "<group>"; };
BAB8C3AC2BAC7A11003DF3CC /* LeaveReviewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeaveReviewView.swift; sourceTree = "<group>"; };
BABFEA6F2B6399C30084C0EC /* Shared */ = {isa = PBXFileReference; lastKnownFileType = wrapper; path = Shared; sourceTree = "<group>"; };
BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductDetailSelectionView.swift; sourceTree = "<group>"; };
BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeProductListView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -307,6 +309,7 @@
BA28F18C2B6155EC0052855E /* SettingsScene */ = {
isa = PBXGroup;
children = (
BAB8C3AB2BAC7A09003DF3CC /* LeaveReview */,
BA097F0C2B9CA820002D3E1E /* Mail */,
BA1688EB2B99D0B700A8F462 /* Notice */,
BA28F18D2B6156420052855E /* SettingsView.swift */,
Expand Down Expand Up @@ -427,6 +430,14 @@
path = View;
sourceTree = "<group>";
};
BAB8C3AB2BAC7A09003DF3CC /* LeaveReview */ = {
isa = PBXGroup;
children = (
BAB8C3AC2BAC7A11003DF3CC /* LeaveReviewView.swift */,
);
path = LeaveReview;
sourceTree = "<group>";
};
E5462C6B2B65CF7800E9FDF2 /* Components */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -649,6 +660,7 @@
E50176262B6A204F0098D1BE /* ProductInfoLineGraphView.swift in Sources */,
BAB5CF252B6B7C5A008B24BF /* Services.swift in Sources */,
BAA4D9AF2B5A1795005999F8 /* SplashView.swift in Sources */,
BAB8C3AD2BAC7A11003DF3CC /* LeaveReviewView.swift in Sources */,
BA8E83242B8EF83B00FE968C /* ProductConfiguration.swift in Sources */,
BAA4D9AD2B5A1795005999F8 /* PyeonHaengApp.swift in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// LeaveReviewView.swift
// PyeonHaeng-iOS
//
// Created by 홍승현 on 3/21/24.
//

import DesignSystem
import SwiftUI

// MARK: - LeaveReviewView

struct LeaveReviewView: View {
@Environment(\.openURL) private var openURL

var body: some View {
Button(action: openAppReview) {
HStack {
Image.appstore
.renderingMode(.template)
.foregroundStyle(.gray900)
Text("Leave a Review")
.font(.b1)
.foregroundStyle(.gray900)
Spacer()
Image(systemName: Constants.disclosureImageName)
.font(.system(size: Metrics.disclosureSize, weight: .semibold)) // Styled to look like a disclosure indicator
.foregroundStyle(.gray.opacity(Metrics.disclosureOpacity))
}
}
}

// MARK: Private methods

/// Opens the Mail app's page in the App Store.
private func openAppReview() {
if let url = URL(string: Constants.reviewURL) {
openURL(url)
}
}
}

// MARK: - Metrics

private enum Metrics {
static let disclosureSize: CGFloat = 14
static let disclosureOpacity: CGFloat = 0.5
}

// MARK: - Constants

private enum Constants {
static let disclosureImageName: String = "chevron.right"

static let reviewURL: String = "https://apps.apple.com/app/id1665633509?action=write-review"
}

#Preview {
LeaveReviewView()
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import SwiftUI
struct MailRowItem: View {
@State private var isMailPresented: Bool = false
@State private var showAlert: Bool = false
@Environment(\.openURL) var openURL
@Environment(\.openURL) private var openURL

private let deviceProvider: DeviceInformationProvider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ private struct SettingsRow: View {
case .contacts:
MailRowItem(deviceProvider: SystemDeviceProvider())

case .leaveReview:
LeaveReviewView()

default:
NavigationLink {} label: {
subject
Expand Down

0 comments on commit 7c3e156

Please sign in to comment.