fix favourites overwrite

This commit is contained in:
Austin Huang 2020-12-23 09:06:53 -05:00
parent 30fcf687eb
commit 7c44dad05d
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ public interface FavoriteDao {
@Query("SELECT * FROM favorites WHERE query_text = :query and type = :type")
Favorite findFavoriteByQueryAndType(String query, FavoriteType type);
@Insert(onConflict = OnConflictStrategy.REPLACE)
@Insert
List<Long> insertFavorites(Favorite... favorites);
@Update

View File

@ -513,7 +513,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
@Override
public void onDataNotAvailable() {
favoriteRepository.insertOrUpdateFavorite(new Favorite(
-1,
0,
hashtag.substring(1),
FavoriteType.HASHTAG,
hashtagModel.getName(),

View File

@ -499,7 +499,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
@Override
public void onDataNotAvailable() {
favoriteRepository.insertOrUpdateFavorite(new Favorite(
-1,
0,
locationId,
FavoriteType.LOCATION,
locationModel.getName(),

View File

@ -623,7 +623,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
@Override
public void onDataNotAvailable() {
favoriteRepository.insertOrUpdateFavorite(new Favorite(
-1,
0,
profileModel.getUsername(),
FavoriteType.USER,
profileModel.getName(),