1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57: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 minSdkVersion 16
targetSdkVersion 29 targetSdkVersion 29
versionCode 44 versionCode 45
versionName '17.8' versionName '17.9'
multiDexEnabled true multiDexEnabled true

View File

@ -7,6 +7,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.webkit.CookieManager; import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
@ -97,6 +98,7 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
} }
@SuppressLint("SetJavaScriptEnabled") @SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
private void initWebView() { private void initWebView() {
if (loginBinding != null) { if (loginBinding != null) {
loginBinding.webView.setWebChromeClient(webChromeClient); loginBinding.webView.setWebChromeClient(webChromeClient);
@ -119,7 +121,18 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
CookieManager.getInstance().removeAllCookies(null); 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/"); loginBinding.webView.loadUrl("https://instagram.com/");
} }
} }

View File

@ -122,12 +122,13 @@ public final class StoryViewer extends BaseLanguageActivity {
return; return;
} }
username = intent.getStringExtra(Constants.EXTRAS_USERNAME).replace("@", ""); username = intent.getStringExtra(Constants.EXTRAS_USERNAME);
final String highlight = intent.getStringExtra(Constants.EXTRAS_HIGHLIGHT); final String highlight = intent.getStringExtra(Constants.EXTRAS_HIGHLIGHT);
final boolean hasUsername = !Utils.isEmpty(username); final boolean hasUsername = !Utils.isEmpty(username);
final boolean hasHighlight = !Utils.isEmpty(highlight); final boolean hasHighlight = !Utils.isEmpty(highlight);
if (hasUsername) { if (hasUsername) {
username = username.replace("@", "");
storyViewerBinding.toolbar.toolbar.setTitle(username); storyViewerBinding.toolbar.toolbar.setTitle(username);
storyViewerBinding.toolbar.toolbar.setOnClickListener(v -> { storyViewerBinding.toolbar.toolbar.setOnClickListener(v -> {
searchUsername(username); searchUsername(username);
@ -150,6 +151,7 @@ public final class StoryViewer extends BaseLanguageActivity {
&& intent.hasExtra(Constants.FEED)) { && intent.hasExtra(Constants.FEED)) {
final FeedStoryModel[] storyFeed = (FeedStoryModel[]) intent.getSerializableExtra(Constants.FEED); final FeedStoryModel[] storyFeed = (FeedStoryModel[]) intent.getSerializableExtra(Constants.FEED);
final int index = intent.getIntExtra(Constants.FEED_ORDER, 1738); 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)) if ((isRightSwipe == true && index == 0) || (isRightSwipe == false && index == storyFeed.length - 1))
Toast.makeText(getApplicationContext(), R.string.no_more_stories, Toast.LENGTH_SHORT).show(); Toast.makeText(getApplicationContext(), R.string.no_more_stories, Toast.LENGTH_SHORT).show();
else { else {
@ -711,6 +713,7 @@ final String url = "https://www.instagram.com/stories/reel/seen";
wr.flush(); wr.flush();
wr.close(); wr.close();
urlConnection.connect(); urlConnection.connect();
Log.d("austin_debug", urlConnection.getResponseCode() + " " + Utils.readFromConnection(urlConnection));
urlConnection.disconnect(); urlConnection.disconnect();
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e("austin_debug", "seen: " + 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) -> { new AlertDialog.Builder(activity).setPositiveButton(R.string.yes, (d, which) -> {
Utils.dataBox.delFavorite(favoriteModel); 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, .setNegativeButton(R.string.no, null).setMessage(getString(R.string.quick_access_confirm_delete,
favoriteModel.getQuery())).show(); favoriteModel.getQuery())).show();

View File

@ -116,11 +116,11 @@ public final class DataBox extends SQLiteOpenHelper {
favorites = new ArrayList<>(); favorites = new ArrayList<>();
do { do {
tempFav = new FavoriteModel( 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)
: "@" + cursor.getString(0), // query text : "@" + cursor.getString(0), // query text
cursor.getLong(1), // date added 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(0) : cursor.getString(2) // display : "@" + cursor.getString(0) : cursor.getString(2) // display
); );