Skip to content

Commit

Permalink
Fix the clear repcount
Browse files Browse the repository at this point in the history
It had an issue where the callback for clearing would run on a different synch context so updating the state did not cause it to update.

Fluxor usually deals with this, but we use it in the tips section now without fluxor
  • Loading branch information
LiamMorrow committed Dec 24, 2023
1 parent 4032f53 commit 5c23536
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
8 changes: 5 additions & 3 deletions LiftLog.App/LiftLog.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

<PropertyGroup>
<TargetFrameworks>net8.0-android;</TargetFrameworks>
<TargetFramework>net8.0-android</TargetFramework>
<TargetFramework Condition="'$(BuildFor)' == 'ios'">net8.0-ios</TargetFramework>
<TargetFramework Condition="'$(BuildFor)' == 'android'">net8.0-android</TargetFramework>
<TargetFramework Condition="'$(BuildFor)' == ''">net8.0</TargetFramework>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('osx'))">$(TargetFrameworks);net8.0-ios;</TargetFrameworks>

<OutputType>Exe</OutputType>
Expand All @@ -22,8 +24,8 @@
<ApplicationIdGuid>71733E37-6FDD-4EEF-A0BF-DE32634D58EC</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.13.0</ApplicationDisplayVersion>
<ApplicationVersion>43</ApplicationVersion>
<ApplicationDisplayVersion>1.13.1</ApplicationDisplayVersion>
<ApplicationVersion>44</ApplicationVersion>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">24.0</SupportedOSPlatformVersion>
Expand Down
2 changes: 1 addition & 1 deletion LiftLog.App/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ if [ "$1" == "-c" ]; then
dotnet clean -f net8.0-android
fi

dotnet build -t:Run -c Debug -f net8.0-android -p:TargetFramework=net8.0-android -p:ExtraDefineConstants=TEST_MODE #-p:AndroidEnableProfiler=true
dotnet build -t:Run -c Debug -f net8.0-android -p:TargetFramework=net8.0-android -p:BuildFor=android -p:ExtraDefineConstants=TEST_MODE #-p:AndroidEnableProfiler=true
11 changes: 5 additions & 6 deletions LiftLog.Ui/Shared/Presentation/PotentialSetCounter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,12 @@
private string? RepCountToStartClass => ToStartNext ? "" : null;


private void OnPointerDown(PointerEventArgs args){
private async void OnPointerDown(PointerEventArgs args){
_lastPointerDownTime = DateTime.Now;
Task.Delay(500).ContinueWith(_ => {
if (_lastPointerDownTime is null || _lastPointerDownTime.Value.AddMilliseconds(500) > DateTime.Now) return;
_clearRepCountTime = DateTime.Now;
ClearRepCount();
});
await Task.Delay(500);
if (_lastPointerDownTime is null || _lastPointerDownTime.Value.AddMilliseconds(500) > DateTime.Now) return;
_clearRepCountTime = DateTime.Now;
ClearRepCount();
}

protected override async Task OnAfterRenderAsync(bool firstRender)
Expand Down
4 changes: 2 additions & 2 deletions LiftLog.Ui/Shared/Smart/Tips/HoldingRepCounterTip.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
CycleRepCount=@(() => CycleRepCountForSet())
ClearRepCount=@(() => ClearRepCountForSet())
UpdateWeight=@((_)=>{})
ToStartNext=false />
ToStartNext=@(set.Set is null) />
</div>
@code{
private PotentialSet set = new PotentialSet(new RecordedSet(8, TimeOnly.MinValue), 10m);
Expand All @@ -33,7 +33,7 @@
private void ClearRepCountForSet()
{
set = set with { Set = null };
StateHasChanged();
InvokeAsync(StateHasChanged);
}


Expand Down

0 comments on commit 5c23536

Please sign in to comment.