Skip to content

Commit

Permalink
Rename, implement iOS & Sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jfversluis committed Aug 17, 2023
1 parent e3fa420 commit 541e727
Show file tree
Hide file tree
Showing 58 changed files with 250 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build
run: dotnet build samples\Plugin.Maui.Feature.Sample.sln -c Release
run: dotnet build samples\Plugin.Maui.Pedometer.Sample.sln -c Release
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build
run: dotnet build src\Plugin.Maui.Feature.sln -c Release
run: dotnet build src\Plugin.Maui.Pedometer.sln -c Release
4 changes: 2 additions & 2 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
id: get_version
uses: battila7/get-version-action@v2
- name: Pack
run: dotnet pack src\Plugin.Maui.Feature.sln -c Release -p:PackageVersion=${{ steps.get_version.outputs.version-without-v }}
run: dotnet pack src\Plugin.Maui.Pedometer.sln -c Release -p:PackageVersion=${{ steps.get_version.outputs.version-without-v }}
- name: Push
run: dotnet nuget push src\Plugin.Maui.Feature\bin\Release\Plugin.Maui.Feature.${{ steps.get_version.outputs.version-without-v }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push src\Plugin.Maui.Pedometer\bin\Release\Plugin.Maui.Pedometer.${{ steps.get_version.outputs.version-without-v }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.NUGET_API_KEY }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Plugin.Maui.Feature
# Plugin.Maui.Pedometer

The `Plugin.Maui.Feature` repository is a template repository that can be used to bootstrap your own .NET MAUI plugin project. You can use this project structure as a blueprint for your own work.
The `Plugin.Maui.Pedometer` repository is a template repository that can be used to bootstrap your own .NET MAUI plugin project. You can use this project structure as a blueprint for your own work.

## Getting Started
1. Create your own GitHub repository from this one by clicking the "Use this template" button and then "Create a new repository". More information in the [documentation](https://docs.github.com/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template). After that, clone the repo to your local machine.

2. Replace all occurrences of `Plugin.Maui.Feature` with whatever your feature or functionality will be. For instance: `Plugin.Maui.ScreenBrightness` or `Plugin.Maui.Audio`. Of course the name can be anything, but to make it more discoverable it could be a great choice to stick to this naming scheme. You can easily do this with your favorite text-editor and do a replace all on all files.
2. Replace all occurrences of `Plugin.Maui.Pedometer` with whatever your feature or functionality will be. For instance: `Plugin.Maui.ScreenBrightness` or `Plugin.Maui.Audio`. Of course the name can be anything, but to make it more discoverable it could be a great choice to stick to this naming scheme. You can easily do this with your favorite text-editor and do a replace all on all files.

2.1 Don't forget to also rename the files and folders on your filesystem.

Expand All @@ -19,7 +19,7 @@ The `Plugin.Maui.Feature` repository is a template repository that can be used t

7. Write your plugin code (under `src`) and add samples to the .NET MAUI sample app (under `samples` folder)

8. Make super sure that your package won't show up as `Plugin.Maui.Feature` on NuGet! If one does, you owe me a drink!
8. Make super sure that your package won't show up as `Plugin.Maui.Pedometer` on NuGet! If one does, you owe me a drink!

9. Publish your package to NuGet, a nice guide to do that can be found here.

Expand Down
8 changes: 4 additions & 4 deletions README_Feature.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Plugin.Maui.Feature
# Plugin.Maui.Pedometer

`Plugin.Maui.Feature` provides the ability to do this amazing thing in your .NET MAUI application.
`Plugin.Maui.Pedometer` provides the ability to do this amazing thing in your .NET MAUI application.

## Getting Started

* Available on NuGet: <http://www.nuget.org/packages/Plugin.Maui.Feature> [![NuGet](https://img.shields.io/nuget/v/Plugin.Maui.Feature.svg?label=NuGet)](https://www.nuget.org/packages/Plugin.Maui.Feature/)
* Available on NuGet: <http://www.nuget.org/packages/Plugin.Maui.Pedometer> [![NuGet](https://img.shields.io/nuget/v/Plugin.Maui.Pedometer.svg?label=NuGet)](https://www.nuget.org/packages/Plugin.Maui.Pedometer/)

## API Usage

`Plugin.Maui.Feature` provides the `Feature` class that has a single property `Brightness` that you can get or set.
`Plugin.Maui.Pedometer` provides the `Feature` class that has a single property `Brightness` that you can get or set.

You can either use it as a static class, e.g.: `Feature.Default.Property = 1` or with dependency injection: `builder.Services.AddSingleton<IFeature>(Feature.Default);`
8 changes: 0 additions & 8 deletions samples/Plugin.Maui.Feature.Sample/MainPage.xaml

This file was deleted.

15 changes: 0 additions & 15 deletions samples/Plugin.Maui.Feature.Sample/MainPage.xaml.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31611.283
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.Maui.Feature.Sample", "Plugin.Maui.Feature.Sample\Plugin.Maui.Feature.Sample.csproj", "{490BB138-9606-4FFF-8AAD-841C5B1ED059}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.Maui.Pedometer.Sample", "Plugin.Maui.Pedometer.Sample\Plugin.Maui.Pedometer.Sample.csproj", "{490BB138-9606-4FFF-8AAD-841C5B1ED059}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.Maui.Feature", "..\src\Plugin.Maui.Feature\Plugin.Maui.Feature.csproj", "{B60F3174-E978-4F2B-B117-F6F0327594C8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Plugin.Maui.Pedometer", "..\src\Plugin.Maui.Pedometer\Plugin.Maui.Pedometer.csproj", "{B60F3174-E978-4F2B-B117-F6F0327594C8}"

EndProject
Global
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Plugin.Maui.Feature.Sample.App">
x:Class="Plugin.Maui.Pedometer.Sample.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

public partial class App : Application
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Shell
x:Class="Plugin.Maui.Feature.Sample.AppShell"
x:Class="Plugin.Maui.Pedometer.Sample.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:Plugin.Maui.Feature.Sample"
xmlns:pages="clr-namespace:Plugin.Maui.Pedometer.Sample"
Shell.FlyoutBehavior="Disabled">

<ShellContent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

public partial class AppShell : Shell
{
Expand Down
11 changes: 11 additions & 0 deletions samples/Plugin.Maui.Pedometer.Sample/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Plugin.Maui.Pedometer.Sample.MainPage"
Title="Pedometer Plugin">

<VerticalStackLayout>
<Button Text="Start/Stop" Clicked="Button_Clicked"/>
<Label x:Name="StepCount" />
</VerticalStackLayout>
</ContentPage>
24 changes: 24 additions & 0 deletions samples/Plugin.Maui.Pedometer.Sample/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
namespace Plugin.Maui.Pedometer.Sample;

public partial class MainPage : ContentPage
{
readonly IPedometer pedometer;

public MainPage(IPedometer pedometer)
{
InitializeComponent();

this.pedometer = pedometer;
pedometer.PedometerReadingChanged += Pedometer_PedometerReadingChanged;
}

void Pedometer_PedometerReadingChanged(object sender, PedometerData e)
{
StepCount.Text = e.NumberOfSteps.ToString();
}

void Button_Clicked(object sender, EventArgs e)
{
pedometer.Start();
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using Plugin.Maui.Feature;
using Plugin.Maui.Pedometer;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

public static class MauiProgram
{
Expand All @@ -17,7 +17,7 @@ public static MauiApp CreateMauiApp()
});

builder.Services.AddTransient<MainPage>();
builder.Services.AddSingleton<IFeature>(Feature.Default);
builder.Services.AddSingleton<IPedometer>(Pedometer.Default);

return builder.Build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Android.Content.PM;
using Android.OS;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Android.App;
using Android.Runtime;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

[Application]
public class MainApplication : MauiApplication
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Foundation;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ObjCRuntime;
using UIKit;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

public class Program
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.Maui;
using Microsoft.Maui.Hosting;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

class Program : MauiApplication
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="7" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="maui-application-id-placeholder" exec="Plugin.Maui.Feature.Sample.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<ui-application appid="maui-application-id-placeholder" exec="Plugin.Maui.Pedometer.Sample.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>maui-application-title-placeholder</label>
<icon>maui-appicon-placeholder</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<maui:MauiWinUIApplication
x:Class="Plugin.Maui.Feature.Sample.WinUI.App"
x:Class="Plugin.Maui.Pedometer.Sample.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
xmlns:local="using:Plugin.Maui.Feature.Sample.WinUI">
xmlns:local="using:Plugin.Maui.Pedometer.Sample.WinUI">

</maui:MauiWinUIApplication>

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace Plugin.Maui.Feature.Sample.WinUI;
namespace Plugin.Maui.Pedometer.Sample.WinUI;

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="Plugin.Maui.Feature.Sample.WinUI.app"/>
<assemblyIdentity version="1.0.0.0" name="Plugin.Maui.Pedometer.Sample.WinUI.app"/>

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Foundation;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@
</array>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
<key>NSMotionUsageDescription</key>
<string>This app wants to show your pedometer readings</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ObjCRuntime;
using UIKit;

namespace Plugin.Maui.Feature.Sample;
namespace Plugin.Maui.Pedometer.Sample;

public class Program
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>Plugin.Maui.Feature.Sample</RootNamespace>
<RootNamespace>Plugin.Maui.Pedometer.Sample</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<!-- Display name -->
<ApplicationTitle>Plugin.Maui.Feature.Sample</ApplicationTitle>
<ApplicationTitle>Plugin.Maui.Pedometer.Sample</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.companyname.pluginsample</ApplicationId>
Expand All @@ -30,6 +30,11 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net7.0-ios'">
<CodesignKey>Apple Development: Created via API (GAC3PB2W36)</CodesignKey>
<CodesignProvision>VS: WildCard Development</CodesignProvision>
</PropertyGroup>

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
Expand All @@ -45,6 +50,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Plugin.Maui.Feature\Plugin.Maui.Feature.csproj" />
<ProjectReference Include="..\..\src\Plugin.Maui.Pedometer\Plugin.Maui.Pedometer.csproj" />
</ItemGroup>
</Project>
6 changes: 0 additions & 6 deletions src/Plugin.Maui.Feature/Feature.android.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/Plugin.Maui.Feature/Feature.macios.cs

This file was deleted.

7 changes: 0 additions & 7 deletions src/Plugin.Maui.Feature/Feature.net.cs

This file was deleted.

15 changes: 0 additions & 15 deletions src/Plugin.Maui.Feature/Feature.shared.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/Plugin.Maui.Feature/Feature.windows.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/Plugin.Maui.Feature/IFeature.cs

This file was deleted.

Loading

0 comments on commit 541e727

Please sign in to comment.