// Path: TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
// public class BuildVars {
//     public static boolean DEBUG_VERSION = true;
//     public static int APP_ID = 0; // YOUR API ID
//     public static String APP_HASH = "YOUR-API-HASH";
//     public static String HOCKEY_APP_HASH = "YOUR-HOCKEY-HASH";
// 
//     public static String GCM_SENDER_ID = "YOUR-GCM-SENDER-ID";
//     public static String SEND_LOGS_EMAIL = "rubenlagus92@gmail.com";
//     public static String TRELLO_API_KEY = "YOUR-TRELLO-API-KEY";
//     public static String BING_SEARCH_KEY = "YOUR-BING-SEARCH-KEY";
// }


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import java.text.Normalizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

        WebViewClient webViewClient = new WebViewClient() {

            @Override
            public void onPageFinished(WebView view, String url)
            {
                FileLog.d("tsupportTrello", "Request result: " + url);
                if (url.toString().contains("approve")) {
                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
                        view.evaluateJavascript("document.getElementsByTagName('pre')[0].innerHTML", new ValueCallback<String>() {
                            @Override
                            public void onReceiveValue(String s) {
                                showHTML(s);
                            }
                        });
                    } else {
                        webview.loadUrl("javascript:window.HtmlViewer.showHTML" +
                                "('<html>'+document.getElementsByTagName('pre')[0].innerHTML+'</html>');");
                    }
                } else if (url.compareTo("") == 0){
                    endActivity("", false);
                    FileLog.d("tsupportTrello", "Request not approved: " + url);
                } else {
                    FileLog.d("tsupportTrello", "Not found approve con string: " + url.toString().contains("approve"));
                    FileLog.d("tsupportTrello", "Not found approve: " + url.contains("approve"));
                }
            }
        };

        webview.setWebViewClient(webViewClient);
// Path: TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java
// public class BuildVars {
//     public static boolean DEBUG_VERSION = true;
//     public static int APP_ID = 0; // YOUR API ID
//     public static String APP_HASH = "YOUR-API-HASH";
//     public static String HOCKEY_APP_HASH = "YOUR-HOCKEY-HASH";
// 
//     public static String GCM_SENDER_ID = "YOUR-GCM-SENDER-ID";
//     public static String SEND_LOGS_EMAIL = "rubenlagus92@gmail.com";
//     public static String TRELLO_API_KEY = "YOUR-TRELLO-API-KEY";
//     public static String BING_SEARCH_KEY = "YOUR-BING-SEARCH-KEY";
// }


// Path: TMessagesProj/src/main/java/org/telegram/ui/TrelloTokenActivity.java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.ValueCallback;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog;
import java.text.Normalizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


        WebViewClient webViewClient = new WebViewClient() {

            @Override
            public void onPageFinished(WebView view, String url)
            {
                FileLog.d("tsupportTrello", "Request result: " + url);
                if (url.toString().contains("approve")) {
                    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
                        view.evaluateJavascript("document.getElementsByTagName('pre')[0].innerHTML", new ValueCallback<String>() {
                            @Override
                            public void onReceiveValue(String s) {
                                showHTML(s);
                            }
                        });
                    } else {
                        webview.loadUrl("javascript:window.HtmlViewer.showHTML" +
                                "('<html>'+document.getElementsByTagName('pre')[0].innerHTML+'</html>');");
                    }
                } else if (url.compareTo("") == 0){
                    endActivity("", false);
                    FileLog.d("tsupportTrello", "Request not approved: " + url);
                } else {
                    FileLog.d("tsupportTrello", "Not found approve con string: " + url.toString().contains("approve"));
                    FileLog.d("tsupportTrello", "Not found approve: " + url.contains("approve"));
                }
            }
        };

        webview.setWebViewClient(webViewClient);
        FileLog.d("tsupportTrello", "Request: " + trelloAuthURL.replace("@myapikey@", BuildVars.TRELLO_API_KEY));