mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-02 21:40:09 +01:00
remove useless firebase remote config
This commit is contained in:
parent
14d52fe42e
commit
b4a70a40ea
@ -22,7 +22,6 @@ dependencies {
|
|||||||
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
compileOnly 'org.checkerframework:checker-qual:2.5.2'
|
||||||
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
|
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
|
||||||
implementation 'com.google.firebase:firebase-messaging:20.1.0'
|
implementation 'com.google.firebase:firebase-messaging:20.1.0'
|
||||||
implementation 'com.google.firebase:firebase-config:19.1.0'
|
|
||||||
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
implementation 'com.google.android.gms:play-services-maps:17.0.0'
|
||||||
implementation 'com.google.android.gms:play-services-auth:17.0.0'
|
implementation 'com.google.android.gms:play-services-auth:17.0.0'
|
||||||
implementation 'com.google.android.gms:play-services-vision:16.2.0'
|
implementation 'com.google.android.gms:play-services-vision:16.2.0'
|
||||||
|
@ -403,6 +403,10 @@
|
|||||||
|
|
||||||
<meta-data android:name="android.max_aspect" android:value="2.5" />
|
<meta-data android:name="android.max_aspect" android:value="2.5" />
|
||||||
|
|
||||||
|
<meta-data
|
||||||
|
android:name="com.google.firebase.messaging.default_notification_icon"
|
||||||
|
android:resource="@drawable/notification" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -10,9 +10,6 @@ import android.os.SystemClock;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
|
|
||||||
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
|
|
||||||
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
|
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.messenger.AccountInstance;
|
import org.telegram.messenger.AccountInstance;
|
||||||
@ -1223,7 +1220,6 @@ public class ConnectionsManager extends BaseController {
|
|||||||
private static class FirebaseTask extends AsyncTask<Void, Void, NativeByteBuffer> {
|
private static class FirebaseTask extends AsyncTask<Void, Void, NativeByteBuffer> {
|
||||||
|
|
||||||
private int currentAccount;
|
private int currentAccount;
|
||||||
private FirebaseRemoteConfig firebaseRemoteConfig;
|
|
||||||
|
|
||||||
public FirebaseTask(int instance) {
|
public FirebaseTask(int instance) {
|
||||||
super();
|
super();
|
||||||
@ -1235,34 +1231,7 @@ public class ConnectionsManager extends BaseController {
|
|||||||
if (native_isTestBackend(currentAccount) != 0) {
|
if (native_isTestBackend(currentAccount) != 0) {
|
||||||
throw new Exception("test backend");
|
throw new Exception("test backend");
|
||||||
}
|
}
|
||||||
firebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
|
|
||||||
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG).build();
|
|
||||||
firebaseRemoteConfig.setConfigSettings(configSettings);
|
|
||||||
String currentValue = firebaseRemoteConfig.getString("ipconfigv3");
|
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
|
||||||
FileLog.d("current firebase value = " + currentValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
firebaseRemoteConfig.fetch(0).addOnCompleteListener(finishedTask -> {
|
|
||||||
final boolean success = finishedTask.isSuccessful();
|
|
||||||
Utilities.stageQueue.postRunnable(() -> {
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
currentTask = null;
|
|
||||||
String config = null;
|
|
||||||
if (success) {
|
|
||||||
firebaseRemoteConfig.activateFetched();
|
|
||||||
config = firebaseRemoteConfig.getString("ipconfigv3");
|
|
||||||
}
|
|
||||||
if (!TextUtils.isEmpty(config)) {
|
|
||||||
byte[] bytes = Base64.decode(config, Base64.DEFAULT);
|
|
||||||
try {
|
|
||||||
NativeByteBuffer buffer = new NativeByteBuffer(bytes.length);
|
|
||||||
buffer.writeBytes(bytes);
|
|
||||||
int date = (int) (firebaseRemoteConfig.getInfo().getFetchTimeMillis() / 1000);
|
|
||||||
native_applyDnsConfig(currentAccount, buffer.address, AccountInstance.getInstance(currentAccount).getUserConfig().getClientPhone(), date);
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
FileLog.d("failed to get firebase result");
|
FileLog.d("failed to get firebase result");
|
||||||
FileLog.d("start dns txt task");
|
FileLog.d("start dns txt task");
|
||||||
@ -1270,8 +1239,6 @@ public class ConnectionsManager extends BaseController {
|
|||||||
DnsTxtLoadTask task = new DnsTxtLoadTask(currentAccount);
|
DnsTxtLoadTask task = new DnsTxtLoadTask(currentAccount);
|
||||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
|
||||||
currentTask = task;
|
currentTask = task;
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Utilities.stageQueue.postRunnable(() -> {
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user