1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-18 04:37:30 +00:00

allow anonymous to see tagged posts

This commit is contained in:
Austin Huang 2020-07-31 17:57:44 -04:00
parent 87fe155f55
commit 9713bb2faa
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
2 changed files with 13 additions and 11 deletions

View File

@ -854,20 +854,22 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
} }
} else { } else {
if (Utils.dataBox.getFavorite(main.userQuery) != null) { if (Utils.dataBox.getFavorite(main.userQuery) != null) {
main.mainBinding.btnFollow.setText(R.string.unfavorite); main.mainBinding.btnFollow.setText(R.string.unfavorite_short);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(resources.getColor( main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_purple_background, null))); R.color.btn_purple_background, null)));
} }
else { else {
main.mainBinding.btnFollow.setText(R.string.favorite); main.mainBinding.btnFollow.setText(R.string.favorite_short);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(resources.getColor( main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_pink_background, null))); R.color.btn_pink_background, null)));
} }
main.mainBinding.btnFollow.setVisibility(View.VISIBLE); main.mainBinding.btnFollow.setVisibility(View.VISIBLE);
main.mainBinding.btnRestrict.setVisibility(View.VISIBLE); if (!profileModel.isReallyPrivate()) {
main.mainBinding.btnRestrict.setText(R.string.tagged); main.mainBinding.btnRestrict.setVisibility(View.VISIBLE);
main.mainBinding.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(resources.getColor( main.mainBinding.btnRestrict.setText(R.string.tagged);
R.color.btn_blue_background, null))); main.mainBinding.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(resources.getColor(
R.color.btn_blue_background, null)));
}
} }
main.mainBinding.mainProfileImage.setEnabled(false); main.mainBinding.mainProfileImage.setEnabled(false);
@ -1197,13 +1199,15 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
private final View.OnClickListener profileActionListener = new View.OnClickListener() { private final View.OnClickListener profileActionListener = new View.OnClickListener() {
@Override @Override
public void onClick(final View v) { public void onClick(final View v) {
final boolean iamme = Utils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE)).equals(main.profileModel.getId()); final boolean iamme = isLoggedIn
if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null) { ? Utils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE)).equals(main.profileModel.getId())
: false;
if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null && v == main.mainBinding.btnFollow) {
Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery, Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery,
Long.parseLong(Utils.dataBox.getFavorite(main.userQuery).split("/")[1]), Long.parseLong(Utils.dataBox.getFavorite(main.userQuery).split("/")[1]),
main.locationModel != null ? main.locationModel.getName() : main.userQuery)); main.locationModel != null ? main.locationModel.getName() : main.userQuery));
onRefresh(); onRefresh();
} else if (!isLoggedIn) { } else if (!isLoggedIn && v == main.mainBinding.btnFollow) {
Utils.dataBox.addFavorite(new DataBox.FavoriteModel(main.userQuery, System.currentTimeMillis(), Utils.dataBox.addFavorite(new DataBox.FavoriteModel(main.userQuery, System.currentTimeMillis(),
main.locationModel != null ? main.locationModel.getName() : main.userQuery)); main.locationModel != null ? main.locationModel.getName() : main.userQuery));
onRefresh(); onRefresh();

View File

@ -90,8 +90,6 @@
<string name="unbookmark">Unbookmark</string> <string name="unbookmark">Unbookmark</string>
<string name="follow">Follow</string> <string name="follow">Follow</string>
<string name="unfollow">Unfollow</string> <string name="unfollow">Unfollow</string>
<string name="favorite">Add to Favorites</string>
<string name="unfavorite">Remove from Favorites</string>
<string name="favorite_short">Favorite</string> <string name="favorite_short">Favorite</string>
<string name="unfavorite_short">Unfavorite</string> <string name="unfavorite_short">Unfavorite</string>
<string name="block">Block</string> <string name="block">Block</string>