Skip to content

Commit

Permalink
Removed any Reddit API references.
Browse files Browse the repository at this point in the history
  • Loading branch information
kekyo committed Jul 8, 2023
1 parent d349a97 commit 4ae1afe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public sealed class MainWindowViewModel
### Modelの実装例

The Cat APIにアクセスする共通コードは、`EpoxyHello.Core` プロジェクトで実装しています。
このプロジェクトは、WPF・Xamarin Forms・Uno・UWPのいずれにも依存せず、完全に独立しています。
このプロジェクトは、WPF・Xamarin Forms・Avalonia・UWP・WinUI・OpenSilverのいずれにも依存せず、完全に独立しています。

このように、依存性を排除することで、マルチプラットフォーム対応の共通化を行うことが出来ますが、
小規模な開発であれば、`Model`の実装を`ViewModel`と同じプロジェクトに配置してもかまいません
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ public sealed class MainWindowViewModel

### Example of Model implementation

The common code to access Reddit is implemented in the `EpoxyHello.Core` project.
It does not depend on either WPF, Xamarin Forms, Uno and UWP assemblies and is completely independent.
The common code to access The Cat API is implemented in the `EpoxyHello.Core` project.
It does not depend on either WPF, Xamarin Forms, Avalonia, UWP, WinUI and OpenSilver assemblies and is completely independent.

By eliminating dependencies in this way, we can achieve commonality for multi-platform support.
However, for small-scale development, you can place the `Model` implementation in the same project as the `ViewModel` implementation
(separating them eliminates the possibility of unintentional dependencies).

[Image downloader from Reddit post (EpoxyHello.Core)](https://github.com/kekyo/Epoxy/blob/main/samples/EpoxyHello.Core/Models/Reddit.cs#L63):
[Image downloader from The Cat API (EpoxyHello.Core)](https://github.com/kekyo/Epoxy/blob/main/samples/EpoxyHello.Core/Models/TheCatAPI.cs#L55):

```csharp
// Model implementation: The pure netstandard2.0 library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type public MainWindowViewModel() as self =
do self.Items.Clear()

let fetchImageAsync url = async {
let! image = Reddit.FetchImageAsync url
let! image = TheCatAPI.FetchImageAsync url
return new Bitmap(new MemoryStream(image))
}

Expand Down
1 change: 1 addition & 0 deletions playground/EpoxyHello.Core/Models/Reddit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

namespace EpoxyHello.Models;

[Obsolete("Old sample implementation.")]
public static class Reddit
{
private static readonly HttpClient httpClient = new HttpClient();
Expand Down
1 change: 1 addition & 0 deletions playground/EpoxyHello.Core/Models/RedditPost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

namespace EpoxyHello.Models;

[Obsolete("Old sample implementation.")]
public sealed class RedditPost
{
public readonly string Title;
Expand Down

0 comments on commit 4ae1afe

Please sign in to comment.