Skip to content

Commit

Permalink
调整自动刷新事件间隔
Browse files Browse the repository at this point in the history
close: #259
  • Loading branch information
Finb committed Dec 6, 2024
1 parent 59655ca commit c7886b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Controller/MessageListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
self?.scrollToTop()
}).disposed(by: self.rx.disposeBag)

// 打开APP时,历史消息列表距离上次刷新超过1小时,则自动刷新一下
// 打开APP时,历史消息列表距离上次刷新超过5分钟,则自动刷新一下
var lastAutoRefreshdate = Date()
NotificationCenter.default.rx
.notification(UIApplication.willEnterForegroundNotification)
.filter { _ in
let now = Date()
if now.timeIntervalSince1970 - lastAutoRefreshdate.timeIntervalSince1970 > 60 * 60 {
if now.timeIntervalSince1970 - lastAutoRefreshdate.timeIntervalSince1970 > 60 * 5 {
lastAutoRefreshdate = now
return true
}
Expand Down

0 comments on commit c7886b5

Please sign in to comment.