Skip to content

Conversation

@tobiasKaminsky
Copy link
Member

@tobiasKaminsky tobiasKaminsky commented Dec 5, 2018

Shows shared users on file list.

Needs feedback from nextcloud/server#12874

@nextcloud nextcloud deleted a comment Dec 7, 2018
@nextcloud nextcloud deleted a comment Dec 7, 2018
@nextcloud nextcloud deleted a comment Dec 7, 2018
@nextcloud nextcloud deleted a comment Dec 7, 2018
private String ownerId;
@Getter
@Setter
private String ownerDisplayName;
Copy link
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
Member Author

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
Member Author

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
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
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
Member Author

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
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
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
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
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
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
Copy link
Member

AndyScherzinger commented Dec 7, 2018

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

@codecov
Copy link

codecov bot commented Feb 26, 2019

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 Files Coverage Δ Complexity Δ
...ain/java/com/owncloud/android/db/ProviderMeta.java 88% <ø> (ø) 0 <0> (ø) ⬇️
...a/com/owncloud/android/utils/FileStorageUtils.java 12.4% <0%> (+4.28%) 0 <0> (ø) ⬇️
...owncloud/android/ui/adapter/OCFileListAdapter.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...loud/android/datamodel/ThumbnailsCacheManager.java 15.44% <0%> (+0.36%) 0 <0> (ø) ⬇️
...wncloud/android/providers/FileContentProvider.java 15.44% <0%> (+0.16%) 0 <0> (ø) ⬇️
...android/ui/fragment/FileDetailSharingFragment.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...ncloud/android/ui/fragment/OCFileListFragment.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...in/java/com/owncloud/android/datamodel/OCFile.java 59.19% <100%> (+0.2%) 0 <0> (ø) ⬇️
...loud/android/datamodel/FileDataStorageManager.java 10.61% <50%> (+0.08%) 0 <0> (ø) ⬇️
.../third_parties/daveKoeller/AlphanumComparator.java 82.14% <0%> (-1.2%) 0% <0%> (ø)
... and 180 more

@codecov
Copy link

codecov bot commented Feb 26, 2019

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 Files Coverage Δ Complexity Δ
...ain/java/com/owncloud/android/db/ProviderMeta.java 88% <ø> (ø) 0 <0> (ø) ⬇️
...a/com/owncloud/android/utils/FileStorageUtils.java 8.04% <0%> (-0.09%) 0 <0> (ø)
.../owncloud/android/authentication/AccountUtils.java 23.77% <0%> (-0.2%) 0 <0> (ø)
...owncloud/android/ui/adapter/OCFileListAdapter.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...wncloud/android/providers/FileContentProvider.java 15.3% <0%> (-0.21%) 0 <0> (ø)
...android/ui/fragment/FileDetailSharingFragment.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...loud/android/datamodel/ThumbnailsCacheManager.java 15.05% <0%> (-0.03%) 0 <0> (ø)
...in/java/com/owncloud/android/datamodel/OCFile.java 59.17% <100%> (+0.18%) 0 <0> (ø) ⬇️
...loud/android/datamodel/FileDataStorageManager.java 10.78% <50%> (+0.25%) 0 <0> (ø) ⬇️
.../third_parties/daveKoeller/AlphanumComparator.java 82.14% <0%> (-1.2%) 0% <0%> (ø)

@tobiasKaminsky
Copy link
Member Author

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
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

@nextcloud nextcloud deleted a comment Feb 27, 2019
@nextcloud nextcloud deleted a comment Feb 27, 2019
@nextcloud-android-bot
Copy link
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
Member Author

@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
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 self-requested a review February 27, 2019 09:56
@tobiasKaminsky
Copy link
Member Author

I tested it, is the idea here to just show avatars from the user who shared it with me?
2019-02-27-110501 2019-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 <[email protected]>
@AndyScherzinger
Copy link
Member

both cases work just fine 👍

@nextcloud-android-bot
Copy link
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 master Feb 27, 2019
@AndyScherzinger AndyScherzinger deleted the showSharedUser branch February 27, 2019 10:59
@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.6.0 milestone Feb 27, 2019
@nextcloud nextcloud deleted a comment Feb 27, 2019
@nextcloud nextcloud deleted a comment Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants