Skip to content

Commit e967615

Browse files
committed
Merge branch 'master' into v3.0
2 parents 900ba17 + 12d1073 commit e967615

File tree

15 files changed

+135
-146
lines changed

15 files changed

+135
-146
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ body:
9292
options:
9393
- label: I have supplied a reproducible sample that is NOT FROM THE SHINY SAMPLES!
9494
required: true
95-
- label: I am a Sponsor OR I am using the LATEST stable/beta version from nuget (v3.0 stable - ALPHAS are not taking issues - Sponsors: I'll still take v2 issues for you')
95+
- label: I am a Sponsor OR I am using the LATEST stable/beta version from nuget (v3.0 stable - ALPHAS are not taking issues - Sponsors can still send v2 issues)
9696
required: true
9797
- label: I am Sponsor OR My GitHub account is 30+ days old
9898
required: true

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ jobs:
4040
fetch-depth: 0
4141

4242
- name: Setup .NET 7.0
43-
uses: actions/setup-dotnet@v1
43+
uses: actions/setup-dotnet@v3
4444
with:
45-
dotnet-version: '7.0.307'
45+
dotnet-version: '7.0.x'
46+
# dotnet-quality: 'preview'
4647

4748
- name: Add .NET Workloads
4849
run: dotnet workload install maui-ios maui-android maui-maccatalyst maui-windows

build/Tasks/Library/BuildTask.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public override void Run(BuildContext context)
2121
//context.MSBuild("Shiny.sln", x => x
2222
context.MSBuild("Build.slnf", x => x
2323
.WithRestore()
24+
//.SetMSBuildPlatform(MSBuildPlatform.Automatic)
25+
//.UseToolVersion(MSBuildToolVersion.VS2022)
26+
//.UseToolVersion("17.7")
2427
.WithTarget("Clean")
2528
.WithTarget("Build")
2629
.WithProperty("PublicRelease", "true")

src/Shiny.BluetoothLE/IBleManager.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ public interface IBleManager
4242
IObservable<ScanResult> Scan(ScanConfig? scanConfig = null);
4343
}
4444

45-
46-
public record ScanConfig(
47-
/// <summary>
48-
/// Filters scan to peripherals that advertise specified service UUIDs
49-
/// iOS - you must set this to initiate a background scan
50-
/// </summary>
51-
params string[] ServiceUuids
52-
);
53-
54-
55-
public record ScanResult(
56-
IPeripheral Peripheral,
57-
int Rssi,
58-
IAdvertisementData AdvertisementData
59-
);
60-
61-
6245
//IObservable<IPeripheral> WhenPeripheralStatusChanged();
6346
//IObservable<AccessState> WhenStatusChanged()
6447
// this really needs to be handled by a delegate because that's where the status changes, user should still call RequestAccess or trap when it fails starting a scan operation

src/Shiny.BluetoothLE/IPeripheral.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,6 @@
55
namespace Shiny.BluetoothLE;
66

77

