Skip to content

Commit 2a3f961

Browse files
committed
Make EtoPlatformInterface use LoggingPlatformInterface
1 parent 78a6fb3 commit 2a3f961

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

Refresher.AndroidApp/AndroidPlatformInterface.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public override QuestionResult Ask(string question)
7676

7777
public override void OpenUrl(Uri uri)
7878
{
79+
base.OpenUrl(uri);
80+
7981
Intent browser = new(Intent.ActionView, Android.Net.Uri.Parse(uri.ToString()));
8082
PipelineActivity.Instance.StartActivity(browser);
8183
}

Refresher.AndroidApp/Refresher.AndroidApp.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
<ApplicationId>com.littlebigrefresh.refresher</ApplicationId>
99
<ApplicationVersion>1</ApplicationVersion>
1010
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
11-
12-
<AndroidSdkDirectory>X:\SDKs\Android</AndroidSdkDirectory>
1311
</PropertyGroup>
1412
<ItemGroup>
1513
<ProjectReference Include="..\Refresher.Core\Refresher.Core.csproj" />

Refresher.Core/Pipelines/Steps/ExampleInputStep.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public ExampleInputStep(Pipeline pipeline) : base(pipeline)
1717

1818
public override Task ExecuteAsync(CancellationToken cancellationToken = default)
1919
{
20-
this.Platform.OpenUrl(new Uri("https://lbp.lbpbonsai.com"));
2120
this.Platform.InfoPrompt("Info");
2221
this.Platform.WarnPrompt("Warn");
2322
this.Platform.ErrorPrompt("Error");

Refresher.Core/Platform/LoggingPlatformInterface.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ public virtual void ErrorPrompt(string prompt)
1818
}
1919

2020
public abstract QuestionResult Ask(string question);
21-
public abstract void OpenUrl(Uri uri);
21+
22+
public virtual void OpenUrl(Uri uri)
23+
{
24+
State.Logger.LogInfo(LogType.Platform, $"Opening URL {uri}");
25+
}
2226

2327
public virtual void PrepareThread() {}
2428
public virtual void PrepareStopThread() {}

Refresher/EtoPlatformInterface.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Refresher;
99

10-
public class EtoPlatformInterface : IPlatformInterface
10+
public class EtoPlatformInterface : LoggingPlatformInterface
1111
{
1212
private readonly RefresherForm _form;
1313

@@ -16,34 +16,34 @@ public EtoPlatformInterface(RefresherForm form)
1616
this._form = form;
1717
}
1818

19-
public void InfoPrompt(string prompt)
19+
public override void InfoPrompt(string prompt)
2020
{
21+
base.InfoPrompt(prompt);
2122
Application.Instance.Invoke(() =>
2223
{
23-
State.Logger.LogInfo(Platform, prompt);
2424
MessageBox.Show(this._form, prompt, "Refresher");
2525
});
2626
}
2727

28-
public void WarnPrompt(string prompt)
28+
public override void WarnPrompt(string prompt)
2929
{
30+
base.WarnPrompt(prompt);
3031
Application.Instance.Invoke(() =>
3132
{
32-
State.Logger.LogWarning(Platform, prompt);
3333
MessageBox.Show(this._form, prompt, "Refresher", MessageBoxType.Warning);
3434
});
3535
}
3636

37-
public void ErrorPrompt(string prompt)
37+
public override void ErrorPrompt(string prompt)
3838
{
39+
base.ErrorPrompt(prompt);
3940
Application.Instance.Invoke(() =>
4041
{
41-
State.Logger.LogError(Platform, prompt);
4242
MessageBox.Show(this._form, prompt, "Refresher", MessageBoxType.Error);
4343
});
4444
}
4545

46-
public QuestionResult Ask(string question)
46+
public override QuestionResult Ask(string question)
4747
{
4848
State.Logger.LogInfo(Platform, $"Asking user '{question}'...");
4949
DialogResult result = MessageBox.Show(question, "Refresher", MessageBoxButtons.YesNo, MessageBoxType.Question);
@@ -57,8 +57,9 @@ public QuestionResult Ask(string question)
5757
};
5858
}
5959

60-
public void OpenUrl(Uri uri)
60+
public override void OpenUrl(Uri uri)
6161
{
62+
base.OpenUrl(uri);
6263
string url = uri.ToString();
6364

6465
try
@@ -82,10 +83,4 @@ public void OpenUrl(Uri uri)
8283
}
8384
// based off of https://stackoverflow.com/a/43232486
8485
}
85-
86-
public void PrepareThread()
87-
{}
88-
89-
public void PrepareStopThread()
90-
{}
9186
}

0 commit comments

Comments
 (0)