7 Commits

Author SHA1 Message Date
Balazs Toldi
b82e4d9d37 Filter saved posts
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 21:45:10 +02:00
Balazs Toldi
1f3d9e58d8 Link resolver for Users
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 21:34:42 +02:00
Balazs Toldi
31e28fb146 Remove AAR dependency file.
This is necessary for the F-Droid build. I'm not a fan of this solution, as the Jcenter is deprecated by now.
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 20:55:20 +02:00
Balazs Toldi
2fbcb95db8 LinkResolverActivity to resolve lemmy communities
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 16:20:51 +02:00
Balazs Toldi
7f74877fd8 Small change in README
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 10:29:11 +02:00
Balazs Toldi
2c6cc3e3d5 Fix issue with loading subscriptions on the Main activity
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 09:20:54 +02:00
Balazs Toldi
d4d533c4f0 Bump version
Signed-off-by: Balazs Toldi <balazs@toldi.eu>
2023-07-26 09:20:24 +02:00
13 changed files with 153 additions and 145 deletions

View File

@@ -42,7 +42,7 @@ LemmInfinity is currently in the early stages of development. Expect many unfini
- [x] Functionality for post upvotes/downvotes
- [x] Functionality to browse comments
- [ ] Capability for creating a new post
- [ ] Ability to create comments
- [x] Ability to create comments
- [ ] Elimination of code/string references specific to Reddit
- [ ] Incorporation of private messaging feature
- [ ] Feature for saving posts

Binary file not shown.

View File

