Browse Source

Implement Push Notification

pull/1/head
InKwon James Kim 5 years ago
parent
commit
c934cb782c
  1. BIN
      .DS_Store
  2. 24
      GME Remit/AppDelegate.swift
  3. 2
      GME Remit/Modules/Home/User Interface/View/HomeViewController.swift
  4. 37
      GME Remit/Modules/Notice/DetailNotification/User Interface/View/DetailNotification.storyboard
  5. 12
      GME Remit/Modules/Notice/DetailNotification/User Interface/View/DetailNotificationViewController.swift
  6. 4
      GME Remit/Modules/Notice/DetailNotification/User Interface/Wireframe/DetailNotificationWireframe.swift
  7. 2
      GME Remit/Modules/Notice/NotificationHistory/Application Logic/Model/NoticeModel.swift
  8. 5
      GME Remit/Modules/Notice/NotificationHistory/User Interface/View/NotificationCell.swift
  9. 34
      GME Remit/Modules/Notice/NotificationHistory/User Interface/View/NotificationHistory.storyboard
  10. 9
      GME Remit/Modules/Notice/NotificationHistory/User Interface/View/NotificationHistoryViewController.swift
  11. 7
      GME Remit/Modules/Notice/NotificationHistory/User Interface/Wireframe/NotificationHistoryWireframe.swift
  12. 21
      GME Remit/Supported Files/Assets.xcassets/new.imageset/Contents.json
  13. BIN
      GME Remit/Supported Files/Assets.xcassets/new.imageset/new.png
  14. 21
      GME Remit/Supported Files/Assets.xcassets/new2.imageset/Contents.json
  15. BIN
      GME Remit/Supported Files/Assets.xcassets/new2.imageset/new2.png

BIN
.DS_Store

24
GME Remit/AppDelegate.swift

