Updating the code to work with application-services v95.0.0

This required updating the code to handle the new app-services error
hierarchy.
pull/543/head
Ben Dean-Kawamura 2 years ago committed by mergify[bot]
parent 78bedb9f3c
commit 70e740f23e

@ -39,7 +39,7 @@ import kotlinx.coroutines.flow.mapNotNull
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import mozilla.appservices.places.BookmarkRoot
import mozilla.appservices.places.uniffi.PlacesException
import mozilla.appservices.places.uniffi.PlacesApiException
import mozilla.components.browser.state.action.ContentAction
import mozilla.components.browser.state.selector.findCustomTab
import mozilla.components.browser.state.selector.findCustomTabOrSelectedTab
@ -1316,7 +1316,7 @@ abstract class BaseBrowserFragment :
.show()
}
}
} catch (e: PlacesException.UrlParseFailed) {
} catch (e: PlacesApiException.UrlParseFailed) {
withContext(Main) {
view?.let {
FenixSnackbar.make(

@ -6,7 +6,7 @@ package org.mozilla.fenix.components.bookmarks
import androidx.annotation.WorkerThread
import mozilla.appservices.places.BookmarkRoot
import mozilla.appservices.places.uniffi.PlacesException
import mozilla.appservices.places.uniffi.PlacesApiException
import mozilla.components.concept.storage.BookmarksStorage
import mozilla.components.concept.storage.HistoryStorage
import org.mozilla.fenix.home.recentbookmarks.RecentBookmark
@ -42,7 +42,7 @@ class BookmarksUseCase(
)
}
canAdd
} catch (e: PlacesException.UrlParseFailed) {
} catch (e: PlacesApiException.UrlParseFailed) {
false
}
}

@ -29,7 +29,7 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.Dispatchers.Main
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import mozilla.appservices.places.uniffi.PlacesException
import mozilla.appservices.places.uniffi.PlacesApiException
import mozilla.components.concept.storage.BookmarkInfo
import mozilla.components.concept.storage.BookmarkNode
import mozilla.components.concept.storage.BookmarkNodeType
@ -287,7 +287,7 @@ class EditBookmarkFragment : Fragment(R.layout.fragment_edit_bookmark), MenuProv
findNavController().popBackStack()
}
} catch (e: PlacesException.UrlParseFailed) {
} catch (e: PlacesApiException.UrlParseFailed) {
withContext(Main) {
binding.inputLayoutBookmarkUrl.error =
getString(R.string.bookmark_invalid_url_error)

@ -17,7 +17,7 @@ import kotlinx.coroutines.withContext
import mozilla.components.concept.storage.Login
import mozilla.components.concept.storage.LoginEntry
import mozilla.components.service.sync.logins.InvalidRecordException
import mozilla.components.service.sync.logins.LoginsStorageException
import mozilla.components.service.sync.logins.LoginsApiException
import mozilla.components.service.sync.logins.NoSuchRecordException
import mozilla.components.service.sync.logins.SyncableLoginsStorage
import org.mozilla.fenix.R
@ -90,7 +90,7 @@ open class SavedLoginsStorageController(
try {
val encryptedLogin = passwordsStorage.add(loginEntryToSave)
syncAndUpdateList(passwordsStorage.decryptLogin(encryptedLogin))
} catch (loginException: LoginsStorageException) {
} catch (loginException: LoginsApiException) {
Log.e(
"Add new login",
"Failed to add new login.",
@ -140,7 +140,7 @@ open class SavedLoginsStorageController(
try {
val encryptedLogin = passwordsStorage.update(guid, loginEntryToSave)
syncAndUpdateList(passwordsStorage.decryptLogin(encryptedLogin))
} catch (loginException: LoginsStorageException) {
} catch (loginException: LoginsApiException) {
when (loginException) {
is NoSuchRecordException,
is InvalidRecordException,
@ -194,7 +194,7 @@ open class SavedLoginsStorageController(
val validEntry = if (entry.password.isNotEmpty()) entry else entry.copy(password = "password")
var dupe = try {
passwordsStorage.findLoginToUpdate(validEntry)?.mapToSavedLogin()
} catch (e: LoginsStorageException) {
} catch (e: LoginsApiException) {
// If the entry was invalid, then consider it not a dupe
null
}

Loading…
Cancel
Save