mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Replace the context based receiver for Android 14
This commit is contained in:
parent
43842c7120
commit
9df11a9302
21 changed files with 152 additions and 163 deletions
|
@ -51,7 +51,6 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(Dependencies.coreKtx)
|
|
||||||
implementation(Dependencies.fragment)
|
implementation(Dependencies.fragment)
|
||||||
implementation(Dependencies.recyclerView)
|
implementation(Dependencies.recyclerView)
|
||||||
implementation(Dependencies.swipeRefreshLayout)
|
implementation(Dependencies.swipeRefreshLayout)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.newsblur.activity;
|
package com.newsblur.activity;
|
||||||
|
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_REBUILD;
|
import static com.newsblur.service.NbSyncManager.UPDATE_REBUILD;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STATUS;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STATUS;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STORY;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STORY;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
|
@ -70,7 +70,7 @@ class LoginProgress : FragmentActivity() {
|
||||||
val startMain = Intent(this, Main::class.java)
|
val startMain = Intent(this, Main::class.java)
|
||||||
startActivity(startMain)
|
startActivity(startMain)
|
||||||
} else {
|
} else {
|
||||||
UIUtils.safeToast(this, it.getErrorMessage(getString(R.string.login_message_error)), Toast.LENGTH_LONG)
|
Toast.makeText(this, it.getErrorMessage(getString(R.string.login_message_error)), Toast.LENGTH_LONG).show()
|
||||||
startActivity(Intent(this, Login::class.java))
|
startActivity(Intent(this, Login::class.java))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.newsblur.activity;
|
package com.newsblur.activity;
|
||||||
|
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_DB_READY;
|
import static com.newsblur.service.NbSyncManager.UPDATE_DB_READY;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_METADATA;
|
import static com.newsblur.service.NbSyncManager.UPDATE_METADATA;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_REBUILD;
|
import static com.newsblur.service.NbSyncManager.UPDATE_REBUILD;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STATUS;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STATUS;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package com.newsblur.activity;
|
package com.newsblur.activity;
|
||||||
|
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STATUS;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STATUS;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
package com.newsblur.activity
|
package com.newsblur.activity
|
||||||
|
|
||||||
import android.content.IntentFilter
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import com.newsblur.util.PrefConstants.ThemeValue
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.core.content.ContextCompat
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.lifecycle.repeatOnLifecycle
|
||||||
import com.newsblur.database.BlurDatabaseHelper
|
import com.newsblur.database.BlurDatabaseHelper
|
||||||
import com.newsblur.util.PrefsUtils
|
import com.newsblur.service.NBSync
|
||||||
import com.newsblur.util.UIUtils
|
import com.newsblur.service.NbSyncManager
|
||||||
import com.newsblur.service.NBSyncReceiver
|
|
||||||
import com.newsblur.util.FeedUtils
|
import com.newsblur.util.FeedUtils
|
||||||
import com.newsblur.util.Log
|
import com.newsblur.util.Log
|
||||||
|
import com.newsblur.util.PrefConstants.ThemeValue
|
||||||
|
import com.newsblur.util.PrefsUtils
|
||||||
|
import com.newsblur.util.UIUtils
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,13 +34,6 @@ open class NbActivity : AppCompatActivity() {
|
||||||
private var uniqueLoginKey: String? = null
|
private var uniqueLoginKey: String? = null
|
||||||
private var lastTheme: ThemeValue? = null
|
private var lastTheme: ThemeValue? = null
|
||||||
|
|
||||||
// Facilitates the db updates by the sync service on the UI
|
|
||||||
private val serviceSyncReceiver = object : NBSyncReceiver() {
|
|
||||||
override fun handleUpdateType(updateType: Int) {
|
|
||||||
runOnUiThread { handleUpdate(updateType) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
Log.offerContext(this)
|
Log.offerContext(this)
|
||||||
Log.d(this, "onCreate")
|
Log.d(this, "onCreate")
|
||||||
|
@ -62,6 +62,19 @@ open class NbActivity : AppCompatActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
finishIfNotLoggedIn()
|
finishIfNotLoggedIn()
|
||||||
|
|
||||||
|
// Facilitates the db updates by the sync service on the UI
|
||||||
|
lifecycleScope.launch {
|
||||||
|
repeatOnLifecycle(Lifecycle.State.RESUMED) {
|
||||||
|
launch {
|
||||||
|
NbSyncManager.state.collectLatest {
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
handleSyncUpdate(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -76,16 +89,11 @@ open class NbActivity : AppCompatActivity() {
|
||||||
PrefsUtils.applyThemePreference(this)
|
PrefsUtils.applyThemePreference(this)
|
||||||
UIUtils.restartActivity(this)
|
UIUtils.restartActivity(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextCompat.registerReceiver(this, serviceSyncReceiver, IntentFilter().apply {
|
|
||||||
addAction(NBSyncReceiver.NB_SYNC_ACTION)
|
|
||||||
}, ContextCompat.RECEIVER_NOT_EXPORTED)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
Log.d(this.javaClass.name, "onPause")
|
Log.d(this.javaClass.name, "onPause")
|
||||||
super.onPause()
|
super.onPause()
|
||||||
unregisterReceiver(serviceSyncReceiver)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun finishIfNotLoggedIn() {
|
private fun finishIfNotLoggedIn() {
|
||||||
|
@ -109,15 +117,18 @@ open class NbActivity : AppCompatActivity() {
|
||||||
FeedUtils.triggerSync(this)
|
FeedUtils.triggerSync(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private fun handleSyncUpdate(nbSync: NBSync) = when (nbSync) {
|
||||||
* Called on each NB activity after the DB has been updated by the sync service.
|
is NBSync.Update -> handleUpdate(nbSync.type)
|
||||||
*
|
is NBSync.Error -> handleErrorMsg(nbSync.msg)
|
||||||
* @param updateType one or more of the UPDATE_* flags in this class to indicate the
|
}
|
||||||
* type of update being broadcast.
|
|
||||||
*/
|
|
||||||
protected open fun handleUpdate(updateType: Int) {
|
protected open fun handleUpdate(updateType: Int) {
|
||||||
Log.w(this, "activity doesn't implement handleUpdate")
|
Log.w(this, "activity doesn't implement handleUpdate")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleErrorMsg(msg: String) {
|
||||||
|
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const val UNIQUE_LOGIN_KEY = "uniqueLoginKey"
|
private const val UNIQUE_LOGIN_KEY = "uniqueLoginKey"
|
|
@ -30,9 +30,9 @@ import com.newsblur.fragment.ReadingPagerFragment
|
||||||
import com.newsblur.keyboard.KeyboardEvent
|
import com.newsblur.keyboard.KeyboardEvent
|
||||||
import com.newsblur.keyboard.KeyboardListener
|
import com.newsblur.keyboard.KeyboardListener
|
||||||
import com.newsblur.keyboard.KeyboardManager
|
import com.newsblur.keyboard.KeyboardManager
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_REBUILD
|
import com.newsblur.service.NbSyncManager.UPDATE_REBUILD
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_STATUS
|
import com.newsblur.service.NbSyncManager.UPDATE_STATUS
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_STORY
|
import com.newsblur.service.NbSyncManager.UPDATE_STORY
|
||||||
import com.newsblur.service.NBSyncService
|
import com.newsblur.service.NBSyncService
|
||||||
import com.newsblur.util.AppConstants
|
import com.newsblur.util.AppConstants
|
||||||
import com.newsblur.util.CursorFilters
|
import com.newsblur.util.CursorFilters
|
||||||
|
|
|
@ -15,7 +15,7 @@ import com.newsblur.domain.Story
|
||||||
import com.newsblur.fragment.LoadingFragment
|
import com.newsblur.fragment.LoadingFragment
|
||||||
import com.newsblur.fragment.ReadingItemFragment
|
import com.newsblur.fragment.ReadingItemFragment
|
||||||
import com.newsblur.fragment.ReadingItemFragment.Companion.newInstance
|
import com.newsblur.fragment.ReadingItemFragment.Companion.newInstance
|
||||||
import com.newsblur.service.NBSyncReceiver
|
import com.newsblur.service.NbSyncManager
|
||||||
import com.newsblur.util.Log
|
import com.newsblur.util.Log
|
||||||
import com.newsblur.util.NBScope
|
import com.newsblur.util.NBScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -226,7 +226,7 @@ class ReadingAdapter(
|
||||||
for (s in stories) {
|
for (s in stories) {
|
||||||
fragments[s.storyHash]?.let { rif ->
|
fragments[s.storyHash]?.let { rif ->
|
||||||
rif.offerStoryUpdate(s)
|
rif.offerStoryUpdate(s)
|
||||||
rif.handleUpdate(NBSyncReceiver.UPDATE_STORY)
|
rif.handleUpdate(NbSyncManager.UPDATE_STORY)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,11 +82,11 @@ public class DeleteFeedFragment extends DialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
if (getArguments().getString(FEED_TYPE).equals(NORMAL_FEED)) {
|
if (getArguments().getString(FEED_TYPE).equals(NORMAL_FEED)) {
|
||||||
feedUtils.deleteFeed(getArguments().getString(FEED_ID), getArguments().getString(FOLDER_NAME), getActivity());
|
feedUtils.deleteFeed(getArguments().getString(FEED_ID), getArguments().getString(FOLDER_NAME));
|
||||||
} else if (getArguments().getString(FEED_TYPE).equals(SAVED_SEARCH_FEED)) {
|
} else if (getArguments().getString(FEED_TYPE).equals(SAVED_SEARCH_FEED)) {
|
||||||
feedUtils.deleteSavedSearch(getArguments().getString(FEED_ID), getArguments().getString(QUERY), getActivity());
|
feedUtils.deleteSavedSearch(getArguments().getString(FEED_ID), getArguments().getString(QUERY));
|
||||||
} else {
|
} else {
|
||||||
feedUtils.deleteSocialFeed(getArguments().getString(FEED_ID), getActivity());
|
feedUtils.deleteSocialFeed(getArguments().getString(FEED_ID));
|
||||||
}
|
}
|
||||||
// if called from a feed view, end it
|
// if called from a feed view, end it
|
||||||
Activity activity = DeleteFeedFragment.this.getActivity();
|
Activity activity = DeleteFeedFragment.this.getActivity();
|
||||||
|
|
|
@ -13,7 +13,6 @@ import com.newsblur.database.BlurDatabaseHelper
|
||||||
import com.newsblur.databinding.LoginasDialogBinding
|
import com.newsblur.databinding.LoginasDialogBinding
|
||||||
import com.newsblur.network.APIManager
|
import com.newsblur.network.APIManager
|
||||||
import com.newsblur.util.PrefsUtils
|
import com.newsblur.util.PrefsUtils
|
||||||
import com.newsblur.util.UIUtils
|
|
||||||
import com.newsblur.util.executeAsyncTask
|
import com.newsblur.util.executeAsyncTask
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -50,7 +49,7 @@ class LoginAsDialogFragment : DialogFragment() {
|
||||||
val startMain = Intent(requireContext(), Main::class.java)
|
val startMain = Intent(requireContext(), Main::class.java)
|
||||||
requireContext().startActivity(startMain)
|
requireContext().startActivity(startMain)
|
||||||
} else {
|
} else {
|
||||||
UIUtils.safeToast(requireActivity(), "Login as $username failed", Toast.LENGTH_LONG)
|
Toast.makeText(requireActivity(), "Login as $username failed", Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,10 +33,10 @@ import com.newsblur.domain.Story
|
||||||
import com.newsblur.domain.UserDetails
|
import com.newsblur.domain.UserDetails
|
||||||
import com.newsblur.keyboard.KeyboardManager
|
import com.newsblur.keyboard.KeyboardManager
|
||||||
import com.newsblur.network.APIManager
|
import com.newsblur.network.APIManager
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_INTEL
|
import com.newsblur.service.NbSyncManager.UPDATE_INTEL
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_SOCIAL
|
import com.newsblur.service.NbSyncManager.UPDATE_SOCIAL
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_STORY
|
import com.newsblur.service.NbSyncManager.UPDATE_STORY
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_TEXT
|
import com.newsblur.service.NbSyncManager.UPDATE_TEXT
|
||||||
import com.newsblur.service.OriginalTextService
|
import com.newsblur.service.OriginalTextService
|
||||||
import com.newsblur.util.*
|
import com.newsblur.util.*
|
||||||
import com.newsblur.util.PrefConstants.ThemeValue
|
import com.newsblur.util.PrefConstants.ThemeValue
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
package com.newsblur.service
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.Intent
|
|
||||||
|
|
||||||
abstract class NBSyncReceiver : BroadcastReceiver() {
|
|
||||||
|
|
||||||
abstract fun handleUpdateType(updateType: Int)
|
|
||||||
|
|
||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
|
||||||
if (intent?.action == NB_SYNC_ACTION) {
|
|
||||||
handleUpdateType(intent.getIntExtra(NB_SYNC_UPDATE_TYPE, 0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
const val NB_SYNC_ACTION = "nb.sync.action"
|
|
||||||
const val NB_SYNC_ERROR_MESSAGE = "nb_sync_error_msg"
|
|
||||||
const val NB_SYNC_UPDATE_TYPE = "nb_sync_update_type"
|
|
||||||
|
|
||||||
const val UPDATE_DB_READY = 1 shl 0
|
|
||||||
const val UPDATE_METADATA = 1 shl 1
|
|
||||||
const val UPDATE_STORY = 1 shl 2
|
|
||||||
const val UPDATE_SOCIAL = 1 shl 3
|
|
||||||
const val UPDATE_INTEL = 1 shl 4
|
|
||||||
const val UPDATE_STATUS = 1 shl 5
|
|
||||||
const val UPDATE_TEXT = 1 shl 6
|
|
||||||
const val UPDATE_REBUILD = 1 shl 7
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -13,11 +13,11 @@ import com.newsblur.NbApplication;
|
||||||
import com.newsblur.R;
|
import com.newsblur.R;
|
||||||
import com.newsblur.database.BlurDatabaseHelper;
|
import com.newsblur.database.BlurDatabaseHelper;
|
||||||
import static com.newsblur.database.BlurDatabaseHelper.closeQuietly;
|
import static com.newsblur.database.BlurDatabaseHelper.closeQuietly;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_DB_READY;
|
import static com.newsblur.service.NbSyncManager.UPDATE_DB_READY;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_METADATA;
|
import static com.newsblur.service.NbSyncManager.UPDATE_METADATA;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_REBUILD;
|
import static com.newsblur.service.NbSyncManager.UPDATE_REBUILD;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STATUS;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STATUS;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STORY;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STORY;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
@ -47,10 +47,7 @@ import com.newsblur.util.NetworkUtils;
|
||||||
import com.newsblur.util.NotificationUtils;
|
import com.newsblur.util.NotificationUtils;
|
||||||
import com.newsblur.util.PrefsUtils;
|
import com.newsblur.util.PrefsUtils;
|
||||||
import com.newsblur.util.ReadingAction;
|
import com.newsblur.util.ReadingAction;
|
||||||
import com.newsblur.util.ReadFilter;
|
|
||||||
import com.newsblur.util.StateFilter;
|
import com.newsblur.util.StateFilter;
|
||||||
import com.newsblur.util.StoryOrder;
|
|
||||||
import com.newsblur.util.UIUtils;
|
|
||||||
import com.newsblur.widget.WidgetUtils;
|
import com.newsblur.widget.WidgetUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -272,6 +269,12 @@ public class NBSyncService extends JobService {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNetworkChanged(@NonNull JobParameters params) {
|
||||||
|
super.onNetworkChanged(params);
|
||||||
|
com.newsblur.util.Log.d(this, "onNetworkChanged");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do the actual work of syncing.
|
* Do the actual work of syncing.
|
||||||
*/
|
*/
|
||||||
|
@ -1160,7 +1163,7 @@ public class NBSyncService extends JobService {
|
||||||
dbHelper.prepareReadingSession(fs, cursorFilters.getStateFilter(), cursorFilters.getReadFilter());
|
dbHelper.prepareReadingSession(fs, cursorFilters.getStateFilter(), cursorFilters.getReadFilter());
|
||||||
// note which feedset we are loading so we can trigger another reset when it changes
|
// note which feedset we are loading so we can trigger another reset when it changes
|
||||||
dbHelper.setSessionFeedSet(fs);
|
dbHelper.setSessionFeedSet(fs);
|
||||||
UIUtils.syncUpdateStatus(context, UPDATE_STORY | UPDATE_STATUS);
|
NbSyncManager.submitUpdate(UPDATE_STORY | UPDATE_STATUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1270,15 +1273,11 @@ public class NBSyncService extends JobService {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendSyncUpdate(int update) {
|
protected void sendSyncUpdate(int update) {
|
||||||
Intent i = new Intent(NBSyncReceiver.NB_SYNC_ACTION);
|
NbSyncManager.submitUpdate(UPDATE_STORY | UPDATE_STATUS);
|
||||||
i.putExtra(NBSyncReceiver.NB_SYNC_UPDATE_TYPE, update);
|
|
||||||
broadcastSync(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendToastError(@NonNull String message) {
|
protected void sendToastError(@NonNull String message) {
|
||||||
Intent i = new Intent(NBSyncReceiver.NB_SYNC_ACTION);
|
NbSyncManager.submitError(message);
|
||||||
i.putExtra(NBSyncReceiver.NB_SYNC_ERROR_MESSAGE, message);
|
|
||||||
broadcastSync(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void broadcastSync(@NonNull Intent intent) {
|
private void broadcastSync(@NonNull Intent intent) {
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.newsblur.service
|
||||||
|
|
||||||
|
import com.newsblur.util.NBScope
|
||||||
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
|
import kotlinx.coroutines.flow.asSharedFlow
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
object NbSyncManager {
|
||||||
|
|
||||||
|
const val UPDATE_DB_READY = 1 shl 0
|
||||||
|
const val UPDATE_METADATA = 1 shl 1
|
||||||
|
const val UPDATE_STORY = 1 shl 2
|
||||||
|
const val UPDATE_SOCIAL = 1 shl 3
|
||||||
|
const val UPDATE_INTEL = 1 shl 4
|
||||||
|
const val UPDATE_STATUS = 1 shl 5
|
||||||
|
const val UPDATE_TEXT = 1 shl 6
|
||||||
|
const val UPDATE_REBUILD = 1 shl 7
|
||||||
|
|
||||||
|
private val _state = MutableSharedFlow<NBSync>()
|
||||||
|
val state = _state.asSharedFlow()
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun submitUpdate(type: Int) = submit(NBSync.Update(type))
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun submitError(msg: String) = submit(NBSync.Error(msg))
|
||||||
|
|
||||||
|
private fun submit(nbSync: NBSync) {
|
||||||
|
NBScope.launch {
|
||||||
|
_state.emit(nbSync)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class NBSync {
|
||||||
|
|
||||||
|
data class Error(
|
||||||
|
val msg: String,
|
||||||
|
) : NBSync()
|
||||||
|
|
||||||
|
data class Update(
|
||||||
|
val type: Int,
|
||||||
|
) : NBSync()
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package com.newsblur.service;
|
package com.newsblur.service;
|
||||||
|
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_TEXT;
|
import static com.newsblur.service.NbSyncManager.UPDATE_TEXT;
|
||||||
|
|
||||||
import com.newsblur.database.DatabaseConstants;
|
import com.newsblur.database.DatabaseConstants;
|
||||||
import com.newsblur.network.domain.StoryTextResponse;
|
import com.newsblur.network.domain.StoryTextResponse;
|
||||||
|
|
|
@ -36,7 +36,7 @@ abstract class SubService(
|
||||||
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
parent.checkCompletion()
|
parent.checkCompletion()
|
||||||
parent.sendSyncUpdate(NBSyncReceiver.UPDATE_STATUS)
|
parent.sendSyncUpdate(NbSyncManager.UPDATE_STATUS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,14 @@ import com.newsblur.domain.Story
|
||||||
import com.newsblur.fragment.ReadingActionConfirmationFragment
|
import com.newsblur.fragment.ReadingActionConfirmationFragment
|
||||||
import com.newsblur.network.APIConstants
|
import com.newsblur.network.APIConstants
|
||||||
import com.newsblur.network.APIManager
|
import com.newsblur.network.APIManager
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_METADATA
|
import com.newsblur.service.NbSyncManager.UPDATE_METADATA
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_SOCIAL
|
import com.newsblur.service.NbSyncManager.UPDATE_SOCIAL
|
||||||
import com.newsblur.service.NBSyncReceiver.Companion.UPDATE_STORY
|
import com.newsblur.service.NbSyncManager.UPDATE_STORY
|
||||||
import com.newsblur.service.NBSyncService
|
import com.newsblur.service.NBSyncService
|
||||||
import com.newsblur.service.OriginalTextService
|
import com.newsblur.service.OriginalTextService
|
||||||
import com.newsblur.util.FeedExt.disableNotification
|
import com.newsblur.util.FeedExt.disableNotification
|
||||||
import com.newsblur.util.FeedExt.setNotifyFocus
|
import com.newsblur.util.FeedExt.setNotifyFocus
|
||||||
import com.newsblur.util.FeedExt.setNotifyUnread
|
import com.newsblur.util.FeedExt.setNotifyUnread
|
||||||
import com.newsblur.util.UIUtils.syncUpdateStatus
|
|
||||||
|
|
||||||
class FeedUtils(
|
class FeedUtils(
|
||||||
private val dbHelper: BlurDatabaseHelper,
|
private val dbHelper: BlurDatabaseHelper,
|
||||||
|
@ -67,14 +66,14 @@ class FeedUtils(
|
||||||
doInBackground = {
|
doInBackground = {
|
||||||
val ra = if (saved) ReadingAction.saveStory(storyHash, userTags) else ReadingAction.unsaveStory(storyHash)
|
val ra = if (saved) ReadingAction.saveStory(storyHash, userTags) else ReadingAction.unsaveStory(storyHash)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_STORY)
|
syncUpdateStatus(UPDATE_STORY)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteSavedSearch(feedId: String?, query: String?, context: Context) {
|
fun deleteSavedSearch(feedId: String?, query: String?) {
|
||||||
NBScope.executeAsyncTask(
|
NBScope.executeAsyncTask(
|
||||||
doInBackground = {
|
doInBackground = {
|
||||||
apiManager.deleteSearch(feedId, query)
|
apiManager.deleteSearch(feedId, query)
|
||||||
|
@ -82,7 +81,7 @@ class FeedUtils(
|
||||||
onPostExecute = { newsBlurResponse ->
|
onPostExecute = { newsBlurResponse ->
|
||||||
if (!newsBlurResponse.isError) {
|
if (!newsBlurResponse.isError) {
|
||||||
dbHelper.deleteSavedSearch(feedId, query)
|
dbHelper.deleteSavedSearch(feedId, query)
|
||||||
syncUpdateStatus(context, UPDATE_METADATA)
|
syncUpdateStatus(UPDATE_METADATA)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -102,7 +101,7 @@ class FeedUtils(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteFeed(feedId: String?, folderName: String?, context: Context) {
|
fun deleteFeed(feedId: String?, folderName: String?) {
|
||||||
NBScope.executeAsyncTask(
|
NBScope.executeAsyncTask(
|
||||||
doInBackground = {
|
doInBackground = {
|
||||||
apiManager.deleteFeed(feedId, folderName)
|
apiManager.deleteFeed(feedId, folderName)
|
||||||
|
@ -110,12 +109,12 @@ class FeedUtils(
|
||||||
onPostExecute = {
|
onPostExecute = {
|
||||||
// TODO: we can't check result.isError() because the delete call sets the .message property on all calls. find a better error check
|
// TODO: we can't check result.isError() because the delete call sets the .message property on all calls. find a better error check
|
||||||
dbHelper.deleteFeed(feedId)
|
dbHelper.deleteFeed(feedId)
|
||||||
syncUpdateStatus(context, UPDATE_METADATA)
|
syncUpdateStatus(UPDATE_METADATA)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteSocialFeed(userId: String?, context: Context) {
|
fun deleteSocialFeed(userId: String?) {
|
||||||
NBScope.executeAsyncTask(
|
NBScope.executeAsyncTask(
|
||||||
doInBackground = {
|
doInBackground = {
|
||||||
apiManager.unfollowUser(userId)
|
apiManager.unfollowUser(userId)
|
||||||
|
@ -123,7 +122,7 @@ class FeedUtils(
|
||||||
onPostExecute = {
|
onPostExecute = {
|
||||||
// TODO: we can't check result.isError() because the delete call sets the .message property on all calls. find a better error check
|
// TODO: we can't check result.isError() because the delete call sets the .message property on all calls. find a better error check
|
||||||
dbHelper.deleteSocialFeed(userId)
|
dbHelper.deleteSocialFeed(userId)
|
||||||
syncUpdateStatus(context, UPDATE_METADATA)
|
syncUpdateStatus(UPDATE_METADATA)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -190,7 +189,7 @@ class FeedUtils(
|
||||||
|
|
||||||
// update unread state and unread counts in the local DB
|
// update unread state and unread counts in the local DB
|
||||||
val impactedFeeds = dbHelper.setStoryReadState(story, read)
|
val impactedFeeds = dbHelper.setStoryReadState(story, read)
|
||||||
syncUpdateStatus(context, UPDATE_STORY)
|
syncUpdateStatus(UPDATE_STORY)
|
||||||
|
|
||||||
NBSyncService.addRecountCandidates(impactedFeeds)
|
NBSyncService.addRecountCandidates(impactedFeeds)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
|
@ -310,7 +309,7 @@ class FeedUtils(
|
||||||
doInBackground = {
|
doInBackground = {
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
val impact = ra.doLocal(context, dbHelper)
|
val impact = ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, impact)
|
syncUpdateStatus(impact)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -353,7 +352,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.shareStory(story.storyHash, story.id, story.feedId, sourceUserId, comment)
|
val ra = ReadingAction.shareStory(story.storyHash, story.id, story.feedId, sourceUserId, comment)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL or UPDATE_STORY)
|
syncUpdateStatus(UPDATE_SOCIAL or UPDATE_STORY)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +360,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.renameFeed(feedId, newFeedName)
|
val ra = ReadingAction.renameFeed(feedId, newFeedName)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
val impact = ra.doLocal(context, dbHelper)
|
val impact = ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, impact)
|
syncUpdateStatus(impact)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +368,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.unshareStory(story.storyHash, story.id, story.feedId)
|
val ra = ReadingAction.unshareStory(story.storyHash, story.id, story.feedId)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL or UPDATE_STORY)
|
syncUpdateStatus(UPDATE_SOCIAL or UPDATE_STORY)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +376,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.likeComment(story.id, commentUserId, story.feedId)
|
val ra = ReadingAction.likeComment(story.id, commentUserId, story.feedId)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL)
|
syncUpdateStatus(UPDATE_SOCIAL)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +384,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.unlikeComment(story.id, commentUserId, story.feedId)
|
val ra = ReadingAction.unlikeComment(story.id, commentUserId, story.feedId)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL)
|
syncUpdateStatus(UPDATE_SOCIAL)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +392,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.replyToComment(storyId, feedId, commentUserId, replyText)
|
val ra = ReadingAction.replyToComment(storyId, feedId, commentUserId, replyText)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL)
|
syncUpdateStatus(UPDATE_SOCIAL)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +400,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.updateReply(story.id, story.feedId, commentUserId, replyId, replyText)
|
val ra = ReadingAction.updateReply(story.id, story.feedId, commentUserId, replyId, replyText)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL)
|
syncUpdateStatus(UPDATE_SOCIAL)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +408,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.deleteReply(story.id, story.feedId, commentUserId, replyId)
|
val ra = ReadingAction.deleteReply(story.id, story.feedId, commentUserId, replyId)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_SOCIAL)
|
syncUpdateStatus(UPDATE_SOCIAL)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +454,7 @@ class FeedUtils(
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
|
|
||||||
syncUpdateStatus(context, UPDATE_METADATA)
|
syncUpdateStatus(UPDATE_METADATA)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -465,7 +464,7 @@ class FeedUtils(
|
||||||
val ra = ReadingAction.instaFetch(feedId)
|
val ra = ReadingAction.instaFetch(feedId)
|
||||||
dbHelper.enqueueAction(ra)
|
dbHelper.enqueueAction(ra)
|
||||||
ra.doLocal(context, dbHelper)
|
ra.doLocal(context, dbHelper)
|
||||||
syncUpdateStatus(context, UPDATE_METADATA)
|
syncUpdateStatus(UPDATE_METADATA)
|
||||||
triggerSync(context)
|
triggerSync(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +486,10 @@ class FeedUtils(
|
||||||
UIUtils.handleUri(context, Uri.parse(url))
|
UIUtils.handleUri(context, Uri.parse(url))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun syncUpdateStatus(updateType: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.newsblur.util;
|
package com.newsblur.util;
|
||||||
|
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_INTEL;
|
import static com.newsblur.service.NbSyncManager.UPDATE_INTEL;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_METADATA;
|
import static com.newsblur.service.NbSyncManager.UPDATE_METADATA;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_SOCIAL;
|
import static com.newsblur.service.NbSyncManager.UPDATE_SOCIAL;
|
||||||
import static com.newsblur.service.NBSyncReceiver.UPDATE_STORY;
|
import static com.newsblur.service.NbSyncManager.UPDATE_STORY;
|
||||||
|
|
||||||
import android.content.ContentValues;
|
import android.content.ContentValues;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -18,7 +18,7 @@ import com.newsblur.network.domain.CommentResponse;
|
||||||
import com.newsblur.network.domain.NewsBlurResponse;
|
import com.newsblur.network.domain.NewsBlurResponse;
|
||||||
import com.newsblur.network.domain.StoriesResponse;
|
import com.newsblur.network.domain.StoriesResponse;
|
||||||
import com.newsblur.network.APIManager;
|
import com.newsblur.network.APIManager;
|
||||||
import com.newsblur.service.NBSyncReceiver;
|
import com.newsblur.service.NbSyncManager;
|
||||||
import com.newsblur.service.NBSyncService;
|
import com.newsblur.service.NBSyncService;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -375,7 +375,7 @@ public class ReadingAction implements Serializable {
|
||||||
} else {
|
} else {
|
||||||
com.newsblur.util.Log.w(this, "failed to refresh story data after action");
|
com.newsblur.util.Log.w(this, "failed to refresh story data after action");
|
||||||
}
|
}
|
||||||
impact |= NBSyncReceiver.UPDATE_SOCIAL;
|
impact |= NbSyncManager.UPDATE_SOCIAL;
|
||||||
}
|
}
|
||||||
if (commentResponse != null) {
|
if (commentResponse != null) {
|
||||||
result = commentResponse;
|
result = commentResponse;
|
||||||
|
@ -384,7 +384,7 @@ public class ReadingAction implements Serializable {
|
||||||
} else {
|
} else {
|
||||||
com.newsblur.util.Log.w(this, "failed to refresh comment data after action");
|
com.newsblur.util.Log.w(this, "failed to refresh comment data after action");
|
||||||
}
|
}
|
||||||
impact |= NBSyncReceiver.UPDATE_SOCIAL;
|
impact |= NbSyncManager.UPDATE_SOCIAL;
|
||||||
}
|
}
|
||||||
if (result != null && impact != 0) {
|
if (result != null && impact != 0) {
|
||||||
result.impactCode = impact;
|
result.impactCode = impact;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import android.view.MenuInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -48,12 +47,10 @@ import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.appbar.MaterialToolbar;
|
import com.google.android.material.appbar.MaterialToolbar;
|
||||||
import com.google.android.material.color.MaterialColors;
|
import com.google.android.material.color.MaterialColors;
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.newsblur.NbApplication;
|
|
||||||
import com.newsblur.R;
|
import com.newsblur.R;
|
||||||
import com.newsblur.activity.*;
|
import com.newsblur.activity.*;
|
||||||
import com.newsblur.domain.Classifier;
|
import com.newsblur.domain.Classifier;
|
||||||
import com.newsblur.domain.Story;
|
import com.newsblur.domain.Story;
|
||||||
import com.newsblur.service.NBSyncReceiver;
|
|
||||||
|
|
||||||
public class UIUtils {
|
public class UIUtils {
|
||||||
|
|
||||||
|
@ -223,28 +220,6 @@ public class UIUtils {
|
||||||
return iconView;
|
return iconView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows a toast in a circumstance where the context might be null. This can very
|
|
||||||
* rarely happen when toasts are done from async tasks and the context is finished
|
|
||||||
* before the task completes, resulting in a crash. This prevents the crash at the
|
|
||||||
* cost of the toast not being shown.
|
|
||||||
*/
|
|
||||||
public static void safeToast(final Activity c, final int rid, final int duration) {
|
|
||||||
if (c != null) {
|
|
||||||
c.runOnUiThread(new Runnable() { public void run() {
|
|
||||||
Toast.makeText(c, rid, duration).show();
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void safeToast(final Activity c, final String text, final int duration) {
|
|
||||||
if ((c != null) && (text != null)) {
|
|
||||||
c.runOnUiThread(new Runnable() { public void run() {
|
|
||||||
Toast.makeText(c, text, duration).show();
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restart an activity. See http://stackoverflow.com/a/11651252/70795
|
* Restart an activity. See http://stackoverflow.com/a/11651252/70795
|
||||||
* We post this on the Handler to allow onResume to finish before the activity restarts
|
* We post this on the Handler to allow onResume to finish before the activity restarts
|
||||||
|
@ -605,14 +580,6 @@ public class UIUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void syncUpdateStatus(Context context, int updateType) {
|
|
||||||
if (NbApplication.isAppForeground()) {
|
|
||||||
Intent intent = new Intent(NBSyncReceiver.NB_SYNC_ACTION);
|
|
||||||
intent.putExtra(NBSyncReceiver.NB_SYNC_UPDATE_TYPE, updateType);
|
|
||||||
context.sendBroadcast(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showSnackBar(View view, String message) {
|
public static void showSnackBar(View view, String message) {
|
||||||
Snackbar.make(view, message, 600).show();
|
Snackbar.make(view, message, 600).show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ object Dependencies {
|
||||||
const val lifecycleRuntime = "androidx.lifecycle:lifecycle-runtime-ktx:${Version.lifecycle}"
|
const val lifecycleRuntime = "androidx.lifecycle:lifecycle-runtime-ktx:${Version.lifecycle}"
|
||||||
const val lifecycleProcess = "androidx.lifecycle:lifecycle-process:${Version.lifecycle}"
|
const val lifecycleProcess = "androidx.lifecycle:lifecycle-process:${Version.lifecycle}"
|
||||||
const val splashScreen = "androidx.core:core-splashscreen:${Version.splashScreen}"
|
const val splashScreen = "androidx.core:core-splashscreen:${Version.splashScreen}"
|
||||||
const val coreKtx = "androidx.core:core-ktx:${Version.coreKtx}"
|
|
||||||
const val hiltAndroid = "com.google.dagger:hilt-android:${Version.hilt}"
|
const val hiltAndroid = "com.google.dagger:hilt-android:${Version.hilt}"
|
||||||
const val hiltCompiler = "com.google.dagger:hilt-compiler:${Version.hilt}"
|
const val hiltCompiler = "com.google.dagger:hilt-compiler:${Version.hilt}"
|
||||||
const val profileInstaller = "androidx.profileinstaller:profileinstaller:${Version.profileInstaller}"
|
const val profileInstaller = "androidx.profileinstaller:profileinstaller:${Version.profileInstaller}"
|
||||||
|
|
|
@ -18,7 +18,6 @@ object Version {
|
||||||
const val browser = "1.8.0"
|
const val browser = "1.8.0"
|
||||||
const val lifecycle = "2.7.0"
|
const val lifecycle = "2.7.0"
|
||||||
const val splashScreen = "1.0.1"
|
const val splashScreen = "1.0.1"
|
||||||
const val coreKtx = "1.12.0"
|
|
||||||
|
|
||||||
const val hilt = "2.51"
|
const val hilt = "2.51"
|
||||||
const val profileInstaller = "1.3.1"
|
const val profileInstaller = "1.3.1"
|
||||||
|
|
Loading…
Add table
Reference in a new issue