8-
public record BleServiceInfo(string Uuid);
9-
10-
public record BleCharacteristicInfo(
11-
BleServiceInfo Service,
12-
string Uuid,
13-
bool IsNotifying,
14-
CharacteristicProperties Properties
15-
);
16-
17-
public record BleDescriptorInfo(
18-
BleCharacteristicInfo Characteristic,
19-
string Uuid
20-
);
21-
22-
public record BleCharacteristicResult(
23-
BleCharacteristicInfo Characteristic,
24-
BleCharacteristicEvent Event,
25-
byte[]? Data
26-
);
27-
28-
public enum BleCharacteristicEvent
29-
{
30-
Read,
31-
Write,
32-
WriteWithoutResponse,
33-
Notification
34-
}
35-
36-
public record BleDescriptorResult(
37-
BleDescriptorInfo Descriptor,
38-
byte[]? Data
39-
);
40-
418
public interface IPeripheral
429
{
4310
string Uuid { get; }

src/Shiny.BluetoothLE/Models.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace Shiny.BluetoothLE;
2+
3+
4+
public record ScanConfig(
5+
/// <summary>
6+
/// Filters scan to peripherals that advertise specified service UUIDs
7+
/// iOS - you must set this to initiate a background scan
8+
/// </summary>
9+
params string[] ServiceUuids
10+
);
11+
12+
13+
public record ScanResult(
14+
IPeripheral Peripheral,
15+
int Rssi,
16+
IAdvertisementData AdvertisementData
17+
);
18+
19+
20+
public record BleServiceInfo(string Uuid);
21+
22+
23+
public record BleCharacteristicInfo(
24+
BleServiceInfo Service,
25+
string Uuid,
26+
bool IsNotifying,
27+
CharacteristicProperties Properties
28+
);
29+
30+
31+
public record BleDescriptorInfo(
32+
BleCharacteristicInfo Characteristic,
33+
string Uuid
34+
);
35+
36+
37+
public record BleCharacteristicResult(
38+
BleCharacteristicInfo Characteristic,
39+
BleCharacteristicEvent Event,
40+
byte[]? Data
41+
);
42+
43+
44+
public enum BleCharacteristicEvent
45+
{
46+
Read,
47+
Write,
48+
WriteWithoutResponse,
49+
Notification
50+
}
51+
52+
53+
public record BleDescriptorResult(
54+
BleDescriptorInfo Descriptor,
55+
byte[]? Data
56+
);

src/Shiny.Core/Shiny.Core.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
<RootNamespace>Shiny</RootNamespace>
88
</PropertyGroup>
99

10-
<ItemGroup>
11-
<None Remove="Reflection\" />
12-
</ItemGroup>
1310
<ItemGroup>
1411
<None Include="Shiny.Core.targets" Pack="True" PackagePath="buildTransitive" />
1512
<PackageReference Include="System.Reactive" Version="6.0.0" />
@@ -27,8 +24,5 @@
2724
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="2.5.1.1" />
2825
</ItemGroup>
2926

30-
<ItemGroup>
31-
<Folder Include="Reflection\" />
32-
</ItemGroup>
3327
<Import Project="Sdk.targets" Sdk="MSBuild.Sdk.Extras" Version="$(MSBuildSdkExtrasVersion)" Condition="'$(UseMSBuild)' == 'true'" />
3428
</Project>

src/Shiny.Core/ShinySubject.cs

Lines changed: 16 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Reactive.Disposables;
5+
using System.Reactive.Linq;
46
using System.Reactive.Subjects;
57
using Microsoft.Extensions.Logging;
68

@@ -15,56 +17,36 @@ public class ShinySubject<T> : ISubject<T>
1517
public ILogger? Logger { get; set; }
1618

1719

18-
public void OnCompleted()
19-
{
20-
foreach (var observer in this.observers)
21-
{
22-
try
23-
{
24-
observer.OnCompleted();
25-
}
26-
catch (Exception ex)
27-
{
28-
this.Logger?.LogWarning(ex, "ShinySubject OnCompleted error on observer");
29-
}
30-
}
31-
}
20+
public void OnCompleted() => this.Pub(x => x.OnCompleted(), "OnCompleted error on observer");
21+
public void OnError(Exception error) => this.Pub(x => x.OnError(error), "OnError error on observer");
22+
public void OnNext(T value) => this.Pub(x => x.OnNext(value), "OnNext error on observer");
3223

3324

34-
public void OnError(Exception error)
25+
protected virtual void Pub(Action<IObserver<T>> action, string errorDescription)
3526
{
36-
foreach (var observer in this.observers)
37-
{
38-
try
39-
{
40-
observer.OnError(error);
41-
}
42-
catch (Exception ex)
43-
{
44-
this.Logger?.LogWarning(ex, "ShinySubject OnError error on observer");
45-
}
46-
}
47-
}
48-
27+
List<IObserver<T>> copy;
28+
lock (this.observers)
29+
copy = this.observers.ToList();
4930

50-
public void OnNext(T value)
51-
{
52-
foreach (var observer in this.observers)
31+
foreach (var observer in copy)
5332
{
5433
try
5534
{
56-
observer.OnNext(value);
35+
action(observer);
5736
}
5837
catch (Exception ex)
5938
{
60-
this.Logger?.LogWarning(ex, "ShinySubject OnNext error on observer");
39+
this.Logger?.LogWarning(ex, errorDescription);
6140
}
6241
}
6342
}
6443

44+
6545
public IDisposable Subscribe(IObserver<T> observer)
6646
{
67-
this.observers.Add(observer);
47+
lock (this.observers)
48+
this.observers.Add(observer);
49+
6850
return Disposable.Create(() => this.observers.Remove(observer));
6951
}
7052
}

src/Shiny.Hosting.Maui/Shiny.Hosting.Maui.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
<ImplicitUsings>enable</ImplicitUsings>
88
</PropertyGroup>
99

10-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
11-
<CreatePackage>false</CreatePackage>
12-
</PropertyGroup>
13-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-ios|AnyCPU'">
14-
<CreatePackage>false</CreatePackage>
15-
</PropertyGroup>
1610
<ItemGroup>
1711
<ProjectReference Include="..\Shiny.Core\Shiny.Core.csproj" />
1812
</ItemGroup>

src/Shiny.Push.FirebaseMessaging/Platforms/iOS/FirebasePushProvider.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4-
using System.Threading;
54
using System.Threading.Tasks;
65
using Firebase.CloudMessaging;
76
using Firebase.Core;
@@ -13,16 +12,13 @@ namespace Shiny.Push;
1312

1413
public class FirebasePushProvider : NotifyPropertyChanged, IPushProvider, IPushTagSupport
1514
{
16-
readonly ILogger logger;
1715
readonly FirebaseConfiguration config;
1816

1917

2018
public FirebasePushProvider(
21-
ILogger<FirebasePushProvider> logger,
2219
FirebaseConfiguration config
2320
)
2421
{
25-
this.logger = logger;
2622
this.config = config;
2723
}
2824

0 commit comments

Comments
 (0)