Commit 2593d08d authored by Thomas's avatar Thomas
Browse files

Fix issue #472 - Allow to browse Mastodon instances before registering

parent 5b164d60
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -55,7 +55,10 @@ public interface MastodonTimelinesService {


    @GET("trends/statuses")
    Call<List<Status>> getStatusTrends(@Header("Authorization") String token);
    Call<List<Status>> getStatusTrends(
            @Header("Authorization") String token,
            @Query("offset") String offset,
            @Query("limit") Integer limit);


    @GET("trends/tags")
+3 −1
Original line number Diff line number Diff line
@@ -379,7 +379,7 @@ public class Timeline {
        @SerializedName("TREND_MESSAGE")
        TREND_MESSAGE("TREND_MESSAGE"),
        @SerializedName("PUBLIC_TREND_MESSAGE")
        PUBLIC_TREND_MESSAGE("PUBLIC_TREND_MESSAGE"),
        TREND_MESSAGE_PUBLIC("TREND_MESSAGE_PUBLIC"),
        @SerializedName("STATUS_HISTORY")
        STATUS_HISTORY("STATUS_HISTORY"),
        @SerializedName("ACCOUNT_TIMELINE")
@@ -394,6 +394,8 @@ public class Timeline {
        FAVOURITE_TIMELINE("FAVOURITE_TIMELINE"),
        @SerializedName("REBLOG_TIMELINE")
        REBLOG_TIMELINE("REBLOG_TIMELINE"),
        @SerializedName("STATUS_REPORT")
        STATUS_REPORT("STATUS_REPORT"),
        @SerializedName("SCHEDULED_TOOT_SERVER")
        SCHEDULED_TOOT_SERVER("SCHEDULED_TOOT_SERVER"),
        @SerializedName("SCHEDULED_TOOT_CLIENT")
+20 −0
Original line number Diff line number Diff line
@@ -147,6 +147,26 @@ public class MastodonHelper {
        return pagination;
    }


    /**
     * Retrieve pagination from header
     *
     * @param headers Headers
     * @return Pagination
     */
    public static Pagination getOffSetPagination(Headers headers) {
        String link = headers.get("Link");
        Pagination pagination = new Pagination();
        if (link != null) {
            Pattern patternMaxId = Pattern.compile("offset=([0-9a-zA-Z]+)\\s?>\\s?;\\s?rel=\"next\"");
            Matcher matcherMaxId = patternMaxId.matcher(link);
            if (matcherMaxId.find()) {
                pagination.max_id = matcherMaxId.group(1);
            }
        }
        return pagination;
    }

    /*public static Pagination getPaginationNotification(List<Notification> notificationList) {
        Pagination pagination = new Pagination();
        if (notificationList == null || notificationList.size() == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -641,7 +641,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
        } else {
            holder.binding.card.setVisibility(View.GONE);
        }
        if (!canBeFederated) {
        if (!canBeFederated && timelineType != Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC) {
            holder.binding.actionShareContainer.setVisibility(View.VISIBLE);
            holder.binding.actionShare.setOnClickListener(v -> {
                Intent sendIntent = new Intent(Intent.ACTION_SEND);
+1 −2
Original line number Diff line number Diff line
@@ -140,9 +140,8 @@ public class FragmentLoginPickInstanceMastodon extends Fragment implements Insta
        if (joinMastodonInstanceList != null) {
            JoinMastodonInstance clickedInstance = joinMastodonInstanceList.get(position);
            Bundle args = new Bundle();
            args.putBoolean(Helper.ARG_MINIFIED, true);
            args.putSerializable(Helper.ARG_REMOTE_INSTANCE_STRING, clickedInstance.domain);
            args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TREND_MESSAGE);
            args.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC);

            Helper.addFragment(
                    getParentFragmentManager(), android.R.id.content, new FragmentMastodonTimeline(),
Loading