sdk 0.37.2 update for release #547

Merged
akinwale merged 48 commits from sdk-0.37-rc into master 2019-05-27 11:30:34 +02:00
akinwale commented 2019-05-17 10:35:48 +02:00 (Migrated from github.com)
No description provided.
neb-b (Migrated from github.com) reviewed 2019-05-17 10:35:48 +02:00
kauffj (Migrated from github.com) requested changes 2019-05-23 22:30:19 +02:00
kauffj (Migrated from github.com) left a comment

Looks good but could use a few small changes. Also some questions to continue to help me get up to speed on mobile.

Looks good but could use a few small changes. Also some questions to continue to help me get up to speed on mobile.
kauffj (Migrated from github.com) commented 2019-05-23 21:51:23 +02:00

hooray!

hooray!
kauffj (Migrated from github.com) commented 2019-05-23 22:05:45 +02:00
  1. This check appears enough times that it may be worth wrapping.
  2. What happens if this isn't true / when would it not be true?
1) This check appears enough times that it may be worth wrapping. 2) What happens if this isn't true / when would it not be true?
kauffj (Migrated from github.com) commented 2019-05-23 21:55:18 +02:00

intended? add to linter to check for these if not

intended? add to linter to check for these if not
@ -88,3 +95,4 @@
this.setState({ currentTime: position }, () => this.setSeekerPosition(this.calculateSeekerPosition()));
}
if (this.props.onMediaLoaded) {
kauffj (Migrated from github.com) commented 2019-05-23 21:55:03 +02:00

why 10? what is 10?

const positionSaveInterval = 10 is a better practice

why 10? what is 10? `const positionSaveInterval = 10` is a better practice
kauffj (Migrated from github.com) commented 2019-05-23 21:58:02 +02:00

I have very little literally no idea if these values are correct. Are these defaults? How important is it to tune these or get them correct?

I have ~~very little~~ literally no idea if these values are correct. Are these defaults? How important is it to tune these or get them correct?
kauffj (Migrated from github.com) commented 2019-05-23 22:09:49 +02:00

this looks like it should be something like below (unless you intended 2 setState calls to be called in succession sometimes, but even in that case you can abstract the shared part of the if statement):

if (!this.state.streamingMode && isPlayable) {
  if (streamingUrl) {
    this.setState({ streamingMode: true, currentStreamUrl: streamingUrl });
  }
  else if (fileInfo && fileInfo.streaming_url) {
    this.setState({ streamingMode: true, currentStreamUrl: fileInfo.streaming_url });
  }
}
this looks like it should be something like below (unless you intended 2 `setState` calls to be called in succession sometimes, but even in that case you can abstract the shared part of the if statement): ``` if (!this.state.streamingMode && isPlayable) { if (streamingUrl) { this.setState({ streamingMode: true, currentStreamUrl: streamingUrl }); } else if (fileInfo && fileInfo.streaming_url) { this.setState({ streamingMode: true, currentStreamUrl: fileInfo.streaming_url }); } } ```
@ -371,3 +487,4 @@
costInfo,
fileInfo,
metadata,
contentType,
kauffj (Migrated from github.com) commented 2019-05-23 22:11:45 +02:00

Would it make sense to instead add an encoded_file_path property to fileInfo in redux? This kind of code seems somewhat out of place in a view component.

Would it make sense to instead add an `encoded_file_path` property to `fileInfo` in redux? This kind of code seems somewhat out of place in a view component.
kauffj (Migrated from github.com) commented 2019-05-23 22:12:36 +02:00

coughs

*coughs*
kauffj (Migrated from github.com) commented 2019-05-23 22:13:53 +02:00

Maybe we should show the download button always? Or if the video is playing? In this design, is it now impossible to not stream a video? What if I want to save for offline viewing?

Maybe we should show the download button always? Or if the video is playing? In this design, is it now impossible to _not_ stream a video? What if I want to save for offline viewing?
kauffj (Migrated from github.com) commented 2019-05-23 22:15:34 +02:00

When/why do we use Async storage vs. Redux?

When/why do we use Async storage vs. Redux?
@ -16,6 +16,8 @@ import Colors from 'styles/colors';
import Constants from 'constants';
import firstRunStyle from 'styles/firstRun';
const firstRunMargins = 80;
kauffj (Migrated from github.com) commented 2019-05-23 22:16:20 +02:00

LINTER

LINTER
@ -62,3 +58,3 @@
render() {
const { onPasswordChanged, onWalletViewLayout, isRetrievingSync, hasSyncedWallet } = this.props;
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
kauffj (Migrated from github.com) commented 2019-05-23 22:17:46 +02:00

That 80 seems potentially evil

That 80 seems potentially evil
@ -237,3 +285,4 @@
syncApplyIsPending,
resendVerificationEmail,
user
} = this.props;
kauffj (Migrated from github.com) commented 2019-05-23 22:18:48 +02:00

Inconsistent casing. I think we generally do not capitalize the second word on actions like this, but what's important is just being consistent.

Inconsistent casing. I think we generally do not capitalize the second word on actions like this, but what's important is just being consistent.
@ -30,3 +30,3 @@
daemonReady: false,
details: 'Starting daemon',
details: 'Starting up...',
message: 'Connecting',
kauffj (Migrated from github.com) commented 2019-05-23 22:19:09 +02:00

Good removal of jargon

Good removal of jargon
@ -0,0 +166,4 @@
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
NotificationCompat.Builder builder = null;
int notificationId = getNotificationId(id);
if (builders.containsKey(notificationId)) {
kauffj (Migrated from github.com) commented 2019-05-23 22:22:08 +02:00

I'm curious if this change was stylistic or necessary 😀 (I agree the new one is better)

I'm curious if this change was stylistic or necessary :grinning: (I agree the new one is better)
kauffj (Migrated from github.com) commented 2019-05-23 22:28:06 +02:00

Should these log statements be in the release?

Should these log statements be in the release?
@ -121,1 +461,4 @@
return intent;
}
@Override
kauffj (Migrated from github.com) commented 2019-05-23 22:26:13 +02:00

Looks like you could use the reverse of https://github.com/havardh/javaflow

Looks like you could use the reverse of https://github.com/havardh/javaflow
kauffj (Migrated from github.com) commented 2019-05-23 22:27:43 +02:00

I continue to think it would be really cool if there was a way for a single definition of Claim, File, etc. to be propagated from the SDK to a variety of languages. We ourselves would presumably use it in JavaScript, Java, Go. (@lyoshenka @eukreign no need to comment, but pointing out a use-case)

I continue to think it would be really cool if there was a way for a single definition of `Claim`, `File`, etc. to be propagated from the SDK to a variety of languages. We ourselves would presumably use it in JavaScript, Java, Go. (@lyoshenka @eukreign no need to comment, but pointing out a use-case)
akinwale (Migrated from github.com) reviewed 2019-05-23 23:13:14 +02:00
@ -88,3 +95,4 @@
this.setState({ currentTime: position }, () => this.setSeekerPosition(this.calculateSeekerPosition()));
}
if (this.props.onMediaLoaded) {
akinwale (Migrated from github.com) commented 2019-05-23 23:13:14 +02:00

Every 10 seconds. Saving every second was resulting in some lag / performance issues.

Every 10 seconds. Saving every second was resulting in some lag / performance issues.
akinwale (Migrated from github.com) reviewed 2019-05-23 23:13:30 +02:00
akinwale (Migrated from github.com) commented 2019-05-23 23:13:30 +02:00

This was meant for debugging. Will be removed.

This was meant for debugging. Will be removed.
akinwale (Migrated from github.com) reviewed 2019-05-23 23:14:56 +02:00
akinwale (Migrated from github.com) commented 2019-05-23 23:14:55 +02:00

Was also using these for testing / debugging. Essentially, these values define how the media player caches bits of loaded media. I'll have to spend some time reading and tuning in order to determine sane values.

Was also using these for testing / debugging. Essentially, these values define how the media player caches bits of loaded media. I'll have to spend some time reading and tuning in order to determine sane values.
akinwale (Migrated from github.com) reviewed 2019-05-23 23:15:47 +02:00
akinwale (Migrated from github.com) commented 2019-05-23 23:15:47 +02:00
  1. True.
  2. Technically, it should never happen, because it's my responsibility to ensure UtilityModule exists in native code.
1. True. 2. Technically, it should never happen, because it's my responsibility to ensure UtilityModule exists in native code.
akinwale (Migrated from github.com) reviewed 2019-05-23 23:16:55 +02:00
@ -0,0 +166,4 @@
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
NotificationCompat.Builder builder = null;
int notificationId = getNotificationId(id);
if (builders.containsKey(notificationId)) {
akinwale (Migrated from github.com) commented 2019-05-23 23:16:54 +02:00

I remember seeing a few cases where the value of writtenBytes was greater than totalBytes, so this ended up being necessary.

I remember seeing a few cases where the value of `writtenBytes` was greater than `totalBytes`, so this ended up being necessary.
akinwale (Migrated from github.com) reviewed 2019-05-23 23:20:29 +02:00
akinwale (Migrated from github.com) commented 2019-05-23 23:20:28 +02:00

No. These will be removed.

No. These will be removed.
akinwale (Migrated from github.com) reviewed 2019-05-27 10:09:59 +02:00
@ -371,3 +487,4 @@
costInfo,
fileInfo,
metadata,
contentType,
akinwale (Migrated from github.com) commented 2019-05-27 10:09:59 +02:00

Apparently, github hid some of the messages by default, so I missed them. The fileInfo is returned by the sdk, but I suppose I can create a makeSelect selector in order to achieve this.

Apparently, github hid some of the messages by default, so I missed them. The `fileInfo` is returned by the sdk, but I suppose I can create a `makeSelect` selector in order to achieve this.
akinwale (Migrated from github.com) reviewed 2019-05-27 10:10:07 +02:00
akinwale (Migrated from github.com) commented 2019-05-27 10:10:07 +02:00

Removed.

Removed.
akinwale (Migrated from github.com) reviewed 2019-05-27 10:16:43 +02:00
akinwale (Migrated from github.com) commented 2019-05-27 10:16:43 +02:00

The initial download / view button will show up if:

  • the fileInfo is present and it's a playable media file (audio / video)
  • it's not a media file, but it is a viewable file: canOpen (image, text/plain, text/html, text/*)
  • and the user has not pressed it yet.

Once the user has pressed it, we begin the download or stream and then the file page has to display one of:

  • an activity indicator (download is about to start or media cannot be played yet)
  • the media player (audio / video) - isPlayable and canLoadMedia are true, or this.state.streamingMode is true if not downloading.
  • the image viewer (images) - completed and canOpen are true
  • the web viewer (text/* types) - same for images
  • the same download button (not interactable) showing the download progress for other file types.
The initial download / view button will show up if: * the `fileInfo` is present and it's a playable media file (audio / video) * it's not a media file, but it is a viewable file: `canOpen` (image, text/plain, text/html, text/*) * and the user has not pressed it yet. Once the user has pressed it, we begin the download or stream and then the file page has to display one of: * an activity indicator (download is about to start or media cannot be played yet) * the media player (audio / video) - `isPlayable` and `canLoadMedia` are `true`, or `this.state.streamingMode` is `true` if not downloading. * the image viewer (images) - `completed` and `canOpen` are `true` * the web viewer (text/* types) - same for images * the same download button (not interactable) showing the download progress for other file types.
akinwale (Migrated from github.com) reviewed 2019-05-27 10:18:20 +02:00
akinwale (Migrated from github.com) commented 2019-05-27 10:18:20 +02:00

Async storage is used for tracking simple values which don't need to be used more than two or three times when transitioning between screens. Using the redux state would require having to create an action, reducer and selector, which would be unnecessary for the scale of the operation being performed.

Async storage is used for tracking simple values which don't need to be used more than two or three times when transitioning between screens. Using the redux state would require having to create an action, reducer and selector, which would be unnecessary for the scale of the operation being performed.
akinwale (Migrated from github.com) reviewed 2019-05-27 10:19:27 +02:00
@ -16,6 +16,8 @@ import Colors from 'styles/colors';
import Constants from 'constants';
import firstRunStyle from 'styles/firstRun';
const firstRunMargins = 80;
akinwale (Migrated from github.com) commented 2019-05-27 10:19:27 +02:00

Sometimes, it's okay to forget.

Sometimes, it's okay to forget.
akinwale (Migrated from github.com) reviewed 2019-05-27 10:20:23 +02:00
@ -62,3 +58,3 @@
render() {
const { onPasswordChanged, onWalletViewLayout, isRetrievingSync, hasSyncedWallet } = this.props;
const { onPasswordChanged, onWalletViewLayout, getSyncIsPending, hasSyncedWallet, syncApplyIsPending } = this.props;
akinwale (Migrated from github.com) commented 2019-05-27 10:20:23 +02:00

Should definitely be a constant. It's the left and right first run margins (32 + 32), and the control padding (8 + 8), added together.

Should definitely be a constant. It's the left and right first run margins (32 + 32), and the control padding (8 + 8), added together.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry-android#547
No description provided.