Skip to content

Commit

Permalink
Merge pull request #231 from Shikkanime/fix-threads-and-bsky
Browse files Browse the repository at this point in the history
Fix ThreadsSocialNetwork.kt and BskySocialNetwork.kt
  • Loading branch information
Ziedelth authored Mar 1, 2024
2 parents 66bcf4c + 86a7923 commit 22ac06c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ class BskySocialNetwork : AbstractSocialNetwork() {
}

private fun checkSession() {
if (!isInitialized) return

if (initializedAt!!.plusMinutes(configCacheService.getValueAsInt(ConfigPropertyKey.BSKY_SESSION_TIMEOUT, 10).toLong()).isBefore(ZonedDateTime.now())) {
logout()
login()
if (initializedAt != null && initializedAt!!.plusMinutes(configCacheService.getValueAsInt(ConfigPropertyKey.BSKY_SESSION_TIMEOUT, 10).toLong())
.isAfter(ZonedDateTime.now())
) {
return
}

logout()
login()
}

override fun sendMessage(message: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class ThreadsSocialNetwork : AbstractSocialNetwork() {
}

private fun checkSession() {
if (!isInitialized) return

if (initializedAt!!.plusMinutes(configCacheService.getValueAsInt(ConfigPropertyKey.THREADS_SESSION_TIMEOUT, 10).toLong())
.isBefore(ZonedDateTime.now())
if (initializedAt != null && initializedAt!!.plusMinutes(configCacheService.getValueAsInt(ConfigPropertyKey.THREADS_SESSION_TIMEOUT, 10).toLong())
.isAfter(ZonedDateTime.now())
) {
logout()
login()
return
}

logout()
login()
}

override fun sendMessage(message: String) {
Expand Down

0 comments on commit 22ac06c

Please sign in to comment.