Clean
This commit is contained in:
parent
f9a8ce7fd1
commit
9b4329e2fe
|
@ -20,7 +20,6 @@ final class NotificationServiceExtension : UNNotificationServiceExtension {
|
|||
if let sharedUserDefaults = UserDefaults(suiteName: "group.com.loki-project.loki-messenger") {
|
||||
isMainAppActive = sharedUserDefaults.bool(forKey: "isMainAppActive")
|
||||
}
|
||||
print("[Ryan debug] isMainAppActive \(isMainAppActive)")
|
||||
// If the main app is running, skip the whole process
|
||||
guard !isMainAppActive else { return self.completeWithFailure(content: notificationContent!) }
|
||||
|
||||
|
|
|
@ -308,7 +308,7 @@ static NSTimeInterval launchStartedAt;
|
|||
}
|
||||
|
||||
NSUserDefaults *sharedUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.loki-project.loki-messenger"];
|
||||
[sharedUserDefaults setBool:true forKey:@"isMainAppActive"];
|
||||
[sharedUserDefaults setBool:YES forKey:@"isMainAppActive"];
|
||||
[sharedUserDefaults synchronize];
|
||||
|
||||
[self ensureRootViewController];
|
||||
|
@ -339,7 +339,7 @@ static NSTimeInterval launchStartedAt;
|
|||
[self clearAllNotificationsAndRestoreBadgeCount];
|
||||
|
||||
NSUserDefaults *sharedUserDefaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.com.loki-project.loki-messenger"];
|
||||
[sharedUserDefaults setBool:false forKey:@"isMainAppActive"];
|
||||
[sharedUserDefaults setBool:NO forKey:@"isMainAppActive"];
|
||||
[sharedUserDefaults synchronize];
|
||||
|
||||
[DDLog flushLog];
|
||||
|
|
|
@ -4,8 +4,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
private var isObservingDatabase = true
|
||||
private var isViewVisible = false { didSet { updateIsObservingDatabase() } }
|
||||
private var tableViewTopConstraint: NSLayoutConstraint!
|
||||
|
||||
private var hasDatabaseModifiedNotificationWhenInvisible = false
|
||||
private var wasDatabaseModifiedExternally = false
|
||||
|
||||
private var threads: YapDatabaseViewMappings = {
|
||||
let result = YapDatabaseViewMappings(groups: [ TSInboxGroup ], view: TSThreadDatabaseViewExtensionName)
|
||||
|
@ -235,7 +234,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
let ext = uiDatabaseConnection.ext(TSThreadDatabaseViewExtensionName) as! YapDatabaseViewConnection
|
||||
let hasChanges = ext.hasChanges(forGroup: TSInboxGroup, in: notifications)
|
||||
guard isObservingDatabase else {
|
||||
hasDatabaseModifiedNotificationWhenInvisible = hasChanges
|
||||
wasDatabaseModifiedExternally = hasChanges
|
||||
return
|
||||
}
|
||||
guard hasChanges else {
|
||||
|
@ -280,9 +279,9 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
|
|||
|
||||
@objc private func handleApplicationDidBecomeActiveNotification(_ notification: Notification) {
|
||||
updateIsObservingDatabase()
|
||||
if (hasDatabaseModifiedNotificationWhenInvisible) {
|
||||
if wasDatabaseModifiedExternally {
|
||||
reload()
|
||||
hasDatabaseModifiedNotificationWhenInvisible = false
|
||||
wasDatabaseModifiedExternally = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -842,8 +842,7 @@ typedef enum : NSUInteger {
|
|||
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||
{
|
||||
[self startReadTimer];
|
||||
[self.conversationViewModel viewDidLoad];
|
||||
[self.conversationViewModel loadAnotherPageOfMessages];
|
||||
[self resetContentAndLayout];
|
||||
}
|
||||
|
||||
- (void)dismissPresentedViewControllerIfNecessary
|
||||
|
|
Loading…
Reference in New Issue