Skip to content

Commit

Permalink
Merge pull request #4 from Specter-13/doc-improvement
Browse files Browse the repository at this point in the history
improve doc, added refresh functionality on application wake up
  • Loading branch information
Specter-13 authored Apr 20, 2023
2 parents b1868ce + 2b5fae0 commit 0cd2dab
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Basic demonstration video: https://youtu.be/daTTTE8QJ0o
| Android | <span style="color:green">yes</span> |
| Windows | <span style="color:green">yes</span> |
| IOS | ? (need testing) |
| MacCatalysts | ? (need testing) |
| MacCatalyst | ? (need testing) |

I don't have access to Mac build tools, therefore IOS/MacOS is untested, but in theory it should work. If anyone would be willing to test it, I would deeply appreciate it.

## Features
---

### Kimai features

- Timesheet management (start, stop, delete, recent, all)
Expand All @@ -46,11 +46,12 @@ I don't have access to Mac build tools, therefore IOS/MacOS is untested, but in
- Graphs by [LiveCharts2](https://github.com/beto-rodriguez/LiveCharts2)

## Limitations
---

- **Kimai v2 is not supported yet**
- There are some inconsistencies within in app dark/light theme changing
- No support for management of project/customers/teams within app
- Missing support for teams management and team reports
- Missing team reports
- Missing offline time-tracking

## Installation
---
Expand Down
2 changes: 1 addition & 1 deletion src/MauiForKimai.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private void OnSettingsPropertyChanged(object sender, PropertyChangedEventArgs e

}

private void SetThemeOnStartup()
private void SetThemeOnStartup()
{
int value = Preferences.Default.Get("mfk_default_theme",-1);
if (value != -1)
Expand Down
15 changes: 14 additions & 1 deletion src/MauiForKimai.App/ViewModels/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public HomeViewModel(IRoutingService rs,

}

public override async Task OnApplicationResume()
{
await Refresh();
}

private async Task FirstStartUp()
{
Expand Down Expand Up @@ -87,6 +91,8 @@ private void RegisterMessages()

[ObservableProperty]
string selectedActivity;
[ObservableProperty]
bool isActivityStarting;

private async Task StartTimesheet(TimesheetModel model)
{
Expand All @@ -98,6 +104,7 @@ private async Task StartTimesheet(TimesheetModel model)

try
{
IsActivityStarting = true;
var form = model.ToTimesheetEditForm(LoginContext.TimetrackingPermissions, LoginContext.TimeOffset);
var timesheet = await timesheetService.Create(form);

Expand All @@ -114,7 +121,7 @@ private async Task StartTimesheet(TimesheetModel model)
}
else
{
MyTimer.TimerStart();
//MyTimer.TimerStart();
IsTimetrackingActive = true;
var activeTimesheet = (await timesheetService.GetActive()).FirstOrDefault();
if(activeTimesheet == null)
Expand All @@ -124,8 +131,10 @@ private async Task StartTimesheet(TimesheetModel model)
}
ActiveTimesheet = activeTimesheet.ToTimesheetActiveModel();
SelectedActivity = ActiveTimesheet.ActivityName;
MyTimer.TimerStartExisting(ActiveTimesheet.Duration);
await Toast.Make($"Activity {SelectedActivity} started successfully", ToastDuration.Short, 14).Show();
}
IsActivityStarting = false;

}
catch (KimaiApiException)
Expand All @@ -142,6 +151,10 @@ public override async Task Initialize()
IsBusy = true;
await LoginToDefault();
IsBusy = false;
if(IsTimetrackingActive)
{
await Refresh();
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ async Task Delete()

//notify and navigate back
IsLoggedToThisServer = false;

await ReinitializeDatabases();
WeakReferenceMessenger.Default.Send(new ServerRefreshMessage(string.Empty));
await Navigation.NavigateTo("..");

Expand Down
15 changes: 15 additions & 0 deletions src/MauiForKimai.App/Views/HomeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,23 @@
TextColor="Green"
VerticalTextAlignment="Center" />

</Border>

<Border
Grid.Row="1"
IsVisible="{Binding IsActivityStarting}"
Style="{StaticResource InfoBar}"
VerticalOptions="End">

<Label
HorizontalTextAlignment="Center"
Style="{StaticResource MicroLabel}"
Text="Activity is starting..."
TextColor="Green"
VerticalTextAlignment="Center" />

</Border>

<Border
x:Name="SwipeMenu"
Grid.Row="2"
Expand Down
7 changes: 0 additions & 7 deletions src/MauiForKimai.App/Views/HomeView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ public HomeView(HomeViewModel vm)
_vm = vm;
BindingContext = _vm;
}

// protected override async void OnAppearing()
// {
//await _vm.TryToLoginToDefaultServer();
// base.OnAppearing();
// }



private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
Expand Down
1 change: 0 additions & 1 deletion src/MauiForKimai.App/Wrappers/TimerWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public void TimerStartExisting(double duration)
}
private void CreateTimer()
{
//Application.Current.Dispatcher.C
_timer = _dispatcherWrapper.CreateTimer();
_timer.Interval = TimeSpan.FromSeconds(1);
_timer.Tick += (s, e) =>
Expand Down

0 comments on commit 0cd2dab

Please sign in to comment.