1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 14:47:29 +00:00

attempt to add a third-party storyviewer, plus logout without removing accounts

This commit is contained in:
Austin Huang 2020-09-11 20:46:20 -04:00
parent 93e8e25186
commit aa6dab07cb
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
26 changed files with 302 additions and 119 deletions

View File

@ -75,9 +75,11 @@ import awais.instagrabber.models.FeedStoryModel;
import awais.instagrabber.models.HighlightModel;
import awais.instagrabber.models.StoryModel;
import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.models.enums.StoryViewerChoice;
import awais.instagrabber.models.stickers.PollModel;
import awais.instagrabber.models.stickers.QuestionModel;
import awais.instagrabber.models.stickers.QuizModel;
import awais.instagrabber.webservices.AloService;
import awais.instagrabber.webservices.ServiceCallback;
import awais.instagrabber.webservices.StoriesService;
import awais.instagrabber.utils.Constants;
@ -109,6 +111,7 @@ public class StoryViewerFragment extends Fragment {
private SwipeEvent swipeEvent;
private GestureDetectorCompat gestureDetector;
private StoriesService storiesService;
private AloService aloService;
private StoryModel currentStory;
private int slidePos;
private int lastSlidePos;
@ -510,33 +513,34 @@ public class StoryViewerFragment extends Fragment {
}
storiesViewModel.getList().setValue(Collections.emptyList());
if (currentStoryMediaId == null) return;
final ServiceCallback storyCallback = new ServiceCallback<List<StoryModel>>() {
@Override
public void onSuccess(final List<StoryModel> storyModels) {
fetching = false;
if (storyModels == null || storyModels.isEmpty()) {
storiesViewModel.getList().setValue(Collections.emptyList());
currentStory = null;
binding.storiesList.setVisibility(View.GONE);
return;
}
binding.storiesList.setVisibility(View.VISIBLE);
storiesViewModel.getList().setValue(storyModels);
currentStory = storyModels.get(0);
refreshStory();
}
@Override
public void onFailure(final Throwable t) {
Log.e(TAG, "Error", t);
}
};
storiesService.getUserStory(currentStoryMediaId,
username,
!isLoggedIn && settingsHelper.getBoolean(Constants.STORIESIG),
!isLoggedIn && settingsHelper.getString(Constants.STORY_VIEWER) == StoryViewerChoice.STORIESIG.getValue(),
false,
false,
isHighlight,
new ServiceCallback<List<StoryModel>>() {
@Override
public void onSuccess(final List<StoryModel> storyModels) {
fetching = false;
if (storyModels == null || storyModels.isEmpty()) {
storiesViewModel.getList().setValue(Collections.emptyList());
currentStory = null;
binding.storiesList.setVisibility(View.GONE);
return;
}
binding.storiesList.setVisibility(View.VISIBLE);
storiesViewModel.getList().setValue(storyModels);
currentStory = storyModels.get(0);
refreshStory();
}
@Override
public void onFailure(final Throwable t) {
Log.e(TAG, "Error", t);
}
});
storyCallback);
}
private void refreshStory() {

View File

@ -71,8 +71,10 @@ import awais.instagrabber.models.ProfileModel;
import awais.instagrabber.models.StoryModel;
import awais.instagrabber.models.enums.DownloadMethod;
import awais.instagrabber.models.enums.PostItemType;
import awais.instagrabber.models.enums.StoryViewerChoice;
import awais.instagrabber.repositories.responses.FriendshipRepoChangeRootResponse;
import awais.instagrabber.repositories.responses.FriendshipRepoRestrictRootResponse;
import awais.instagrabber.webservices.AloService;
import awais.instagrabber.webservices.FriendshipService;
import awais.instagrabber.webservices.ServiceCallback;
import awais.instagrabber.utils.Constants;
@ -102,6 +104,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
private PostsAdapter postsAdapter;
private ActionMode actionMode;
private Handler usernameSettingHandler;
private AloService aloService;
private FriendshipService friendshipService;
private boolean shouldRefresh = true;
private StoryModel[] storyModels;
@ -208,6 +211,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
super.onCreate(savedInstanceState);
fragmentActivity = (MainActivity) requireActivity();
friendshipService = FriendshipService.getInstance();
aloService = AloService.getInstance();
setHasOptionsMenu(true);
}
@ -354,12 +358,12 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
binding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
final String profileId = profileModel.getId();
if (settingsHelper.getBoolean(Constants.STORIESIG) || isLoggedIn) {
if (settingsHelper.getString(Constants.STORY_VIEWER) == StoryViewerChoice.STORIESIG.getValue() || isLoggedIn) {
new iStoryStatusFetcher(profileId,
profileModel.getUsername(),
false,
false,
!isLoggedIn && settingsHelper.getBoolean(Constants.STORIESIG),
!isLoggedIn && settingsHelper.getString(Constants.STORY_VIEWER) == StoryViewerChoice.STORIESIG.getValue(),
false,
result -> {
storyModels = result;
@ -368,7 +372,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new HighlightsFetcher(profileId,
!isLoggedIn && settingsHelper.getBoolean(Constants.STORIESIG),
!isLoggedIn && settingsHelper.getString(Constants.STORY_VIEWER) == StoryViewerChoice.STORIESIG.getValue(),
result -> {
if (result != null) {
binding.highlightsList.setVisibility(View.VISIBLE);
@ -376,6 +380,23 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} else binding.highlightsList.setVisibility(View.GONE);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
else if (settingsHelper.getString(Constants.STORY_VIEWER).equals(StoryViewerChoice.ALOINSTAGRAM.getValue())) {
Log.d("austin_debug", "alo triggered");
aloService.getUserStory(profileId, profileModel.getUsername(), false, new ServiceCallback<List<StoryModel>>() {
@Override
public void onSuccess(final List<StoryModel> result){
if (result != null && result.size() > 0) {
storyModels = result.toArray(storyModels);
binding.mainProfileImage.setStoriesBorder();
}
}
@Override
public void onFailure(final Throwable t) {
Log.e(TAG, "Error on aloService", t);
}
});
}
if (isLoggedIn) {
final String myId = CookieUtils.getUserIdFromCookie(cookie);

View File

@ -55,9 +55,7 @@ public class AboutFragment extends BasePreferencesFragment {
// alphabetical order!!!
thirdPartyCategory.addPreference(getExoPlayerPreference());
thirdPartyCategory.addPreference(getFrescoPreference());
thirdPartyCategory.addPreference(getGlidePreference());
thirdPartyCategory.addPreference(getJsoupPreference());
thirdPartyCategory.addPreference(getPhotoViewPreference());
thirdPartyCategory.addPreference(getRetrofitPreference());
final PreferenceCategory licenseCategory = new PreferenceCategory(requireContext());
@ -152,34 +150,6 @@ public class AboutFragment extends BasePreferencesFragment {
return preference;
}
private Preference getGlidePreference() {
final Preference preference = new Preference(requireContext());
preference.setTitle("Glide");
preference.setSummary("Copyright 2014 Google, Inc. All rights reserved. Custom license.");
preference.setIconSpaceReserved(false);
preference.setOnPreferenceClickListener(p -> {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://bumptech.github.io/glide/"));
startActivity(intent);
return true;
});
return preference;
}
private Preference getPhotoViewPreference() {
final Preference preference = new Preference(requireContext());
preference.setTitle("PhotoView");
preference.setSummary("Copyright 2018 Chris Banes. Apache Version 2.0.");
preference.setIconSpaceReserved(false);
preference.setOnPreferenceClickListener(p -> {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/chrisbanes/PhotoView"));
startActivity(intent);
return true;
});
return preference;
}
private Preference getExoPlayerPreference() {
final Preference preference = new Preference(requireContext());
preference.setTitle("ExoPlayer");

View File

@ -57,7 +57,6 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
final PreferenceCategory accountCategory = new PreferenceCategory(requireContext());
accountCategory.setTitle(R.string.account);
accountCategory.setSummary(R.string.account_hint);
accountCategory.setIconSpaceReserved(false);
screen.addPreference(accountCategory);
// To re-login, user can just add the same account back from account switcher dialog
@ -70,41 +69,55 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
// return true;
// }));
if (isLoggedIn) {
accountCategory.setSummary(R.string.account_hint);
accountCategory.addPreference(getAccountSwitcherPreference(cookie));
accountCategory.addPreference(getPreference(R.string.logout, "Remove all accounts", -1, preference -> {
accountCategory.addPreference(getPreference(R.string.logout, R.string.logout_summary, R.drawable.ic_logout, preference -> {
if (getContext() == null) return false;
new AlertDialog.Builder(getContext())
.setTitle(R.string.logout)
.setMessage("This will remove all added accounts from the app!\n"
+ "To remove just one account, long tap the account from the account switcher dialog.\n"
+ "Do you want to continue?")
.setPositiveButton(R.string.yes, (dialog, which) -> {
CookieUtils.setupCookies("LOGOUT");
shouldRecreate();
Toast.makeText(requireContext(), R.string.logout_success, Toast.LENGTH_SHORT).show();
settingsHelper.putString(Constants.COOKIE, "");
})
.setNegativeButton(R.string.cancel, null)
.show();
CookieUtils.setupCookies("LOGOUT");
shouldRecreate();
Toast.makeText(requireContext(), R.string.logout_success, Toast.LENGTH_SHORT).show();
settingsHelper.putString(Constants.COOKIE, "");
return true;
}));
} else {
if (Utils.dataBox.getAllCookies().size() > 0) {
accountCategory.addPreference(getAccountSwitcherPreference(null));
}
// Need to show something to trigger login activity
accountCategory.addPreference(getPreference(R.string.add_account, R.drawable.ic_add, preference -> {
startActivityForResult(new Intent(getContext(), Login.class), Constants.LOGIN_RESULT_CODE);
return true;
}));
if (Utils.dataBox.getAllCookies().size() > 0) {
accountCategory.addPreference(getPreference(R.string.remove_all_acc, null, R.drawable.ic_delete, preference -> {
if (getContext() == null) return false;
new AlertDialog.Builder(getContext())
.setTitle(R.string.logout)
.setMessage(R.string.remove_all_acc_warning)
.setPositiveButton(R.string.yes, (dialog, which) -> {
CookieUtils.setupCookies("REMOVE");
shouldRecreate();
Toast.makeText(requireContext(), R.string.logout_success, Toast.LENGTH_SHORT).show();
settingsHelper.putString(Constants.COOKIE, "");
})
.setNegativeButton(R.string.cancel, null)
.show();
return true;
}));
}
}
final PreferenceCategory generalCategory = new PreferenceCategory(requireContext());
generalCategory.setTitle("General");
generalCategory.setIconSpaceReserved(false);
screen.addPreference(generalCategory);
generalCategory.addPreference(getPreference(R.string.action_notif, R.drawable.ic_not_liked, preference -> {
final NavDirections navDirections = MorePreferencesFragmentDirections.actionMorePreferencesFragmentToNotificationsViewer();
NavHostFragment.findNavController(this).navigate(navDirections);
return true;
}));
if (isLoggedIn) {
generalCategory.addPreference(getPreference(R.string.action_notif, R.drawable.ic_not_liked, preference -> {
final NavDirections navDirections = MorePreferencesFragmentDirections.actionMorePreferencesFragmentToNotificationsViewer();
NavHostFragment.findNavController(this).navigate(navDirections);
return true;
}));
}
generalCategory.addPreference(getPreference(R.string.action_settings, R.drawable.ic_outline_settings_24, preference -> {
final NavDirections navDirections = MorePreferencesFragmentDirections.actionMorePreferencesFragmentToSettingsPreferencesFragment();
NavHostFragment.findNavController(this).navigate(navDirections);
@ -129,7 +142,7 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
screen.addPreference(versionPreference);
final Preference reminderPreference = getPreference(R.string.reminder, R.string.reminder_summary, R.drawable.ic_warning, null);
reminderPreference.setEnabled(false);
reminderPreference.setSelectable(false);
screen.addPreference(reminderPreference);
}
@ -333,6 +346,7 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
if (onClickListener != null) root.setOnClickListener(onClickListener);
final PrefAccountSwitcherBinding binding = PrefAccountSwitcherBinding.bind(root);
final String uid = CookieUtils.getUserIdFromCookie(cookie);
if (uid == null) return;
final DataBox.CookieModel user = Utils.dataBox.getCookie(uid);
if (user == null) return;
binding.fullName.setText(user.getFullName());

View File

@ -85,7 +85,7 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
anonUsersPreferenceCategory.setIconSpaceReserved(false);
anonUsersPreferenceCategory.setTitle(R.string.anonymous_settings);
anonUsersPreferenceCategory.addPreference(getUseInstaDpPreference());
anonUsersPreferenceCategory.addPreference(getUseStoriesIgPreference());
anonUsersPreferenceCategory.addPreference(getStoryViewerPreference());
}
}
@ -256,11 +256,21 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
return preference;
}
private Preference getUseStoriesIgPreference() {
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(requireContext());
preference.setKey(Constants.STORIESIG);
preference.setTitle(R.string.storiesig_settings);
@NonNull
private Preference getStoryViewerPreference() {
final ListPreference preference = new ListPreference(requireContext());
preference.setSummaryProvider(ListPreference.SimpleSummaryProvider.getInstance());
final int length = getResources().getStringArray(R.array.anonymous_story_viewer).length;
final String[] values = new String[length];
for (int i = 0; i < length; i++) {
values[i] = String.valueOf(i);
}
preference.setKey(Constants.STORY_VIEWER);
preference.setTitle(R.string.stories_viewer_settings);
preference.setDialogTitle(R.string.stories_viewer_settings);
preference.setEntries(R.array.anonymous_story_viewer);
preference.setIconSpaceReserved(false);
preference.setEntryValues(values);
return preference;
}

View File

@ -0,0 +1,20 @@
package awais.instagrabber.models.enums;
import java.io.Serializable;
public enum StoryViewerChoice implements Serializable {
NONE(0),
STORIESIG(1),
ALOINSTAGRAM(2),
INSTADP(3);
private int value;
StoryViewerChoice(int value) {
this.value = value;
}
public String getValue() {
return String.valueOf(value);
}
}

View File

@ -0,0 +1,18 @@
package awais.instagrabber.repositories.thirdparty;
import java.util.Map;
import retrofit2.Call;
import retrofit2.http.POST;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.Header;
import retrofit2.http.Url;
public interface AloRepository {
@FormUrlEncoded
@POST("myfile/show.php")
Call<String> getUserStory(@Header("User-Agent") String userAgent,
@Field("storyonId") String id);
}

View File

@ -0,0 +1,15 @@
package awais.instagrabber.repositories.thirdparty;
import java.util.Map;
import retrofit2.Call;
import retrofit2.http.Header;
import retrofit2.http.GET;
import retrofit2.http.QueryMap;
public interface InstadpRepository {
@GET("stories/{username}")
Call<String> getUserStory(@Header("User-Agent") String userAgent,
@QueryMap(encoded = true) Map<String, String> variables);
}

View File

@ -12,7 +12,7 @@ public final class Constants {
public static final String PREV_INSTALL_VERSION = "prevVersion";
// boolean prefs
public static final String DOWNLOAD_USER_FOLDER = "download_user_folder";
public static final String BOTTOM_TOOLBAR = "bottom_toolbar";
// deprecated: public static final String BOTTOM_TOOLBAR = "bottom_toolbar";
public static final String FOLDER_SAVE_TO = "saved_to";
public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
public static final String MUTED_VIDEOS = "muted_videos";
@ -22,7 +22,8 @@ public final class Constants {
public static final String MARK_AS_SEEN = "mark_as_seen";
public static final String DM_MARK_AS_SEEN = "dm_mark_as_seen";
public static final String INSTADP = "instadp";
public static final String STORIESIG = "storiesig";
// deprecated: public static final String STORIESIG = "storiesig";
public static final String STORY_VIEWER = "story_viewer";
public static final String AMOLED_THEME = "amoled_theme";
public static final String CHECK_ACTIVITY = "check_activity";
public static final String CHECK_UPDATES = "check_updates";

View File

@ -23,11 +23,15 @@ public final class CookieUtils {
if (cookieStore == null || TextUtils.isEmpty(cookieRaw)) {
return;
}
if (cookieRaw.equals("LOGOUT")) {
if (cookieRaw.equals("REMOVE")) {
cookieStore.removeAll();
Utils.dataBox.deleteAllUserCookies();
return;
}
else if (cookieRaw.equals("LOGOUT")) {
cookieStore.removeAll();
return;
}
try {
final URI uri1 = new URI("https://instagram.com");
final URI uri2 = new URI("https://instagram.com/");

View File

@ -241,7 +241,6 @@ public final class ExportImportUtils {
json.put(Constants.DOWNLOAD_USER_FOLDER, settingsHelper.getBoolean(Constants.DOWNLOAD_USER_FOLDER));
json.put(Constants.MUTED_VIDEOS, settingsHelper.getBoolean(Constants.MUTED_VIDEOS));
json.put(Constants.BOTTOM_TOOLBAR, settingsHelper.getBoolean(Constants.BOTTOM_TOOLBAR));
json.put(Constants.AUTOPLAY_VIDEOS, settingsHelper.getBoolean(Constants.AUTOPLAY_VIDEOS));
json.put(Constants.AUTOLOAD_POSTS, settingsHelper.getBoolean(Constants.AUTOLOAD_POSTS));
json.put(Constants.FOLDER_SAVE_TO, settingsHelper.getBoolean(Constants.FOLDER_SAVE_TO));

View File

@ -13,7 +13,6 @@ import static awais.instagrabber.utils.Constants.APP_LANGUAGE;
import static awais.instagrabber.utils.Constants.APP_THEME;
import static awais.instagrabber.utils.Constants.AUTOLOAD_POSTS;
import static awais.instagrabber.utils.Constants.AUTOPLAY_VIDEOS;
import static awais.instagrabber.utils.Constants.BOTTOM_TOOLBAR;
import static awais.instagrabber.utils.Constants.CHECK_ACTIVITY;
import static awais.instagrabber.utils.Constants.CHECK_UPDATES;
import static awais.instagrabber.utils.Constants.COOKIE;
@ -33,7 +32,7 @@ import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
import static awais.instagrabber.utils.Constants.PREV_INSTALL_VERSION;
import static awais.instagrabber.utils.Constants.SHOW_QUICK_ACCESS_DIALOG;
import static awais.instagrabber.utils.Constants.SKIPPED_VERSION;
import static awais.instagrabber.utils.Constants.STORIESIG;
import static awais.instagrabber.utils.Constants.STORY_VIEWER;
public final class SettingsHelper {
private final SharedPreferences sharedPreferences;
@ -56,9 +55,8 @@ public final class SettingsHelper {
}
public boolean getBoolean(@BooleanSettings final String key) {
final boolean booleanDefault = getBooleanDefault(key);
if (sharedPreferences != null) return sharedPreferences.getBoolean(key, booleanDefault);
return booleanDefault;
if (sharedPreferences != null) return sharedPreferences.getBoolean(key, false);
return false;
}
@NonNull
@ -76,14 +74,6 @@ public final class SettingsHelper {
return 0;
}
private boolean getBooleanDefault(@BooleanSettings final String key) {
return BOTTOM_TOOLBAR.equals(key) ||
AUTOPLAY_VIDEOS.equals(key) ||
SHOW_QUICK_ACCESS_DIALOG.equals(key) ||
MUTED_VIDEOS.equals(key) ||
CHECK_UPDATES.equals(key);
}
public int getThemeCode(final boolean fromHelper) {
int themeCode = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
@ -122,12 +112,12 @@ public final class SettingsHelper {
@StringDef(
{APP_LANGUAGE, APP_THEME, COOKIE, FOLDER_PATH, DATE_TIME_FORMAT, DATE_TIME_SELECTION, CUSTOM_DATE_TIME_FORMAT,
DEVICE_UUID, SKIPPED_VERSION, DEFAULT_TAB})
DEVICE_UUID, SKIPPED_VERSION, DEFAULT_TAB, STORY_VIEWER})
public @interface StringSettings {}
@StringDef({DOWNLOAD_USER_FOLDER, BOTTOM_TOOLBAR, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
AUTOLOAD_POSTS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN,
INSTADP, STORIESIG, AMOLED_THEME, CHECK_ACTIVITY, CHECK_UPDATES})
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
AUTOLOAD_POSTS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, INSTADP,
AMOLED_THEME, CHECK_ACTIVITY, CHECK_UPDATES})
public @interface BooleanSettings {}
@StringDef({PREV_INSTALL_VERSION})

View File

@ -0,0 +1,92 @@
package awais.instagrabber.webservices;
import android.util.Log;
import androidx.annotation.NonNull;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import awais.instagrabber.models.ProfileModel;
import awais.instagrabber.models.StoryModel;
import awais.instagrabber.models.enums.MediaItemType;
import awais.instagrabber.repositories.thirdparty.AloRepository;
import awais.instagrabber.utils.Constants;
import awais.instagrabber.utils.ResponseBodyUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class AloService extends BaseService {
private static final String TAG = "AloService";
private final AloRepository repository;
private static AloService instance;
private AloService() {
final Retrofit retrofit = getRetrofitBuilder()
.baseUrl("https://aloinstagram.com")
.build();
repository = retrofit.create(AloRepository.class);
}
public static AloService getInstance() {
if (instance == null) {
instance = new AloService();
}
return instance;
}
public void getUserStory(final String id,
final String username,
final boolean highlight,
final ServiceCallback<List<StoryModel>> callback) {
final Call<String> userStoryCall = repository.getUserStory(Constants.A_USER_AGENT, id);
userStoryCall.enqueue(new Callback<String>() {
@Override
public void onResponse(@NonNull final Call<String> call, @NonNull final Response<String> response) {
final String body = response.body();
if (body == null) {
Log.e(TAG, "body is null");
return;
}
final Document data = Jsoup.parse(body);
final Elements media = data.select(".mySpan > a");
Log.d("austin_debug", id+ ": "+body);
if (data != null && media != null) {
final int mediaLen = media.size();
final List<StoryModel> models = new ArrayList<>();
for (Element story : media) {
final StoryModel model = new StoryModel(null,
story.absUrl("href"),
story.selectFirst("video") != null ? MediaItemType.MEDIA_TYPE_VIDEO : MediaItemType.MEDIA_TYPE_IMAGE,
-1, // doesn't exist, to handle
username,
id,
false);
models.add(model);
}
callback.onSuccess(models);
}
}
@Override
public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
callback.onFailure(t);
}
});
}
}

View File

@ -39,35 +39,30 @@ public class FriendshipService extends BaseService {
public void follow(final String userId,
final String targetUserId,
final String crsfToken,
final String csrfToken,
final ServiceCallback<FriendshipRepoChangeRootResponse> callback) {
change("create", userId, targetUserId, crsfToken, callback);
change("create", userId, targetUserId, csrfToken, callback);
}
public void unfollow(final String userId,
final String targetUserId,
final String crsfToken,
final String csrfToken,
final ServiceCallback<FriendshipRepoChangeRootResponse> callback) {
change("destroy", userId, targetUserId, crsfToken, callback);
change("destroy", userId, targetUserId, csrfToken, callback);
}
public void block(final String userId,
final String targetUserId,
final String crsfToken,
final String csrfToken,
final ServiceCallback<FriendshipRepoChangeRootResponse> callback) {
change("block", userId, targetUserId, crsfToken, callback);
change("block", userId, targetUserId, csrfToken, callback);
}
public void unblock(final String userId,
final String targetUserId,
final String crsfToken,
final String csrfToken,
final ServiceCallback<FriendshipRepoChangeRootResponse> callback) {
change("unblock", userId, targetUserId, crsfToken, callback);
}
public void restrict(final String targetUserId,
final String csrfToken,
final ServiceCallback<FriendshipRepoRestrictRootResponse> callback) {
change("unblock", userId, targetUserId, csrfToken, callback);
}
public void toggleRestrict(final String targetUserId,
@ -101,16 +96,16 @@ public class FriendshipService extends BaseService {
public void approve(final String userId,
final String targetUserId,
final String crsfToken,
final String csrfToken,
final ServiceCallback<FriendshipRepoChangeRootResponse> callback) {
change("approve", userId, targetUserId, crsfToken, callback);
change("approve", userId, targetUserId, csrfToken, callback);
}
public void ignore(final String userId,
final String targetUserId,
final String crsfToken,
final String csrfToken,
final ServiceCallback<FriendshipRepoChangeRootResponse> callback) {
change("ignore", userId, targetUserId, crsfToken, callback);
change("ignore", userId, targetUserId, csrfToken, callback);
}
private void change(final String action,

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View File

@ -38,6 +38,12 @@
<item>2</item>
<item>3</item>
</string-array>
<string-array name="anonymous_story_viewer">
<item>Disable</item>
<item>storiesig</item>
<item>Aloinstagram</item>
<item>Instadp</item>
</string-array>
<string-array name="separator_presets">
<item>None</item>
<item>\@</item>

View File

@ -53,6 +53,7 @@
<string name="privacy_warning">Privacy</string>
<string name="instadp_settings">Use Instadp for high definition profile pictures</string>
<string name="storiesig_settings">Use storiesig for stories and highlights from public users</string>
<string name="stories_viewer_settings">Story viewer service</string>
<string name="import_export">Import/Export</string>
<string name="select_language">Language</string>
<string name="what_to_do_dialog">What to do?</string>
@ -97,6 +98,9 @@
<string name="read_more">read more…</string>
<string name="login">Login</string>
<string name="logout">Logout</string>
<string name="logout_summary">Browse Instagram anonymously</string>
<string name="remove_all_acc">Remove all accounts</string>
<string name="remove_all_acc_warning">This will remove all added accounts from the app!\nTo remove just one account, long tap the account from the account switcher dialog.\nDo you want to continue?</string>
<string name="send_logs">Send Debug Logs</string>
<string name="time_settings">Date format</string>
<string name="project_link">Visit Project Page</string>