Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
Minor bug fixes
  • Loading branch information
AndreasReitberger committed Aug 5, 2022
1 parent 890bc62 commit 6a1f9bb
Show file tree
Hide file tree
Showing 28 changed files with 244 additions and 138 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified source/MauiSettings/.vs/MauiSettings/v17/.suo
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
namespace AndreasReitberger.Maui.Attributes
{
/*
* Based on the idea of Advexp.Settings.Local by Alexey Ivakin
* Repo: https://bitbucket.org/advexp/component-advexp.settings
* License: Apache-2.0 (https://licenses.nuget.org/Apache-2.0)
*
* Modifed by Andreas Reitberger to work on .NET MAUI
*/

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class MauiSettingAttribute : MauiSettingBaseAttribute
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
namespace AndreasReitberger.Maui.Attributes
{
/*
* Based on the idea of Advexp.Settings.Local by Alexey Ivakin
* Repo: https://bitbucket.org/advexp/component-advexp.settings
* License: Apache-2.0 (https://licenses.nuget.org/Apache-2.0)
*
* Modifed by Andreas Reitberger to work on .NET MAUI
*/
public class MauiSettingBaseAttribute : Attribute
{
#region Properties
Expand Down
7 changes: 7 additions & 0 deletions source/MauiSettings/MauiSettings/Enums/MauiSettingsActions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
namespace AndreasReitberger.Maui.Enums
{
/*
* Based on the idea of Advexp.Settings.Local by Alexey Ivakin
* Repo: https://bitbucket.org/advexp/component-advexp.settings
* License: Apache-2.0 (https://licenses.nuget.org/Apache-2.0)
*
* Modifed by Andreas Reitberger to work on .NET MAUI
*/
public enum MauiSettingsActions
{
Load,
Expand Down
10 changes: 10 additions & 0 deletions source/MauiSettings/MauiSettings/Enums/MauiSettingsTarget.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace AndreasReitberger.Maui.Enums
{
public enum MauiSettingsTarget
{
Local,
#if IOS
ICloud,
#endif
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static T GetSettingsValue<T>(string key, T defaultValue)
break;
default:
// For all other types try to serialize it as JSON
string jsonString = Preferences.Get(key, string.Empty);
string jsonString = Preferences.Get(key, string.Empty) ?? string.Empty;
returnValue = JsonConvert.DeserializeObject<T>(jsonString);
break;
}
Expand Down
7 changes: 7 additions & 0 deletions source/MauiSettings/MauiSettings/Helper/MauiSettingsInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
namespace AndreasReitberger.Maui.Helper
{
/*
* Based on the idea of Advexp.Settings.Local by Alexey Ivakin
* Repo: https://bitbucket.org/advexp/component-advexp.settings
* License: Apache-2.0 (https://licenses.nuget.org/Apache-2.0)
*
* Modifed by Andreas Reitberger to work on .NET MAUI
*/
internal class MauiSettingsInfo
{
#region Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

namespace AndreasReitberger.Maui.Helper
{
/*
* Based on the idea of Advexp.Settings.Local by Alexey Ivakin
* Repo: https://bitbucket.org/advexp/component-advexp.settings
* License: Apache-2.0 (https://licenses.nuget.org/Apache-2.0)
*
* Modifed by Andreas Reitberger to work on .NET MAUI
*/
internal class MauiSettingsMemberInfo
{
#region Properties
Expand Down
3 changes: 2 additions & 1 deletion source/MauiSettings/MauiSettings/MauiSettings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
<RepositoryUrl>https://github.com/AndreasReitberger/MauiSettings</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags> MAUI, dotnet, NET, Settings, Preference</PackageTags>
<PackageLicenseExpression>apache-2.0</PackageLicenseExpression>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>MauiSettings</Title>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
<Version>1.0.1</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
284 changes: 159 additions & 125 deletions source/MauiSettings/MauiSettings/MauiSettingsGeneric.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace MauiSettings
namespace AndreasReitberger.Maui
{
// All the code in this file is only included on Android.
public partial class MauiSettingsGeneric
public partial class MauiSettingsGeneric<SO> where SO : new()
{
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace MauiSettings
namespace AndreasReitberger.Maui
{
// All the code in this file is only included on Mac Catalyst.
public partial class MauiSettingsGeneric
public partial class MauiSettingsGeneric<SO> where SO : new()
{
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;

namespace MauiSettings
namespace AndreasReitberger.Maui
{
// All the code in this file is only included on Tizen.
public partial class MauiSettingsGeneric
public partial class MauiSettingsGeneric<SO> where SO : new()
{
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace MauiSettings
namespace AndreasReitberger.Maui
{
// All the code in this file is only included on Windows.
public partial class MauiSettingsGeneric
public partial class MauiSettingsGeneric<SO> where SO : new()
{
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
namespace MauiSettings
using AndreasReitberger.Maui.Enums;

namespace AndreasReitberger.Maui
{
// All the code in this file is only included on iOS.
public partial class PlatformClass1
public partial class MauiSettingsGeneric<SO> where SO : new()
{
#region Methods
public async Task SyncSettingsWithICloud()
public async Task SyncSettingsToICloud()
{
await Task.Run(async delegate
{
await SyncSettingsToICloud(settings: SettingsObject);
});
}

public async Task SyncSettingsToICloud(object settings)
{
await Task.Run(async delegate
{
await GetClassMetaAsyn(settings: settings, mode: MauiSettingsActions.Load);
});
}

public async Task SyncSettingsFromICloud()
{

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

namespace AndreasReitberger.Maui.Utilities
{
/*
* Based on the idea of Advexp.Settings.Local by Alexey Ivakin
* Repo: https://bitbucket.org/advexp/component-advexp.settings
* License: Apache-2.0 (https://licenses.nuget.org/Apache-2.0)
*
* Modifed by Andreas Reitberger to work on .NET MAUI
*/
internal class MauiSettingNameFormater
{
#region Variables
Expand Down

0 comments on commit 6a1f9bb

Please sign in to comment.