podverse-rn icon indicating copy to clipboard operation
podverse-rn copied to clipboard

Often not showing Boostagram controls when applicable

Open dwvisser opened this issue 2 years ago • 47 comments

Describe the bug On iOS, When I play a new episode of one of my V4V podcasts, e.g., https://podcastindex.org/podcast/575694, it will often not display the "streaming sats" and "boostagram" controls. Sometimes if I pause, leave the app, and come back after a time, the controls are then there.

To Reproduce Steps to reproduce the behavior:

  1. Go to "Episodes" tab
  2. Select a recently downloaded V4V podcast episode.
  3. Playback screen doesn't show sats controls as expected.

Expected behavior Playback screen always shows sats controls for Lightning-enabled podcasts.

Smartphone (please complete the following information):

  • Device: iPhone 13
  • OS: iOS 16.3.1
  • App Version: 4.12.2 Build 2088

dwvisser avatar Mar 03 '23 11:03 dwvisser

@dwvisser thanks for the bug report. Hmm I am unable to reproduce this issue unfortunately. Have you subscribed to Linux Unplugged by searching for it in Podverse, or added it by RSS URL? The add by RSS podcasts have reduced feature support. That might not be the problem though.

A few people have reported similar problems though it's more than an edge case. I'll see if I can add something to try to prevent it in the next release, but it will be difficult to fix until I can reproduce the issue.

mitchdowney avatar Mar 04 '23 04:03 mitchdowney

Have you subscribed to Linux Unplugged by searching for it in Podverse, or added it by RSS URL? The add by RSS podcasts have reduced feature support. That might not be the problem though.

I'm pretty sure I searched in Podverse. I was completely unable to import OPML from Castamatic for some reason. Here is a screenshot of the subscribed podcast on my client:

image

dwvisser avatar Mar 04 '23 11:03 dwvisser

Well, today, https://podcastindex.org/podcast/487548 just worked with sat streaming. 🤞🏻that this continues. 😊

dwvisser avatar Mar 05 '23 12:03 dwvisser

@dwvisser hmm well that's good if it's not happening anymore, but I wish I knew what happened lol it seems like there must be a race condition causing the bug to only happen occasionally.

mitchdowney avatar Mar 05 '23 20:03 mitchdowney

On the theory that the issue might have to do with (possibly temporary) feed data, I should report that right this moment, I have no sat streaming/boost controls when playing this podcast: https://podcastindex.org/podcast/5049889

dwvisser avatar Mar 07 '23 12:03 dwvisser

On the theory that the issue might have to do with (possibly temporary) feed data,

…or with their Lightning channels?

dwvisser avatar Mar 07 '23 13:03 dwvisser

@dwvisser this really has me stumped...I have never run into this on my iPhone XR and I listen to podcasts with V4V streaming on a lot. I just played 5 episodes of Bitcoin Dad Pod on it and the V4V buttons remained available on the Player screen.

Obviously something is causing the problem for you though...

Question: when the issue happens, what do you see when you go to More > Value for Value (V4V)? Does it show Alby is "Connected"? If yes, and if you tap Alby, does it show you your wallet info and how many sats are in it?

Also, do you use a Lightning wallet provided by Alby? Or did you connect your own Lightning node to Alby? I have only ever used the default Alby wallet.

mitchdowney avatar Mar 07 '23 17:03 mitchdowney

Question: when the issue happens, what do you see when you go to More > Value for Value (V4V)? Does it show Alby is "Connected"? If yes, and if you tap Alby, does it show you your wallet info and how many sats are in it?

I'll have to answer this when the problem pops up again. At present, still playing back same podcast, the sats controls appeared about 20 minutes into the episode, and are still there. The wallet shows as connected, and having 59412 sats.

Also, do you use a Lightning wallet provided by Alby? Or did you connect your own Lightning node to Alby? I have only ever used the default Alby wallet.

Default Alby wallet. I considered connecting my own node, but decided I like the default for my V4V activities.

dwvisser avatar Mar 07 '23 17:03 dwvisser

@dwvisser thank you. It seems likely there is a race condition. This line here at least should grab globalState after the await that proceeds where it is at currently: https://github.com/podverse/podverse-rn/blob/develop/src/state/actions/v4v/v4v.ts#L347

I can change that in v4.12.4. Not sure that's the source of the problem though...

If notice any other patterns please let me know.

mitchdowney avatar Mar 07 '23 19:03 mitchdowney

@dwvisser thank you. It seems likely there is a race condition. This line here at least should grab globalState after the await that proceeds where it is at currently: https://github.com/podverse/podverse-rn/blob/develop/src/state/actions/v4v/v4v.ts#L347

An opportunity for me to level up on my modern JS/Typescript understanding. 😁 I'll study this function later.

dwvisser avatar Mar 07 '23 20:03 dwvisser

