-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update service for smalltalk api
- Loading branch information
1 parent
15a1906
commit 0803488
Showing
17 changed files
with
287 additions
and
46 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
...obileApps/Small-Talk/O2NextGen.SmallTalk/O2NextGen.SmallTalk/Controls/ExtendedListView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using O2NextGen.SmallTalk.Core.ViewModels; | ||
using System; | ||
using System.Linq; | ||
using Xamarin.Forms; | ||
|
||
namespace O2NextGen.SmallTalk.Core.Controls | ||
{ | ||
public class ExtendedListView : ListView | ||
{ | ||
public ExtendedListView() : this(ListViewCachingStrategy.RecycleElement) | ||
{ | ||
} | ||
|
||
public ExtendedListView(ListViewCachingStrategy cachingStrategy) : base(cachingStrategy) | ||
{ | ||
//this.ItemAppearing += OnItemAppearing; | ||
this.PropertyChanged += ExtendedListView_PropertyChanged; | ||
} | ||
|
||
private void ExtendedListView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) | ||
{ | ||
if (this.BindingContext == null) | ||
return; | ||
var context = this.BindingContext as ChatDetailViewModel; | ||
if (context.Messages == null) return; | ||
//GET SCROLL CURRENT POSITION HERE! | ||
var target = context.Messages[context.Messages.Count - 1]; | ||
|
||
ScrollTo(target, ScrollToPosition.End, true); | ||
} | ||
|
||
//private void OnItemAppearing(object sender, ItemVisibilityEventArgs e) | ||
//{ | ||
// if (ItemAppearingCommand != null) | ||
// { | ||
// ItemAppearingCommand?.Execute(e.Item); | ||
// } | ||
//} | ||
public void ScrollToLast() | ||
{ | ||
Device.BeginInvokeOnMainThread(() => | ||
{ | ||
try | ||
{ | ||
if (ItemsSource != null && ItemsSource.Cast<object>().Count() > 0) | ||
{ | ||
var msg = ItemsSource.Cast<object>().LastOrDefault(); | ||
if (msg != null) | ||
{ | ||
ScrollTo(msg, ScrollToPosition.End, false); | ||
} | ||
} | ||
} | ||
catch (Exception ex) | ||
{ | ||
System.Diagnostics.Debug.WriteLine(ex.ToString()); | ||
} | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Services/smalltalk/O2NextGen.SmallTalk.Api/.config/dotnet-tools.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-ef": { | ||
"version": "6.0.3", | ||
"commands": [ | ||
"dotnet-ef" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 24 additions & 21 deletions
45
src/Services/smalltalk/O2NextGen.SmallTalk.Api/O2NextGen.SmallTalk.Api.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<UserSecretsId>3e239bd5-b8d6-455f-8e46-ea4782668914</UserSecretsId> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
<DockerfileContext>..\..\..</DockerfileContext> | ||
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<TargetFramework>netcoreapp2.2</TargetFramework> | ||
<UserSecretsId>3e239bd5-b8d6-455f-8e46-ea4782668914</UserSecretsId> | ||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
<DockerfileContext>..\..\..</DockerfileContext> | ||
<DockerComposeProjectPath>..\..\..\docker-compose.dcproj</DockerComposeProjectPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="wwwroot\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.App" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Http.Polly"> | ||
<Version>2.2.0</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\SDKs\O2NG.Sdk.NetCore\O2NG.Sdk.NetCore.Models\O2NextGen.Sdk.NetCore.Models.csproj" /> | ||
<ProjectReference Include="..\O2NextGen.SmallTalk.Business\O2NextGen.SmallTalk.Business.csproj" /> | ||
<ProjectReference Include="..\O2NextGen.SmallTalk.Data\O2NextGen.SmallTalk.Data.csproj" /> | ||
<ProjectReference Include="..\O2NextGen.SmallTalk.Impl\O2NextGen.SmallTalk.Impl.csproj" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\SDKs\O2NG.Sdk.NetCore\O2NG.Sdk.NetCore.Models\O2NextGen.Sdk.NetCore.Models.csproj" /> | ||
<ProjectReference Include="..\O2NextGen.SmallTalk.Business\O2NextGen.SmallTalk.Business.csproj" /> | ||
<ProjectReference Include="..\O2NextGen.SmallTalk.Data\O2NextGen.SmallTalk.Data.csproj" /> | ||
<ProjectReference Include="..\O2NextGen.SmallTalk.Impl\O2NextGen.SmallTalk.Impl.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
26 changes: 26 additions & 0 deletions
26
src/Services/smalltalk/O2NextGen.SmallTalk.Api/Services/SignalRService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace O2NextGen.SmallTalk.Api.Services | ||
{ | ||
public class SignalRService: ISignalRService | ||
{ | ||
private readonly HttpClient _httpClient; | ||
public SignalRService(HttpClient httpClient) | ||
{ | ||
_httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); | ||
} | ||
|
||
public async Task GetAsync(CancellationToken ct) | ||
{ | ||
await _httpClient.GetAsync($"api/chat", ct); | ||
} | ||
} | ||
|
||
public interface ISignalRService | ||
{ | ||
Task GetAsync(CancellationToken ct); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.