mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-12 09:18:42 +01:00
Compare commits
No commits in common. "2ea47cf7fd01fbd4e1707c6cf4281d3dbe728ac5" and "02bed2eb3bdd916e9519d7a8137a006c1b128d6e" have entirely different histories.
2ea47cf7fd
...
02bed2eb3b
BIN
.assets/IzzyOnDroid.png
Normal file
BIN
.assets/IzzyOnDroid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
@ -27,6 +27,9 @@ A Lemmy client for Android written in Java. It's a fork of the [Infinity for Red
|
||||
<img src="./.assets/google-play-badge.png" height="80">
|
||||
</a>
|
||||
|
||||
<a href="https://apt.izzysoft.de/fdroid/index/apk/eu.toldi.infinityforlemmy">
|
||||
<img src="./.assets/IzzyOnDroid.png" height="80">
|
||||
</a>
|
||||
<a href="https://codeberg.org/Bazsalanszky/Eternity/releases/">
|
||||
<img src="./.assets/codeberg.png" height="80">
|
||||
</a>
|
||||
|
@ -323,7 +323,7 @@
|
||||
<data android:host="feddit.de" />
|
||||
<data android:host="lemmy.fmhy.ml" />
|
||||
<data android:host="lemmy.ca" />
|
||||
<data android:host="hexbear.net" />
|
||||
<data android:host="www.hexbear.net" />
|
||||
<data android:host="programming.dev" />
|
||||
<data android:host="lemmy.dbzer0.com" />
|
||||
<data android:host="lemmy.blahaj.zone" />
|
||||
|
@ -48,10 +48,7 @@ public class SortType {
|
||||
TOP_SIX_MONTHS("TopSixMonths", "Top"),
|
||||
TOP_NINE_MONTHS("TopNineMonths", "Top"),
|
||||
TOP_YEAR("TopYear", "Top"),
|
||||
TOP_ALL("TopAll", "Top"),
|
||||
|
||||
SCALED("Scaled", "Scaled"),
|
||||
CONTROVERSIAL("Controversial", "Controversial");
|
||||
TOP_ALL("TopAll", "Top");
|
||||
|
||||
public final String value;
|
||||
public final String fullName;
|
||||
|
@ -67,9 +67,6 @@ public class LoginActivity extends BaseActivity {
|
||||
private static final String ENABLE_DOM_STATE = "EDS";
|
||||
private static final String IS_AGREE_TO_USER_AGGREMENT_STATE = "IATUAS";
|
||||
|
||||
public static final String EXTRA_INPUT_USERNAME = "INPUT_USERNAME";
|
||||
public static final String EXTRA_INPUT_INSTANCE = "INPUT_INSTANCE";
|
||||
|
||||
@BindView(R.id.coordinator_layout_login_activity)
|
||||
CoordinatorLayout coordinatorLayout;
|
||||
@BindView(R.id.appbar_layout_login_activity)
|
||||
@ -152,17 +149,6 @@ public class LoginActivity extends BaseActivity {
|
||||
isAgreeToUserAgreement = savedInstanceState.getBoolean(IS_AGREE_TO_USER_AGGREMENT_STATE);
|
||||
}
|
||||
|
||||
// Get username and instance from intent
|
||||
Intent intent = getIntent();
|
||||
String username_intent = intent.getStringExtra(EXTRA_INPUT_USERNAME);
|
||||
String instance_intent = intent.getStringExtra(EXTRA_INPUT_INSTANCE);
|
||||
if (username_intent != null) {
|
||||
username_input.setText(username_intent);
|
||||
}
|
||||
if (instance_intent != null) {
|
||||
instance_input.setText(instance_intent);
|
||||
}
|
||||
|
||||
LemmyVerseFetchInstances.INSTANCE.fetchInstances(mLemmyVerseRetrofit, new FetchInstancesListener() {
|
||||
|
||||
@Override
|
||||
|
@ -248,8 +248,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
private int fabOption;
|
||||
private int inboxCount;
|
||||
|
||||
private boolean mBearerTokenUsed = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SplashScreen.installSplashScreen(this);
|
||||
@ -342,7 +340,7 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
|
||||
mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null);
|
||||
mRetrofit.setAccessToken(mAccessToken);
|
||||
mBearerTokenUsed = mCurrentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.BEARER_TOKEN_AUTH, true);
|
||||
|
||||
|
||||
mAccountName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_NAME, null);
|
||||
mAccountQualifiedName = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCOUNT_QUALIFIED_NAME, null);
|
||||
@ -376,8 +374,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
mRetrofit.setBaseURL(instancePreference);
|
||||
this.recreate();
|
||||
}
|
||||
} else {
|
||||
checkUserToken();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1085,34 +1081,6 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
|
||||
}
|
||||
}
|
||||
|
||||
private void checkUserToken() {
|
||||
if (mBearerTokenUsed) {
|
||||
FetchUserData.validateAuthToken(mRetrofit.getRetrofit(), new FetchUserData.ValidateAuthTokenListener() {
|
||||
@Override
|
||||
public void onValidateAuthTokenSuccess() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValidateAuthTokenFailed() {
|
||||
// Alert user that the token is invalid and they need to re-login
|
||||
new MaterialAlertDialogBuilder(MainActivity.this, R.style.MaterialAlertDialogTheme)
|
||||
.setTitle(R.string.token_expired)
|
||||
.setMessage(R.string.token_expired_message)
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
|
||||
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
|
||||
// Username without instance
|
||||
String username = mAccountName.substring(0, mAccountQualifiedName.indexOf("@"));
|
||||
intent.putExtra(LoginActivity.EXTRA_INPUT_USERNAME, username);
|
||||
intent.putExtra(LoginActivity.EXTRA_INPUT_INSTANCE, mRetrofit.getBaseURL());
|
||||
startActivity(intent);
|
||||
})
|
||||
.setCancelable(false)
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void loadUserData() {
|
||||
if (!mFetchUserInfoSuccess) {
|
||||
FetchUserData.fetchUnreadCount(mRetrofit.getRetrofit(), mAccessToken, new FetchUserData.FetchUserUnreadCountListener() {
|
||||
|
@ -346,7 +346,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
||||
mHideUpvoteRatio = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_UPVOTE_RATIO, false);
|
||||
mHideTheNumberOfAwards = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_AWARDS, false);
|
||||
mHideSubredditAndUserPrefix = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_SUBREDDIT_AND_USER_PREFIX, false);
|
||||
mShareOnLocalInstance = sharedPreferences.getBoolean(SharedPreferencesUtils.SHARE_LINK_ON_LOCAL_INSTANCE, false);
|
||||
mShareOnLocalInstance = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.SHARE_LINK_ON_LOCAL_INSTANCE, false);
|
||||
mShowDisplayNames = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.POST_DETAIL_DISPLAY_NAME_INSTEAD_OF_USERNAME, true);
|
||||
mHideTheNumberOfVotes = postDetailsSharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_THE_NUMBER_OF_VOTES, false);
|
||||
mHideDownvotes = !currentAccountSharedPreferences.getBoolean(SharedPreferencesUtils.CAN_DOWNVOTE, true);
|
||||
|
@ -66,9 +66,6 @@ public interface LemmyAPI {
|
||||
@GET("api/v3/user/unread_count")
|
||||
Call<MessageCount> userUnreadCount(@NonNull @Query("auth") String access_token);
|
||||
|
||||
@GET("api/v3/user/validate_auth")
|
||||
Call<String> userValidateAuth();
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("api/v3/user/mention/mark_as_read")
|
||||
Call<String> userMentionMarkAsRead(@Body ReadMessageDTO params);
|
||||
|
@ -43,12 +43,6 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
||||
@BindView(R.id.top_type_text_view_sort_type_bottom_sheet_fragment)
|
||||
TextView topTypeTextView;
|
||||
|
||||
@BindView(R.id.scaled_type_text_view_sort_type_bottom_sheet_fragment)
|
||||
TextView scaledTypeTextView;
|
||||
|
||||
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment)
|
||||
TextView controversialTypeTextView;
|
||||
|
||||
private BaseActivity activity;
|
||||
|
||||
public SortTypeBottomSheetFragment() {
|
||||
@ -95,10 +89,6 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
||||
oldTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(oldTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
|
||||
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.SCALED.fullName)) {
|
||||
scaledTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(scaledTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
} else if (currentSortType.equals(SortType.Type.CONTROVERSIAL.fullName)) {
|
||||
controversialTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(controversialTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
|
||||
}
|
||||
|
||||
hotTypeTextView.setOnClickListener(view -> {
|
||||
@ -121,16 +111,6 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
||||
dismiss();
|
||||
});
|
||||
|
||||
scaledTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.SCALED));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
controversialTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.CONTROVERSIAL));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
|
||||
if (activity.typeface != null) {
|
||||
Utils.setFontToAllTextViews(rootView, activity.typeface);
|
||||
|
@ -107,33 +107,6 @@ public class FetchUserData {
|
||||
});
|
||||
}
|
||||
|
||||
public static void validateAuthToken(Retrofit retrofit, ValidateAuthTokenListener validateAuthTokenListener) {
|
||||
LemmyAPI api = retrofit.create(LemmyAPI.class);
|
||||
|
||||
Call<String> validateAuthToken = api.userValidateAuth();
|
||||
validateAuthToken.enqueue(new Callback<>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
|
||||
if (response.isSuccessful()) {
|
||||
validateAuthTokenListener.onValidateAuthTokenSuccess();
|
||||
} else {
|
||||
validateAuthTokenListener.onValidateAuthTokenFailed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
|
||||
validateAuthTokenListener.onValidateAuthTokenFailed();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface ValidateAuthTokenListener {
|
||||
void onValidateAuthTokenSuccess();
|
||||
|
||||
void onValidateAuthTokenFailed();
|
||||
}
|
||||
|
||||
public interface FetchUserUnreadCountListener {
|
||||
void onFetchUserUnreadCountSuccess(int unreadCount);
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
<vector android:height="24dp"
|
||||
android:tint="#000000"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
android:width="24dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M14,11V8c4.56,-0.58 8,-3.1 8,-6H2c0,2.9 3.44,5.42 8,6l0,3c-3.68,0.73 -8,3.61 -8,11h6v-2H4.13c0.93,-6.83 6.65,-7.2 7.87,-7.2s6.94,0.37 7.87,7.2H16v2h6C22,14.61 17.68,11.73 14,11zM12,22c-1.1,0 -2,-0.9 -2,-2c0,-0.55 0.22,-1.05 0.59,-1.41C11.39,17.79 16,16 16,16s-1.79,4.61 -2.59,5.41C13.05,21.78 12.55,22 12,22z" />
|
||||
</vector>
|
@ -87,44 +87,6 @@
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/scaled_type_text_view_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableStart="@drawable/baseline_scale_24"
|
||||
android:drawablePadding="48dp"
|
||||
android:focusable="true"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/sort_scaled"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/controversial_type_text_view_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:drawableStart="@drawable/ic_controversial_24"
|
||||
android:drawablePadding="48dp"
|
||||
android:focusable="true"
|
||||
android:fontFamily="?attr/font_family"
|
||||
android:paddingStart="32dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/sort_controversial"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/top_type_text_view_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -1318,7 +1318,4 @@
|
||||
<string name="original_app">The original Reddit app</string>
|
||||
<string name="settings_credits_original_app_description">"Infinity was created by u/Hostilenemy "</string>
|
||||
<string name="the_url_of_you_prefered_lemmy_instance_with_or_without_the_https_prefix">The URL of you prefered Lemmy instance with or without the https:// prefix</string>
|
||||
<string name="sort_scaled">Scaled</string>
|
||||
<string name="token_expired">Token Expired</string>
|
||||
<string name="token_expired_message">"Your token has been expired. As Eternity does not store your password, you need to manually log back in! "</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user