Browse Source
fix favourites overwrite
renovate/org.robolectric-robolectric-4.x
Austin Huang
4 years ago
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with
4 additions and
4 deletions
-
app/src/main/java/awais/instagrabber/db/dao/FavoriteDao.java
-
app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
-
app/src/main/java/awais/instagrabber/fragments/LocationFragment.java
-
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
|
@ -21,7 +21,7 @@ public interface FavoriteDao { |
|
|
@Query("SELECT * FROM favorites WHERE query_text = :query and type = :type") |
|
|
@Query("SELECT * FROM favorites WHERE query_text = :query and type = :type") |
|
|
Favorite findFavoriteByQueryAndType(String query, FavoriteType type); |
|
|
Favorite findFavoriteByQueryAndType(String query, FavoriteType type); |
|
|
|
|
|
|
|
|
@Insert(onConflict = OnConflictStrategy.REPLACE) |
|
|
|
|
|
|
|
|
@Insert |
|
|
List<Long> insertFavorites(Favorite... favorites); |
|
|
List<Long> insertFavorites(Favorite... favorites); |
|
|
|
|
|
|
|
|
@Update |
|
|
@Update |
|
|
|
@ -513,7 +513,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
@Override |
|
|
@Override |
|
|
public void onDataNotAvailable() { |
|
|
public void onDataNotAvailable() { |
|
|
favoriteRepository.insertOrUpdateFavorite(new Favorite( |
|
|
favoriteRepository.insertOrUpdateFavorite(new Favorite( |
|
|
-1, |
|
|
|
|
|
|
|
|
0, |
|
|
hashtag.substring(1), |
|
|
hashtag.substring(1), |
|
|
FavoriteType.HASHTAG, |
|
|
FavoriteType.HASHTAG, |
|
|
hashtagModel.getName(), |
|
|
hashtagModel.getName(), |
|
|
|
@ -499,7 +499,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR |
|
|
@Override |
|
|
@Override |
|
|
public void onDataNotAvailable() { |
|
|
public void onDataNotAvailable() { |
|
|
favoriteRepository.insertOrUpdateFavorite(new Favorite( |
|
|
favoriteRepository.insertOrUpdateFavorite(new Favorite( |
|
|
-1, |
|
|
|
|
|
|
|
|
0, |
|
|
locationId, |
|
|
locationId, |
|
|
FavoriteType.LOCATION, |
|
|
FavoriteType.LOCATION, |
|
|
locationModel.getName(), |
|
|
locationModel.getName(), |
|
|
|
@ -623,7 +623,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
@Override |
|
|
@Override |
|
|
public void onDataNotAvailable() { |
|
|
public void onDataNotAvailable() { |
|
|
favoriteRepository.insertOrUpdateFavorite(new Favorite( |
|
|
favoriteRepository.insertOrUpdateFavorite(new Favorite( |
|
|
-1, |
|
|
|
|
|
|
|
|
0, |
|
|
profileModel.getUsername(), |
|
|
profileModel.getUsername(), |
|
|
FavoriteType.USER, |
|
|
FavoriteType.USER, |
|
|
profileModel.getName(), |
|
|
profileModel.getName(), |
|
|