Bug Fixes

Bug Fixes
master
Abdul Mannan 2022-02-15 01:41:59 +05:00
parent 18de5b8eb6
commit 483befe288
3 changed files with 17 additions and 13 deletions

View File

@ -218,11 +218,11 @@ public class geckoClients
private final WebExtension.PortDelegate mPortDelegate = new WebExtension.PortDelegate() { private final WebExtension.PortDelegate mPortDelegate = new WebExtension.PortDelegate() {
@Override @Override
public void onPortMessage(final @NonNull Object message, public void onPortMessage(final @NonNull Object message,final @NonNull WebExtension.Port port) {
final @NonNull WebExtension.Port port) { if(message!=null && mSession.getProgress()==100 && !mSession.mCloseRequested && mSession.isFirstPaintExecuted && !mSession.mOnBackPressed){
if(message!=null && mSession.getProgress()==100){
event.invokeObserver(Arrays.asList(message, mSession.getCurrentURL()), M_INDEX_WEBSITE); event.invokeObserver(Arrays.asList(message, mSession.getCurrentURL()), M_INDEX_WEBSITE);
} }
mSession.mOnBackPressed = false;
} }
@Override @Override

View File

@ -115,10 +115,12 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
private int m_current_url_id = -1; private int m_current_url_id = -1;
private GeckoView mGeckoView; private GeckoView mGeckoView;
private boolean mIsLoaded = false; private boolean mIsLoaded = false;
private boolean isFirstPaintExecuted = false; public boolean isFirstPaintExecuted = false;
private boolean mIsProgressBarChanging = false; private boolean mIsProgressBarChanging = false;
private Handler mFindHandler; private Handler mFindHandler;
private boolean mClosed = false; private boolean mClosed = false;
public boolean mCloseRequested = false;
public boolean mOnBackPressed = false;
public SessionState mSessionState; public SessionState mSessionState;
geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){ geckoSession(eventObserver.eventListener event,String mSessionID,AppCompatActivity mContext, GeckoView pGeckoView){
@ -314,6 +316,9 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
@Override @Override
public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) { public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) {
mCloseRequested = false;
isFirstPaintExecuted = false;
PrefsHelper.setPref(keys.PROXY_TYPE, 1); PrefsHelper.setPref(keys.PROXY_TYPE, 1);
PrefsHelper.setPref(keys.PROXY_SOCKS,"127.0.0.1"); PrefsHelper.setPref(keys.PROXY_SOCKS,"127.0.0.1");
PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, orbotLocalConstants.mSOCKSPort); PrefsHelper.setPref(keys.PROXY_SOCKS_PORT, orbotLocalConstants.mSOCKSPort);
@ -347,10 +352,9 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
@UiThread @UiThread
public void onPageStop(@NonNull GeckoSession var1, boolean var2) { public void onPageStop(@NonNull GeckoSession var1, boolean var2) {
mCloseRequested = !var2;
if(var2){ if(var2){
if(mProgress>=100){ if(mProgress>=100){
//event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.ON_UPDATE_THEME);
//event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id, mTheme), enums.etype.on_update_favicon);
event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_page_loaded); event.invokeObserver(Arrays.asList(null,mSessionID), enums.etype.on_page_loaded);
if(!mThemeChanged){ if(!mThemeChanged){
@ -760,6 +764,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
@UiThread @UiThread
public void onCloseRequest(@NonNull GeckoSession var1) { public void onCloseRequest(@NonNull GeckoSession var1) {
if(!canGoBack() && !mClosed){ if(!canGoBack() && !mClosed){
mCloseRequested = true;
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.back_list_empty); event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.back_list_empty);
} }
} }
@ -767,6 +772,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
int mCrashCount = 0; int mCrashCount = 0;
@UiThread @UiThread
public void onCrash(@NonNull GeckoSession session) { public void onCrash(@NonNull GeckoSession session) {
mCloseRequested = true;
if(!mClosed && status.sSettingIsAppStarted){ if(!mClosed && status.sSettingIsAppStarted){
if(event==null){ if(event==null){
return; return;
@ -792,6 +798,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
@UiThread @UiThread
public void onKill(@NonNull GeckoSession session) { public void onKill(@NonNull GeckoSession session) {
mCloseRequested = true;
if(!mClosed && status.sSettingIsAppStarted){ if(!mClosed && status.sSettingIsAppStarted){
if(event==null){ if(event==null){
return; return;
@ -1159,6 +1166,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
void goBackSession(){ void goBackSession(){
wasBackPressed = true; wasBackPressed = true;
mOnBackPressed = true;
goBack(); goBack();
try { try {

View File

@ -80,9 +80,6 @@ class crawlerDataModel
String mURL = strings.GENERIC_EMPTY_STR; String mURL = strings.GENERIC_EMPTY_STR;
private void onSendRequest(){ private void onSendRequest(){
if (mHTML.size()<100){
return;
}
RequestQueue mRequestQueue = Volley.newRequestQueue(mContext, new ProxiedHurlStack()); RequestQueue mRequestQueue = Volley.newRequestQueue(mContext, new ProxiedHurlStack());
String url = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/user_index/"; String url = "http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/user_index/";
@ -116,10 +113,9 @@ class crawlerDataModel
crawlerRowModel mModel = mHTML.remove(0); crawlerRowModel mModel = mHTML.remove(0);
mHtml = mModel.getHTML(); mHtml = mModel.getHTML();
mURL = mModel.getURL(); mURL = mModel.getURL();
if (mHTML.size()<100){
onParseHTML(mHtml, mURL);
onSendRequest(); onSendRequest();
}
} }
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();