@@ -8,8 +8,8 @@ android {
applicationId "eu.toldi.infinityforlemmy"
minSdk 21
targetSdk 33
versionCode 121
versionName "0.0.1"
versionCode 122
versionName "0.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
@@ -175,7 +175,7 @@ dependencies {
implementation 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
// Customizable TextView
implementation files("Modules/customtextview-2.1.aar")
implementation 'com.libRG:customtextview:2.4'
// Dismiss gesturing
implementation 'app.futured.hauler:hauler:5.0.0'

View File

@@ -45,14 +45,10 @@ import eu.toldi.infinityforlemmy.post.PostPagingSource;
import eu.toldi.infinityforlemmy.readpost.InsertReadPost;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import retrofit2.Retrofit;
public class AccountSavedThingActivity extends BaseActivity implements ActivityToolbarInterface,
PostLayoutBottomSheetFragment.PostLayoutSelectionCallback, MarkPostAsReadInterface {
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject

View File

@@ -26,6 +26,7 @@ import javax.inject.Named;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.R;
import eu.toldi.infinityforlemmy.customtheme.CustomThemeWrapper;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
public class LinkResolverActivity extends AppCompatActivity {
@@ -38,8 +39,8 @@ public class LinkResolverActivity extends AppCompatActivity {
private static final String POST_PATTERN_2 = "/(u|U|user)/[\\w-]+/comments/\\w+/?\\w+/?";
private static final String POST_PATTERN_3 = "/[\\w-]+$";
private static final String COMMENT_PATTERN = "/(r|u|U|user)/[\\w-]+/comments/\\w+/?[\\w-]+/\\w+/?";
private static final String SUBREDDIT_PATTERN = "/[rR]/[\\w-]+/?";
private static final String USER_PATTERN = "/(u|U|user)/[\\w-]+/?";
private static final String SUBREDDIT_PATTERN = "(?:https?://[\\w.-]+)?/c/[\\w-]+(@[\\w.-]+)?";
private static final String USER_PATTERN = "(?:https?://[\\w.-]+)?/u(sers)?/[\\w-]+(@[\\w.-]+)?";
private static final String SIDEBAR_PATTERN = "/[rR]/[\\w-]+/about/sidebar";
private static final String MULTIREDDIT_PATTERN = "/user/[\\w-]+/m/\\w+/?";
private static final String MULTIREDDIT_PATTERN_2 = "/[rR]/(\\w+\\+?)+/?";
@@ -156,6 +157,18 @@ public class LinkResolverActivity extends AppCompatActivity {
intent.putExtra(ViewImageOrGifActivity.EXTRA_IMAGE_URL_KEY, uri.toString());
intent.putExtra(ViewImageOrGifActivity.EXTRA_FILE_NAME_KEY, id + ".jpg");
startActivity(intent);
} else if (uri.toString().matches(SUBREDDIT_PATTERN)) {
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_COMMUNITY_FULL_NAME_KEY, uri.getScheme() != null ? LemmyUtils.actorID2FullName(uri.toString()) : path.substring(3));
intent.putExtra(ViewSubredditDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else if (uri.toString().matches(USER_PATTERN)) {
Intent intent = new Intent(this, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_QUALIFIED_USER_NAME_KEY, uri.getScheme() != null ? LemmyUtils.actorID2FullName(uri.toString()) : path.substring(3));
intent.putExtra(ViewUserDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewUserDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else if (authority.equals("v.redd.it")) {
Intent intent = new Intent(this, ViewVideoActivity.class);
intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_V_REDD_IT);
@@ -219,18 +232,6 @@ public class LinkResolverActivity extends AppCompatActivity {
intent.putExtra(WikiActivity.EXTRA_SUBREDDIT_NAME, segments.get(1));
intent.putExtra(WikiActivity.EXTRA_WIKI_PATH, wikiPage);
startActivity(intent);
} else if (path.matches(SUBREDDIT_PATTERN)) {
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, path.substring(3));
intent.putExtra(ViewSubredditDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else if (path.matches(USER_PATTERN)) {
Intent intent = new Intent(this, ViewUserDetailActivity.class);
intent.putExtra(ViewUserDetailActivity.EXTRA_USER_NAME_KEY, segments.get(1));
intent.putExtra(ViewUserDetailActivity.EXTRA_MESSAGE_FULLNAME, messageFullname);
intent.putExtra(ViewUserDetailActivity.EXTRA_NEW_ACCOUNT_NAME, newAccountName);
startActivity(intent);
} else if (path.matches(SIDEBAR_PATTERN)) {
Intent intent = new Intent(this, ViewSubredditDetailActivity.class);
intent.putExtra(ViewSubredditDetailActivity.EXTRA_SUBREDDIT_NAME_KEY, path.substring(3, path.length() - 14));

View File

@@ -71,6 +71,7 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import eu.toldi.infinityforlemmy.ActivityToolbarInterface;
import eu.toldi.infinityforlemmy.FetchMyInfo;
import eu.toldi.infinityforlemmy.FetchSubscribedThing;
import eu.toldi.infinityforlemmy.Infinity;
import eu.toldi.infinityforlemmy.MarkPostAsReadInterface;
@@ -1022,7 +1023,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
private void loadSubscriptions() {
if (mAccessToken != null && !mFetchSubscriptionsSuccess) {
FetchSubscribedThing.fetchSubscribedThing(mRetrofit.getRetrofit(), mAccessToken, mAccountName, null,
FetchSubscribedThing.fetchSubscribedThing(mRetrofit.getRetrofit(), mAccessToken, mAccountQualifiedName, null,
new ArrayList<>(), new ArrayList<>(),
new ArrayList<>(),
new FetchSubscribedThing.FetchSubscribedThingListener() {
@@ -1034,7 +1035,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
mExecutor,
new Handler(),
mRedditDataRoomDatabase,
mAccountName,
mAccountQualifiedName,
subscribedSubredditData,
subscribedUserData,
subredditData,
@@ -1051,7 +1052,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
private void loadUserData() {
if (!mFetchUserInfoSuccess) {
FetchUserData.fetchUserData(mRedditDataRoomDatabase, mOauthRetrofit, mAccessToken,
FetchUserData.fetchUserData(mRedditDataRoomDatabase, mRetrofit.getRetrofit(), mAccessToken,
mAccountName, new FetchUserData.FetchUserDataListener() {
@Override
public void onFetchUserDataSuccess(UserData userData, int inboxCount) {
@@ -1068,19 +1069,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
mFetchUserInfoSuccess = false;
}
});
/*FetchMyInfo.fetchAccountInfo(mOauthRetrofit, mRedditDataRoomDatabase, mAccessToken,
new FetchMyInfo.FetchMyInfoListener() {
@Override
public void onFetchMyInfoSuccess(String name, String profileImageUrl, String bannerImageUrl, int karma) {
mAccountName = name;
mFetchUserInfoSuccess = true;
}
@Override
public void onFetchMyInfoFailed(boolean parseFailed) {
mFetchUserInfoSuccess = false;
}
});*/
}
}

View File

@@ -233,6 +233,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
private int fabOption;
private MaterialAlertDialogBuilder nsfwWarningBuilder;
private boolean hideSubredditDescription;
@Override
protected void onCreate(Bundle savedInstanceState) {
((Infinity) getApplication()).getAppComponent().inject(this);
@@ -336,7 +338,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
boolean hideSubredditDescription = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_DESCRIPTION, false);
hideSubredditDescription = mSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_DESCRIPTION, false);
subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME_KEY);
qualifiedName = getIntent().getStringExtra(EXTRA_COMMUNITY_FULL_NAME_KEY);
@@ -364,8 +366,97 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
checkNewAccountAndBindView();
fetchSubredditData();
if (subredditName != null) {
setupVisibleElements();
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (sectionsPagerAdapter != null) {
return sectionsPagerAdapter.handleKeyDown(keyCode) || super.onKeyDown(keyCode, event);
}
return super.onKeyDown(keyCode, event);
}
@Override
public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
@Override
protected CustomThemeWrapper getCustomThemeWrapper() {
return mCustomThemeWrapper;
}
@Override
protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2);
}
});
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false);
expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor();
expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator();
expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground();
collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor();
collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator();
collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground();
linearLayout.setBackgroundColor(expandedTabBackgroundColor);
subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit());
subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
nSubscribersTextView.setTextColor(primaryTextColor);
nOnlineSubscribersTextView.setTextColor(primaryTextColor);
sinceTextView.setTextColor(primaryTextColor);
creationTimeTextView.setTextColor(primaryTextColor);
descriptionTextView.setTextColor(primaryTextColor);
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
applyTabLayoutTheme(tabLayout);
applyFABTheme(navigationWrapper.floatingActionButton);
if (typeface != null) {
subredditNameTextView.setTypeface(typeface);
subscribeSubredditChip.setTypeface(typeface);
nSubscribersTextView.setTypeface(typeface);
nOnlineSubscribersTextView.setTypeface(typeface);
sinceTextView.setTypeface(typeface);
creationTimeTextView.setTypeface(typeface);
descriptionTextView.setTypeface(typeface);
}
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed();
}
private void checkNewAccountAndBindView() {
if (mNewAccountName != null) {
if (mAccountName == null || !mAccountName.equals(mNewAccountName)) {
SwitchAccount.switchAccount(mRedditDataRoomDatabase,mRetrofit, mCurrentAccountSharedPreferences,
mExecutor, new Handler(), mNewAccountName, newAccount -> {
EventBus.getDefault().post(new SwitchAccountEvent(getClass().getName()));
Toast.makeText(this, R.string.account_switched, Toast.LENGTH_SHORT).show();
mNewAccountName = null;
if (newAccount != null) {
mAccessToken = newAccount.getAccessToken();
mAccountName = newAccount.getAccountName();
}
bindView();
});
} else {
bindView();
}
} else {
bindView();
}
}
private void setupVisibleElements() {
subredditNameTextView.setText(subredditName);
communityFullNameTextView.setText(qualifiedName);
@@ -486,97 +577,17 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
});
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (sectionsPagerAdapter != null) {
return sectionsPagerAdapter.handleKeyDown(keyCode) || super.onKeyDown(keyCode, event);
}
return super.onKeyDown(keyCode, event);
}
@Override
public SharedPreferences getDefaultSharedPreferences() {
return mSharedPreferences;
}
@Override
protected CustomThemeWrapper getCustomThemeWrapper() {
return mCustomThemeWrapper;
}
@Override
protected void applyCustomTheme() {
coordinatorLayout.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor());
appBarLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
appBarLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
collapsingToolbarLayout.setScrimVisibleHeightTrigger(toolbar.getHeight() + tabLayout.getHeight() + getStatusBarHeight() * 2);
}
});
applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar, false);
expandedTabTextColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTextColor();
expandedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabIndicator();
expandedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithExpandedCollapsingToolbarTabBackground();
collapsedTabTextColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTextColor();
collapsedTabIndicatorColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabIndicator();
collapsedTabBackgroundColor = mCustomThemeWrapper.getTabLayoutWithCollapsedCollapsingToolbarTabBackground();
linearLayout.setBackgroundColor(expandedTabBackgroundColor);
subredditNameTextView.setTextColor(mCustomThemeWrapper.getSubreddit());
subscribeSubredditChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
nSubscribersTextView.setTextColor(primaryTextColor);
nOnlineSubscribersTextView.setTextColor(primaryTextColor);
sinceTextView.setTextColor(primaryTextColor);
creationTimeTextView.setTextColor(primaryTextColor);
descriptionTextView.setTextColor(primaryTextColor);
navigationWrapper.applyCustomTheme(mCustomThemeWrapper.getBottomAppBarIconColor(), mCustomThemeWrapper.getBottomAppBarBackgroundColor());
applyTabLayoutTheme(tabLayout);
applyFABTheme(navigationWrapper.floatingActionButton);
if (typeface != null) {
subredditNameTextView.setTypeface(typeface);
subscribeSubredditChip.setTypeface(typeface);
nSubscribersTextView.setTypeface(typeface);
nOnlineSubscribersTextView.setTypeface(typeface);
sinceTextView.setTypeface(typeface);
creationTimeTextView.setTypeface(typeface);
descriptionTextView.setTypeface(typeface);
}
unsubscribedColor = mCustomThemeWrapper.getUnsubscribed();
subscribedColor = mCustomThemeWrapper.getSubscribed();
}
private void checkNewAccountAndBindView() {
if (mNewAccountName != null) {
if (mAccountName == null || !mAccountName.equals(mNewAccountName)) {
SwitchAccount.switchAccount(mRedditDataRoomDatabase,mRetrofit, mCurrentAccountSharedPreferences,
mExecutor, new Handler(), mNewAccountName, newAccount -> {
EventBus.getDefault().post(new SwitchAccountEvent(getClass().getName()));
Toast.makeText(this, R.string.account_switched, Toast.LENGTH_SHORT).show();
mNewAccountName = null;
if (newAccount != null) {
mAccessToken = newAccount.getAccessToken();
mAccountName = newAccount.getAccountName();
}
bindView();
});
} else {
bindView();
}
} else {
bindView();
}
}
private void fetchSubredditData() {
if (!mFetchSubredditInfoSuccess) {
FetchSubredditData.fetchSubredditData(mOauthRetrofit, mRetrofit.getRetrofit(), qualifiedName, mAccessToken, new FetchSubredditData.FetchSubredditDataListener() {
@Override
public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) {
qualifiedName = LemmyUtils.actorID2FullName(subredditData.getActorId());
if (subredditName == null) {
subredditName = subredditData.getTitle();
setupVisibleElements();
}
mNCurrentOnlineSubscribers = nCurrentOnlineSubscribers;
nOnlineSubscribersTextView.setText(getString(R.string.online_subscribers_number_detail, nCurrentOnlineSubscribers));
InsertSubredditData.insertSubredditData(mExecutor, new Handler(), mRedditDataRoomDatabase,

View File

@@ -107,6 +107,7 @@ import eu.toldi.infinityforlemmy.user.UserData;
import eu.toldi.infinityforlemmy.user.UserFollowing;
import eu.toldi.infinityforlemmy.user.UserViewModel;
import eu.toldi.infinityforlemmy.utils.APIUtils;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
import eu.toldi.infinityforlemmy.utils.SharedPreferencesUtils;
import eu.toldi.infinityforlemmy.utils.Utils;
import io.noties.markwon.AbstractMarkwonPlugin;
@@ -230,6 +231,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
private String mMessageFullname;
private String mNewAccountName;
private UserData mUserData;
//private MaterialAlertDialogBuilder nsfwWarningBuilder;
@Override
@@ -271,9 +274,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
lockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false);
if (username.equalsIgnoreCase("me")) {
username = mAccountName;
}
if (savedInstanceState == null) {
mMessageFullname = getIntent().getStringExtra(EXTRA_MESSAGE_FULLNAME);
@@ -288,8 +288,13 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
fetchUserInfo();
Resources resources = getResources();
if (mUserData != null) {
setupVisibleElements();
}
}
private void setupVisibleElements() {
Resources resources = getResources();
String title = username;
userNameTextView.setText(title);
qualifiedNameTextView.setText(qualifiedName);
@@ -404,7 +409,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
return true;
});
userViewModel = new ViewModelProvider(this, new UserViewModel.Factory(getApplication(), mRedditDataRoomDatabase, username))
userViewModel = new ViewModelProvider(this, new UserViewModel.Factory(getApplication(), mRedditDataRoomDatabase, LemmyUtils.qualifiedUserName2ActorId(qualifiedName)))
.get(UserViewModel.class);
userViewModel.getUserLiveData().observe(this, userData -> {
if (userData != null) {
@@ -1071,6 +1076,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
FetchUserData.fetchUserData(mRetrofit.getRetrofit(), qualifiedName, new FetchUserData.FetchUserDataListener() {
@Override
public void onFetchUserDataSuccess(UserData userData, int inboxCount) {
mUserData = userData;
username = userData.getName();
setupVisibleElements();
new ViewUserDetailActivity.InsertUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), userData,
() -> mFetchUserInfoSuccess = true).execute();
}

View File

@@ -34,6 +34,7 @@ public interface LemmyAPI {
@Query("sort") String sort,
@Query("page") Integer page,
@Query("limit") Integer limit,
@Query("saved_only") Boolean saved_only,
@Query("auth") String access_token);
@GET("api/v3/community/list")

View File

@@ -252,7 +252,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<Integer, Post
private ListenableFuture<LoadResult<Integer, Post>> loadUserPosts(@NonNull LoadParams<Integer> loadParams, LemmyAPI api) {
ListenableFuture<Response<String>> userPosts;
userPosts = api.getUserPosts(subredditOrUserName, sortType.getType().value,loadParams.getKey(),25,accessToken);
userPosts = api.getUserPosts(subredditOrUserName, sortType.getType().value, loadParams.getKey(), 25, userWhere.equals(USER_WHERE_SAVED), accessToken);
ListenableFuture<LoadResult<Integer, Post>> pageFuture = Futures.transform(userPosts, this::transformData, executor);

View File

@@ -20,6 +20,9 @@ public interface UserDao {
@Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
LiveData<UserData> getUserLiveData(String userName);
@Query("SELECT * FROM users WHERE actor_id = :actor_id COLLATE NOCASE LIMIT 1")
LiveData<UserData> getUserLiveDataByQualifiedName(String actor_id);
@Query("SELECT * FROM users WHERE name = :userName COLLATE NOCASE LIMIT 1")
UserData getUserData(String userName);
}

View File

@@ -10,9 +10,9 @@ public class UserRepository {
private UserDao mUserDao;
private LiveData<UserData> mUserLiveData;
UserRepository(RedditDataRoomDatabase redditDataRoomDatabase, String userName) {
UserRepository(RedditDataRoomDatabase redditDataRoomDatabase, String actor_id) {
mUserDao = redditDataRoomDatabase.userDao();
mUserLiveData = mUserDao.getUserLiveData(userName);
mUserLiveData = mUserDao.getUserLiveData(actor_id);
}
LiveData<UserData> getUserLiveData() {

BIN
signed.apk.idsig Normal file

Binary file not shown.