Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix force instant view #581

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ This is the complete source code and the build instructions for the official alt

* [Homebrew](https://brew.sh)
* git with LFS, wget and sed: `$ brew install git git-lfs wget gsed && git lfs install`
* Java runtime: `brew install java`
* Run `java --help` to verify your system can find Java. If not, run `sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk`

#### Ubuntu

Expand Down Expand Up @@ -130,4 +132,4 @@ List of third-party components used in **Telegram X** can be found [here](/docs/

**Telegram X** welcomes contributions. Check out [pull request template](/docs/PULL_REQUEST_TEMPLATE.md) and [guide for contributors](/docs/GUIDE.md) to learn more about Telegram X internals before creating the first pull request.

If you are a regular user and experience a problem with Telegram X, the best place to look for solution is [Telegram X chat](https://t.me/tgandroidtests) — a community with over 4 thousand members. Please do not use this repository to ask questions: if you have general issue with Telegram, refer to [FAQ](http://telegram.org/faq) or contact [Telegram Support](https://telegram.org/faq#telegram-support).
If you are a regular user and experience a problem with Telegram X, the best place to look for solution is [Telegram X chat](https://t.me/tgandroidtests) — a community with over 4 thousand members. Please do not use this repository to ask questions: if you have general issue with Telegram, refer to [FAQ](http://telegram.org/faq) or contact [Telegram Support](https://telegram.org/faq#telegram-support).
16 changes: 15 additions & 1 deletion app/src/main/java/org/thunderdog/challegram/data/TGMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -7641,7 +7641,20 @@ public TdApi.WebPage findWebPage (String link) {

@Override
public boolean forceInstantView (String link) {
return hasInstantView(link);
int instantViewOption = Settings.instance().getInstantViewMode();
switch (instantViewOption) {
case Settings.INSTANT_VIEW_MODE_ALL:
return hasInstantView(link);
case Settings.INSTANT_VIEW_MODE_INTERNAL:
return hasInstantView(link) && isInternalLink(link);
case Settings.INSTANT_VIEW_MODE_NONE:
return false;
}
return true;
}

private boolean isInternalLink(String link) {
return link.contains("telegram.org") || link.contains("telegra.ph");
}

@Override
Expand Down Expand Up @@ -7679,6 +7692,7 @@ public boolean onPhoneNumberClick (String phoneNumber) {
return false;
}

// Austin right here
@Override
public boolean onUrlClick (View view, String link, boolean promptUser, @NonNull TdlibUi.UrlOpenParameters openParameters) {
trackSponsoredMessageClicked();
Expand Down