This repository has been archived by the owner on Jul 11, 2022. It is now read-only.
forked from chandevel/Clover
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'leftypol-cloudflare-ddos' into leftypol-release-tmp
- Loading branch information
Showing
7 changed files
with
153 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ba/app/src/main/java/com/github/adamantcheese/chan/ui/controller/ChallengeController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.github.adamantcheese.chan.ui.controller; | ||
|
||
import android.content.Context; | ||
import android.webkit.WebResourceRequest; | ||
import android.webkit.WebView; | ||
import android.webkit.WebViewClient; | ||
|
||
import com.github.adamantcheese.chan.R; | ||
import com.github.adamantcheese.chan.controller.Controller; | ||
import com.github.adamantcheese.chan.core.di.NetModule; | ||
import com.github.adamantcheese.chan.core.model.orm.Loadable; | ||
import com.github.adamantcheese.chan.core.site.common.CommonSite; | ||
import com.github.adamantcheese.chan.utils.AndroidUtils; | ||
|
||
public class ChallengeController extends Controller { | ||
protected Loadable behindChallenge; | ||
|
||
private WebView web; | ||
|
||
public ChallengeController(Context context, Loadable behindChallenge) { | ||
super(context); | ||
this.behindChallenge = behindChallenge; | ||
} | ||
|
||
@Override | ||
public void onCreate() { | ||
super.onCreate(); | ||
navigation.title = AndroidUtils.getString(R.string.challenge_screen); | ||
|
||
web = new WebView(context); | ||
web.setWebViewClient(new WebViewClient(){ | ||
@Override | ||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { | ||
return false; | ||
} | ||
}); | ||
|
||
CommonSite.CommonCallModifier siteCallModifier = behindChallenge.site.callModifier(); | ||
if (siteCallModifier != null) { | ||
siteCallModifier.modifyWebView(web); | ||
} | ||
|
||
web.getSettings().setJavaScriptEnabled(true); | ||
web.getSettings().setDomStorageEnabled(true); | ||
web.getSettings().setUserAgentString(NetModule.USER_AGENT); | ||
web.loadUrl(behindChallenge.desktopUrl()); | ||
|
||
this.view = web; | ||
} | ||
|
||
@Override | ||
public void onDestroy() { | ||
super.onDestroy(); | ||
this.web.destroy(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters