Merge branch 'dotnet-7' into sdk-containers
This commit is contained in:
Коммит
ce1005e03f
|
@ -21,9 +21,4 @@ public partial class App : Application
|
|||
Routing.RegisterRoute(nameof(CategoriesPage), typeof(CategoriesPage));
|
||||
Routing.RegisterRoute(nameof(CategoryPage), typeof(CategoryPage));
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState activationState)
|
||||
{
|
||||
return new MauiWindow(MainPage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,6 @@ public static class Config
|
|||
|
||||
public static string BaseWeb = $"{Base}:5002/";
|
||||
public static string Base = DeviceInfo.Platform == DevicePlatform.Android ? "http://10.0.2.2" : "http://localhost";
|
||||
public static string APIUrl = $"{Base}:5000/v1/";
|
||||
public static string APIUrl = $"{Base}:5000/";
|
||||
public static string ListenTogetherUrl = $"{Base}:5001/listentogether";
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
Margin="32"
|
||||
HorizontalOptions="Center"
|
||||
FontAttributes="Bold"
|
||||
FontSize="{OnPlatform UWP=24, Android=14,iOS=14}"
|
||||
FontSize="{OnPlatform WinUI=24, Android=14,iOS=14}"
|
||||
Style="{StaticResource H5LabelStyle}" />
|
||||
<Grid.GestureRecognizers>
|
||||
<TapGestureRecognizer Command="{Binding SelectedCommand, Source={RelativeSource AncestorType={x:Type viewmodels:CategoriesViewModel}}}"
|
||||
|
|
|
@ -17,6 +17,7 @@ public partial class DiscoverPage : ContentPage
|
|||
await viewModel.InitializeAsync();
|
||||
}
|
||||
|
||||
|
||||
protected override void OnDisappearing()
|
||||
{
|
||||
player.OnDisappearing();
|
||||
|
|
|
@ -14,6 +14,7 @@ public class ShowsService
|
|||
public ShowsService(ListenLaterService listenLaterService)
|
||||
{
|
||||
this.httpClient = new HttpClient() { BaseAddress = new Uri(Config.APIUrl) };
|
||||
httpClient.DefaultRequestHeaders.Add("api-version", "1.0");
|
||||
this.listenLaterService = listenLaterService;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,16 @@ public partial class DiscoverViewModel : ViewModelBase
|
|||
|
||||
internal async Task InitializeAsync()
|
||||
{
|
||||
await FetchAsync();
|
||||
//Delay on first load until window loads
|
||||
await Task.Delay(1000);
|
||||
await FetchAsync();
|
||||
}
|
||||
|
||||
private async Task FetchAsync()
|
||||
{
|
||||
if(shows?.Any() ?? false)
|
||||
return;
|
||||
|
||||
var podcastsModels = await showsService.GetShowsAsync();
|
||||
|
||||
if (podcastsModels == null)
|
||||
|
|
|
@ -24,6 +24,7 @@ public static class MauiProgram
|
|||
builder.Services.AddHttpClient<PodcastService>(client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(APIUrl);
|
||||
client.DefaultRequestHeaders.Add("api-version", "1.0");
|
||||
});
|
||||
|
||||
#if WINDOWS
|
||||
|
|
|
@ -15,6 +15,6 @@ public class EpisodesHttpClient : IEpisodesClient
|
|||
|
||||
public async Task<Episode> GetEpisodeByIdAsync(Guid episodeId, CancellationToken cancellationToken)
|
||||
{
|
||||
return (await _httpClient.GetFromJsonAsync<Episode>($"v1/episodes/{episodeId}", cancellationToken))!;
|
||||
return (await _httpClient.GetFromJsonAsync<Episode>($"episodes/{episodeId}", cancellationToken))!;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ namespace ListenTogether.Infrastructure
|
|||
serviceCollection.AddHttpClient<IEpisodesClient, EpisodesHttpClient>(opt =>
|
||||
{
|
||||
opt.BaseAddress = new Uri(configuration["NetPodcastApi:BaseAddress"]);
|
||||
opt.DefaultRequestHeaders.Add("api-version", "1.0");
|
||||
});
|
||||
|
||||
return serviceCollection;
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.4.0-beta.2" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9.8" />
|
||||
<PackageReference Include="OpenTelemetry.Extensions" Version="1.0.0-beta.3" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.8" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.0.0-alpha.1" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.3" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc9.8" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.1.0-alpha.1" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.8" />
|
||||
<PackageReference Include="OpenTelemetry.Instrumentation.EventCounters" Version="1.0.0-alpha.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -10,7 +10,7 @@ public static class CategoriesApi
|
|||
{
|
||||
public static RouteGroupBuilder MapCategoriesApi(this RouteGroupBuilder group)
|
||||
{
|
||||
group.MapPost("/", GetAllCategories);
|
||||
group.MapGet("/", GetAllCategories).WithName("GetCategories");
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ public static class EpisodesApi
|
|||
{
|
||||
public static RouteGroupBuilder MapEpisodesApi(this RouteGroupBuilder group)
|
||||
{
|
||||
group.MapPost("/{id}", GetEpisodeById);
|
||||
group.MapGet("/{id}", GetEpisodeById).WithName("GetEpisodeById");
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ using Podcast.Infrastructure.Data;
|
|||
using Podcast.Infrastructure.Data.Models;
|
||||
using Podcast.Infrastructure.Http.Feeds;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
|
||||
namespace Podcast.API.Routes;
|
||||
|
||||
|
@ -13,10 +14,16 @@ public static class FeedsApi
|
|||
{
|
||||
public static RouteGroupBuilder MapFeedsApi(this RouteGroupBuilder group)
|
||||
{
|
||||
group.MapPost("/", CreateFeed);
|
||||
group.MapGet("/", GetAllFeeds);
|
||||
group.MapPut("/{id}", UpdateFeed).RequireAuthorization().AddOpenApiSecurityRequirement();
|
||||
group.MapDelete("/{id}", DeleteFeed).RequireAuthorization().AddOpenApiSecurityRequirement();
|
||||
group.MapPost("/", CreateFeed).WithName("CreateFeed");
|
||||
group.MapGet("/", GetAllFeeds).WithName("GetFeeds");
|
||||
group.MapPut("/{id}", UpdateFeed)
|
||||
.RequireAuthorization("modify_feeds")
|
||||
.AddOpenApiSecurityRequirement()
|
||||
.WithName("UpdateFeedById");
|
||||
group.MapDelete("/{id}", DeleteFeed)
|
||||
.RequireAuthorization("modify_feeds")
|
||||
.AddOpenApiSecurityRequirement()
|
||||
.WithName("DeleteFeedById");
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ public static class ShowsApi
|
|||
{
|
||||
public static RouteGroupBuilder MapShowsApi(this RouteGroupBuilder group)
|
||||
{
|
||||
group.MapGet("/", GetAllShows);
|
||||
group.MapGet("/{id}", GetShowById);
|
||||
group.MapGet("/", GetAllShows).WithName("GetShows");
|
||||
group.MapGet("/{id}", GetShowById).WithName("GetShowsById");
|
||||
return group;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"PodcastDb": "",
|
||||
"PodcastDb": "Server=localhost, 5433;Database=Podcast;User Id=sa;Password=Pass@word",
|
||||
"FeedQueue": "UseDevelopmentStorage=true"
|
||||
},
|
||||
"Authentication": {
|
||||
|
@ -17,7 +17,8 @@
|
|||
"http://localhost:56906",
|
||||
"https://localhost:44385",
|
||||
"https://localhost:5001",
|
||||
"http://localhost:5000"
|
||||
"http://localhost:5000",
|
||||
"1ba2c41d-3a54-414a-9700-1f9393cfafca"
|
||||
],
|
||||
"ValidIssuer": "dotnet-user-jwts"
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
|||
builder.Services.AddHttpClient<PodcastService>(
|
||||
client => {
|
||||
client.BaseAddress = new Uri(builder.Configuration["PodcastApi:BaseAddress"]!);
|
||||
client.DefaultRequestHeaders.Add("api-supported-versions", "1.0,2.0");
|
||||
client.DefaultRequestHeaders.Add("api-version", "1.0");
|
||||
});
|
||||
builder.Services.AddScoped<ThemeInterop>();
|
||||
builder.Services.AddScoped<IAudioInterop, AudioInterop>();
|
||||
|
|
|
@ -128,21 +128,27 @@
|
|||
{
|
||||
isRoomHost = true;
|
||||
roomCode = room.Code;
|
||||
await OnJoinRoom.InvokeAsync(room.Code);
|
||||
await OnRoomCreated.InvokeAsync();
|
||||
await InvokeAsync(async () =>
|
||||
{
|
||||
await OnJoinRoom.InvokeAsync(room.Code);
|
||||
await OnRoomCreated.InvokeAsync();
|
||||
});
|
||||
}
|
||||
|
||||
private async void OnRoomUpdated(Room room)
|
||||
{
|
||||
if (currentRoom == null && !isRoomHost)
|
||||
await InvokeAsync(async () =>
|
||||
{
|
||||
await SetPlayerState(room);
|
||||
}
|
||||
currentRoom = room;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
if (currentRoom == null && !isRoomHost)
|
||||
{
|
||||
await SetPlayerState(room);
|
||||
}
|
||||
currentRoom = room;
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
private async void OnPlayerStateUpdated(Room room) => await SetPlayerState(room);
|
||||
private async void OnPlayerStateUpdated(Room room) => await InvokeAsync(() => SetPlayerState(room));
|
||||
|
||||
private async Task SetPlayerState(Room room)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче