Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 2adf41fe authored by alperozturk's avatar alperozturk
Browse files

check shareType

parent 4898e099
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap

    private boolean containsNoNewPublicShare(List<OCShare> shares) {
        for (OCShare share : shares) {
            if (share.getShareType() == ShareType.NEW_PUBLIC_LINK) {
            if (share.getShareType() != null && share.getShareType() == ShareType.NEW_PUBLIC_LINK) {
                return false;
            }
        }
@@ -550,7 +550,7 @@ public class NoteShareActivity extends BrandedActivity implements ShareeListAdap
    }

    private boolean isReshareForbidden(OCShare share) {
        return ShareType.FEDERATED == share.getShareType() ||
        return (share.getShareType() != null && ShareType.FEDERATED == share.getShareType()) ||
                capabilities != null && !capabilities.isReSharingAllowed();
    }

+6 −4
Original line number Diff line number Diff line
@@ -150,12 +150,14 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
        List<OCShare> users = new ArrayList<>();

        for (OCShare share : shares) {
            if (share.getShareType()  != null) {
                if (ShareType.PUBLIC_LINK == share.getShareType() || ShareType.EMAIL == share.getShareType()) {
                    links.add(share);
                } else if (share.getShareType() != ShareType.INTERNAL) {
                    users.add(share);
                }
            }
        }

        links.sort((o1, o2) -> Long.compare(o2.getSharedDate(), o1.getSharedDate()));
        users.sort((o1, o2) -> Long.compare(o2.getSharedDate(), o1.getSharedDate()));
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public class LinkShareViewHolder extends BrandedViewHolder {
    }

    public void bind(OCShare publicShare, ShareeListAdapterListener listener) {
        if (ShareType.EMAIL == publicShare.getShareType()) {
        if (publicShare.getShareType() != null && ShareType.EMAIL == publicShare.getShareType()) {
            binding.name.setText(publicShare.getSharedWithDisplayName());
            binding.icon.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(),
                    R.drawable.ic_email,
+11 −2
Original line number Diff line number Diff line
@@ -42,8 +42,12 @@ public class ShareViewHolder extends RecyclerView.ViewHolder {
        String accountName = account.getDisplayName();
        String name = share.getSharedWithDisplayName();
        binding.icon.setTag(null);
        final var shareType = share.getShareType();
        if (shareType == null) {
            return;
        }

        switch (share.getShareType()) {
        switch (shareType) {
            case GROUP:
                name = context.getString(R.string.share_group_clarification, name);
                // viewThemeUtils.files.createAvatar(share.getShareType(), binding.icon, context);
@@ -74,6 +78,11 @@ public class ShareViewHolder extends RecyclerView.ViewHolder {

        binding.name.setText(name);

        if (accountName == null) {
            binding.overflowMenu.setVisibility(View.GONE);
            return;
        }

        if (accountName.equalsIgnoreCase(share.getShareWith()) || accountName.equalsIgnoreCase(share.getUserId())) {
            binding.overflowMenu.setVisibility(View.VISIBLE);

@@ -99,7 +108,7 @@ public class ShareViewHolder extends RecyclerView.ViewHolder {

    private void setImage(ImageView avatar, String name, @DrawableRes int fallback) {
        try {
            // avatar.setImageDrawable(TextDrawable.createNamedAvatar(name, avatarRadiusDimension));
            AvatarLoader.INSTANCE.load(context, avatar, account);
        } catch (StringIndexOutOfBoundsException e) {
            avatar.setImageResource(fallback);
        }
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ public class NoteShareActivityShareItemActionBottomSheetDialog extends BrandedBo
    }

    private void updateUI() {
        if (ocShare.getShareType() == ShareType.PUBLIC_LINK) {
        if (ocShare.getShareType() != null && ocShare.getShareType() == ShareType.PUBLIC_LINK) {
            binding.menuShareAddAnotherLink.setVisibility(View.VISIBLE);
            binding.menuShareSendLink.setVisibility(View.VISIBLE);
        } else {
Loading