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

fix #53, fix #54 (pending check), fix @RAMAR-RAR story seen, fix hashtag favourite

This commit is contained in:
Austin Huang 2020-08-16 13:42:11 -04:00
parent 87a7c400d7
commit b1b6ede675
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
5 changed files with 24 additions and 8 deletions

View File

@ -9,8 +9,8 @@ android {
minSdkVersion 16
targetSdkVersion 29
versionCode 44
versionName '17.8'
versionCode 45
versionName '17.9'
multiDexEnabled true

View File

@ -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);
}
CookieManager.getInstance().removeAllCookies(null);
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/");
}
}

View File

@ -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);

View File

@ -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();

View File

@ -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
);