diff --git a/app/src/main/java/com/h/pixeldroid/MainActivity.kt b/app/src/main/java/com/h/pixeldroid/MainActivity.kt index bba22ae0..fb2b74dc 100644 --- a/app/src/main/java/com/h/pixeldroid/MainActivity.kt +++ b/app/src/main/java/com/h/pixeldroid/MainActivity.kt @@ -39,6 +39,7 @@ import com.mikepenz.materialdrawer.model.interfaces.* import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader import com.mikepenz.materialdrawer.util.DrawerImageLoader import com.mikepenz.materialdrawer.widget.AccountHeaderView +import org.ligi.tracedroid.sending.sendTraceDroidStackTracesIfExist import retrofit2.HttpException import java.io.IOException @@ -68,6 +69,8 @@ class MainActivity : BaseActivity() { launchActivity(LoginActivity(), firstTime = true) finish() } else { + sendTraceDroidStackTracesIfExist("contact@pixeldroid.org", this) + setupDrawer() val tabs: List<() -> Fragment> = listOf( diff --git a/app/src/main/java/com/h/pixeldroid/utils/PixelDroidApplication.kt b/app/src/main/java/com/h/pixeldroid/utils/PixelDroidApplication.kt index c2a6df27..abedc1fa 100644 --- a/app/src/main/java/com/h/pixeldroid/utils/PixelDroidApplication.kt +++ b/app/src/main/java/com/h/pixeldroid/utils/PixelDroidApplication.kt @@ -16,7 +16,6 @@ class PixelDroidApplication: Application() { super.onCreate() TraceDroid.init(this) - sendTraceDroidStackTracesIfExist("contact@pixeldroid.org", this) val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) diff --git a/app/src/main/java/com/h/pixeldroid/utils/api/objects/Error.kt b/app/src/main/java/com/h/pixeldroid/utils/api/objects/Error.kt new file mode 100644 index 00000000..7a2d5be9 --- /dev/null +++ b/app/src/main/java/com/h/pixeldroid/utils/api/objects/Error.kt @@ -0,0 +1,5 @@ +package com.h.pixeldroid.utils.api.objects + +data class Error( + val error: String? +) \ No newline at end of file diff --git a/app/src/main/java/com/h/pixeldroid/utils/di/APIModule.kt b/app/src/main/java/com/h/pixeldroid/utils/di/APIModule.kt index 79346fe7..2d6cb27f 100644 --- a/app/src/main/java/com/h/pixeldroid/utils/di/APIModule.kt +++ b/app/src/main/java/com/h/pixeldroid/utils/di/APIModule.kt @@ -2,7 +2,6 @@ package com.h.pixeldroid.utils.di import com.h.pixeldroid.utils.api.PixelfedAPI import com.h.pixeldroid.utils.db.AppDatabase -import com.h.pixeldroid.utils.db.addUser import com.h.pixeldroid.utils.db.entities.UserDatabaseEntity import dagger.Module import dagger.Provides @@ -11,7 +10,6 @@ import okhttp3.* import retrofit2.Retrofit import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory import retrofit2.converter.gson.GsonConverterFactory -import java.lang.Exception import javax.inject.Singleton @Module @@ -74,9 +72,18 @@ class PixelfedAPIHolder(db: AppDatabase?){ ): PixelfedAPI { val newAPI = intermediate .baseUrl(user.instance_uri) - .client(OkHttpClient().newBuilder().authenticator(TokenAuthenticator(user, db)).build()) + .client( + OkHttpClient().newBuilder().authenticator(TokenAuthenticator(user, db)) + .addInterceptor { + it.request().newBuilder().run { + header("Accept", "application/json") + it.proceed(build()) + } + }.build() + ) .build().create(PixelfedAPI::class.java) api = newAPI return newAPI } + } \ No newline at end of file