@ -30,9 +30,23 @@ let server: Server = .live
var destination: PushNotificationDestination?
var overlayView: UIView?
enum PushNotificationDestination: String {
case trasactionHistory = "TransactionHistory"
case rechargeHistory = "RechargeHistory"
enum PushNotificationDestination {
case trasactionHistory
case rechargeHistory
case pushNotification
static func getDestination(target: String) -> PushNotificationDestination? {
switch target {
case "TransactionHistory":
return .trasactionHistory
case "RechargeHistory":
return .rechargeHistory
case "PushNotification":
return .pushNotification
default:
return nil
}
}
}
@UIApplicationMain
@ -211,6 +225,8 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
TransactionHistoryGroupWireframe().open(overseasType: .inbound, on: baseVC)
case .rechargeHistory:
RechargeHistoryWireframe().open(on: baseVC)
case .pushNotification:
NotificationHistoryWireframe().open(on: baseVC)
}
}
@ -222,7 +238,7 @@ extension AppDelegate {
private func extractDestination(userInfo: [String : AnyObject]?) -> PushNotificationDestination? {
guard
let destination = userInfo?["destination"] as? String,
let destinationType = PushNotificationDestination(rawValue: destination) else {
let destinationType = PushNotificationDestination.getDestination(target: destination) else {
return nil
}

2
GME Remit/Modules/Home/User Interface/View/HomeViewController.swift

@ -122,6 +122,8 @@ class HomeViewController: UIViewController {
presenter?.openRechargeHistory()
case .trasactionHistory:
presenter?.openTransactionHistory(type: .inbound)
case .pushNotification:
NotificationHistoryWireframe().open(on: self)
}
destination = nil

37
GME Remit/Modules/Notice/DetailNotification/User Interface/View/DetailNotification.storyboard

@ -26,31 +26,31 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="x6S-1E-Rmc">
<rect key="frame" x="0.0" y="44" width="375" height="553"/>
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ML8-hk-1GR">
<rect key="frame" x="0.0" y="0.0" width="375" height="820"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="819.5"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="Wsd-cO-bxJ">
<rect key="frame" x="10" y="10" width="355" height="800"/>
<rect key="frame" x="10" y="10" width="355" height="799.5"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="72d-Sq-55k">
<rect key="frame" x="0.0" y="0.0" width="355" height="16"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="15.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="등록일자" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ba0-9X-U4Q">
<rect key="frame" x="0.0" y="0.0" width="321" height="16"/>
<rect key="frame" x="0.0" y="0.0" width="318.5" height="15.5"/>
<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="252" verticalHuggingPriority="251" text=":" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VtH-Wb-Is9">
<rect key="frame" x="326" y="0.0" width="3.5" height="16"/>
<rect key="frame" x="323.5" y="0.0" width="4" height="15.5"/>
<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="252" verticalHuggingPriority="251" text="N/A" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fT6-kB-U4e">
<rect key="frame" x="334.5" y="0.0" width="20.5" height="16"/>
<rect key="frame" x="332.5" y="0.0" width="22.5" height="15.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="13"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
@ -58,7 +58,7 @@
</subviews>
</stackView>
<view opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MoG-ji-hov">
<rect key="frame" x="0.0" y="36" width="355" height="764"/>
<rect key="frame" x="0.0" y="35.5" width="355" height="764"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="15" translatesAutoresizingMaskIntoConstraints="NO" id="yWn-XD-aDq">
<rect key="frame" x="10" y="10" width="335" height="744"/>
@ -129,28 +129,13 @@
<constraint firstAttribute="bottom" secondItem="ML8-hk-1GR" secondAttribute="bottom" id="gzb-NO-0QC"/>
</constraints>
</scrollView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Uxw-P2-Rcs">
<rect key="frame" x="10" y="607" width="355" height="50"/>
<color key="backgroundColor" name="ThemeRed"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="bmR-YE-llR"/>
</constraints>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/>
<state key="normal" title="확인">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="titleShadowColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
</button>
</subviews>
<color key="backgroundColor" name="ThemeMainBackground"/>
<constraints>
<constraint firstItem="x6S-1E-Rmc" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" id="Ddw-KF-zjP"/>
<constraint firstItem="Uxw-P2-Rcs" firstAttribute="top" secondItem="x6S-1E-Rmc" secondAttribute="bottom" constant="10" id="Dfg-S8-yih"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="trailing" secondItem="Uxw-P2-Rcs" secondAttribute="trailing" constant="10" id="PXF-ua-OjY"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="bottom" secondItem="x6S-1E-Rmc" secondAttribute="bottom" id="arC-PG-Dhb"/>
<constraint firstItem="x6S-1E-Rmc" firstAttribute="trailing" secondItem="O1T-1R-Sun" secondAttribute="trailing" id="hzI-l9-Bog"/>
<constraint firstItem="x6S-1E-Rmc" firstAttribute="top" secondItem="O1T-1R-Sun" secondAttribute="top" id="thZ-2A-kLa"/>
<constraint firstItem="Uxw-P2-Rcs" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" constant="10" id="wBu-1Y-Do9"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="bottom" secondItem="Uxw-P2-Rcs" secondAttribute="bottom" constant="10" id="y20-YH-pkO"/>
</constraints>
<viewLayoutGuide key="safeArea" id="O1T-1R-Sun"/>
</view>
@ -160,7 +145,6 @@
<outlet property="contentView" destination="MoG-ji-hov" id="8W5-Es-IzO"/>
<outlet property="dateLabel" destination="fT6-kB-U4e" id="Uuj-VD-n2h"/>
<outlet property="imageView" destination="vi3-zj-Dn3" id="Uc2-Yh-aWx"/>
<outlet property="okButton" destination="Uxw-P2-Rcs" id="fBe-Re-Vc5"/>
<outlet property="titleLabel" destination="MTQ-OQ-Ne0" id="Qjy-V5-R16"/>
</connections>
</viewController>
@ -191,9 +175,6 @@
<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>

12
GME Remit/Modules/Notice/DetailNotification/User Interface/View/DetailNotificationViewController.swift

@ -23,7 +23,6 @@ class DetailNotificationViewController: UIViewController {
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var contentLabel: UILabel!
@IBOutlet private weak var dateLabel: UILabel!
@IBOutlet private weak var okButton: UIButton!
@IBOutlet private weak var contentView: UIView!
// MARK: VC's Life cycle
@ -55,20 +54,9 @@ extension DetailNotificationViewController {
}
private func setUI() {
if self.presentingViewController == nil {
okButton.isHidden = true
}
// contentView.layer.cornerRadius = 5
// contentView.layer.borderWidth = 1
// contentView.layer.borderColor = UIColor.themeSeparate.cgColor
okButton.layer.cornerRadius = 5
}
private func setUIBinding() {
okButton.rx.tap.bind {[weak self] in
self?.dismiss(animated: true)
}.disposed(by: disposeBag)
}
private func setBinding() {

4
GME Remit/Modules/Notice/DetailNotification/User Interface/Wireframe/DetailNotificationWireframe.swift

@ -38,11 +38,11 @@ extension DetailNotificationWireframe: DetailNotificationWireframeInput {
viewController.navigationController?.pushViewController(vc, animated: true)
}
func open(with index: String, on viewController: UIViewController) {
func open(with index: String, on viewController: UIViewController?) {
self.index = index
let vc = getMainView()
let naviVC = UINavigationController(rootViewController: vc)
viewController.present(naviVC, animated: true)
viewController?.present(naviVC, animated: true)
}
}

2
GME Remit/Modules/Notice/NotificationHistory/Application Logic/Model/NoticeModel.swift

@ -12,6 +12,7 @@ struct NoticeModel: Mappable {
var title: String?
var key: String?
var date: String?
var isRead: String?
init?(map: Map) {
@ -21,5 +22,6 @@ struct NoticeModel: Mappable {
title <- map["title"]
key <- map["rowId"]
date <- map["createDate"]
isRead <- map["isRead"]
}
}

5
GME Remit/Modules/Notice/NotificationHistory/User Interface/View/NotificationCell.swift

@ -12,9 +12,14 @@ class NotificationCell: UITableViewCell {
@IBOutlet private weak var titleLabel: UILabel!
@IBOutlet private weak var dateLabel: UILabel!
@IBOutlet private weak var newIconImageView: UIImageView!
func setModel(_ model: NoticeModel) {
newIconImageView.isHidden = false
titleLabel.text = model.title
dateLabel.text = model.date
newIconImageView.isHidden = model.isRead == "1"
}
}

34
GME Remit/Modules/Notice/NotificationHistory/User Interface/View/NotificationHistory.storyboard

@ -35,7 +35,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="There is no notice" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hII-jh-P5Z">
<rect key="frame" x="120" y="12" width="135.5" height="20"/>
<rect key="frame" x="123" y="12" width="129" height="20.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
@ -58,12 +58,29 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="3Id-Zk-2a3">
<rect key="frame" x="20" y="16" width="315" height="58"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1FP-bq-7Wa">
<stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="nRW-4q-6W0">
<rect key="frame" x="0.0" y="0.0" width="315" height="38"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1FP-bq-7Wa">
<rect key="frame" x="0.0" y="0.0" width="36" height="38"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="19"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="new" translatesAutoresizingMaskIntoConstraints="NO" id="tgE-Ed-yVU">
<rect key="frame" x="41" y="0.0" width="20" height="38"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="m7D-Ev-6yI"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CcW-YB-c6O">
<rect key="frame" x="66" y="0.0" width="249" height="38"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Date" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dwW-XM-PeE">
<rect key="frame" x="0.0" y="38" width="315" height="20"/>
<constraints>
@ -94,6 +111,7 @@
</tableViewCellContentView>
<connections>
<outlet property="dateLabel" destination="dwW-XM-PeE" id="kd7-8a-HPB"/>
<outlet property="newIconImageView" destination="tgE-Ed-yVU" id="m1x-cJ-TPf"/>
<outlet property="titleLabel" destination="1FP-bq-7Wa" id="djE-Vd-glM"/>
</connections>
</tableViewCell>
@ -109,8 +127,13 @@
</constraints>
<viewLayoutGuide key="safeArea" id="O1T-1R-Sun"/>
</view>
<navigationItem key="navigationItem" id="XcP-xq-HWI"/>
<navigationItem key="navigationItem" id="XcP-xq-HWI">
<barButtonItem key="leftBarButtonItem" image="ic_cancel" id="XEy-ga-xCy">
<color key="tintColor" name="ThemeBlack"/>
</barButtonItem>
</navigationItem>
<connections>
<outlet property="closeButton" destination="XEy-ga-xCy" id="fu1-Tq-U4b"/>
<outlet property="noticeErrorLabel" destination="hII-jh-P5Z" id="Ahx-Pi-50w"/>
<outlet property="tableView" destination="fmg-qn-Ab0" id="gPt-cu-zgE"/>
</connections>
@ -139,7 +162,12 @@
</scene>
</scenes>
<resources>
<image name="ic_cancel" width="12" height="12"/>
<image name="new" width="17" height="5"/>
<image name="right_arrow" width="128" height="128"/>
<namedColor name="ThemeBlack">
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</namedColor>
<namedColor name="ThemeSeparate">
<color red="0.82400000095367432" green="0.82400000095367432" blue="0.82400000095367432" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>

9
GME Remit/Modules/Notice/NotificationHistory/User Interface/View/NotificationHistoryViewController.swift

@ -21,6 +21,7 @@ class NotificationHistoryViewController: UIViewController {
// MARK: IBOutlets
@IBOutlet private weak var tableView: UITableView!
@IBOutlet private weak var noticeErrorLabel: UILabel!
@IBOutlet private weak var closeButton: UIBarButtonItem!
// MARK: VC's Life cycle
override func viewDidLoad() {
@ -32,6 +33,10 @@ class NotificationHistoryViewController: UIViewController {
super.viewWillAppear(animated)
setupNormalNavigation()
title = "Notice"
if self.presentingViewController == nil {
self.navigationItem.leftBarButtonItem = nil
}
}
override func viewWillDisappear(_ animated: Bool) {
@ -57,7 +62,9 @@ extension NotificationHistoryViewController {
}
private func setUIBinding() {
closeButton.rx.tap.bind {[weak self] in
self?.dismiss(animated: true)
}.disposed(by: disposeBag)
}
private func setBinding() {

7
GME Remit/Modules/Notice/NotificationHistory/User Interface/Wireframe/NotificationHistoryWireframe.swift

@ -34,4 +34,11 @@ extension NotificationHistoryWireframe: NotificationHistoryWireframeInput {
func detail(index: String) {
DetailNotificationWireframe().push(with: index, at: view)
}
func open(on viewController: UIViewController?) {
let vc = getMainView()
let naviVC = UINavigationController(rootViewController: vc)
viewController?.present(naviVC, animated: true)
}
}

21
GME Remit/Supported Files/Assets.xcassets/new.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "new.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
GME Remit/Supported Files/Assets.xcassets/new.imageset/new.png

After

Width: 17  |  Height: 5  |  Size: 3.0 KiB

21
GME Remit/Supported Files/Assets.xcassets/new2.imageset/Contents.json

@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "new2.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

BIN
GME Remit/Supported Files/Assets.xcassets/new2.imageset/new2.png

After

Width: 17  |  Height: 5  |  Size: 137 B

Loading…
Cancel
Save