Browse Source

add expire date of pop-up notification

pull/1/head
InKwon James Kim 5 years ago
parent
commit
fbe7aeaed5
  1. 2
      GMERemittance/Info.plist
  2. 8
      GMERemittance/Module/Home/User Interface/View/HomeViewController.swift
  3. 1
      GMERemittance/Module/Main/User Interface/Wireframe/MainWireframe.swift
  4. 15
      GMERemittance/Module/PopupNotification/User Interface/Wireframe/PopupNotificationWireframe.swift
  5. 1
      GMERemittance/Utility/AppConstants.swift

2
GMERemittance/Info.plist

@ -30,7 +30,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0</string>
<string>1</string>
<key>Fabric</key> <key>Fabric</key>
<dict> <dict>
<key>APIKey</key> <key>APIKey</key>

8
GMERemittance/Module/Home/User Interface/View/HomeViewController.swift

@ -807,6 +807,14 @@ extension HomeViewController {
} }
private func popUpNotification() { private func popUpNotification() {
self.isShowTokenRenewAlert = true
// FIXME: Temporary expire date
let dateformat = DateFormatter()
dateformat.dateFormat = "yyyy-MM-dd"
let expireDate = dateformat.date(from: "2019-08-01")
UserDefaults.standard.set(expireDate, forKey: AppConstants.dateOfExpireNotification)
PopupNotificationWireframe().show(source: self) PopupNotificationWireframe().show(source: self)
} }
} }

1
GMERemittance/Module/Main/User Interface/Wireframe/MainWireframe.swift

@ -96,6 +96,7 @@ extension MainWireframe: MainWireframeInput {
store.setValue(nil, forKey: UserKeys.accessCode) store.setValue(nil, forKey: UserKeys.accessCode)
store.removeObject(forKey: AppConstants.dateOfDontShowNotification) store.removeObject(forKey: AppConstants.dateOfDontShowNotification)
store.removeObject(forKey: AppConstants.dateOfExpireNotification)
KeyChain.shared.save(data: "0", key: .login) KeyChain.shared.save(data: "0", key: .login)

15
GMERemittance/Module/PopupNotification/User Interface/Wireframe/PopupNotificationWireframe.swift

@ -33,12 +33,21 @@ extension PopupNotificationWireframe: PopupNotificationWireframeInput {
} }
func show(source: UIViewController) { func show(source: UIViewController) {
let now = Date()
// FIXME: Temporary expire date
if let expireDate = UserDefaults
.standard
.object(forKey: AppConstants.dateOfExpireNotification) as? Date {
if let remindDate = expireDate - now, remindDate <= 0 {
return
}
}
if let date = UserDefaults if let date = UserDefaults
.standard .standard
.object(forKey: AppConstants.dateOfDontShowNotification) as? Date { .object(forKey: AppConstants.dateOfDontShowNotification) as? Date {
let now = Date()
// TODO: if now - date == 0 then don't show notification else show notification and delete dateOfDontShowNotification // TODO: if now - date == 0 then don't show notification else show notification and delete dateOfDontShowNotification
if let remindDate = now - date, remindDate == 0 { if let remindDate = now - date, remindDate == 0 {

1
GMERemittance/Utility/AppConstants.swift

@ -34,6 +34,7 @@ class AppConstants {
static let accessTokenRegTime = "accessTokenRegTime" static let accessTokenRegTime = "accessTokenRegTime"
static let accessTokenExpTime = "accessTokenExpTime" static let accessTokenExpTime = "accessTokenExpTime"
static let dateOfDontShowNotification = "dateOfDontShowNotification" static let dateOfDontShowNotification = "dateOfDontShowNotification"
static let dateOfExpireNotification = "dateOfExpireNotification"
} }
enum Devices { enum Devices {

Loading…
Cancel
Save