Skip to content

Commit

Permalink
Use swipe-down gesture for start sync instead of refresh collection list
Browse files Browse the repository at this point in the history
  • Loading branch information
sunkup committed Oct 23, 2023
1 parent fe679da commit 07c3c03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import android.content.Intent
import android.content.SyncResult
import android.net.ConnectivityManager
import android.net.wifi.WifiManager
import android.os.Build
import android.provider.CalendarContract
import android.provider.ContactsContract
import androidx.annotation.IntDef
Expand Down Expand Up @@ -63,7 +62,7 @@ import java.util.logging.Level
*
* By enqueuing this worker ([SyncWorker.enqueue]) a sync will be started immediately (as soon as
* possible). Currently, there are three scenarios starting a sync:
* 1) *manual sync*: User presses an in-app sync button and enqueues this worker directly.
* 1) *manual sync*: User presses sync button or performs swipe-down gesture and enqueues this worker directly.
* 2) *periodic sync*: User defines time interval to sync in app settings. The [PeriodicSyncWorker] runs
* in the background and enqueues this worker when due.
* 3) *content-triggered sync*: User changes a calendar event, task or contact, or presses a sync
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import android.provider.ContactsContract
import android.view.*
import android.widget.PopupMenu
import androidx.annotation.CallSuper
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
Expand Down Expand Up @@ -147,7 +146,7 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList
}

override fun onRefresh() {
model.refresh()
model.sync()
}

override fun onResume() {
Expand Down Expand Up @@ -334,9 +333,7 @@ abstract class CollectionsFragment: Fragment(), SwipeRefreshLayout.OnRefreshList

// actions

fun refresh() {
RefreshCollectionsWorker.refreshCollections(getApplication(), serviceId)
}
fun sync() = SyncWorker.enqueueAllAuthorities(getApplication(), accountModel.account)

}

Expand Down

0 comments on commit 07c3c03

Please sign in to comment.