1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-02 16:40:39 +01:00

remove useless firebase remote config

This commit is contained in:
NekoInverter 2020-01-19 17:43:37 +08:00 committed by Riko Sakurauchi
parent 14d52fe42e
commit b4a70a40ea
No known key found for this signature in database
GPG Key ID: 25AC0345B92902AF
3 changed files with 12 additions and 42 deletions

View File

@ -22,7 +22,6 @@ dependencies {
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.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-auth:17.0.0'
implementation 'com.google.android.gms:play-services-vision:16.2.0'

View File

@ -403,6 +403,10 @@
<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>
</manifest>

View File

@ -10,9 +10,6 @@ import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Base64;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import com.google.firebase.remoteconfig.FirebaseRemoteConfigSettings;
import org.json.JSONArray;
import org.json.JSONObject;
import org.telegram.messenger.AccountInstance;
@ -1223,7 +1220,6 @@ public class ConnectionsManager extends BaseController {
private static class FirebaseTask extends AsyncTask<Void, Void, NativeByteBuffer> {
private int currentAccount;
private FirebaseRemoteConfig firebaseRemoteConfig;
public FirebaseTask(int instance) {
super();
@ -1235,43 +1231,14 @@ public class ConnectionsManager extends BaseController {
if (native_isTestBackend(currentAccount) != 0) {
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(() -> {
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;
}
});
Utilities.stageQueue.postRunnable(() -> {
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) {
Utilities.stageQueue.postRunnable(() -> {