Commit graph

422 commits

Author SHA1 Message Date
Rafael
5dd457d045 Fix live chat 2022-03-03 11:39:42 -05:00
Rafael
c4a23ff856 Fix batch resolve 2022-03-03 11:39:42 -05:00
Rafael
96e7fda26a Batch-resolve channels on doCommentList fetch 2022-03-03 11:39:42 -05:00
infinite-persistence
66e0b84e12
Grab homepages from the content API (#1016)
Currently, homepages are still build as part of the app, so this change doesn't bring much benefit other than to support the wrapper app.

When the service is moved away from the app, we won't have to rebuild the app when homepages change, and also the ui.js bundle would be smaller without the need to code-split.
2022-03-03 09:22:59 -05:00
infinite-persistence
a14239a9dc Livestream fetch: add language option
The function argument order can be a bit ugly, but putting it at the back as optional param makes it easier to test without affecting existing clients.
2022-02-25 16:53:45 -05:00
saltrafael
2152583816
[Fix] linked uris (#959)
* Fix live claim uri being passed

* Refactor show page

* Fix linked comment being erased
2022-02-24 10:20:07 -05:00
saltrafael
17e3fcc27c
[Fix] revert fileRenderFloating vs Mobile change (#937)
* Bump react-draggable

Old version was giving out console errors for outdated react functions

* Refactor fileRenderFloating

* Merge fileRenderMobile into fileRenderFloating

* Fixes from review

* Attempt fix failed to view live
2022-02-23 16:13:22 -05:00
infinite-persistence
39de1d7e84
Band-aid: warn about AdGuard blocking our CDN (#934)
* Band-aid: warn about AdGuard blocking our CDN

Getting 50-100 errors per day. This will be a band-aid until the AdGuard fixes it.

* update message

Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
2022-02-22 14:17:41 -05:00
infinite-persistence
79f1b1242d
Clear search cache instead of full reload on homepage 2nd-click (#930)
## Ticket
lbry-desktop 6841

## Issue
If you are already at the homepage and you click the "Home" or "Odysee" logo again, the entire page reloads, causing the whole startup sequence to re-run (lots of fetches).

This can be annoying when not intended (e.g. clicked too many times), as startup is slow for some and we also lose non-persistent Redux data (for debugging).

I believe the requirement was just to reload the homepage tiles, as they might be showing stale ones after a while. A full reload was the quick-and-easy fix.

## Approach
Best not to touch the complicated `ClaimTilesDiscover`, so just clear the search cache key in this scenario. `ClaimTilesDiscover` will then pick this up and perform a new `claim_search`.
2022-02-21 07:54:23 -05:00
infinite-persistence
80d4d8c57c
Limit channel-creation count from the UI (#886)
## Issue
534 prevent new channel creation over x channels

## Notes
Also handled from the API call (`doCreateChannel`) in case there are other UI components that create channels.
2022-02-16 09:14:08 -05:00
saltrafael
6fa12bf237
Fix wrong param for selector (#874) 2022-02-15 10:35:39 -05:00
Thomas Zarebczan
f943affb19
update reports endpoint. 2022-02-09 15:06:38 -05:00
infinite-persistence
f9a1fcc6a7 Bump thumbnail size to 5MB & check size before upload.
- The previous 2MB was a CDN limit (more of a mistake). That has been increased to a far greater number, so we're setting a more reasonable 5MB limit.
- The previous code checks/shows the "size exceeded" message after the file has been uploaded ... in the `catch` block. This will not work since the CDN now allows a 5MB file.
    - Fixed by checking the size before actually uploading.
2022-02-09 11:14:46 -05:00
Rafael
0394211021 Fixes 2022-02-08 12:35:40 -05:00
Rafael
2b56ca8599 Cleanup CommentCreate 2022-02-08 12:35:40 -05:00
Rafael
baf51f9c32 Create swipeableDrawer component
- CommentsList needs to return a title with comment amounts
- mobile player dimensions needed to fill in the cover
- hid livestream header for now until figuring out a better presentation
- ~colum-reverse~ was causing problems with MUI's drawer scrolling, so reversed the chat order and made it ~column~ by default
- Hid bottom expand navigation if component not yet opened
- some other style changes in the middle
2022-02-08 12:35:40 -05:00
Rafael
0c47f1daa9 Refactor fileRenderIninitiator component
- Only pass necessary props
- Created new initialize play redux action
- Removed deprecated ~file app download~ keyboard functionality, moved preventDefault to videojs keyboard events to prevent ~space~ moving down the page
2022-02-08 12:35:40 -05:00
Rafael
5794432288 Refactor fileActions
- moved doPrepareEdit incognito and channel calls to separate action
- same with download
- Tooltips
- No major differences between mobile or default returned components so removed condition since mobile style will be changed later on this branch
2022-02-08 12:35:40 -05:00
David Granado
ce903c9280
Patch to restore position upon returning to video until more fully fleshed out fix can be introduced (#817)
* Patch to restore position upon returning to video until more fully fleshed out fix can be introduced

* Add code to notify other open tabs of position saving

* Fix typo

* Wrap localStorage access in try/catch in event browser settings make it unavailable

* Remove formatting changes

* Move constant from 'pages' to 'player'

* Move dispatch out of try/catch

* Fixed typo
2022-02-07 12:51:26 -05:00
AsadUmar
65ad2df643
fix RESOLVE_URIS_COMPLETED, to have one large action instead of hundr… (#798)
* fix RESOLVE_URIS_COMPLETED, to have one large action instead of hundreds of small ones

* Addressed comments.

* Addressed comments.

* Addressed comments.

Co-authored-by: Asad Umar <au@visuary.fr>
2022-02-07 12:39:12 -05:00
infinite-persistence
fe3a55ff95 Remove custom comments server
- Not used by Web.
- It's basically a revert of Desktop 5459.
2022-02-03 10:24:58 -05:00
Rafael
898376888d Fix 2022-01-27 11:32:01 -05:00
Rafael
6544f4c0b6 Fix resolve mentioned_channels 2022-01-27 11:32:01 -05:00
infinite-persistence
7fc66aecb6 Defer user/invite_status from startup
## Issue
Closes 385

## Approach
As mentioned in the ticket, the current places where that info is needed is in the Invites Page and Social Share Component.

1. Invites Page: it is already doing the fetch on mount, so no issue there.
2. Social Share: show spinner until the data is fetched.
2022-01-21 09:19:17 -05:00
Rafael
2340138ab5 Fix failed resolve 2022-01-20 14:02:39 -05:00
infinite-persistence
a8a666383a Remove 'store.user.accessToken' now that we've confirmed nobody uses it. 2022-01-19 13:12:09 -05:00
infinite-persistence
e4658bb044
Fix missing claims in large collection (#726)
## Issue
A huge list like http://localhost:9090/$/list/d91815c1bc8c80a1f354284a8c8e92d84d5f07a6 (193 items) often produces fewer results in the final rendered list.

## Cause
The same list of IDs was passed into `claim_search`, and we just increment the `page`. However, it seems like `claim_search` does not honor the order between each call, and some results from the previous page took the place of the results in the next page.  The total is the same, but there are now duplicates.

## Fix
When batching, slice the ID list ourselves to bypass the problem for now.
2022-01-18 09:33:01 -05:00
infinite-persistence
bdb83b5295
Commentron: *Delegates was failing silently
Added toasts to indicate errors instead of failing silently.
2022-01-18 10:46:18 +08:00
infinite-persistence
c1cb9345ad
Commentron: param updates for moderation.*Delegates
## Reason
https://odysee-workspace.slack.com/archives/C02FMSYF51B/p1642435815038000?thread_ts=1642129696.024400&cid=C02FMSYF51B
Due to unaligned parameters not compliant with Authenticate, ModAuthenticate APIs.

It will still work without this PR as there is a compatibility layer, but should use the correct params moving forward.
2022-01-18 10:43:58 +08:00
infinite-persistence
7989020a04
Corrected mentioned_channels parameter name (#719)
Commentron json params are usually underscored instead of camel-cased.

Double-checked commentron code:

```
// MentionedChannel channels mentioned in comment
type MentionedChannel struct {
	ChannelName string `json:"channel_name"`
	ChannelID   string `json:"channel_id"`
}
```

The parameter should probably also be skipped instead of sending empty array, but leaving as-is for now since that is minor.
2022-01-17 08:44:45 -05:00
infinite-persistence
9743f4b49e
Move commentron error mapping to separate file 2022-01-17 10:25:06 +08:00
saltrafael
ea9c7a4a27
[Live Chat] Break down componets for Page Layout + Add ability to Pop Out chat window + Hide chat option (#681)
* Refactor CommentBadge

* Refactor livestreamComment component

* Refactor and split livestreamComment CSS

* Refactor livestreamComments component

* Refactor and split livestreamComments CSS

* Remove never used spinner

* Refactor livestream Page

* Refactor page component

* Refactor livestreamLayout component

* Break apart livestreamComments into separate sibling components

- This helps separating LivestreamComments to deal with only the comments, and the LivestreamLayout to be used for its own Page as a Popout option, and also for a layered approach for mobile

* Create Popout Chat Page, Add Popout Chat Menu Option

* Add Hide Chat option

* sockety improvements

* Websocket changes

Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
2022-01-14 15:24:16 -05:00
saltrafael
b810e07053
Fix doAbandonClaim (#699)
* Refactor doAbandonClaim parameters to only claim

- Gets txid and nout by default now, and passing claim allows using more data to verify ownership in case of txid:nout failing again
- Unused on modalRemoveCard
- Edited the comment on doCollectionDelete to explain better

* Fix doAbandonClaim failing to select my claim
2022-01-14 14:26:03 -05:00
saltrafael
f3892325ce
Find and Pass mentioned channel name + claim id on comment_create (#690) 2022-01-14 09:50:09 -05:00
infinite-persistence
4ae1df4eb9
Thumb: make CDN limit an env so we can change easily 2022-01-13 13:18:41 +08:00
saltrafael
2575c5d448
[Playlist] Pull in sorting changes from desktop + Add Drag-n-Drop + Handle unavailable/deleted claims (#641)
* Add ordering Icons

* Refactor doCollectionEdit

- It required claims as parameter, when only uris are used to populate the collection, so that was changed to pass down the uris instead.
- There were unused and mostly unnecessary functions inside, for example the parameter claimIds was never used so it would never enter the claimSearch function which again would be used to generate uris, so it's better to just use uris as parameter

* Add List Reordering changes

* Add toggle button for list editing

* Add toggle on content page collection sidebar

* Enable drag-n-drop to re-order list items

https://www.youtube.com/watch?v=aYZRRyukuIw

* Allow removing all unavailable claims from a List

* Fix <g> on icons

* Fix section buttons positioning

* Move preventDefault and stopPropagation to buttons div instead of each button, preventing clicking even if disabled opening the claim

* Change dragging cursor

* Fix sizing

* Fix dragging component

* Restrict dragging to vertical axis

* Ignore shuffle state for ordering

* Fix console errors

* Mobile fixes

* Fix sidebar spacing

* Fix grey on mobile after click
2022-01-12 14:14:12 -05:00
infinite-persistence
8507d07d3e
Remove incorrect comments
- activeChannelClaim is the comment creator, not receiver.
- doSeeNotifications marks a notification as "seen", and not "send a notification".
- Removed comments that are just explaining the syntax.
2022-01-10 09:18:11 +08:00
Thomas Zarebczan
ac93e0c22c
2MB max thumb size messaging (#650) 2022-01-07 14:39:27 -05:00
Dan Peterson
bc38466abf
Add a better solution for 304 browser bug + update naming conventions to better articulate what's happening (#603) 2022-01-06 12:49:49 -05:00
infinite-persistence
50550bfa99
Thumbnail uploads: don't show the extra error info in the GUI 2022-01-06 15:39:52 +08:00
infinite-persistence
57f48f462e
Thumbnail uploads: handle non-JSON responses 2022-01-06 15:39:52 +08:00
infinite-persistence
01459d906a
tus: Get more information from publish errors 2022-01-06 15:39:51 +08:00
infinite-persistence
96c3b727fe
Thumbnail uploads: report file details (#628)
I'm leaving the generic "Unexpected JSON" error alone for now, as I think this should be fixed at Nick's end.
2022-01-05 21:07:54 -05:00
infinite-persistence
39a4cb3d77 Switch thumbnail server: spee.ch --> vanwanet 2022-01-05 11:49:41 -05:00
infinite-persistence
6583b6a636 Sync: fix new user sign up flow
## Issue
- When signing up, the "channel suggestions" page was stuck because `prefsReady` was never set as `preference_get` was never called.
- It was never called due to the optimizations to skip it when there is no difference between the local and server wallet.

## Change
- The first ever `sync/get` will result in a "no wallet" error, and there is already a `catch` to handle it. But the change in 38c13cf5 caused the `catch` to be skipped and went directly to `sync_apply` instead. Although the `catch` is also doing the same thing (`sync_apply`), it also has an additional callback to call `preference_get`.
    - Fixed by ensuring this scenario ends up in the `catch` block like it was originally intended.
- We also did some optimization in the callback to skip the final `preference_get` if there is no difference in hash. But for the case of signing up, we do want to run it (so that `prefsReady` and other stuff gets initialized), so pass `hasNewData = true` to the callback.
2022-01-05 04:00:12 -05:00
infinite-persistence
d03f80c6b1 Skip 'install/new' if web already exists
## Issue
Part of 385 "Defer api.odysee.com calls to their respective pages / install new"
2022-01-04 08:54:30 -05:00
infinite-persistence
1f5f8f1213 Remove unused firebase and domain parameter 2022-01-04 08:54:30 -05:00
infinite-persistence
e5a2e3961e Remove unused items 2022-01-04 08:54:30 -05:00
infinite-persistence
5948ee0d80
i18n: restore ability to retrieve new i18n strings
## Issue
In the original Desktop code, new strings encountered during runtime will be automatically added to the local `app-strings.json` file. The feature is unavailable in Web because writing to file would require explicit permissions.

## Change
Partially restore the functionality by saving the strings to memory and retrieving it from the console via `copy(window.new_strings)`. It's a little bit of manual work, but I think it is good as it forces a sanity check before committing (previously, experimental/developmental strings are committed and being translated in Transifex).
2022-01-03 10:36:12 +08:00
Dan Peterson
a96d2a47be Create new anytime form state to explicitly set to release to now. Clear internal scheduled tag when editing. 2021-12-30 15:21:59 -05:00
Dan Peterson
33cce4bbcd Update so that any edited streams without a date/time change still get the tag if needed. 2021-12-30 15:21:59 -05:00
Dan Peterson
356c5bf30f - Add a system-level tag for scheduled live streams
- Query for that tag in the upcoming section
- Improve special tag organization
- Filter out the internal tags in the UI
- Add missing types to publish state
2021-12-30 15:21:59 -05:00
infinite-persistence
0ccf9f2c05 Handle removed livestream comments 2021-12-30 11:55:44 -05:00
infinite-persistence
39a0beb4ee Remove channel_list from end of Sync Loop
## Issue
- Slow for users with many channels.
- The need to do it in Sync Loop is more applicable to Desktop.

## Approach
- Just remove it from sync loop.
- It will still be called when entering `/$/channels`, so that's an alternative to fix things when it is out of sync.
2021-12-29 21:16:20 -05:00
Dan Peterson
c22a3048dc Make sure user is available (ie. backend api not down) 2021-12-29 15:45:10 -05:00
infinite-persistence
b6d21692e6 Fix broken startup sync-lock
## Issue
In 38c13cf5, an additional `doGetAndPopulatePreferences` was added in `doSignIn` to ensure we have populated the preferences at least once. With that, `doHandleSyncComplete` can skip `doGetAndPopulatePreferences` is there is no change in the hash.

The addition broke the "initial sync lock", thus incorrectly allowing users to change preferences when the process is not completed.

## Change
I think the additional call is no longer needed since we now store a local hash for comparison, so `doGetAndPopulatePreferences` wouldn't be incorrectly skipped in the first ever `doHandleSyncComplete`.
2021-12-29 10:32:38 -05:00
infinite-persistence
d7e3127e65 Sync: handle fast-actions being reverted
## Repro
1. Follow a channel.
2. When `preference_set` is sent, unfollow the channel.
3. A few seconds later, the final setting reflects (1) instead of (2).

The current sync loop involves doing a final `sync/get` at the end. While not necessary for the scenario above, the code flow covers various cases, so it's still needed for now.

## Approach
Implement an abort mechanism to the sync-loop.

When syncing from the `buildSharedStateMiddleware` loop, generate an ID for each sync session, and only store the latest one. Pass the ID to the completion-callback (and other places as needed), so we can check if our session is still the latest one before executing the callback.

The check for invalidation can also be placed in more places to cut off the sync process earlier, but it's only done for 2 critical places for now.
2021-12-29 10:32:38 -05:00
infinite-persistence
b1f4a2a590 Defer notification/categories
## Ticket
Part of "#385 Defer api.odysee.com calls to their respective pages / install new"

## Change
Pull out `notification/categories` from `doNotificationList` and fetch it in Notifications Page. I don't there there are other places that need it for now.
2021-12-29 09:15:06 -05:00
Dan Peterson
ea1691609b throw cust error only when failing to parse json 2021-12-23 20:59:08 -05:00
Dan Peterson
8887996718 temporary hotfix for live api resp handling 2021-12-23 20:59:08 -05:00
infinite-persistence
3bce2e656f
Remove unused doSyncWithPreferences 2021-12-23 16:29:46 +08:00
infinite-persistence
abff1f3259 Change logic for daily reward claiming to weekly
Closes 531
2021-12-23 02:40:58 -05:00
Dan Peterson
d382671616 Add stream start to active live streams, and refactor how data active claim is stored in redux 2021-12-22 13:50:49 -05:00
Dan Peterson
2be14c86c3
Add ability to have claim searches auto-fetch up to 3 pages. (#504)
* Add ability to have claim searches auto-fetch up to 3 pages.

* make total_items and total_pages optional

* use auto pagination strategy when determining live claim

* Bump page size back to 50
2021-12-20 13:25:16 -05:00
Dan Peterson
038692cafc
Feature livestream scheduling (#458)
Add livestream scheduling feature
Also supports back to back streams, and will notify on a non-active stream of an active one.
2021-12-16 16:59:13 -05:00
infinite-persistence
50d1d062ad
Revert "Switch thumbnail server: spee.ch --> vanwanet"
This reverts commit 1a0a62058c.
2021-12-16 16:16:22 +08:00
infinite-persistence
1a0a62058c Switch thumbnail server: spee.ch --> vanwanet 2021-12-15 13:59:45 -05:00
infinite-persistence
3b87f0aba6 Remove content_tags and related functions
No longer necessary.

Also removed a few doToggleTagFollowDesktop props (unused by the View).
2021-12-13 11:54:53 -05:00
Rafael
5feaa30e58 Add back support for Winning Uri 2021-12-09 15:35:40 -05:00
Rafael
c2a3698015 Fix and Improve searching 2021-12-09 15:35:40 -05:00
Rafael
db5f24ae28 Add back and improved support for searching while mentioning 2021-12-09 15:35:40 -05:00
infinite-persistence
157b50c58e
Upload: tab sync and various fixes (#428)
* Upload: fix redux key clash

## Issue
`params` is the "final" value that will be passed to the SDK and  `channel` is not a valid argument (it should be `channel_name`). Also, it seems like we only pass the channel ID now and skip the channel name entirely.

For the anonymous case, a clash will still happen when since the channel part is hardcoded to `anonymous`.

## Approach
Generate a guid in `params` and use that as the key to handle all the cases above. We couldn't use the `uploadUrl` because v1 doesn't have it.

The old formula is retained to allow users to retry or cancel their existing uploads one last time (otherwise it will persist forever). The next upload will be using the new key.

* Upload: add tab-locking

## Issue
- The previous code does detect uploads from multiple tabs, but it was done by handling the CONFLICT error message from the backend. At certain corner-cases, this does not work well. A better way is to not allow resumption while the same file is being uploading from another tab.

- When an upload from 1 tab finishes, the GUI on the other tab does not remove the completed item. User either have to refresh or click Cancel. Clicking Cancel results in the 404 backend error. This should be avoided.

## Approach
- Added tab synchronization and locking by passing the "locked" and "removed" information through `localStorage`.

## Other considered approaches
- Wallet sync -- but decided not to pollute the wallet.
- 3rd-party redux tab syncing -- but decided it's not worth adding another module for 1 usage.

* Upload: check if locked before confirming delete

## Reproduce
Have 2 tabs + paused upload
Open "cancel" dialog in one of the tabs.
Continue upload in other tab
Confirm cancellation in first tab
Upload disappears from both tabs, but based on network traffic the upload keeps happening.
(If upload finishes the claim seems to get created)
2021-12-07 09:48:09 -05:00
infinite-persistence
fd17ab4c8b
Route recommendation search to recsys + add user_id (#353)
* Route recommendation search to recsys 5% of the time + add `user_id`

## Ticket
334 send some recommended requests to recsys

## Approach
`doSearch`:
    - If the search options include `related_to`, route that to the new `searchRecommendations` which performs the 5% check + appends `user_id` at the end. This way, we don't need to alter the function signature of `doSearch`.
    - Else, run proceed as normal.

* Always go to alt provider

f

Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
2021-11-24 15:25:22 -05:00
infinite-persistence
4267c1ccf7
Un-authenticated resolve (#341)
* apiCall: add option to not send the auth header

## Why
Want an option to make un-authenticated `resolve` calls where appropriate, to improve caching.

## How
All `apiCall`s are authenticated by default, but when clients add NO_AUTH to the params, `apiCall` will exclude the X_LBRY_AUTH_TOKEN. It will also strip NO_AUTH from the param object before sending it out.

* Add hook for 'resolve' and 'claim_search' to check and skip auth...

... if the params does not contain anything that requires the wallet.

* doResolveUri, doClaimSearch: let clients decide when to include_my_output

- No more hardcoding 'include_purchase_receipt' and 'include_is_my_output'
- doResolveUri: include these params when opening a file page. This was the only place that was doing that prior to this PR.

* is_my_output: use the signing_channel as alternative

## Notes
`is_my_output` is more expensive to resolve, so it is not being requested all the time.

## Change
Looking at the signing channel as the additional fallback, on top of `myClaimIds`.

## Aside
I think using `myClaimIds` here is redundant, as it is usually populated from `is_my_ouput`. But leaving as is for now...
2021-11-24 09:33:34 -05:00
infinite-persistence
3c4ccdd2fe
Kill makeSelectClientSetting
## Why
- No memo required (no transformation).
- `makeSelect*` is an incorrect pattern.

## Changes
- Replaced makeSelectClientSetting with selectClientSetting.
- Remove unused selectShowRepostedContent.
2021-11-23 12:29:53 +08:00
infinite-persistence
328b60d021
Notifications: skip resolve during boot (#330)
## Issue
- Large resolve count (albeit batched) on bootup.

## Changes
- Skip the call on bootup. The same call will happen when you click the notification bell, so it's not too late to resolve at that time.
- Added `true` to `doResolveUris` to return cached results, otherwise it will keep resolving the same channels every time we enter Notifications Page.
2021-11-19 09:46:31 -05:00
infinite-persistence
0941667150
Cost Info selector fixes
- no memo required since they are just directly accessing the store.
2021-11-19 16:01:25 +08:00
Thomas Zarebczan
51546436ce
remove tag sync 2021-11-17 03:09:26 -05:00
infinite-persistence
201a826381
Simplify makeSelectIsUriResolving
- Memo not required. `resolvingUris` is very dynamic and is a short array anyways.
- Changeg from using `indexOf` to `includes`, which is more concise.
2021-11-16 14:32:58 +08:00
infinite-persistence
73f208923a
Optimize makeSelectClaimIsNsfw (and it's surrounding friends) 2021-11-16 10:14:01 +08:00
infinite-persistence
38c13cf5ef Skip USER_STATE_POPULATE when sync_hash is the same
## Changes
- doHandleSyncComplete: only call doGetAndPopulatePreferences when there is new data.
- But for that to work, we'll need to populate preferences at least once. We'll do that in doSignIn.
- We can also remove the "sync/prefs ready" mechanism that was mainly meant for Desktop.

Then came another problem: while trying to spark changes between 2 tabs, `sync/get` was saying "no change" despite the local and server hash being different. I think it is because the both `sync_hash + sync/get` combo is operating on server data, so the hash is the same. I'm guessing this is why we ended up just running doGetAndPopulatePreferences every time before PR, since this flag wasn't correct in this scenario.

- Updated `data.changed` to consider both API results and comparison with local hash.
2021-11-15 07:06:39 -08:00
infinite-persistence
342fcb4024 doSignIn: cleanup, no functional change
Seems unlikely that we'll need to disable notifications, so cleaned up the code a bit.
2021-11-15 07:06:39 -08:00
infinite-persistence
0f68bad3eb
Optimize selectClaimIsMine
## Why
Frequently used; top in perf profile

## Changes
Most of the time, you already have the claim object in the current context. `selectClaimIsMineForUri` will retrieve the claim again, which is wasteful, even if it is memoized (looking up the cache still takes time).

Break apart the logic and added the alternative `selectClaimIsMine` for faster lookup.
2021-11-11 16:10:06 +08:00
infinite-persistence
cb6a044584
Support resume-able upload via tus (#186)
* Publish button: use spinner instead of "Publishing..."

Looks better, plus the preview could take a while sometimes.

* Refactor `doPublish`. No functional change

This is to allow `doPublish` to accept a custom payload as an input (for resuming uploads), instead of always resolving it from the redux data.

* Add doPublishResume

* Support resume-able upload via tus

## Issue
38 Handle resumable file upload

## Notes
Since we can't serialize a File object, we'll need to the user to re-select the file to resume.

* Exclude "modified date" for Firefox/Android

## Issue
It appears that the modification date of the Android file changes when selected, so that file was deemed "different" when trying to resume upload.

## Change
Exclude modification date for now. Let's assume a smart user.

* Move 'currentUploads' to 'publish' reducer

`publish` is currently rehydrated, so we can ride on that and don't need to store the `currentUploads` in `localStorage` for persistence. This would allow us to store Markdown Post data too, as `localStorage` has a 5MB limit per app.

We could have also made `webReducer` rehydrate, but in this repo, there is no need to split it to another reducer. It also makes more sense to be part of publish anyway (at least to me).

This change is mostly moving items between files, with the exception of
1. An additional REHYDRATE in the publish reducer to clean up the tusUploader.
2. Not clearing `currentUploads` in CLEAR_PUBLISH.

* Restore v1 code for livestream replay, etc.

v2 (tus) does not handle `remote_url`, so the app still needs v1 for that. Since we'll still have v1 code, use v1 for previews as well.
2021-11-10 13:16:16 -05:00
infinite-persistence
ece2312ec5 selectClaimIsMineForUri to replace makeSelectClaimIsMine
## Issue
`normalizeUri` | `parseURI` is expensive and has been causing sluggish operations when called repeatedly or within a loop.

## Change
Since I'm not confident enough to remove the call entirely from makeSelectClaimIsMine (although I've yet to find a scenario that the uri is not already normalized), we'll try caching the calls instead.

## Results
- in a simple test of toggling between 2 category pages, we saved 20ms from `parseURI` calls alone.

- in a test of opening all categories one time, the memory usage remained similar. This makes sense since we removed a `makeSelect*` (which creates a selector for each call + not memoizing), and replaced that with a cached selector that's actually memoizing.
2021-11-10 16:49:12 +08:00
infinite-persistence
bc67379c26
Block: pass comment ID for deletion when being blocked. (#255)
* Simplify dispatch map

Since none of dispatches are doing any custom transformation, just use a direct map. The number of arguments for the comment function are getting crazy.

* Block: pass comment ID for deletion when being blocked.
2021-11-09 09:43:02 -05:00
infinite-persistence
cfd67b1c8d
Allow moderators to delete comment (#235)
## Ticket
223 Add ability for delegated moderators to delete comments

## Changes
- Refactored doCommentAbandon's signature so we don't end up converting between "uri" and "Claim" several times and needing to lookup redux when the client can already provide us the exact values that we need.

- Pass the new moderator fields to the API.

- Remove the need to call 'makeSelectChannelPermUrlForClaimUri' since it's a simple field query when we already have the claim.
2021-11-08 12:22:40 -05:00
Dan Peterson
704452732a
Add hints if an error occurs subscribing to notifications (#143)
* Add hints if an error occurs subscribing to notifications

* Update import (type/linting issue)

* disable optimization for debugging

* Revert "disable optimization for debugging"

This reverts commit 5b837f94e97b7488a7dc565e7f74d399e19c286f.

* improve detection of notification support + improve ux / ui surrounding that

* update translations
2021-11-01 14:51:23 -04:00
saltrafael
5f1f702490
[New Feature] Stickers (#131)
* Refactor filePrice

* Refactor Wallet Tip Components

* Add backend sticker support for comments

* Add stickers

* Refactor commentCreate

* Add Sticker Selector and sticker comment creation

* Add stickers display to comments and hyperchats

* Fix wrong checks for total Super Chats
2021-10-28 16:25:34 -04:00
infinite-persistence
2922f0f2dc Revert "Code-split homepages"
This reverts commit 310fc81bd9.

Was breaking the `get` api
2021-10-28 01:33:46 +08:00
Dan Peterson
03f69eff86
Browser push notifications (#133)
* fix type error

fix is subscribed check

- Persist subscription data locally
- add / remove subscription during log in / out
- Use store directly in hook

Add toast error if subscription fails

Revert removal of v2

hotfix linting issue

Add custom notification handler

- fix isSupported flag
- make icon color compatible with light/dark theme
- fix icon on notifications blocked banner

wip: add push notification banner to notifications page.

- ignore failed deletions via internal API
- add ua parsing package
- add more robust meta data to token save

refactor naming + add push toggle to notification button

shift some code around

update css naming o proper BEM notation

update notifications UI

remove now unneeded util function

Update push notification system to sue firebase sdk

separate service worker webpack bundling

update service worker to use firebase sdk

Add firebase config

Add firebase and remove filemanager

Stub out the basics for browser push notifications.

* fix safari

* try smaller image for badge

* add token validation with server, refactor code

* remove param

* add special icon for web notification badge

* add translations

* add missing trans for toast error

* add pushRequest method that will not prompt users who have subscribed but since disabled notifications in the settings.
2021-10-27 10:38:10 -04:00
infinite-persistence
310fc81bd9
Code-split homepages
## Ticket
97

## Issue
8% of the ui.js chunk consists of the 5 custom homepages
2021-10-27 07:55:24 +08:00
infinite-persistence
27f346d8f1
Don't memoize selectors without transformation
It was not meant to be used for these cases -- wasting resources creating and going through the cache for each simple direct access.
2021-10-24 13:05:06 +08:00
infinite-persistence
b7685a151d
Additional GA events via redux/lbryio hook
## Issue
85 Add additional GA events

## Approach
Instead of placing analytic calls all over the GUI code (no separation of concerns), try to do it through a redux middleware instead.

## Changes
- Updated GA event and parameter naming after understanding how reporting works.
- Removed unused analytics.
2021-10-22 10:56:43 +08:00
Thomas Zarebczan
23525b0baa
FAQ stuff (#109) 2021-10-21 16:21:51 -04:00
infinite-persistence
9bbd72d179
Fix reaction-selector reference invalidation
## Issue
When comments are refreshed, each `Comment` gets rendered 4-5 times due to reference invalidation for `othersReacts` (the data didn't actually change).

## Change
For selectors without transformation, there is no need to memoize using `createSelector` -- just access it directly. Also, don't do things like `return a[id] || {}` in a reducer, because the reference to the empty object will be different on each call.

Always return directly from the state so that the same reference is returned.

This simple change avoided the wasted resources needed for `createSelector`, and reduced to render to just 2 (initial render, and when reactions are fetched).
2021-10-19 21:15:26 +08:00
Merge
30023422b8
Desktop cherry-pick: "7240 Integrate lbry redux and lbryinc" 2021-10-19 20:40:07 +08:00
mayeaux
e3791aefdc
Send video bitrate and user bandwidth to Watchman (#7145)
* adding functionality to detect user download speed

* calculating bandwidth speed more intelligently

* saving download speed and updating it every 30s

* all the functionality should be done needs testing

* fix linting

* use a 1mb file for calculating bandwidth

* add optional chaining plugin to babel and get bitrate from texttrack

* allow optional chaining for flow

* ignore flow error

* disable bandwidth checking functionality

* fix flow error
2021-10-06 14:59:33 -04:00
zeppi
b44be39252 move file actions from lbry-redux 2021-10-06 10:22:49 -04:00
infinite-persistence
de6c6f9bfd
List own comments (#7171)
* Add option to pass in url-search params.

Impetus: allow linked comment ID and setting the discussion tab when clicking on the `ClaimPreview`.

* comment.list: fix typos and renamed variables

- Switch from 'author' to 'creator' to disambiguate between comment author and content author. For comment author, we'll use 'commenter' from now on.
- Corrected 'commenterClaimId' to 'creatorClaimId' (just a typo, no functional change).

* doCommentReset: change param from uri to claimId

This reduces one lookup as clients will always have the claimID ready, but might not have the full URI.

It was using URI previously just to match the other APIs.

* Add doCommentListOwn -- command to fetch own comments

Since the redux slice is set up based on content or channel ID (for Channel Discussion page), re-use the channel ID for the case of "own comments". We always clear each ID when fetching page-0, so no worries of conflict when actually browsing the Channel Discussion page.

* Comment: add option to hide the actions section

* Implement own-comments page

* Use new param to remove sort-pins-first.

comment.List currently always pushes pins to the top to support pagination. This new param removes this behavior.
2021-10-01 08:10:27 -04:00