Browse Source
Merge branch 'developer_Test'
Merge branch 'developer_Test'
Conflicts: GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRate.storyboardpull/1/head
Jeongbae Kong
4 years ago
37 changed files with 1213 additions and 12 deletions
-
BIN.DS_Store
-
4GME Remit.xcodeproj/project.pbxproj
-
2GME Remit/Models/Response/User.swift
-
8GME Remit/Modules/Home/User Interface/View/Home.storyboard
-
2GME Remit/Modules/PowerCallModules/LocalTopup/PhoneCardRecharge/User Interface/View/PhoneCardRecharge.storyboard
-
2GME Remit/Modules/Profile/PersonalInformation/User Interface/View/PersonalInformation.storyboard
-
2GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRate.storyboard
-
41GME Remit/Modules/RewardModules/CouponBox/Application Logic/Interactor/CouponBoxInteractor.swift
-
17GME Remit/Modules/RewardModules/CouponBox/Application Logic/Interactor/CouponBoxInteractorIO.swift
-
44GME Remit/Modules/RewardModules/CouponBox/Application Logic/Model/CouponBoxModel.swift
-
30GME Remit/Modules/RewardModules/CouponBox/Application Logic/Model/CouponBoxModelContainer.swift
-
89GME Remit/Modules/RewardModules/CouponBox/Application Logic/Service/CouponBoxService.swift
-
16GME Remit/Modules/RewardModules/CouponBox/Application Logic/Service/CouponBoxServiceType.swift
-
11GME Remit/Modules/RewardModules/CouponBox/Module Interface/CouponBoxModuleInterface.swift
-
46GME Remit/Modules/RewardModules/CouponBox/User Interface/Presenter/CouponBoxPresenter.swift
-
53GME Remit/Modules/RewardModules/CouponBox/User Interface/View/Cell/CouponBoxTableViewCell.swift
-
229GME Remit/Modules/RewardModules/CouponBox/User Interface/View/CouponBox.storyboard
-
180GME Remit/Modules/RewardModules/CouponBox/User Interface/View/CouponBoxViewController.swift
-
21GME Remit/Modules/RewardModules/CouponBox/User Interface/View/CouponBoxViewInterface.swift
-
56GME Remit/Modules/RewardModules/CouponBox/User Interface/Wireframe/CouponBoxWireframe.swift
-
16GME Remit/Modules/RewardModules/CouponBox/User Interface/Wireframe/CouponBoxWireframeInputOutput.swift
-
2GME Remit/Modules/SideMenu/SideMenu.storyboard
-
3GME Remit/Modules/SideMenu/SideMenuViewController.swift
-
1GME Remit/Modules/SplashScreen/User Interface/View/SplashScreenViewController.swift
-
27GME Remit/MultiLanguages/bn.lproj/Localizable.strings
-
28GME Remit/MultiLanguages/id.lproj/Localizable.strings
-
26GME Remit/MultiLanguages/km.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/mn.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/my-MM.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/my.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/ne.lproj/Localizable.strings
-
26GME Remit/MultiLanguages/ru-RU.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/si.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/th.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/ur-PK.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/uz.lproj/Localizable.strings
-
27GME Remit/MultiLanguages/vi-VN.lproj/Localizable.strings
@ -0,0 +1,41 @@ |
|||
// |
|||
// CouponBoxInteractor.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import Foundation |
|||
|
|||
class CouponBoxInteractor { |
|||
|
|||
// MARK: Properties |
|||
|
|||
weak var output: CouponBoxInteractorOutput? |
|||
private let service: CouponBoxServiceType |
|||
|
|||
// MARK: Initialization |
|||
|
|||
init(service: CouponBoxServiceType) { |
|||
self.service = service |
|||
} |
|||
} |
|||
|
|||
// MARK: CouponBox interactor input interface |
|||
|
|||
extension CouponBoxInteractor: CouponBoxInteractorInput { |
|||
func fetchCouponBox() { |
|||
service.fetchCouponBox( |
|||
success: { |
|||
self.output?.setModel(with: $0) |
|||
}, |
|||
failure: {[weak self] in |
|||
guard let `self` = self else { |
|||
return |
|||
} |
|||
self.output?.setError(with: $0) |
|||
} |
|||
) |
|||
} |
|||
} |
@ -0,0 +1,17 @@ |
|||
// |
|||
// CouponBoxInteractorIO.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
protocol CouponBoxInteractorInput: class { |
|||
/// Fetch coupon using fetchCouponBox |
|||
func fetchCouponBox() |
|||
} |
|||
|
|||
protocol CouponBoxInteractorOutput: class { |
|||
func setModel(with model: [CouponBoxModel]?) |
|||
func setError(with error:Error) |
|||
} |
@ -0,0 +1,44 @@ |
|||
// |
|||
// CouponBoxModel.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 04/12/2019. |
|||
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import Foundation |
|||
import ObjectMapper |
|||
|
|||
struct CouponBoxModel: Mappable { |
|||
var schemeId: String? |
|||
var couponType: String? |
|||
var couponName: String? |
|||
var discountType: String? |
|||
var discountValue: String? |
|||
var expireDate: String? |
|||
var buyDate: String? |
|||
|
|||
init?(map: Map) { } |
|||
|
|||
mutating func mapping(map: Map) { |
|||
schemeId <- map["schemeId"] |
|||
couponType <- map["couponType"] |
|||
couponName <- map["couponName"] |
|||
discountType <- map["discountType"] |
|||
discountValue <- map["discountValue"] |
|||
expireDate <- map["expireDate"] |
|||
buyDate <- map["buyDate"] |
|||
} |
|||
} |
|||
|
|||
extension CouponBoxModel: Equatable { |
|||
static func == (lhs: CouponBoxModel, rhs: CouponBoxModel) -> Bool { |
|||
return lhs.schemeId == rhs.schemeId && |
|||
lhs.couponType == rhs.couponType && |
|||
lhs.couponName == rhs.couponName && |
|||
lhs.discountType == rhs.discountType && |
|||
lhs.discountValue == rhs.discountValue && |
|||
lhs.expireDate == rhs.expireDate && |
|||
lhs.buyDate == rhs.buyDate |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
// |
|||
// CouponBoxModelContainer.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 04/12/2019. |
|||
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import Foundation |
|||
import ObjectMapper |
|||
|
|||
struct CouponBoxModelContainer: Mappable { |
|||
var errorCode: String? |
|||
var message: String? |
|||
var id: String? |
|||
var extra: String? |
|||
var extra2: String? |
|||
var data: [CouponBoxModel]? |
|||
|
|||
init?(map: Map) { } |
|||
|
|||
mutating func mapping(map: Map) { |
|||
errorCode <- map["ErrorCode"] |
|||
message <- map["Msg"] |
|||
id <- map["Id"] |
|||
extra <- map["Extra"] |
|||
extra2 <- map["Extra2"] |
|||
data <- map["Data"] |
|||
} |
|||
} |
@ -0,0 +1,89 @@ |
|||
// |
|||
// CouponBoxService.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import Foundation |
|||
|
|||
class CouponBoxService: CouponBoxServiceType { |
|||
func fetchCouponBox( |
|||
success: @escaping (([CouponBoxModel]?) -> Void), |
|||
failure: @escaping ((Error) -> Void) |
|||
) { |
|||
|
|||
guard let customerId = GMEDB.shared.user.string(.senderId) else { |
|||
let error = NSError.init( |
|||
domain: "Network", |
|||
code: 0, |
|||
userInfo: [NSLocalizedDescriptionKey : "no exist senderId"]) |
|||
failure(error) |
|||
|
|||
return |
|||
} |
|||
// let testString = |
|||
// """ |
|||
// { |
|||
// "ErrorCode": "0", |
|||
// "Msg": "SUCCESS", |
|||
// "Id": "", |
|||
// "Extra": "", |
|||
// "Extra2": "", |
|||
// "Data": [ |
|||
// { |
|||
// "schemeId": "10", |
|||
// "couponType": "1", |
|||
// "couponName": "100% coupon", |
|||
// "discountType": "1", |
|||
// "discountValue": "100.0000", |
|||
// "expireDate": "2020-06-28 오후 5:39:12", |
|||
// "buyDate": "2019-06-28 오후 5:51:53" |
|||
// }, |
|||
// { |
|||
// "schemeId": "12", |
|||
// "couponType": "2", |
|||
// "couponName": "5000 Won Discount Coupon", |
|||
// "discountType": "", |
|||
// "discountValue": "5000", |
|||
// "expireDate": "2020-06-28 오후 5:39:12", |
|||
// "buyDate": "2019-06-28 오후 5:51:53" |
|||
// } |
|||
// ] |
|||
// } |
|||
// """ |
|||
// let json = ResponseContainerArray<CouponBoxModel>(JSONString: testString) |
|||
// success(json?.data) |
|||
|
|||
let parameter = [ |
|||
"customerId": customerId |
|||
] |
|||
|
|||
let url = baseUrlWithoutVersion + "v1/mobile/GetCouponList" |
|||
|
|||
auth.request( |
|||
method: .post, |
|||
url: url, |
|||
params: parameter, |
|||
success: { (response: CouponBoxModelContainer) in |
|||
if (response.errorCode ?? "") == "1" { |
|||
let error = NSError.init( |
|||
domain: "Network", |
|||
code: 0, |
|||
userInfo: [NSLocalizedDescriptionKey : |
|||
response.message ?? ""]) |
|||
|
|||
failure(error) |
|||
} else { |
|||
let model = response.data |
|||
success(model) |
|||
} |
|||
}, |
|||
failure: { failure($0) } |
|||
) |
|||
|
|||
} |
|||
} |
|||
|
|||
|
@ -0,0 +1,16 @@ |
|||
// |
|||
// CouponBoxServiceType.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
protocol CouponBoxServiceType: class, ApiServiceType { |
|||
/// Fetch coupon order history |
|||
|
|||
func fetchCouponBox( |
|||
success: @escaping (([CouponBoxModel]?) -> Void), |
|||
failure: @escaping ((Error) -> Void) |
|||
) |
|||
} |
@ -0,0 +1,11 @@ |
|||
// |
|||
// CouponBoxModuleInterface.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
protocol CouponBoxModuleInterface: class { |
|||
func fetchCouponBox() |
|||
} |
@ -0,0 +1,46 @@ |
|||
// |
|||
// CouponBoxPresenter.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import Foundation |
|||
|
|||
class CouponBoxPresenter { |
|||
|
|||
// MARK: Properties |
|||
|
|||
weak var view: CouponBoxViewInterface? |
|||
var interactor: CouponBoxInteractorInput? |
|||
var wireframe: CouponBoxWireframeInput? |
|||
|
|||
} |
|||
|
|||
// MARK: CouponBox module interface |
|||
|
|||
extension CouponBoxPresenter: CouponBoxModuleInterface { |
|||
func fetchCouponBox() { |
|||
view?.startLoading() |
|||
interactor?.fetchCouponBox() |
|||
} |
|||
} |
|||
|
|||
// MARK: CouponBox interactor output interface |
|||
|
|||
extension CouponBoxPresenter: CouponBoxInteractorOutput { |
|||
func setModel(with model: [CouponBoxModel]?) { |
|||
view?.endLoading() |
|||
view?.setModel(with: model) |
|||
} |
|||
|
|||
func setError(with error: Error) { |
|||
view?.endLoading() |
|||
view?.setError(with: error) |
|||
} |
|||
} |
|||
|
|||
extension CouponBoxPresenter: CouponBoxWireframeOutput { |
|||
|
|||
} |
@ -0,0 +1,53 @@ |
|||
// |
|||
// CouponBoxTableViewCell.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
class CouponBoxTableViewCell: UITableViewCell { |
|||
|
|||
@IBOutlet weak var couponNameLabel: UILabel! |
|||
@IBOutlet weak var couponExpiryStartDateLabel: UILabel! |
|||
@IBOutlet weak var couponExpiryEndDateLabel: UILabel! |
|||
@IBOutlet weak var discountValueLabel: UILabel! |
|||
@IBOutlet weak var cellContentView: UIView! |
|||
|
|||
override func awakeFromNib() { |
|||
super.awakeFromNib() |
|||
// Initialization code |
|||
} |
|||
|
|||
override func setSelected(_ selected: Bool, animated: Bool) { |
|||
super.setSelected(selected, animated: animated) |
|||
} |
|||
|
|||
func couponBoxModel(with model: CouponBoxModel?) { |
|||
guard let model = model else { return } |
|||
|
|||
cellContentView.layer.borderWidth = 1 |
|||
cellContentView.layer.borderColor = UIColor.gray.cgColor |
|||
cellContentView.layer.cornerRadius = 5 |
|||
|
|||
couponNameLabel.font = UIFont.sanfrancisco(.medium, size: 17) |
|||
couponNameLabel.text = model.couponName |
|||
|
|||
couponExpiryStartDateLabel.font = UIFont.sanfrancisco(.medium, size: 17) |
|||
couponExpiryStartDateLabel.text = model.buyDate |
|||
|
|||
couponExpiryEndDateLabel.font = UIFont.sanfrancisco(.medium, size: 17) |
|||
couponExpiryEndDateLabel.text = model.expireDate |
|||
|
|||
discountValueLabel.font = UIFont.sanfrancisco(.medium, size: 17) |
|||
|
|||
if model.discountType == "1" { |
|||
discountValueLabel.text = "\(model.discountValue ?? "")%" |
|||
} else { |
|||
discountValueLabel.text = "\(model.discountValue ?? "")KRW" |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,229 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="HSb-ou-7T5"> |
|||
<device id="retina5_5" orientation="portrait" appearance="light"/> |
|||
<dependencies> |
|||
<deployment identifier="iOS"/> |
|||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/> |
|||
<capability name="Named colors" minToolsVersion="9.0"/> |
|||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> |
|||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
|||
</dependencies> |
|||
<customFonts key="customFonts"> |
|||
<array key="SanFranciscoDisplay-Medium.otf"> |
|||
<string>SanFranciscoDisplay-Medium</string> |
|||
</array> |
|||
<array key="SanFranciscoDisplay-Regular.otf"> |
|||
<string>SanFranciscoDisplay-Regular</string> |
|||
</array> |
|||
</customFonts> |
|||
<scenes> |
|||
<!--CouponBox--> |
|||
<scene sceneID="R60-Pu-Hpy"> |
|||
<objects> |
|||
<viewController storyboardIdentifier="CouponBoxViewController" title="CouponBox" id="HSb-ou-7T5" customClass="CouponBoxViewController" customModule="GME_Remit" sceneMemberID="viewController"> |
|||
<view key="view" contentMode="scaleToFill" id="9Uc-9s-KgO"> |
|||
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/> |
|||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
|||
<subviews> |
|||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" allowsSelection="NO" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ezy-zE-5Tn"> |
|||
<rect key="frame" x="10" y="84" width="394" height="642"/> |
|||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<view key="tableHeaderView" contentMode="scaleToFill" id="usQ-1d-CTS"> |
|||
<rect key="frame" x="0.0" y="0.0" width="394" height="1"/> |
|||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
|||
<color key="backgroundColor" name="ThemeSeparate"/> |
|||
</view> |
|||
<view key="tableFooterView" contentMode="scaleToFill" id="ypK-Om-Vgj"> |
|||
<rect key="frame" x="0.0" y="177" width="394" height="44"/> |
|||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> |
|||
<subviews> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="There are no coupons" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hfr-ee-qjq"> |
|||
<rect key="frame" x="114" y="12" width="166" height="20"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
</subviews> |
|||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<constraints> |
|||
<constraint firstItem="hfr-ee-qjq" firstAttribute="centerX" secondItem="ypK-Om-Vgj" secondAttribute="centerX" id="761-La-11E"/> |
|||
<constraint firstItem="hfr-ee-qjq" firstAttribute="centerY" secondItem="ypK-Om-Vgj" secondAttribute="centerY" id="Z52-4e-eSq"/> |
|||
</constraints> |
|||
</view> |
|||
<prototypes> |
|||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="CouponCell" rowHeight="120" id="J7s-TN-7il" customClass="CouponCell" customModule="GME_Remit" customModuleProvider="target"> |
|||
<rect key="frame" x="0.0" y="29" width="394" height="120"/> |
|||
<autoresizingMask key="autoresizingMask"/> |
|||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="J7s-TN-7il" id="iVw-0N-Jmx"> |
|||
<rect key="frame" x="0.0" y="0.0" width="394" height="120"/> |
|||
<autoresizingMask key="autoresizingMask"/> |
|||
<subviews> |
|||
<view opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="r8r-7g-2zz"> |
|||
<rect key="frame" x="5" y="5" width="384" height="110"/> |
|||
<subviews> |
|||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" alignment="top" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="rlQ-VP-lmr"> |
|||
<rect key="frame" x="20" y="10" width="287.66666666666669" height="90"/> |
|||
<subviews> |
|||
<stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="bWL-jL-jgo"> |
|||
<rect key="frame" x="0.0" y="0.0" width="63.333333333333336" height="23.333333333333332"/> |
|||
<subviews> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BITRHDAY" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0fN-Cu-zf1"> |
|||
<rect key="frame" x="0.0" y="0.0" width="63.333333333333336" height="23.333333333333332"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="13"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
</subviews> |
|||
</stackView> |
|||
<stackView opaque="NO" contentMode="scaleToFill" spacing="4" translatesAutoresizingMaskIntoConstraints="NO" id="Mvh-Fv-WQg"> |
|||
<rect key="frame" x="0.0" y="33.333333333333336" width="213.66666666666666" height="23.333333333333336"/> |
|||
<subviews> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="SERVICE DISCOUNT" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M2u-YV-fRK"> |
|||
<rect key="frame" x="0.0" y="0.0" width="162" height="23.333333333333332"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(20%)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u9h-2K-juJ"> |
|||
<rect key="frame" x="166" y="0.0" width="47.666666666666657" height="23.333333333333332"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="18"/> |
|||
<color key="textColor" name="ThemeRed"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
</subviews> |
|||
</stackView> |
|||
<stackView opaque="NO" contentMode="scaleToFill" spacing="13" translatesAutoresizingMaskIntoConstraints="NO" id="Lbv-w4-9FN"> |
|||
<rect key="frame" x="0.0" y="66.666666666666671" width="184" height="23.333333333333329"/> |
|||
<subviews> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(2018-05-05)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uzc-AR-517"> |
|||
<rect key="frame" x="0.0" y="0.0" width="75" height="23.333333333333332"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="13"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="~" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EV1-AV-ghr"> |
|||
<rect key="frame" x="88" y="0.0" width="8" height="23.333333333333332"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="13"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="(2019-05-05)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hmE-gu-16z"> |
|||
<rect key="frame" x="109" y="0.0" width="75" height="23.333333333333332"/> |
|||
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="13"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
</subviews> |
|||
</stackView> |
|||
</subviews> |
|||
</stackView> |
|||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="right" translatesAutoresizingMaskIntoConstraints="NO" id="Q7E-3R-YGd"> |
|||
<rect key="frame" x="349" y="47.666666666666664" width="15" height="15"/> |
|||
<constraints> |
|||
<constraint firstAttribute="width" constant="15" id="PoU-i8-MOt"/> |
|||
<constraint firstAttribute="height" constant="15" id="rKY-fM-WO4"/> |
|||
</constraints> |
|||
</imageView> |
|||
</subviews> |
|||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<constraints> |
|||
<constraint firstItem="rlQ-VP-lmr" firstAttribute="leading" secondItem="r8r-7g-2zz" secondAttribute="leading" constant="20" id="06D-WH-oMN"/> |
|||
<constraint firstAttribute="trailing" secondItem="Q7E-3R-YGd" secondAttribute="trailing" constant="20" id="5nc-n3-qje"/> |
|||
<constraint firstItem="Q7E-3R-YGd" firstAttribute="leading" secondItem="rlQ-VP-lmr" secondAttribute="trailing" constant="41.5" id="RBd-s8-VRG"/> |
|||
<constraint firstAttribute="bottom" secondItem="rlQ-VP-lmr" secondAttribute="bottom" constant="10" id="SlU-UU-j6A"/> |
|||
<constraint firstItem="rlQ-VP-lmr" firstAttribute="top" secondItem="r8r-7g-2zz" secondAttribute="top" constant="10" id="cUE-4j-Qqs"/> |
|||
<constraint firstItem="Q7E-3R-YGd" firstAttribute="centerY" secondItem="r8r-7g-2zz" secondAttribute="centerY" id="tLc-eS-GR5"/> |
|||
</constraints> |
|||
</view> |
|||
</subviews> |
|||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<constraints> |
|||
<constraint firstItem="r8r-7g-2zz" firstAttribute="leading" secondItem="iVw-0N-Jmx" secondAttribute="leading" constant="5" id="1dW-Ze-KDF"/> |
|||
<constraint firstItem="r8r-7g-2zz" firstAttribute="top" secondItem="iVw-0N-Jmx" secondAttribute="top" constant="5" id="bY5-ve-1KQ"/> |
|||
<constraint firstAttribute="bottom" secondItem="r8r-7g-2zz" secondAttribute="bottom" constant="5" id="cCH-fC-86m"/> |
|||
<constraint firstAttribute="trailing" secondItem="r8r-7g-2zz" secondAttribute="trailing" constant="5" id="cu8-qr-apg"/> |
|||
</constraints> |
|||
</tableViewCellContentView> |
|||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> |
|||
<connections> |
|||
<outlet property="checkImageView" destination="Q7E-3R-YGd" id="tGN-ln-4I9"/> |
|||
<outlet property="couponCellBackgroundView" destination="r8r-7g-2zz" id="PD9-kR-kL1"/> |
|||
<outlet property="couponNameLabel" destination="0fN-Cu-zf1" id="0Wt-6S-ldx"/> |
|||
<outlet property="discountLabel" destination="u9h-2K-juJ" id="dCc-ze-qWC"/> |
|||
<outlet property="expireDateLabel" destination="hmE-gu-16z" id="fLS-kM-Tbt"/> |
|||
<outlet property="startDateLabel" destination="uzc-AR-517" id="6Mi-TW-QP4"/> |
|||
</connections> |
|||
</tableViewCell> |
|||
</prototypes> |
|||
</tableView> |
|||
<stackView opaque="NO" contentMode="scaleToFill" spacing="8" translatesAutoresizingMaskIntoConstraints="NO" id="DeL-q7-24F"> |
|||
<rect key="frame" x="16.000000000000007" y="10" width="113.66666666666669" height="64"/> |
|||
<subviews> |
|||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="couponImage" translatesAutoresizingMaskIntoConstraints="NO" id="UmJ-8h-GhH"> |
|||
<rect key="frame" x="0.0" y="0.0" width="64" height="64"/> |
|||
</imageView> |
|||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CDB-as-6GK"> |
|||
<rect key="frame" x="72" y="0.0" width="41.666666666666657" height="64"/> |
|||
<fontDescription key="fontDescription" type="system" pointSize="17"/> |
|||
<color key="textColor" name="ThemeText"/> |
|||
<nil key="highlightedColor"/> |
|||
</label> |
|||
</subviews> |
|||
</stackView> |
|||
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TNH-We-CX0"> |
|||
<rect key="frame" x="215" y="10" width="183" height="30"/> |
|||
<state key="normal" title="sdfgsdfgsdfgsdfgsdfgsdfg"> |
|||
<color key="titleColor" name="ThemeRed"/> |
|||
</state> |
|||
<connections> |
|||
<action selector="couponGuidelineButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="S7x-Uz-0me"/> |
|||
</connections> |
|||
</button> |
|||
</subviews> |
|||
<color key="backgroundColor" name="ThemeMainBackground"/> |
|||
<constraints> |
|||
<constraint firstItem="TNH-We-CX0" firstAttribute="top" secondItem="O1T-1R-Sun" secondAttribute="top" constant="10" id="08v-rM-6Kt"/> |
|||
<constraint firstItem="DeL-q7-24F" firstAttribute="top" secondItem="O1T-1R-Sun" secondAttribute="top" constant="10" id="2UI-AI-6en"/> |
|||
<constraint firstItem="ezy-zE-5Tn" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" constant="10" id="6w8-5P-6N7"/> |
|||
<constraint firstAttribute="bottom" secondItem="ezy-zE-5Tn" secondAttribute="bottom" constant="10" id="8qk-86-TUV"/> |
|||
<constraint firstItem="O1T-1R-Sun" firstAttribute="trailing" secondItem="TNH-We-CX0" secondAttribute="trailing" constant="16" id="Ldu-dz-CzH"/> |
|||
<constraint firstItem="O1T-1R-Sun" firstAttribute="trailing" secondItem="ezy-zE-5Tn" secondAttribute="trailing" constant="10" id="UHq-lo-4Ls"/> |
|||
<constraint firstItem="TNH-We-CX0" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="DeL-q7-24F" secondAttribute="trailing" constant="10" id="Uem-MN-t6j"/> |
|||
<constraint firstItem="DeL-q7-24F" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" constant="16" id="Yl6-Iq-kPc"/> |
|||
<constraint firstItem="ezy-zE-5Tn" firstAttribute="top" secondItem="DeL-q7-24F" secondAttribute="bottom" constant="10" id="jK4-NE-dqh"/> |
|||
</constraints> |
|||
<viewLayoutGuide key="safeArea" id="O1T-1R-Sun"/> |
|||
</view> |
|||
<connections> |
|||
<outlet property="couponCount" destination="CDB-as-6GK" id="ah6-bh-HOg"/> |
|||
<outlet property="couponCountStackView" destination="DeL-q7-24F" id="Du7-qv-GxA"/> |
|||
<outlet property="couponGuidelineText" destination="TNH-We-CX0" id="WCf-Y4-fjS"/> |
|||
<outlet property="noCouponMessageLabel" destination="hfr-ee-qjq" id="Q4v-ZY-ncW"/> |
|||
<outlet property="noCouponView" destination="ypK-Om-Vgj" id="JIk-VJ-aNb"/> |
|||
<outlet property="tableView" destination="ezy-zE-5Tn" id="DT4-kB-AtU"/> |
|||
</connections> |
|||
</viewController> |
|||
<placeholder placeholderIdentifier="IBFirstResponder" id="8je-5K-XuW" userLabel="First Responder" sceneMemberID="firstResponder"/> |
|||
</objects> |
|||
<point key="canvasLocation" x="-93.75" y="231.33802816901408"/> |
|||
</scene> |
|||
</scenes> |
|||
<resources> |
|||
<image name="couponImage" width="32" height="32"/> |
|||
<image name="right" width="22" height="22"/> |
|||
<namedColor name="ThemeMainBackground"> |
|||
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
<namedColor name="ThemeRed"> |
|||
<color red="0.92941176470588238" green="0.10588235294117647" blue="0.14117647058823529" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
<namedColor name="ThemeSeparate"> |
|||
<color red="0.82400000095367432" green="0.82400000095367432" blue="0.82400000095367432" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
<namedColor name="ThemeText"> |
|||
<color red="0.28999999165534973" green="0.28999999165534973" blue="0.28999999165534973" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</namedColor> |
|||
</resources> |
|||
<color key="tintColor" red="0.78177064659999995" green="0.55228364470000002" blue="0.018981300289999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
|||
</document> |
@ -0,0 +1,180 @@ |
|||
// |
|||
// CouponBoxViewController.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
import XLPagerTabStrip |
|||
|
|||
protocol CouponBoxDelegate: class { |
|||
func couponBoxView( |
|||
_ viewController: CouponBoxViewController, |
|||
didSelectModel model: CouponBoxModel? |
|||
) |
|||
} |
|||
|
|||
class CouponBoxViewController: UIViewController { |
|||
|
|||
// MARK: Properties |
|||
|
|||
weak var delegate: CouponBoxDelegate? |
|||
|
|||
private var couponList: [CouponBoxModel]? { |
|||
didSet { |
|||
let message = "possessed_coupon_number_text".localized().replacingOccurrences( |
|||
of: "xxx", with: "\(couponList?.count ?? 0)") |
|||
|
|||
couponCount.text = message |
|||
couponCount.font = .sanfrancisco(.regular, size: 13) |
|||
|
|||
if couponList?.count != 0 { //쿠폰리스트가 있으면, |
|||
noCouponView.isHidden = true |
|||
} else { |
|||
noCouponView.isHidden = false |
|||
} |
|||
tableView.reloadData() |
|||
} |
|||
} |
|||
|
|||
var presenter: CouponBoxModuleInterface? |
|||
private lazy var refreshControl = UIRefreshControl() |
|||
|
|||
// MARK: Computed Properties |
|||
|
|||
// MARK: IBOutlets |
|||
|
|||
@IBOutlet weak var tableView: UITableView! |
|||
@IBOutlet weak var noCouponView: UIView! |
|||
@IBOutlet weak var couponCount: UILabel! |
|||
@IBOutlet weak var couponGuidelineText: UIButton! |
|||
@IBOutlet weak var couponCountStackView: UIStackView! |
|||
@IBOutlet weak var noCouponMessageLabel: UILabel! |
|||
|
|||
// MARK: VC's Life cycle |
|||
|
|||
override func viewDidLoad() { |
|||
super.viewDidLoad() |
|||
setup() |
|||
setUI() |
|||
} |
|||
override func viewWillAppear(_ animated: Bool) { |
|||
super.viewWillAppear(animated) |
|||
presenter?.fetchCouponBox() |
|||
} |
|||
|
|||
// MARK: IBActions |
|||
@IBAction func couponGuidelineButton(_ sender: UIButton) { |
|||
// presenter?.goCouponGuideline() |
|||
} |
|||
} |
|||
|
|||
// MARK: CouponBoxViewInterface |
|||
extension CouponBoxViewController: CouponBoxViewInterface { |
|||
func setModel(with model: [CouponBoxModel]?) { |
|||
couponList = model |
|||
} |
|||
|
|||
func setError(with error: Error) { |
|||
alert(message: error.localizedDescription) |
|||
} |
|||
|
|||
func startLoading() { |
|||
showProgressHud() |
|||
} |
|||
|
|||
func endLoading() { |
|||
hideProgressHud() |
|||
} |
|||
} |
|||
|
|||
// MARK: Other Functions |
|||
extension CouponBoxViewController { |
|||
private func setup() { |
|||
initDelegate() |
|||
addRefreshControlCollectionView() |
|||
noCouponMessageLabel.text = "no_coupon_text".localized() |
|||
// all setup should be done here |
|||
} |
|||
|
|||
private func initDelegate() { |
|||
tableView.dataSource = self |
|||
tableView.delegate = self |
|||
} |
|||
private func setUI() { |
|||
couponGuidelineText.setTitle("coupon_guideline_title_text".localized(), for: .normal) |
|||
couponGuidelineText.titleLabel?.font = .sanfrancisco(.regular, size: 13) |
|||
couponGuidelineText.backgroundColor = .clear |
|||
couponCountStackView.backgroundColor = .clear |
|||
} |
|||
|
|||
private func addRefreshControlCollectionView() { |
|||
let colorOption = [NSAttributedString.Key.foregroundColor : UIColor.themeWhite] |
|||
|
|||
let title = NSAttributedString(string: "pull to refresh", attributes: colorOption) |
|||
|
|||
refreshControl.attributedTitle = title |
|||
refreshControl.backgroundColor = .themeBlue |
|||
refreshControl.tintColor = .themeWhite |
|||
refreshControl.addTarget(self, action: #selector(refresh), for: .valueChanged) |
|||
|
|||
if #available(iOS 10.0, *) { |
|||
tableView.refreshControl = refreshControl |
|||
} else { |
|||
tableView.addSubview(refreshControl) |
|||
} |
|||
} |
|||
|
|||
@objc |
|||
private func refresh() { |
|||
self.presenter?.fetchCouponBox() |
|||
|
|||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {[weak self] in |
|||
self?.tableView.refreshControl?.endRefreshing() |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
// MARK: - XLPagerTabStrip'`s IndicatorInfoProvider |
|||
extension CouponBoxViewController: IndicatorInfoProvider { |
|||
func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo { |
|||
return IndicatorInfo.init(title: "couponbox_title_text".localized()) |
|||
} |
|||
} |
|||
|
|||
// MARK: - UITableViewDataSource |
|||
extension CouponBoxViewController: UITableViewDataSource { |
|||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
|||
return couponList?.count ?? 0 |
|||
} |
|||
|
|||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
|||
guard let cell = tableView.dequeueReusableCell(withIdentifier: "CouponCell") as? CouponCell else { |
|||
return CouponBoxTableViewCell() |
|||
} |
|||
cell.setModel(couponList?[indexPath.row]) |
|||
return cell |
|||
} |
|||
} |
|||
|
|||
extension CouponBoxViewController: UITableViewDelegate { |
|||
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { |
|||
let result = UIView() |
|||
|
|||
// recreate insets from existing ones in the table view |
|||
let insets = tableView.separatorInset |
|||
let width = tableView.bounds.width - insets.left - insets.right |
|||
let sepFrame = CGRect(x: insets.left, y: -0.5, width: width, height: 0.5) |
|||
|
|||
// create layer with separator, setting color |
|||
let sep = CALayer() |
|||
sep.frame = sepFrame |
|||
sep.backgroundColor = tableView.separatorColor?.cgColor |
|||
result.layer.addSublayer(sep) |
|||
|
|||
return result |
|||
} |
|||
} |
@ -0,0 +1,21 @@ |
|||
// |
|||
// CouponBoxViewInterface.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
protocol CouponBoxViewInterface: class { |
|||
/// present activity indicator for something process |
|||
func startLoading() |
|||
|
|||
/// dismiss activity indicator for something process |
|||
func endLoading() |
|||
|
|||
///set Model |
|||
func setModel(with model: [CouponBoxModel]?) |
|||
|
|||
///set Error |
|||
func setError(with error: Error) |
|||
} |
@ -0,0 +1,56 @@ |
|||
// |
|||
// CouponBoxWireframe.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import UIKit |
|||
|
|||
class CouponBoxWireframe { |
|||
weak var view: UIViewController! |
|||
weak var output: CouponBoxWireframeOutput? |
|||
private var model: [CouponBoxModel]? |
|||
private weak var delegate: CouponBoxDelegate? |
|||
|
|||
} |
|||
|
|||
extension CouponBoxWireframe: CouponBoxWireframeInput { |
|||
|
|||
var storyboardName: String {return "CouponBox"} |
|||
|
|||
func getMainView() -> UIViewController { |
|||
let service = CouponBoxService() |
|||
let interactor = CouponBoxInteractor(service: service) |
|||
// , model: model) |
|||
let presenter = CouponBoxPresenter() |
|||
let viewController = viewControllerFromStoryboard(of: CouponBoxViewController.self) |
|||
|
|||
output = presenter |
|||
|
|||
viewController.presenter = presenter |
|||
viewController.delegate = delegate |
|||
interactor.output = presenter |
|||
presenter.interactor = interactor |
|||
presenter.wireframe = self |
|||
presenter.view = viewController |
|||
|
|||
view = viewController |
|||
return viewController |
|||
} |
|||
|
|||
func openWith( |
|||
|
|||
delegate: CouponBoxDelegate?, |
|||
model: [CouponBoxModel]?, |
|||
source: UIViewController |
|||
) { |
|||
self.delegate = delegate |
|||
self.model = model |
|||
|
|||
let vc = getMainView() |
|||
|
|||
source.present(vc, animated: true, completion: nil) |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
// |
|||
// CouponBoxWireframeInputOutput.swift |
|||
// GME Remit |
|||
// |
|||
// Created by Jeongbae Kong on 03/12/2019. |
|||
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved. |
|||
// |
|||
|
|||
import Foundation |
|||
|
|||
protocol CouponBoxWireframeInput: WireframeInput { |
|||
} |
|||
|
|||
protocol CouponBoxWireframeOutput: class { |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue