mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-16 11:47:29 +00:00
Add merged changes missed by Gitkraken
This commit is contained in:
parent
039194d046
commit
404747fedc
@ -46,6 +46,7 @@ import awais.instagrabber.dialogs.PostsLayoutPreferencesDialogFragment;
|
||||
import awais.instagrabber.fragments.PostViewV2Fragment;
|
||||
import awais.instagrabber.models.FeedStoryModel;
|
||||
import awais.instagrabber.models.PostsLayoutPreferences;
|
||||
import awais.instagrabber.repositories.requests.StoryViewerOptions;
|
||||
import awais.instagrabber.repositories.responses.Media;
|
||||
import awais.instagrabber.utils.Constants;
|
||||
import awais.instagrabber.utils.DownloadUtils;
|
||||
@ -56,7 +57,6 @@ import awais.instagrabber.webservices.StoriesService;
|
||||
|
||||
import static androidx.core.content.PermissionChecker.checkSelfPermission;
|
||||
import static awais.instagrabber.utils.DownloadUtils.WRITE_PERMISSION;
|
||||
import static awais.instagrabber.utils.Utils.settingsHelper;
|
||||
|
||||
public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener {
|
||||
private static final String TAG = "FeedFragment";
|
||||
@ -82,7 +82,8 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
||||
new FeedStoriesAdapter.OnFeedStoryClickListener() {
|
||||
@Override
|
||||
public void onFeedStoryClick(FeedStoryModel model, int position) {
|
||||
final NavDirections action = FeedFragmentDirections.actionFeedFragmentToStoryViewerFragment(position, null, false, false, null, null, false, false);
|
||||
final NavDirections action = FeedFragmentDirections
|
||||
.actionFeedFragmentToStoryViewerFragment(StoryViewerOptions.forFeedStoryPosition(position));
|
||||
NavHostFragment.findNavController(FeedFragment.this).navigate(action);
|
||||
}
|
||||
|
||||
@ -382,7 +383,7 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
||||
}
|
||||
|
||||
private void fetchStories() {
|
||||
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
||||
// final String cookie = settingsHelper.getString(Constants.COOKIE);
|
||||
storiesFetching = true;
|
||||
updateSwipeRefreshState();
|
||||
storiesService.getFeedStories(new ServiceCallback<List<FeedStoryModel>>() {
|
||||
|
@ -59,7 +59,6 @@ import awais.instagrabber.adapters.HighlightsAdapter;
|
||||
import awais.instagrabber.asyncs.ProfileFetcher;
|
||||
import awais.instagrabber.asyncs.ProfilePostFetchService;
|
||||
import awais.instagrabber.asyncs.UsernameFetcher;
|
||||
import awais.instagrabber.asyncs.direct_messages.CreateThreadAction;
|
||||
import awais.instagrabber.customviews.PrimaryActionModeCallback;
|
||||
import awais.instagrabber.customviews.PrimaryActionModeCallback.CallbacksHelper;
|
||||
import awais.instagrabber.databinding.FragmentProfileBinding;
|
||||
@ -80,6 +79,7 @@ import awais.instagrabber.models.PostsLayoutPreferences;
|
||||
import awais.instagrabber.models.StoryModel;
|
||||
import awais.instagrabber.models.enums.FavoriteType;
|
||||
import awais.instagrabber.models.enums.PostItemType;
|
||||
import awais.instagrabber.repositories.requests.StoryViewerOptions;
|
||||
import awais.instagrabber.repositories.responses.FriendshipChangeResponse;
|
||||
import awais.instagrabber.repositories.responses.FriendshipRestrictResponse;
|
||||
import awais.instagrabber.repositories.responses.FriendshipStatus;
|
||||
@ -865,11 +865,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
}
|
||||
|
||||
private void fetchStoryAndHighlights(final long profileId) {
|
||||
storiesService.getUserStory(String.valueOf(profileId),
|
||||
profileModel.getUsername(),
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
storiesService.getUserStory(
|
||||
StoryViewerOptions.forUser(profileId, profileModel.getFullName()),
|
||||
new ServiceCallback<List<StoryModel>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<StoryModel> storyModels) {
|
||||
@ -986,14 +983,14 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
});
|
||||
profileDetailsBinding.btnDM.setOnClickListener(v -> {
|
||||
profileDetailsBinding.btnDM.setEnabled(false);
|
||||
new CreateThreadAction(cookie, profileModel.getPk(), threadId -> {
|
||||
if (isAdded()) {
|
||||
final NavDirections action = ProfileFragmentDirections
|
||||
.actionProfileFragmentToDMThreadFragment(threadId, profileModel.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(action);
|
||||
}
|
||||
profileDetailsBinding.btnDM.setEnabled(true);
|
||||
}).execute();
|
||||
// new CreateThreadAction(cookie, profileModel.getPk(), threadId -> {
|
||||
// if (isAdded()) {
|
||||
// final NavDirections action = ProfileFragmentDirections
|
||||
// .actionProfileFragmentToDMThreadFragment(threadId, profileModel.getUsername());
|
||||
// NavHostFragment.findNavController(this).navigate(action);
|
||||
// }
|
||||
// profileDetailsBinding.btnDM.setEnabled(true);
|
||||
// }).execute();
|
||||
});
|
||||
profileDetailsBinding.mainProfileImage.setOnClickListener(v -> {
|
||||
if (!hasStories) {
|
||||
@ -1011,7 +1008,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
if (which == 1) {
|
||||
// show stories
|
||||
final NavDirections action = ProfileFragmentDirections
|
||||
.actionProfileFragmentToStoryViewerFragment(-1, null, false, false, profileModel.getPk(), username, false, false);
|
||||
.actionProfileFragmentToStoryViewerFragment(StoryViewerOptions.forUser(profileModel.getPk(),
|
||||
profileModel.getFullName()));
|
||||
NavHostFragment.findNavController(this).navigate(action);
|
||||
return;
|
||||
}
|
||||
@ -1071,8 +1069,9 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
private void setupHighlights() {
|
||||
highlightsViewModel = new ViewModelProvider(fragmentActivity).get(HighlightsViewModel.class);
|
||||
highlightsAdapter = new HighlightsAdapter((model, position) -> {
|
||||
final NavDirections action = ProfileFragmentDirections
|
||||
.actionProfileFragmentToStoryViewerFragment(position, model.getTitle(), false, false, 0, null, false, false);
|
||||
final StoryViewerOptions options = StoryViewerOptions.forHighlight(model.getTitle());
|
||||
options.setCurrentFeedStoryIndex(position);
|
||||
final NavDirections action = ProfileFragmentDirections.actionProfileFragmentToStoryViewerFragment(options);
|
||||
NavHostFragment.findNavController(this).navigate(action);
|
||||
});
|
||||
final Context context = getContext();
|
||||
|
Loading…
Reference in New Issue
Block a user