Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ public class ServerSettings {
UserDefaults.standard.removeObject(forKey: ServerConstants.UserDefaults.lastSyncTime)
}

public class var lastSyncTime: Date? {
UserDefaults.standard.object(forKey: ServerConstants.UserDefaults.lastSyncTime) as? Date
}

// Push Token
public class func pushToken() -> String? {
UserDefaults.standard.string(forKey: ServerConstants.UserDefaults.pushToken)
Expand Down
4 changes: 3 additions & 1 deletion podcasts/AuthenticationHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class AuthenticationHelper {
ServerSettings.refreshToken = response.refreshToken

// we've signed in, set all our existing podcasts to be non synced
DataManager.sharedManager.markAllPodcastsUnsynced()
if ServerSettings.lastSyncTime == nil {
DataManager.sharedManager.markAllPodcastsUnsynced()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@geekygecko Before merging this I'd like to double-check with you as I might be missing any user case.

The app will only mark all podcasts as unsynced if the user has never logged in to any account in this device.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they have just signed in, the last sync should be nil already. 🤔
If they signed out for six months and subscribed to many podcasts, then signed in again, won't that mean those new podcasts won't appear on their other devices?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't that mean those new podcasts won't appear on their other devices?

Based on my tests it syncs just fine (as per the PR description)

}

SyncManager.syncReason = .login
ServerSettings.clearLastSyncTime()
Expand Down
4 changes: 4 additions & 0 deletions podcasts/DeveloperMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ struct DeveloperMenu: View {
PodcastManager.shared.unsubscribe(podcast: podcast)
}
}

Button("Clear all folder information") {
DataManager.sharedManager.clearAllFolderInformation()
}
}

Section {
Expand Down
4 changes: 3 additions & 1 deletion podcasts/SyncSigninViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ class SyncSigninViewController: PCViewController, UITextFieldDelegate {
ServerSettings.saveSyncingPassword(password)

// we've signed in, set all our existing podcasts to be non synced
DataManager.sharedManager.markAllPodcastsUnsynced()
if ServerSettings.lastSyncTime == nil {
DataManager.sharedManager.markAllPodcastsUnsynced()
}

SyncManager.syncReason = .login
ServerSettings.clearLastSyncTime()
Expand Down