Fix AppCenter SDK

This commit is contained in:
Grishka
2022-02-19 03:04:04 +03:00
parent c382668049
commit f4e71cf130
4 changed files with 15 additions and 7 deletions

View File

@@ -1,11 +1,14 @@
package org.joinmastodon.android;
import android.app.Application;
import android.os.Bundle;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.fragments.HomeFragment;
import org.joinmastodon.android.fragments.SplashFragment;
import java.lang.reflect.InvocationTargetException;
import androidx.annotation.Nullable;
import me.grishka.appkit.FragmentStackActivity;
@@ -26,5 +29,12 @@ public class MainActivity extends FragmentStackActivity{
showFragmentClearingBackStack(fragment);
}
}
if(BuildConfig.BUILD_TYPE.startsWith("appcenter")){
// Call the appcenter SDK wrapper through reflection because it is only present in beta builds
try{
Class.forName("org.joinmastodon.android.AppCenterWrapper").getMethod("init", Application.class).invoke(null, getApplication());
}catch(ClassNotFoundException|NoSuchMethodException|IllegalAccessException|InvocationTargetException ignore){}
}
}
}

View File

@@ -23,10 +23,5 @@ public class MastodonApp extends Application{
ImageCache.setParams(params);
NetworkUtils.setUserAgent("MastodonAndroid/"+BuildConfig.VERSION_NAME);
context=getApplicationContext();
// Call the appcenter SDK wrapper through reflection because it is only present in beta builds
try{
Class.forName("org.joinmastodon.android.AppCenterWrapper").getMethod("init", Application.class).invoke(null, this);
}catch(ClassNotFoundException|NoSuchMethodException|IllegalAccessException|InvocationTargetException ignore){}
}
}