mirror of
https://github.com/NekoX-Dev/NekoX.git
synced 2024-12-02 19:00:08 +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,43 +1231,14 @@ 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();
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder().setDeveloperModeEnabled(BuildConfig.DEBUG).build();
|
if (BuildVars.LOGS_ENABLED) {
|
||||||
firebaseRemoteConfig.setConfigSettings(configSettings);
|
FileLog.d("failed to get firebase result");
|
||||||
String currentValue = firebaseRemoteConfig.getString("ipconfigv3");
|
FileLog.d("start dns txt task");
|
||||||
if (BuildVars.LOGS_ENABLED) {
|
}
|
||||||
FileLog.d("current firebase value = " + currentValue);
|
DnsTxtLoadTask task = new DnsTxtLoadTask(currentAccount);
|
||||||
}
|
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
|
||||||
|
currentTask = task;
|
||||||
firebaseRemoteConfig.fetch(0).addOnCompleteListener(finishedTask -> {
|
|
||||||
final boolean success = finishedTask.isSuccessful();
|
|
||||||
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) {
|
|
||||||
FileLog.d("failed to get firebase result");
|
|
||||||
FileLog.d("start dns txt task");
|
|
||||||
}
|
|
||||||
DnsTxtLoadTask task = new DnsTxtLoadTask(currentAccount);
|
|
||||||
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null);
|
|
||||||
currentTask = task;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Utilities.stageQueue.postRunnable(() -> {
|
Utilities.stageQueue.postRunnable(() -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user