Skip to content

Show shared user - #3320

Merged
AndyScherzinger merged 1 commit into
masterfrom
showSharedUser
Feb 27, 2019
Merged

Show shared user#3320
AndyScherzinger merged 1 commit into
masterfrom
showSharedUser

Conversation

@tobiasKaminsky

@tobiasKaminskytobiasKaminsky commented Dec 5, 2018

Copy link
Copy Markdown
Member

Shows shared users on file list.

Needs feedback from nextcloud/server#12874

@nextcloudnextcloud deleted a comment Dec 7, 2018
@nextcloudnextcloud deleted a comment Dec 7, 2018
@nextcloudnextcloud deleted a comment Dec 7, 2018
@nextcloudnextcloud deleted a comment Dec 7, 2018
private String ownerId;
@Getter
@Setter
private String ownerDisplayName;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be formatted as single lines

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damn Android Studio is always changing this.
I had to do this on a different branch without AndroidStudio… :/

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #3325 for this

try {
return TextDrawable.createAvatar(mAccount.name, mAvatarRadius);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be a proper log statement

if (holder instanceof OCFileListItemViewHolder) {
OCFileListItemViewHolder itemViewHolder = (OCFileListItemViewHolder) holder;

if (!TextUtils.isEmpty(file.getOwnerId()) && !mAccount.name.split("@")[0].equals(file.getOwnerId())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably move the split method based on the "@" into a utils class (not sure if we already have one for account/name things since I believe we do splitting based on the @ sign already in some other places so we should centralize that part.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
sharedIconView.setOnClickListener(view -> ocFileListFragmentInterface.onShareIconClick(file));

if (!TextUtils.isEmpty(file.getOwnerId()) && !mAccount.name.split("@")[0].equals(file.getOwnerId())) { // TODO refactor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment abpve regarding handdling of @


@Override
public boolean shouldCallGeneratedCallback(String tag, Object callContext) {
// return ((ImageView) callContext).getTag().equals(tag);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out code in case we alsways return false

fileSize = itemView.findViewById(R.id.file_size);
lastModification = itemView.findViewById(R.id.last_mod);
overflowMenu = itemView.findViewById(R.id.overflow_menu);
sharedAvatar = itemView.findViewById(R.id.sharedAvatar);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should replace this with butterknife :)

}

private void setShareWithYou() {
if (!TextUtils.isEmpty(file.getOwnerId()) && !account.name.split("@")[0].equals(file.getOwnerId())) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment about creation of a split @ method


private static final String ARG_FILE = "FILE";
private static final String ARG_ACCOUNT = "ACCOUNT";
private static final String TAG = FileDetailSharingFragment.class.getSimpleName();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TAG isn't used atm

@AndyScherzinger

AndyScherzinger commented Dec 7, 2018

Copy link
Copy Markdown
Member

did an initial review of the code, just some minor things / cosmetics :)

@codecov

codecovBot commented Feb 26, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3320 into master will increase coverage by 0.17%.
The diff coverage is 12.5%.

@@ Coverage Diff @@## master #3320 +/- ##
===========================================
+ Coverage 6% 6.18% +0.17% 
Complexity 1 1 ===========================================
Files 318 317 -1 Lines 31024 30575 -449 Branches 4447 4394 -53 ===========================================
+ Hits 1863 1890 +27 + Misses 28884 28400 -484 - Partials 277 285 +8
Impacted FilesCoverage ΔComplexity Δ
...ain/java/com/owncloud/android/db/ProviderMeta.java88% <ø> (ø)0 <0> (ø)⬇️
...a/com/owncloud/android/utils/FileStorageUtils.java12.4% <0%> (+4.28%)0 <0> (ø)⬇️
...owncloud/android/ui/adapter/OCFileListAdapter.java0% <0%> (ø)0 <0> (ø)⬇️
...loud/android/datamodel/ThumbnailsCacheManager.java15.44% <0%> (+0.36%)0 <0> (ø)⬇️
...wncloud/android/providers/FileContentProvider.java15.44% <0%> (+0.16%)0 <0> (ø)⬇️
...android/ui/fragment/FileDetailSharingFragment.java0% <0%> (ø)0 <0> (ø)⬇️
...ncloud/android/ui/fragment/OCFileListFragment.java0% <0%> (ø)0 <0> (ø)⬇️
...in/java/com/owncloud/android/datamodel/OCFile.java59.19% <100%> (+0.2%)0 <0> (ø)⬇️
...loud/android/datamodel/FileDataStorageManager.java10.61% <50%> (+0.08%)0 <0> (ø)⬇️
.../third_parties/daveKoeller/AlphanumComparator.java82.14% <0%> (-1.2%)0% <0%> (ø)
... and 180 more

@codecov

codecovBot commented Feb 26, 2019

Copy link
Copy Markdown

Codecov Report

Merging #3320 into master will decrease coverage by <.01%.
The diff coverage is 7.86%.

@@ Coverage Diff @@## master #3320 +/- ##
===========================================
- Coverage 6% 6% -0.01% 
Complexity 1 1 ===========================================
Files 318 318 Lines 31008 31077 +69 Branches 4448 4455 +7 ===========================================
+ Hits 1862 1866 +4 - Misses 28869 28934 +65 
Partials 277 277
Impacted FilesCoverage ΔComplexity Δ
...ain/java/com/owncloud/android/db/ProviderMeta.java88% <ø> (ø)0 <0> (ø)⬇️
...a/com/owncloud/android/utils/FileStorageUtils.java8.04% <0%> (-0.09%)0 <0> (ø)
.../owncloud/android/authentication/AccountUtils.java23.77% <0%> (-0.2%)0 <0> (ø)
...owncloud/android/ui/adapter/OCFileListAdapter.java0% <0%> (ø)0 <0> (ø)⬇️
...wncloud/android/providers/FileContentProvider.java15.3% <0%> (-0.21%)0 <0> (ø)
...android/ui/fragment/FileDetailSharingFragment.java0% <0%> (ø)0 <0> (ø)⬇️
...loud/android/datamodel/ThumbnailsCacheManager.java15.05% <0%> (-0.03%)0 <0> (ø)
...in/java/com/owncloud/android/datamodel/OCFile.java59.17% <100%> (+0.18%)0 <0> (ø)⬇️
...loud/android/datamodel/FileDataStorageManager.java10.78% <50%> (+0.25%)0 <0> (ø)⬇️
.../third_parties/daveKoeller/AlphanumComparator.java82.14% <0%> (-1.2%)0% <0%> (ø)

@tobiasKaminsky

Copy link
Copy Markdown
MemberAuthor

2 findbugs increased:

  • onBindView is longer/complexer and therefore generates a warning
  • AccountUtils.accountOwnsFile:
    STT_STRING_PARSING_A_FIELD: This method parses a String that is a field This method calls a parsing method (indexOf, lastIndexOf, startsWith, endsWith, substring, indexOf) on a String that is a field, or comes from a collection that is a field. This implies that the String in question is holding multiple parts of information inside the string, which would be more maintainable and type safe if that value was a true collection or a first class object with fields, rather than a String.
    This is referring to account.name, which we split to get the userId.
    We could use:
AccountManager accountManager = AccountManager.get(context);
String userId = accountManager.getUserData(account,
com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);

But this is not that lightweight like a string operation.

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

Lint

TypemasterPR
Warnings6868
Errors00

FindBugs (new)

Warning TypeNumber
Bad practice Warnings33
Correctness Warnings120
Internationalization Warnings15
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings119
Security Warnings56
Dodgy code Warnings126
Total483

FindBugs (master)

Warning TypeNumber
Bad practice Warnings33
Correctness Warnings120
Internationalization Warnings15
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings119
Security Warnings56
Dodgy code Warnings124
Total481

@nextcloudnextcloud deleted a comment Feb 27, 2019
@nextcloudnextcloud deleted a comment Feb 27, 2019
@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

Lint

TypemasterPR
Warnings6868
Errors00

FindBugs (new)

Warning TypeNumber
Bad practice Warnings33
Correctness Warnings120
Internationalization Warnings15
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings119
Security Warnings56
Dodgy code Warnings126
Total483

FindBugs (master)

Warning TypeNumber
Bad practice Warnings33
Correctness Warnings120
Internationalization Warnings15
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings119
Security Warnings56
Dodgy code Warnings124
Total481

@tobiasKaminsky

Copy link
Copy Markdown
MemberAuthor

@AndyScherzinger ready for review.
Although you did this some time ago, please have a look again, as there were quite some changes.

@AndyScherzinger

Copy link
Copy Markdown
Member

Although you did this some time ago, please have a look again, as there were quite some changes.

I tested it, is the idea here to just show avatars from the user who shared it with me?

AndyScherzinger
AndyScherzinger previously approved these changes Feb 27, 2019
@tobiasKaminsky

Copy link
Copy Markdown
MemberAuthor

I tested it, is the idea here to just show avatars from the user who shared it with me?
2019-02-27-1105012019-02-27-110505

  • show avatar in list, hide share button as this behaves the same way
  • show avatar and info in sharing view

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@AndyScherzinger

Copy link
Copy Markdown
Member

both cases work just fine 👍

@nextcloud-android-bot

Copy link
Copy Markdown
Collaborator

Lint

TypemasterPR
Warnings6868
Errors00

FindBugs (new)

Warning TypeNumber
Bad practice Warnings33
Correctness Warnings120
Internationalization Warnings15
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings119
Security Warnings56
Dodgy code Warnings126
Total483

FindBugs (master)

Warning TypeNumber
Bad practice Warnings33
Correctness Warnings120
Internationalization Warnings15
Malicious code vulnerability Warnings5
Multithreaded correctness Warnings9
Performance Warnings119
Security Warnings56
Dodgy code Warnings124
Total481

@AndyScherzinger
AndyScherzinger merged commit 5b0a352 into masterFeb 27, 2019
@AndyScherzinger
AndyScherzinger deleted the showSharedUser branch February 27, 2019 10:59
@nextcloudnextcloud deleted a comment Feb 27, 2019
@nextcloudnextcloud deleted a comment Feb 27, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tobiasKaminsky@AndyScherzinger@nextcloud-android-bot