@dwvisser cool well be careful...I am not the best role model for modern JS/TypeScript 😂

mitchdowney avatar Mar 07 '23 20:03 mitchdowney

This is probably unrelated, but I thought I should ask: I don't see an explicit check on the optional parameter anywhere, e.g.:

if (typeof(preventPlayerUpdate) !== 'undefined') {
   // foo
} else {
  // bar
}

On the line, if (!preventPlayerUpdate && nowPlayingItem) {, how does the optional boolean parameter preventPlayerUpdate evaluate if not provided?

dwvisser avatar Mar 08 '23 15:03 dwvisser

@dwvisser I changed the order of that one asynchronous issue and it will be in v4.12.4: https://github.com/podverse/podverse-rn/commit/bdfdf431856c96baaf3b55291b5aa8bb9d490878

But...I have no idea if that will actually fix your issue. I just know that line was a problem and might be related.

RE: typeof undefined...I think that is more explicit than JavaScript cares about. If the optional parameter is not provided, then its value will be undefined, and if (!preventPlayerUpdate) will not be a problem for it. undefined is handled as a falsey value inside conditionals in javascript.

mitchdowney avatar Mar 08 '23 20:03 mitchdowney

@dwvisser I changed the order of that one asynchronous issue and it will be in v4.12.4: https://github.com/podverse/podverse-rn/commit/bdfdf431856c96baaf3b55291b5aa8bb9d490878

But...I have no idea if that will actually fix your issue. I just know that line was a problem and might be related.

I think the fix is plausible. When my phone has that version or later, I'll keep you posted on whether the issue goes away or not.

dwvisser avatar Mar 08 '23 20:03 dwvisser

Unfortunately, this morning I confirmed I have v4.12.4, but this issue is still happening. 🧐 image

dwvisser avatar Mar 13 '23 11:03 dwvisser

Have you been able to test this condition?:

Question: when the issue happens, what do you see when you go to More > Value for Value (V4V)? Does it show Alby is "Connected"? If yes, and if you tap Alby, does it show you your wallet info and how many sats are in it?

Unfortunately I am all out of ideas for how to debug this. You're the only person reporting this issue at the moment, and I'm just not able to figure out how to reproduce the issue. It's also not 100% this issue is within our control to solve as if Alby returns an error response from their server, then our app will not render the V4V controls.

mitchdowney avatar Mar 13 '23 20:03 mitchdowney

For what it's worth, in case some one else has time to reproduce and debug the issue, here is where V4V gets initialized in global state. Again until I'm able to reproduce the issue I don't know what I can do to help here. If someone needs help setting up a local environment to work on the app please let me know.

https://github.com/podverse/podverse-rn/blob/develop/src/state/actions/v4v/v4v.ts#L77

mitchdowney avatar Mar 13 '23 20:03 mitchdowney

Have you been able to test this condition?:

Question: when the issue happens, what do you see when you go to More > Value for Value (V4V)? Does it show Alby is "Connected"? If yes, and if you tap Alby, does it show you your wallet info and how many sats are in it?

On another podcast (LUP again), I see the issue, then go see that my Alby wallet is, indeed, connected.

This discussion gave me an idea, and I believe I have a workaround that may be a clue to reproduction and/or a fix. Steps:

  1. See the issue, I.e., start playing a V4V podcast where Boostagram controls aren't showing as they should.
  2. Pause playback.
  3. Swipe the Podverse app "up out of memory"
  4. Relaunch Podverse. You should see that most recently played podcast at the bottom of the screen.
  5. Select the …More tab
  6. Select Value 4 value (V4V)
  7. Select your Alby wallet to view the balance screen
  8. Press the play button on the screen podcast control at the bottom of the screen. You should now be able to see your Boostagram controls when viewing the episode playback screen.

It only seems to work reliably with the bottom-of-screen playback control. Navigate to other podcasts and Boostagram control might break again.

dwvisser avatar Mar 14 '23 12:03 dwvisser

@dwvisser thanks again.

Can you reach out to [email protected] with your Alby account that you are experiencing the issue with? @bumi offered to take a look and see if he notices anything unusual about your account.

But in the meantime...I'm still pretty stumped, but maybe I can add an extra call to handle the V4V state. It sounds like that function gets called along the way in your steps, which ends up in fixing the issue. I'm not sure how it's getting missed in the first place but...calling the same function again later shouldn't cause an issue.

mitchdowney avatar Mar 14 '23 20:03 mitchdowney

@dwvisser are you still running into this issue? (if you're still using podverse?)

mitchdowney avatar Apr 15 '23 05:04 mitchdowney

@dwvisser are you still running into this issue? (if you're still using podverse?)

I'm still using Podverse. 🙂 It still happens (not all the time). My client shows up-to-date version 4.12.7 build 2128. The good news is, my workaround is reliable when it happens.

dwvisser avatar Apr 15 '23 14:04 dwvisser

@dwvisser ok thanks. I am curious, do you know if these steps are definitely necessary for your work around?

Relaunch Podverse. You should see that most recently played podcast at the bottom of the screen. Select the …More tab Select Value 4 value (V4V) Select your Alby wallet to view the balance screen

So, just closing and restarting the app is not enough to workaround the bug for you? You have to go to More > V4V > Alby > play?

In any case, I'm going to look into this today and see if I can identify anything that'd explain the bug...

mitchdowney avatar Apr 15 '23 17:04 mitchdowney

I can say that the last time the issue showed, that restarting alone didn't bring up the correct view on playback screen.

I tried to reproduce just now and couldn't get it to happen. A few days ago, I replaced my old unreliable (for our iOS devices anyway) Wi-Fi 5 mesh system with a fancy new Wifi 6E mesh system, so maybe connectivity has something to do with it? It's possible that the last time I saw the issue, I was out and about relying on my MVNO's connectivity (Mint Mobile), which isn't always perfect.

dwvisser avatar Apr 15 '23 17:04 dwvisser

@dwvisser hmm networking issues could definitely be related to the issue (and I know nothing about mesh systems lol they sound cool though), because if the app makes a failing network request to Alby when loading a value-enabled podcast in the player, then the app will think you are not logged in, and not render the value buttons.

The buttons should still render though even if a network request fails (the boosts and streams should instead fail until you have internet connectivity again). I'll see if I can make it work that way in 4.12.8.

mitchdowney avatar Apr 15 '23 17:04 mitchdowney

@dwvisser ok...this a bit of a shot in the dark, but I'm thinking we should initialize our v4v services after the rest of the app (player, queue, settings, etc.) finishes initializing.

Our v4vRefreshProviderWalletInfo function needs a nowPlayingItem to be available on the global.player in order to update the player state. I'm not sure moving the v4vInitialize to happen later on the PodcastsScreen will help or hurt...but I think it's worth a try.

https://github.com/podverse/podverse-rn/commit/03cea5b7d7052fbae0c0d6a5dd72afc1865f2e56

mitchdowney avatar Apr 15 '23 20:04 mitchdowney

@dwvisser v4.12.8 should now be available on iOS. Can you try the new version and let me know if the issue still pops up for you?

I'm going to close the issue for now just to move it off my plate, but if it still occurs for you, let me know here and we can reopen it.

mitchdowney avatar Apr 21 '23 22:04 mitchdowney

Looks good on latest version too. I only had one incident of the issue the other day, and it was just as I was arriving at a store, and my phone was trying to get connected to their "captive portal" public Wi-Fi just as the podcast started playing.

dwvisser avatar Apr 22 '23 01:04 dwvisser

I still see this issue, unfortunately. I'm on Verizon 4.13.0 Build 2211. Here's an additional clue: I can be listening to a V4V podcast, streaming sats, seeing the boost controls. Then it finishes, and I go pick another boost-capable podcast episode to listen to from my episode list, and it won't show the boost controls on its playback screen.

dwvisser avatar Jul 08 '23 11:07 dwvisser

@dwvisser sorry that's a bummer :(

If you see this issue again (the boost button goes missing when the app starts playing another V4V-enabled podcast), can you try going to More > Value for Value > Alby > and see if it correctly shows your wallet is connected?

There are three things I can think of potentially being an issue:

  1. a race condition where the nowPlayingItem is not available on the Player screen at the time that the Player screen appears. If that is the case though, then I would expect that the boost button would appear if you dismiss the Player screen and then tap to show it again. Have you tried that?

  2. if the Alby API rejects a "get wallet info" request with an error for some reason, then depending on the error Podverse could detect that as the wallet being disconnected. If this is the case, it could be difficult to track down (at least for me). Also, if you were to go to the More > Value for Value > Alby screen, then it should send another request to the Alby API for wallet info, and if it succeeds, then when you re-open the player, the boost controls should be there (I think).

  3. Some podcasts have their V4V tags within their RSS feed, but many other podcasts have their V4V tags within the Podcast Index API. For the latter podcasts, we have to make a separate request to get the V4V tag info and load them in our Player state. If the PI API request fails for some reason, then the podcast would load in the player, but without the valueTags. Maybe we could identify if this is an issue if you reported which podcasts the issue happens with? If just one of them is RSS based (not from PI API), then that would seem to rule out this scenario.

mitchdowney avatar Jul 08 '23 19:07 mitchdowney

As for option number 3, I am streaming sats and boosting to Jupiter Broadcasting feeds like Linux Unplugged and Coder Radio, as well as to Bitcoin Dad Pod.

dwvisser avatar Jul 08 '23 20:07 dwvisser