mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Merge branch 'master' into feature/share-photos-dm
This commit is contained in:
commit
74f2b6f268
@ -10,8 +10,8 @@ android {
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 44
|
||||
versionName '17.8'
|
||||
versionCode 45
|
||||
versionName '17.9'
|
||||
|
||||
multiDexEnabled true
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.CookieSyncManager;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
@ -97,6 +98,7 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled")
|
||||
@SuppressWarnings("deprecation")
|
||||
private void initWebView() {
|
||||
if (loginBinding != null) {
|
||||
loginBinding.webView.setWebChromeClient(webChromeClient);
|
||||
@ -119,7 +121,18 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
|
||||
CookieManager.getInstance().removeAllCookies(null);
|
||||
CookieManager.getInstance().flush();
|
||||
} else {
|
||||
CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(getApplicationContext());
|
||||
cookieSyncMngr.startSync();
|
||||
CookieManager cookieManager = CookieManager.getInstance();
|
||||
cookieManager.removeAllCookie();
|
||||
cookieManager.removeSessionCookie();
|
||||
cookieSyncMngr.stopSync();
|
||||
cookieSyncMngr.sync();
|
||||
}
|
||||
loginBinding.webView.loadUrl("https://instagram.com/");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package awais.instagrabber.activities;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
@ -152,7 +153,7 @@ public final class ProfileViewer extends BaseLanguageActivity implements SwipeRe
|
||||
(!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> {
|
||||
if (result != null && result.length > 0)
|
||||
startActivity(new Intent(ProfileViewer.this, StoryViewer.class)
|
||||
//.putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
||||
.putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
||||
.putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle())
|
||||
.putExtra(Constants.EXTRAS_STORIES, result)
|
||||
);
|
||||
@ -168,6 +169,8 @@ public final class ProfileViewer extends BaseLanguageActivity implements SwipeRe
|
||||
private String cookie = Utils.settingsHelper.getString(Constants.COOKIE), userQuery;
|
||||
public boolean isLoggedIn = !Utils.isEmpty(cookie);
|
||||
private ActivityProfileBinding profileBinding;
|
||||
private ArrayAdapter<String> profileDialogAdapter;
|
||||
private DialogInterface.OnClickListener profileDialogListener;
|
||||
|
||||
protected void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||
stopCurrentExecutor();
|
||||
@ -187,6 +190,21 @@ public final class ProfileViewer extends BaseLanguageActivity implements SwipeRe
|
||||
|
||||
resources = getResources();
|
||||
|
||||
profileDialogAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
|
||||
new String[]{resources.getString(R.string.view_pfp), resources.getString(R.string.show_stories)});
|
||||
profileDialogListener = (dialog, which) -> {
|
||||
final Intent newintent;
|
||||
if (which == 0 || storyModels == null || storyModels.length < 1) {
|
||||
newintent = new Intent(this, ProfilePicViewer.class).putExtra(
|
||||
((hashtagModel != null) ? Constants.EXTRAS_HASHTAG : (locationModel != null ? Constants.EXTRAS_LOCATION : Constants.EXTRAS_PROFILE)),
|
||||
((hashtagModel != null) ? hashtagModel : (locationModel != null ? locationModel : profileModel)));
|
||||
}
|
||||
else newintent = new Intent(this, StoryViewer.class).putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
|
||||
.putExtra(Constants.EXTRAS_STORIES, storyModels)
|
||||
.putExtra(Constants.EXTRAS_HASHTAG, (hashtagModel != null));
|
||||
startActivity(newintent);
|
||||
};
|
||||
|
||||
profileBinding.profileView.swipeRefreshLayout.setOnRefreshListener(this);
|
||||
profileBinding.profileView.mainUrl.setMovementMethod(new LinkMovementMethod());
|
||||
|
||||
@ -239,6 +257,28 @@ public final class ProfileViewer extends BaseLanguageActivity implements SwipeRe
|
||||
});
|
||||
profileBinding.profileView.mainPosts.addOnScrollListener(lazyLoader);
|
||||
|
||||
final View.OnClickListener onClickListener = v -> {
|
||||
if (v == profileBinding.profileView.mainBiography) {
|
||||
Utils.copyText(this, profileBinding.profileView.mainBiography.getText().toString());
|
||||
} else if (v == profileBinding.profileView.locationBiography) {
|
||||
Utils.copyText(this, profileBinding.profileView.locationBiography.getText().toString());
|
||||
} else if (v == profileBinding.profileView.mainProfileImage || v == profileBinding.profileView.mainHashtagImage || v == profileBinding.profileView.mainLocationImage) {
|
||||
if (storyModels == null || storyModels.length <= 0) {
|
||||
profileDialogListener.onClick(null, 0);
|
||||
} else {
|
||||
// because sometimes configuration changes made this crash on some phones
|
||||
new AlertDialog.Builder(this).setAdapter(profileDialogAdapter, profileDialogListener)
|
||||
.setNeutralButton(R.string.cancel, null).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
profileBinding.profileView.mainBiography.setOnClickListener(onClickListener);
|
||||
profileBinding.profileView.locationBiography.setOnClickListener(onClickListener);
|
||||
profileBinding.profileView.mainProfileImage.setOnClickListener(onClickListener);
|
||||
profileBinding.profileView.mainHashtagImage.setOnClickListener(onClickListener);
|
||||
profileBinding.profileView.mainLocationImage.setOnClickListener(onClickListener);
|
||||
|
||||
this.onRefresh();
|
||||
}
|
||||
|
||||
|
@ -122,12 +122,13 @@ public final class StoryViewer extends BaseLanguageActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
username = intent.getStringExtra(Constants.EXTRAS_USERNAME).replace("@", "");
|
||||
username = intent.getStringExtra(Constants.EXTRAS_USERNAME);
|
||||
final String highlight = intent.getStringExtra(Constants.EXTRAS_HIGHLIGHT);
|
||||
final boolean hasUsername = !Utils.isEmpty(username);
|
||||
final boolean hasHighlight = !Utils.isEmpty(highlight);
|
||||
|
||||
if (hasUsername) {
|
||||
username = username.replace("@", "");
|
||||
storyViewerBinding.toolbar.toolbar.setTitle(username);
|
||||
storyViewerBinding.toolbar.toolbar.setOnClickListener(v -> {
|
||||
searchUsername(username);
|
||||
@ -150,6 +151,7 @@ public final class StoryViewer extends BaseLanguageActivity {
|
||||
&& intent.hasExtra(Constants.FEED)) {
|
||||
final FeedStoryModel[] storyFeed = (FeedStoryModel[]) intent.getSerializableExtra(Constants.FEED);
|
||||
final int index = intent.getIntExtra(Constants.FEED_ORDER, 1738);
|
||||
if (settingsHelper.getBoolean(MARK_AS_SEEN)) new SeenAction().execute();
|
||||
if ((isRightSwipe == true && index == 0) || (isRightSwipe == false && index == storyFeed.length - 1))
|
||||
Toast.makeText(getApplicationContext(), R.string.no_more_stories, Toast.LENGTH_SHORT).show();
|
||||
else {
|
||||
@ -692,7 +694,7 @@ final String url = "https://i.instagram.com/api/v1/media/"+currentStory.getStory
|
||||
|
||||
class SeenAction extends AsyncTask<Void, Void, Void> {
|
||||
protected Void doInBackground(Void... lmao) {
|
||||
final String url = "https://www.instagram.com/stories/reel/seen";
|
||||
final String url = "https://www.instagram.com/stories/reel/seen";
|
||||
try {
|
||||
String urlParameters = "reelMediaId="+currentStory.getStoryMediaId().split("_")[0]
|
||||
+"&reelMediaOwnerId="+currentStory.getUserId()
|
||||
@ -711,6 +713,7 @@ final String url = "https://www.instagram.com/stories/reel/seen";
|
||||
wr.flush();
|
||||
wr.close();
|
||||
urlConnection.connect();
|
||||
Log.d("austin_debug", urlConnection.getResponseCode() + " " + Utils.readFromConnection(urlConnection));
|
||||
urlConnection.disconnect();
|
||||
} catch (Throwable ex) {
|
||||
Log.e("austin_debug", "seen: " + ex);
|
||||
|
@ -138,7 +138,7 @@ public final class QuickAccessDialog extends BottomSheetDialogFragment implement
|
||||
|
||||
new AlertDialog.Builder(activity).setPositiveButton(R.string.yes, (d, which) -> {
|
||||
Utils.dataBox.delFavorite(favoriteModel);
|
||||
rvFavorites.findViewWithTag(favoriteModel).setVisibility(View.GONE);
|
||||
favoritesAdapter.setItems(Utils.dataBox.getAllFavorites());
|
||||
})
|
||||
.setNegativeButton(R.string.no, null).setMessage(getString(R.string.quick_access_confirm_delete,
|
||||
favoriteModel.getQuery())).show();
|
||||
|
@ -116,11 +116,11 @@ public final class DataBox extends SQLiteOpenHelper {
|
||||
favorites = new ArrayList<>();
|
||||
do {
|
||||
tempFav = new FavoriteModel(
|
||||
(cursor.getString(0).charAt(0) == '@' || cursor.getString(0).contains("/"))
|
||||
(cursor.getString(0).charAt(0) == '@' || cursor.getString(0).charAt(0) == '#' || cursor.getString(0).contains("/"))
|
||||
? cursor.getString(0)
|
||||
: "@" + cursor.getString(0), // query text
|
||||
cursor.getLong(1), // date added
|
||||
cursor.getString(2) == null ? (cursor.getString(0).charAt(0) == '@' || cursor.getString(0).contains("/"))
|
||||
cursor.getString(2) == null ? (cursor.getString(0).charAt(0) == '@' || cursor.getString(0).charAt(0) == '#' || cursor.getString(0).contains("/"))
|
||||
? cursor.getString(0)
|
||||
: "@" + cursor.getString(0) : cursor.getString(2) // display
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user