Fix unable to check anonymous subscription.

This commit is contained in:
Alex Ning 2021-04-10 10:00:46 +08:00
parent 21e1fcdad9
commit e5750e35b7
2 changed files with 12 additions and 1 deletions

View File

@ -3,10 +3,12 @@ package ml.docilealligator.infinityforreddit.activities;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
@ -99,4 +101,13 @@ public class AnonymousSubscriptionsActivity extends BaseActivity {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return false;
}
}

View File

@ -16,7 +16,7 @@ public class CheckIsSubscribedToSubreddit {
if (!redditDataRoomDatabase.accountDao().isAnonymousAccountInserted()) {
redditDataRoomDatabase.accountDao().insertAnonymousAccount();
}
SubscribedSubredditData subscribedSubredditData = redditDataRoomDatabase.subscribedSubredditDao().getSubscribedSubreddit(subredditName, accountName);
SubscribedSubredditData subscribedSubredditData = redditDataRoomDatabase.subscribedSubredditDao().getSubscribedSubreddit(subredditName, accountName == null ? "-" : accountName);
handler.post(() -> {
if (subscribedSubredditData != null) {
checkIsSubscribedToSubredditListener.isSubscribed();