Skip to content

Commit

Permalink
Renamed MessagesMovingJobService to MessagesManagingJobService.| #504
Browse files Browse the repository at this point in the history
  • Loading branch information
DenBond7 committed Oct 11, 2019
1 parent 8487f53 commit a0bbdb1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion FlowCrypt/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name=".jobscheduler.MessagesMovingJobService"
android:name=".jobscheduler.MessagesManagingJobService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ import javax.mail.Session
import javax.mail.Store

/**
* This [JobService] moves messages from one folder to another one (archiving, deleting, total
* deleting and etc).
* This [JobService] manages messages (archiving, deleting, total deleting and etc).
*
* @author Denis Bondarenko
* Date: 10/9/19
* Time: 7:05 PM
* E-mail: [email protected]
*/
class MessagesMovingJobService : JobService() {
class MessagesManagingJobService : JobService() {

override fun onCreate() {
super.onCreate()
Expand All @@ -65,9 +64,9 @@ class MessagesMovingJobService : JobService() {
/**
* This is an implementation of [AsyncTask] which sends the outgoing messages.
*/
private class MoveMessagesAsyncTask internal constructor(jobService: MessagesMovingJobService)
private class MoveMessagesAsyncTask internal constructor(jobService: MessagesManagingJobService)
: AsyncTask<JobParameters, Boolean, JobParameters>() {
private val weakRef: WeakReference<MessagesMovingJobService> = WeakReference(jobService)
private val weakRef: WeakReference<MessagesManagingJobService> = WeakReference(jobService)

private var sess: Session? = null
private var store: Store? = null
Expand Down Expand Up @@ -166,14 +165,14 @@ class MessagesMovingJobService : JobService() {

companion object {

private val TAG = MessagesMovingJobService::class.java.simpleName
private val TAG = MessagesManagingJobService::class.java.simpleName

@JvmStatic
fun schedule(context: Context?) {
context ?: return

val jobInfoBuilder = JobInfo.Builder(JobIdManager.JOB_TYPE_MOVE_MESSAGES,
ComponentName(context, MessagesMovingJobService::class.java))
ComponentName(context, MessagesManagingJobService::class.java))
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
.setPersisted(true)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import com.flowcrypt.email.database.dao.source.AccountDao
import com.flowcrypt.email.database.dao.source.AccountDaoSource
import com.flowcrypt.email.database.dao.source.ActionQueueDaoSource
import com.flowcrypt.email.jobscheduler.ForwardedAttachmentsDownloaderJobService
import com.flowcrypt.email.jobscheduler.MessagesMovingJobService
import com.flowcrypt.email.jobscheduler.MessagesManagingJobService
import com.flowcrypt.email.jobscheduler.MessagesSenderJobService
import com.flowcrypt.email.security.SecurityUtils
import com.flowcrypt.email.service.EmailSyncService
Expand Down Expand Up @@ -50,7 +50,7 @@ class LauncherActivity : BaseActivity() {
PreferenceManager.setDefaultValues(this, R.xml.preferences_notifications_settings, false)
ForwardedAttachmentsDownloaderJobService.schedule(applicationContext)
MessagesSenderJobService.schedule(applicationContext)
MessagesMovingJobService.schedule(applicationContext)
MessagesManagingJobService.schedule(applicationContext)
FeedbackJobIntentService.enqueueWork(this)

account = AccountDaoSource().getActiveAccountInformation(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import com.flowcrypt.email.database.MessageState
import com.flowcrypt.email.database.dao.source.AccountDaoSource
import com.flowcrypt.email.database.dao.source.ContactsDaoSource
import com.flowcrypt.email.database.dao.source.imap.MessageDaoSource
import com.flowcrypt.email.jobscheduler.MessagesMovingJobService
import com.flowcrypt.email.jobscheduler.MessagesManagingJobService
import com.flowcrypt.email.model.MessageEncryptionType
import com.flowcrypt.email.model.MessageType
import com.flowcrypt.email.service.attachment.AttachmentDownloadManagerService
Expand Down Expand Up @@ -213,7 +213,7 @@ class MessageDetailsFragment : BaseSyncFragment(), View.OnClickListener {
R.id.menuActionArchiveMessage -> {
MessageDaoSource().updateMsgState(context!!, details?.email ?: "", details?.label ?: "",
details?.uid?.toLong() ?: 0, MessageState.PENDING_ARCHIVING)
MessagesMovingJobService.schedule(context?.applicationContext)
MessagesManagingJobService.schedule(context?.applicationContext)
activity?.finish()
true
}
Expand Down

0 comments on commit a0bbdb1

Please sign in to comment.