Skip to content

Commit e133234

Browse files
committed
Start fixing
1 parent 62a033f commit e133234

35 files changed

+1745
-49
lines changed

Shiny.sln

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,20 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Firebase.Messaging.iO
112112
EndProject
113113
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Ble.SetupAccessory", "src\Shiny.Ble.SetupAccessory\Shiny.Ble.SetupAccessory.csproj", "{117DC567-07E2-47BB-A8D8-65ED6C362DF8}"
114114
EndProject
115+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Health", "src\Shiny.Health\Shiny.Health.csproj", "{1BC12AA3-35AC-409A-ADDE-BB67D306BB4D}"
116+
EndProject
117+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Extensions.Configuration.Remote", "src\Shiny.Extensions.Configuration.Remote\Shiny.Extensions.Configuration.Remote.csproj", "{AA568F92-C206-4C2C-BACF-1FA96E51586D}"
118+
EndProject
119+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Extensions.Configuration.Remote.Maui", "src\Shiny.Extensions.Configuration.Remote.Maui\Shiny.Extensions.Configuration.Remote.Maui.csproj", "{42E410C7-4711-47EC-A3A8-97ED2D8C2EAD}"
120+
EndProject
121+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shiny.Support.Reactive", "src\Shiny.Support.Reactive\Shiny.Support.Reactive.csproj", "{AD01E72B-B53F-4E9A-83F1-F304840F830E}"
122+
EndProject
123+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "configuration", "configuration", "{22C27462-5443-4E10-BB44-8A6BEABCF739}"
124+
EndProject
125+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "notifications", "notifications", "{8F8821B3-EE5E-4E64-9696-98A97CD0EB49}"
126+
EndProject
127+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "support", "support", "{F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1}"
128+
EndProject
115129
Global
116130
GlobalSection(SolutionConfigurationPlatforms) = preSolution
117131
Debug|Any CPU = Debug|Any CPU
@@ -233,6 +247,22 @@ Global
233247
{117DC567-07E2-47BB-A8D8-65ED6C362DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
234248
{117DC567-07E2-47BB-A8D8-65ED6C362DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
235249
{117DC567-07E2-47BB-A8D8-65ED6C362DF8}.Release|Any CPU.Build.0 = Release|Any CPU
250+
{1BC12AA3-35AC-409A-ADDE-BB67D306BB4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
251+
{1BC12AA3-35AC-409A-ADDE-BB67D306BB4D}.Debug|Any CPU.Build.0 = Debug|Any CPU
252+
{1BC12AA3-35AC-409A-ADDE-BB67D306BB4D}.Release|Any CPU.ActiveCfg = Release|Any CPU
253+
{1BC12AA3-35AC-409A-ADDE-BB67D306BB4D}.Release|Any CPU.Build.0 = Release|Any CPU
254+
{AA568F92-C206-4C2C-BACF-1FA96E51586D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
255+
{AA568F92-C206-4C2C-BACF-1FA96E51586D}.Debug|Any CPU.Build.0 = Debug|Any CPU
256+
{AA568F92-C206-4C2C-BACF-1FA96E51586D}.Release|Any CPU.ActiveCfg = Release|Any CPU
257+
{AA568F92-C206-4C2C-BACF-1FA96E51586D}.Release|Any CPU.Build.0 = Release|Any CPU
258+
{42E410C7-4711-47EC-A3A8-97ED2D8C2EAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
259+
{42E410C7-4711-47EC-A3A8-97ED2D8C2EAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
260+
{42E410C7-4711-47EC-A3A8-97ED2D8C2EAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
261+
{42E410C7-4711-47EC-A3A8-97ED2D8C2EAD}.Release|Any CPU.Build.0 = Release|Any CPU
262+
{AD01E72B-B53F-4E9A-83F1-F304840F830E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
263+
{AD01E72B-B53F-4E9A-83F1-F304840F830E}.Debug|Any CPU.Build.0 = Debug|Any CPU
264+
{AD01E72B-B53F-4E9A-83F1-F304840F830E}.Release|Any CPU.ActiveCfg = Release|Any CPU
265+
{AD01E72B-B53F-4E9A-83F1-F304840F830E}.Release|Any CPU.Build.0 = Release|Any CPU
236266
EndGlobalSection
237267
GlobalSection(SolutionProperties) = preSolution
238268
HideSolutionNode = FALSE
@@ -246,28 +276,35 @@ Global
246276
{069AE9CC-9793-4E3A-ACBE-4763325527D8} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
247277
{53833B4E-C3FD-4DEC-A8D6-6E8E17603A87} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
248278
{1601A59D-B2E0-4BCF-98BF-BE74FAA11C13} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
249-
{8D6035EC-A59B-4531-998F-F5D955B057F6} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
250279
{B0B23E85-0DAB-4723-9690-44EB14F6321D} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
251280
{F3A15C34-EBBD-439E-9AFE-D78FF1FDBB60} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
252-
{61751BE5-2EA0-43CF-A271-8DE24E934080} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
253-
{F80BF383-347B-492D-87D2-D566D80AFFC7} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
254-
{A4FAACE2-CE11-415C-8886-97A9A52FB35C} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
255281
{DA452A0B-08F8-4809-95F4-9CD583F30FEA} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
256-
{47A57CFE-A1A8-407A-86FA-FA003D562C58} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
257282
{B145321D-8E33-4A33-B5CF-37A162C0E261} = {7C114E37-36C8-4971-91C6-E2557DDCB4E8}
258283
{2E4505D4-B9B3-4836-A0F8-37BA72025D3D} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
259284
{3A8077E2-E4BE-47FE-A08D-7ABFDE28961A} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
260-
{2DB017C9-BB62-4FF5-8832-38B9DF0E847E} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
261-
{9FE27436-643D-4EDF-AF4A-F0770CD0AEB3} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
262-
{A7717BEB-CF3C-4CAB-8826-FD3848CCBE95} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
263285
{6084D6FA-765E-4AE2-A29E-3FE9DFC4A5FC} = {7C114E37-36C8-4971-91C6-E2557DDCB4E8}
264286
{88774A33-08F5-4AA1-A77C-A7ED2CFFDE51} = {7C114E37-36C8-4971-91C6-E2557DDCB4E8}
265287
{C21631E7-A789-4DF8-B83F-03D6A07B57B4} = {7C114E37-36C8-4971-91C6-E2557DDCB4E8}
266288
{4B31F220-D152-40A7-8D0F-2FABA7C3926C} = {7C114E37-36C8-4971-91C6-E2557DDCB4E8}
267-
{A44BB6F8-283F-4FD7-9955-41B6B515AC98} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
268-
{95304E51-AD99-41EA-A007-16F6FDCEC779} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
269-
{F7E69503-E920-4E1E-8F7C-358DD7982738} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
270289
{117DC567-07E2-47BB-A8D8-65ED6C362DF8} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
290+
{1BC12AA3-35AC-409A-ADDE-BB67D306BB4D} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
291+
{22C27462-5443-4E10-BB44-8A6BEABCF739} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
292+
{61751BE5-2EA0-43CF-A271-8DE24E934080} = {22C27462-5443-4E10-BB44-8A6BEABCF739}
293+
{AA568F92-C206-4C2C-BACF-1FA96E51586D} = {22C27462-5443-4E10-BB44-8A6BEABCF739}
294+
{42E410C7-4711-47EC-A3A8-97ED2D8C2EAD} = {22C27462-5443-4E10-BB44-8A6BEABCF739}
295+
{8F8821B3-EE5E-4E64-9696-98A97CD0EB49} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
296+
{8D6035EC-A59B-4531-998F-F5D955B057F6} = {8F8821B3-EE5E-4E64-9696-98A97CD0EB49}
297+
{A4FAACE2-CE11-415C-8886-97A9A52FB35C} = {8F8821B3-EE5E-4E64-9696-98A97CD0EB49}
298+
{F80BF383-347B-492D-87D2-D566D80AFFC7} = {8F8821B3-EE5E-4E64-9696-98A97CD0EB49}
299+
{A7717BEB-CF3C-4CAB-8826-FD3848CCBE95} = {8F8821B3-EE5E-4E64-9696-98A97CD0EB49}
300+
{F7E69503-E920-4E1E-8F7C-358DD7982738} = {8F8821B3-EE5E-4E64-9696-98A97CD0EB49}
301+
{95304E51-AD99-41EA-A007-16F6FDCEC779} = {8F8821B3-EE5E-4E64-9696-98A97CD0EB49}
302+
{F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1} = {6374E4D9-1BD8-4880-B603-AFDEA8345D7E}
303+
{A44BB6F8-283F-4FD7-9955-41B6B515AC98} = {F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1}
304+
{2DB017C9-BB62-4FF5-8832-38B9DF0E847E} = {F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1}
305+
{9FE27436-643D-4EDF-AF4A-F0770CD0AEB3} = {F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1}
306+
{AD01E72B-B53F-4E9A-83F1-F304840F830E} = {F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1}
307+
{47A57CFE-A1A8-407A-86FA-FA003D562C58} = {F7AD08AA-DE04-4A88-AD31-C5BA3A4751A1}
271308
EndGlobalSection
272309
GlobalSection(ExtensibilityGlobals) = postSolution
273310
SolutionGuid = {135D86AF-4EC4-4AA0-BD06-75C410F3EA08}

samples/Directory.build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<MauiVersion>8.0.40</MauiVersion>
4-
<MicrosoftExtensionsVersion>8.0.0</MicrosoftExtensionsVersion>
3+
<MauiVersion>9.0.21</MauiVersion>
4+
<MicrosoftExtensionsVersion>9.0.0</MicrosoftExtensionsVersion>
55
</PropertyGroup>
66
</Project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:sample="clr-namespace:Sample"
5+
x:DataType="sample:HealthTestViewModel"
6+
x:Class="Sample.HealthTestPage"
7+
Title="Health Test">
8+
9+
<RefreshView IsRefreshing="{Binding IsBusy}"
10+
Command="{Binding Load}">
11+
12+
<VerticalStackLayout>
13+
<Grid RowDefinitions="Auto, Auto, Auto"
14+
ColumnDefinitions="1*, 3*">
15+
16+
<Label Text="Start"
17+
Grid.Row="0"
18+
Grid.Column="0" />
19+
20+
<DatePicker Date="{Binding Start}"
21+
Grid.Row="0"
22+
Grid.Column="1" />
23+
24+
<Label Text="End"
25+
Grid.Row="1"
26+
Grid.Column="0" />
27+
28+
<DatePicker Date="{Binding End}"
29+
Grid.Row="1"
30+
Grid.Column="1" />
31+
32+
<Button Text="Query"
33+
Command="{Binding Load}"
34+
Grid.Row="2"
35+
Grid.ColumnSpan="2" />
36+
</Grid>
37+
38+
<TableView Intent="Data">
39+
<TableRoot>
40+
<TableSection>
41+
<TextCell Text="Calories (total - kilocalories)"
42+
Detail="{Binding Calories}"
43+
Command="{Binding NavToList}"
44+
CommandParameter="Calories" />
45+
46+
<TextCell Text="Distance (total - meters)"
47+
Detail="{Binding Distance}"
48+
Command="{Binding NavToList}"
49+
CommandParameter="Distance" />
50+
51+
<TextCell Text="Heart Rate (avg)"
52+
Detail="{Binding HeartRate}"
53+
Command="{Binding NavToList}"
54+
CommandParameter="HeartRate" />
55+
56+
<TextCell Text="Steps (total)"
57+
Detail="{Binding Steps}"
58+
Command="{Binding NavToList}"
59+
CommandParameter="StepCount" />
60+
</TableSection>
61+
</TableRoot>
62+
</TableView>
63+
</VerticalStackLayout>
64+
</RefreshView>
65+
</ContentPage>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Sample;
2+
3+
4+
public partial class HealthTestPage : ContentPage
5+
{
6+
public HealthTestPage()
7+
{
8+
this.InitializeComponent();
9+
}
10+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System.Linq;
2+
using Shiny.Health;
3+
4+
namespace Sample;
5+
6+
7+
public class HealthTestViewModel : ViewModel
8+
{
9+
public HealthTestViewModel(
10+
BaseServices services,
11+
IHealthService health
12+
) : base(services)
13+
{
14+
this.Start = DateTime.Now.AddDays(-1).Date;
15+
this.End = this.Start.ToEndOfDay();
16+
17+
this.Load = ReactiveCommand.CreateFromTask(async () =>
18+
{
19+
var result = await health.RequestPermissions(
20+
DataType.Calories,
21+
DataType.Distance,
22+
DataType.HeartRate,
23+
DataType.StepCount
24+
);
25+
//if (!result)
26+
//{
27+
// await this.Dialogs.Alert("Failed permission check");
28+
// return;
29+
//}
30+
31+
if (this.Start < this.End)
32+
{
33+
this.ErrorText = String.Empty;
34+
}
35+
else
36+
{
37+
this.ErrorText = "Start date must be greater than End date";
38+
this.Calories = 0;
39+
this.HeartRate = 0;
40+
this.Distance = 0;
41+
this.Steps = 0;
42+
return;
43+
}
44+
45+
this.Distance = (await health.GetDistances(this.Start, this.End, Interval.Days)).Sum(x => x.Value);
46+
this.Calories = (await health.GetCalories(this.Start, this.End, Interval.Days)).Sum(x => x.Value);
47+
this.Steps = (await health.GetStepCounts(this.Start, this.End, Interval.Days)).Sum(x => x.Value);
48+
this.HeartRate = (await health.GetAverageHeartRate(this.Start, this.End, Interval.Days)).Average(x => x.Value);
49+
});
50+
this.BindBusyCommand(this.Load);
51+
52+
this.NavToList = ReactiveCommand.CreateFromTask(async (string arg) =>
53+
{
54+
var type = Enum.Parse<DataType>(arg);
55+
await this.Navigation.Navigate("ListPage", ("Type", type));
56+
});
57+
}
58+
59+
60+
public override void OnAppearing()
61+
{
62+
base.OnAppearing();
63+
this.Load.Execute(null);
64+
}
65+
66+
public ICommand Load { get; }
67+
public ICommand NavToList { get; }
68+
[Reactive] public DateTimeOffset Start { get; set; }
69+
[Reactive] public DateTimeOffset End { get; set; }
70+
71+
[Reactive] public string? ErrorText { get; private set; }
72+
[Reactive] public double Steps { get; private set; }
73+
[Reactive] public double Calories { get; private set; }
74+
[Reactive] public double Distance { get; private set; }
75+
[Reactive] public double HeartRate { get; private set; }
76+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:sample="clr-namespace:Sample"
5+
xmlns:health="clr-namespace:Shiny.Health;assembly=Shiny.Health"
6+
x:DataType="sample:ListViewModel"
7+
x:Class="Sample.ListPage"
8+
Title="{Binding Title}">
9+
10+
<StackLayout HorizontalOptions="FillAndExpand"
11+
VerticalOptions="FillAndExpand">
12+
13+
<Grid RowDefinitions="Auto, Auto, Auto"
14+
ColumnDefinitions="1*, 2*, 2*">
15+
16+
<Label Text="Start Date"
17+
Grid.Column="0"
18+
Grid.Row="0" />
19+
20+
<DatePicker Date="{Binding DateStart}"
21+
Grid.Column="1"
22+
Grid.Row="0" />
23+
24+
<TimePicker Time="{Binding TimeStart}"
25+
Grid.Column="2"
26+
Grid.Row="0" />
27+
28+
<Label Text="End Date"
29+
Grid.Column="0"
30+
Grid.Row="1" />
31+
32+
<DatePicker Date="{Binding DateEnd}"
33+
Grid.Column="1"
34+
Grid.Row="1" />
35+
36+
<TimePicker Time="{Binding TimeEnd}"
37+
Grid.Column="2"
38+
Grid.Row="1" />
39+
</Grid>
40+
41+
<Button Text="Run Query"
42+
Command="{Binding Load}" />
43+
44+
<CollectionView ItemsSource="{Binding Data}"
45+
HorizontalOptions="FillAndExpand"
46+
VerticalOptions="FillAndExpand">
47+
<CollectionView.EmptyView>
48+
<Label Text="No Items" />
49+
</CollectionView.EmptyView>
50+
51+
<CollectionView.ItemTemplate>
52+
<DataTemplate x:DataType="health:NumericHealthResult">
53+
<StackLayout Padding="0,5">
54+
<StackLayout Orientation="Horizontal" Spacing="5">
55+
<Label FontAttributes="Bold" Text="{Binding Start, StringFormat='{0:MM/dd/yyyy a\\t h:mm tt}'}" />
56+
<Label FontAttributes="Bold" Text="to" />
57+
<Label FontAttributes="Bold" Text="{Binding End, StringFormat='{0:MM/dd/yyyy a\\t h:mm tt}'}" />
58+
</StackLayout>
59+
<Label Text="{Binding Value, StringFormat='Value: {0}'}" />
60+
</StackLayout>
61+
</DataTemplate>
62+
</CollectionView.ItemTemplate>
63+
</CollectionView>
64+
</StackLayout>
65+
</ContentPage>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Sample;
2+
3+
public partial class ListPage : ContentPage
4+
{
5+
public ListPage()
6+
{
7+
InitializeComponent();
8+
}
9+
}

0 commit comments

Comments
 (0)