mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-16 11:47:29 +00:00
Merge branch 'master' into feature/scroll-stories-with-feed
This commit is contained in:
commit
88ed4257c0
@ -264,7 +264,8 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
private RecyclerLazyLoader feedLazyLoader, discoverLazyLoader;
|
private RecyclerLazyLoader feedLazyLoader, discoverLazyLoader;
|
||||||
private DiscoverAdapter discoverAdapter;
|
private DiscoverAdapter discoverAdapter;
|
||||||
public SimpleExoPlayer currentFeedPlayer; // hack for remix drawer layout
|
public SimpleExoPlayer currentFeedPlayer; // hack for remix drawer layout
|
||||||
public final boolean isLoggedIn = !Utils.isEmpty(Utils.settingsHelper.getString(Constants.COOKIE));
|
private String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
|
||||||
|
public boolean isLoggedIn = !Utils.isEmpty(cookie);
|
||||||
|
|
||||||
public MainHelper(@NonNull final Main main) {
|
public MainHelper(@NonNull final Main main) {
|
||||||
stopCurrentExecutor();
|
stopCurrentExecutor();
|
||||||
@ -282,6 +283,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
final ImageView iconDiscover = (ImageView) iconSlider.getChildAt(2);
|
final ImageView iconDiscover = (ImageView) iconSlider.getChildAt(2);
|
||||||
|
|
||||||
final boolean isBottomToolbar = Utils.settingsHelper.getBoolean(BOTTOM_TOOLBAR);
|
final boolean isBottomToolbar = Utils.settingsHelper.getBoolean(BOTTOM_TOOLBAR);
|
||||||
|
isLoggedIn = !Utils.isEmpty(cookie);
|
||||||
if (!isLoggedIn) {
|
if (!isLoggedIn) {
|
||||||
main.mainBinding.drawerLayout.removeView(main.mainBinding.feedView.feedLayout);
|
main.mainBinding.drawerLayout.removeView(main.mainBinding.feedView.feedLayout);
|
||||||
main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverSwipeRefreshLayout);
|
main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverSwipeRefreshLayout);
|
||||||
@ -724,9 +726,6 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
|
|
||||||
final boolean isLoggedIn = !Utils.isEmpty(cookie);
|
|
||||||
|
|
||||||
currentlyExecuting = new PostsFetcher(main.userQuery, postsFetchListener)
|
currentlyExecuting = new PostsFetcher(main.userQuery, postsFetchListener)
|
||||||
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
@ -793,25 +792,25 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
main.mainBinding.profileView.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
|
main.mainBinding.profileView.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
|
||||||
final String profileId = profileModel.getId();
|
final String profileId = profileModel.getId();
|
||||||
|
|
||||||
final String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
|
if (isLoggedIn || Utils.settingsHelper.getBoolean(Constants.STORIESIG)) {
|
||||||
final boolean isLoggedIn = !Utils.isEmpty(cookie);
|
new iStoryStatusFetcher(profileId, profileModel.getUsername(), false, false,
|
||||||
new iStoryStatusFetcher(profileId, profileModel.getUsername(), false, false,
|
(!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), false,
|
||||||
(!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), false,
|
result -> {
|
||||||
result -> {
|
main.storyModels = result;
|
||||||
main.storyModels = result;
|
if (result != null && result.length > 0) main.mainBinding.profileView.mainProfileImage.setStoriesBorder();
|
||||||
if (result != null && result.length > 0) main.mainBinding.profileView.mainProfileImage.setStoriesBorder();
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
|
||||||
|
|
||||||
new HighlightsFetcher(profileId, (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), result -> {
|
new HighlightsFetcher(profileId, (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), result -> {
|
||||||
if (result != null && result.length > 0) {
|
if (result != null && result.length > 0) {
|
||||||
main.mainBinding.profileView.highlightsList.setVisibility(View.VISIBLE);
|
main.mainBinding.profileView.highlightsList.setVisibility(View.VISIBLE);
|
||||||
main.highlightsAdapter.setData(result);
|
main.highlightsAdapter.setData(result);
|
||||||
}
|
}
|
||||||
else main.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
|
else main.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
|
||||||
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
}
|
||||||
|
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
final String myId = Utils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE));
|
final String myId = Utils.getUserIdFromCookie(cookie);
|
||||||
if (!profileId.equals(myId)) {
|
if (!profileId.equals(myId)) {
|
||||||
main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
|
main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
|
||||||
main.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
|
main.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
|
||||||
@ -1009,8 +1008,6 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
|
|
||||||
final String profileId = locationModel.getId();
|
final String profileId = locationModel.getId();
|
||||||
|
|
||||||
final String cookie = Utils.settingsHelper.getString(Constants.COOKIE);
|
|
||||||
final boolean isLoggedIn = !Utils.isEmpty(cookie);
|
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
new iStoryStatusFetcher(profileId.split("/")[0], null, true, false, false, false, result -> {
|
new iStoryStatusFetcher(profileId.split("/")[0], null, true, false, false, false, result -> {
|
||||||
main.storyModels = result;
|
main.storyModels = result;
|
||||||
@ -1224,7 +1221,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(final View v) {
|
public void onClick(final View v) {
|
||||||
final boolean iamme = (isLoggedIn && main.profileModel != null)
|
final boolean iamme = (isLoggedIn && main.profileModel != null)
|
||||||
? Utils.getUserIdFromCookie(Utils.settingsHelper.getString(Constants.COOKIE)).equals(main.profileModel.getId())
|
? Utils.getUserIdFromCookie(cookie).equals(main.profileModel.getId())
|
||||||
: false;
|
: false;
|
||||||
if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null && v == main.mainBinding.profileView.btnFollow) {
|
if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null && v == main.mainBinding.profileView.btnFollow) {
|
||||||
Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery,
|
Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery,
|
||||||
@ -1284,8 +1281,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
|
|||||||
urlConnection.setRequestMethod("POST");
|
urlConnection.setRequestMethod("POST");
|
||||||
urlConnection.setUseCaches(false);
|
urlConnection.setUseCaches(false);
|
||||||
urlConnection.setRequestProperty("User-Agent", Constants.USER_AGENT);
|
urlConnection.setRequestProperty("User-Agent", Constants.USER_AGENT);
|
||||||
urlConnection.setRequestProperty("x-csrftoken",
|
urlConnection.setRequestProperty("x-csrftoken", cookie.split("csrftoken=")[1].split(";")[0]);
|
||||||
Utils.settingsHelper.getString(Constants.COOKIE).split("csrftoken=")[1].split(";")[0]);
|
|
||||||
if (action == "restrict") {
|
if (action == "restrict") {
|
||||||
final String urlParameters = "target_user_id="+main.profileModel.getId();
|
final String urlParameters = "target_user_id="+main.profileModel.getId();
|
||||||
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
urlConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||||
|
@ -164,7 +164,7 @@ public final class DirectMessagesUserInbox extends AppCompatActivity {
|
|||||||
.putExtra(Constants.EXTRAS_STORIES, sms)
|
.putExtra(Constants.EXTRAS_STORIES, sms)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (directItemModel.getText() != null) {
|
else if (directItemModel.getText() != null && directItemModel.getText().toString().contains("@")) {
|
||||||
searchUsername(directItemModel.getText().toString().split("@")[1].split(" ")[0]);
|
searchUsername(directItemModel.getText().toString().split("@")[1].split(" ")[0]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -135,6 +135,7 @@ public final class Main extends BaseLanguageActivity {
|
|||||||
setStack(bundle);
|
setStack(bundle);
|
||||||
userQuery = bundle.getString("query");
|
userQuery = bundle.getString("query");
|
||||||
}
|
}
|
||||||
|
mainHelper.isLoggedIn = !Utils.isEmpty(Utils.settingsHelper.getString(Constants.COOKIE));
|
||||||
|
|
||||||
itemGetter = itemGetType -> {
|
itemGetter = itemGetType -> {
|
||||||
if (itemGetType == ItemGetType.MAIN_ITEMS) return allItems;
|
if (itemGetType == ItemGetType.MAIN_ITEMS) return allItems;
|
||||||
|
@ -60,11 +60,11 @@ public final class DirectMessagesAdapter extends RecyclerView.Adapter<DirectMess
|
|||||||
for (int i = 0; i < Math.min(3, users.length); ++i)
|
for (int i = 0; i < Math.min(3, users.length); ++i)
|
||||||
glideRequestManager.load(users[i].getSdProfilePic()).into(holder.multipleProfilePics[i]);
|
glideRequestManager.load(users[i].getSdProfilePic()).into(holder.multipleProfilePics[i]);
|
||||||
|
|
||||||
} else if (users.length == 1) {
|
} else {
|
||||||
holder.ivProfilePic.setVisibility(View.VISIBLE);
|
holder.ivProfilePic.setVisibility(View.VISIBLE);
|
||||||
holder.multipleProfilePicsContainer.setVisibility(View.GONE);
|
holder.multipleProfilePicsContainer.setVisibility(View.GONE);
|
||||||
|
|
||||||
glideRequestManager.load(users[0].getSdProfilePic()).into(holder.ivProfilePic);
|
glideRequestManager.load(users.length == 1 ? users[0].getSdProfilePic() : null).into(holder.ivProfilePic);
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.tvUsername.setText(threadModel.getThreadTitle());
|
holder.tvUsername.setText(threadModel.getThreadTitle());
|
||||||
@ -79,6 +79,7 @@ public final class DirectMessagesAdapter extends RecyclerView.Adapter<DirectMess
|
|||||||
final CharSequence messageText;
|
final CharSequence messageText;
|
||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case TEXT:
|
case TEXT:
|
||||||
|
case LIKE:
|
||||||
messageText = lastItemModel.getText();
|
messageText = lastItemModel.getText();
|
||||||
break;
|
break;
|
||||||
case LINK:
|
case LINK:
|
||||||
|
@ -167,6 +167,7 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
|||||||
holder.tvMessage.setVisibility(View.VISIBLE);
|
holder.tvMessage.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
case TEXT:
|
case TEXT:
|
||||||
|
case LIKE:
|
||||||
text = directItemModel.getText();
|
text = directItemModel.getText();
|
||||||
text = Utils.getSpannableUrl(text.toString()); // for urls
|
text = Utils.getSpannableUrl(text.toString()); // for urls
|
||||||
if (Utils.hasMentions(text)) text = Utils.getMentionText(text); // for mentions
|
if (Utils.hasMentions(text)) text = Utils.getMentionText(text); // for mentions
|
||||||
@ -217,13 +218,11 @@ public final class MessageItemsAdapter extends RecyclerView.Adapter<TextMessageV
|
|||||||
|
|
||||||
case RAVEN_MEDIA: {
|
case RAVEN_MEDIA: {
|
||||||
final DirectItemRavenMediaModel ravenMediaModel = directItemModel.getRavenMediaModel();
|
final DirectItemRavenMediaModel ravenMediaModel = directItemModel.getRavenMediaModel();
|
||||||
final RavenExpiringMediaActionSummaryModel mediaActionSummary = ravenMediaModel.getExpiringMediaActionSummary();
|
|
||||||
|
|
||||||
mediaModel = ravenMediaModel.getMedia();
|
final boolean isExpired = ravenMediaModel == null || (mediaModel = ravenMediaModel.getMedia()) == null ||
|
||||||
|
|
||||||
final boolean isExpired = mediaModel == null ||
|
|
||||||
Utils.isEmpty(mediaModel.getThumbUrl()) && mediaModel.getPk() < 1;
|
Utils.isEmpty(mediaModel.getThumbUrl()) && mediaModel.getPk() < 1;
|
||||||
|
|
||||||
|
final RavenExpiringMediaActionSummaryModel mediaActionSummary = ravenMediaModel.getExpiringMediaActionSummary();
|
||||||
holder.mediaExpiredIcon.setVisibility(isExpired ? View.VISIBLE : View.GONE);
|
holder.mediaExpiredIcon.setVisibility(isExpired ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
int textRes = R.string.dms_inbox_raven_media_unknown;
|
int textRes = R.string.dms_inbox_raven_media_unknown;
|
||||||
|
@ -702,8 +702,7 @@ public final class Utils {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LIKE:
|
case LIKE:
|
||||||
text = new SpannableString(itemObject.getString("like"));
|
text = itemObject.getString("like");
|
||||||
((SpannableString) text).setSpan(new RelativeSizeSpan(15f), 0, text.length(), 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STORY_SHARE:
|
case STORY_SHARE:
|
||||||
|
Loading…
Reference in New Issue
Block a user