cheesebaron / cheesebaron.mvxplugins Goto Github PK
View Code? Open in Web Editor NEWA collection of plugins for MvvmCross
License: Apache License 2.0
A collection of plugins for MvvmCross
License: Apache License 2.0
So my project fails to compile.
I opened up the nupkg for CheeseBaron.MvxPlugins.Settings.1.0.0.nupkg and I see SMSPluginBootstrap.cs.pp.
Visual Studio 2015
NuGet Package Manager for Visual Studio ##Version 2015 3.0.60410.213## latest.
Attempting to gather dependencies information for package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2' with respect to project targeting 'MonoAndroid, Version=v5.0'
Attempting to resolve dependencies for package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2'
Resolved actions to install package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2'
Install failed. Rolling back...
Package 'MvvmCross.PortableSupport 3.5.1' does not exist in project 'SampleApp.Droid'
Install-Package : Could not install package 'MvvmCross.PortableSupport 3.5.1'. You are trying to install this package into a project that targets 'MonoAndroid, Version=v5.0', but the package does not
contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Cheesebaron.MvxPlugins.FormsPresenters -DependencyVersion Lowest ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Attempting to gather dependencies information for package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2' with respect to project targeting 'Xamarin.iOS, Version=v1.0'
Attempting to resolve dependencies for package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2'
Resolved actions to install package 'Cheesebaron.MvxPlugins.FormsPresenters.0.0.2'
Install failed. Rolling back...
Package 'MvvmCross.PortableSupport 3.5.1' does not exist in project 'SampleApp.iOS'
Install-Package : Could not install package 'MvvmCross.PortableSupport 3.5.1'. You are trying to install this package into a project that targets 'Xamarin.iOS, Version=v1.0', but the package does not
contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Cheesebaron.MvxPlugins.FormsPresenters -DependencyVersion Lowest ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Could not install package 'MvvmCross.PortableSupport 3.5.1'. You are trying to install this package into a project that targets 'MonoAndroid, Version=v5.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Could not install package 'MvvmCross.PortableSupport 3.5.1'. You are trying to install this package into a project that targets 'Xamarin.iOS, Version=v1.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
This seems like a similar issue reported against MvvM Cross Could not install package 'MvvmCross.PortableSupport 3.5.0' and closed by Stuart Lodge.
MonoTouch10 is pre-Unified.
3.2 was our last non-Unified release
See release notes on http://slodge.blogspot.com
However the Droid project is showing a similar error that I do not understand. It appears to be that when installing FormsPresenters it knows that it needs 'MvvmCross.PortableSupport 3.5.1' but that package is not compatible with the Consumer, i.e. FormsPresenters.
With boolean value, suppose any key is saved as false; when using method settings.GetValue with default value of true (my understanding is, it should get the value from file, and only if missing, return default value), it's returning true instead of false.
Basically, it's coming to this area
if (Equals(default(T), returnVal))
{
returnVal = defaultValue;
}
on debug, I can see returnVal = false, defaultValue = true before it's set to be same.
in AddOrUpdateValue, the line:
var type = value.GetType();
crashes if value is null.
It should be replaced with:
public bool AddOrUpdateValue<T>(string key, T value = default(T))
{
if(string.IsNullOrEmpty(key))
throw new ArgumentException("Key must have a value", "key");
var type = typeof(T);
I'd like to have some test suites for the plugins, just to make sure the logic works. Although some of the tests probably would end up as integration tests, it would still be quite valuable.
Hi
first of all, thanks for the plugins! :)
I had some issues with the version 2.1 of the connectivity plugin on Android. I noticed that all the properties are false when you start the app even though I have an internet connection via cellular. When I
disable and enable my mobile connection it turns correctly to true, but is false after the next restart.
Also, when I'm in the app and start wlan it turns to true correctly as well.
I've found the same issue on 2.0.1 version of the plugin.
I have an HTC 10 with Android 6.0.1
So here's what i've experienced: I install the Settings nuget package in my core, droid and touch project. It works on Android. But for my touch project, i cannot instantiate my viewmodel, as it uses the ISettings service. Likewise, Mvx.CanResolve() returns false.
If i pull the code here from github, and add it as regular projects which i reference, everything works fine.
It seems to me there might be a problem with the nuget package?
Add MIT license to FormsPresenters code.
When I turn on airplane mode and turn it back off, IsConnected still returns false. Same thing also happens when I turn off wifi and then back on (I don’t have cellular service).
When I try to read a Int64, I get an error that a Double cannot be converted to a Int64. I changed the iOS code to convert Int64 to string and back, then it works fine. This should not interfere with Android code.
Thanks for your effort to share this code.
I found just packages for SMS, Settings and ModernHttpClient.
Thanks Cheesebaron!
TODO
Right now we are using Apache 2.0 license for everything. This forces the developer to appropriately attribute this project in their app. Although it seems like no one is aware of this and maybe we should just use a less strict license, such as MIT?
The csproj file has the following reference:
....\submodules\MvvmCross\bin\Debug\Mvx\WindowsPhone\Cirrious.MvvmCross.Binding.dllThe submodules directory was there in previous versions but you are now using NuGet to manage most references and so the submodules directory has gone. Presumably this is not a serious error e.g. nothing actually references Cirrious.MvvmCross.Binding.dll?
This will make things much easier for version handling in the consumer side.
Hi,
I wanted to use the SMS Plugin, but I get a strange warning which prevents my code from compiling:
The primary reference "Cheesebaron.MvxPlugins.SMS" could not be resolved because it was built against the ".NETPortable,Version=v4.5,Profile=Profile78" framework. This is a higher version than the currently targeted framework ".NETPortable,Version=v4.0,Profile=Profile24".
Anyway, my settings seem to be correct.
What could be the cause of that?
Regards,
Marcel
I get the following from Nuget after I update my project's core PCL to the new profile as required by the latest mvvmcross:
Could not install package 'Cheesebaron.MvxPlugins.Settings 1.0.2'. You are trying to install this package into a project that targets 'portable-net45+win+wpa81+MonoAndroid10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Why are some of the plugins missing nuget packages, and will this be fixed?
I just did the pre-scan before submitting the new version of my app to the Windows Phone store, and it gave the error "The binary Cheesebaron.MvxPlugins.SMS.dll is built in debug mode."
Apparently, Windows Phone Store will not allow applications to be submitted if one of the dependencies was built in debug mode.
Application
class from Xamarin.FormsWhen in release mode with LinkAll set to true, the app crashes.
Fix the crash in ConnectivityPluginBootstrap.cs by adding Preserve:
/// <summary>
/// Default constructor not found for type Cheesebaron.MvxPlugins.Connectivity.Touch.Plugin
/// </summary>
[Foundation.Preserve(AllMembers = true)]
public class ConnectivityPluginBootstrapLinkerPleaseInclude
{
public void Include()
{
new Cheesebaron.MvxPlugins.Connectivity.Touch.Plugin();
}
}
Some code is returning a Task and simply wrapping the contents into Task.Run(() => {});
. This is basically lying about something being async when not.
This is needed to be fixed. Might break the API some places.
So far I've seen it in
Please I am having the following problem Running my MVVMCross Application on a Windows Phone 8 Device
My Package Config is:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Bulboss.MvvmCross.Plugins.UserInteraction" version="1.3.1" targetFramework="wp8" />
<package id="Cheesebaron.MvxPlugins.Settings" version="2.1.0" targetFramework="wp8" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="wp8" />
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="wp8" />
<package id="Microsoft.Net.Http" version="2.2.22" targetFramework="wp8" />
<package id="MvvmCross" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Binding" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Core" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Platform" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Plugin.File" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Plugin.Json" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Plugin.Location" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Plugin.Messenger" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Plugin.Network" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.Plugin.Visibility" version="4.3.0" targetFramework="wp8" />
<package id="MvvmCross.StarterPack" version="4.3.0" targetFramework="wp8" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="wp8" />
<package id="WPtoolkit" version="4.2013.08.16" targetFramework="wp8" />
</packages>
I have the plugin bootstrapped as follows
public class SettingsPluginBootstrap : MvxPluginBootstrapAction<Cheesebaron.MvxPlugins.Settings.PluginLoader>
{
}
And I use the Settings Plugin like so
public class SettingsService
{
private ISettings _settings;
public SettingsService(ISettings settingsService)
{
_settings = settingsService;
}
}
My windows Phone Application Constructor Is Setup as follows
public App()
{
var setup = new Setup(RootFrame);
setup.Initialize();
}
But whenever setup.Initialize() is called. I get the followin exception
Additional information: could not load plugin assembly for type Cheesebaron.MvxPlugins.Settings.PluginLoader
at MvvmCross.Platform.Plugins.MvxFilePluginManager.LoadAssembly(Type toLoad)
at MvvmCross.Platform.Plugins.MvxFilePluginManager.FindPlugin(Type toLoad)
at MvvmCross.Platform.Plugins.MvxPluginManager.ExceptionWrappedLoadPlugin(Type toLoad)
at MvvmCross.Platform.Plugins.MvxPluginManager.EnsurePlatformAdaptionLoaded[T]()
at Cheesebaron.MvxPlugins.Settings.PluginLoader.EnsureLoaded()
at MvvmCross.Platform.Plugins.MvxPluginManager.EnsurePluginLoaded(IMvxPluginLoader pluginLoader)
at MvvmCross.Platform.Plugins.MvxPluginManager.EnsurePluginLoaded(Type type)
at MvvmCross.Platform.Plugins.MvxPluginManager.EnsurePluginLoaded[TType]()
at MvvmCross.Platform.Plugins.MvxPluginBootstrapAction`1.Load(IMvxPluginManager manager)
at MvvmCross.Platform.Plugins.MvxPluginBootstrapAction`1.RunAction()
at System.Action.Invoke()
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.InternalSetResolver(Type tInterface, IResolver resolver)
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.RegisterSingleton[TInterface](TInterface theObject)
at MvvmCross.Platform.Mvx.RegisterSingleton[TInterface](TInterface service)
at MvvmCross.Core.Platform.MvxSetup.InitializePluginFramework()
at MvvmCross.Core.Platform.MvxSetup.InitializeSecondary()
at MvvmCross.Core.Platform.MvxSetup.Initialize()
at IGovern.WinPhone.App..ctor()
Please What Am I Doing Wrong???
Hi,
when I try to invoke ISettings.GetValueOrDefault I receive the following Exception:
An exception occurred at AddFavoriteService: 'jobject' must not be IntPtr.Zero.
Parameter name: jobject - StackTrace: at Android.Runtime.JNIEnv.CallObjectMethod (IntPtr jobject, IntPtr jmethod, Android.Runtime.JValue[] parms) [0x00000] in :0
at Android.Content.ISharedPreferencesInvoker.GetString (System.String key, System.String defValue) [0x00000] in :0
at Refractored.MvxPlugins.Settings.Droid.MvxAndroidSettings.GetValueOrDefault[String](System.String key, System.String defaultValue) [0x00000] in :0
at Myproject.Core.PCL\Data\UserPreferences.AddFavoriteService (System.String cityId, System.String serviceId) [0x00014] in c:\Myproject.Core.PCL\Data\UserPreferences.cs:45
at Android.Content.ISharedPreferencesInvoker.GetString (System.String key, System.String defValue) [0x00000] in :0
at Refractored.MvxPlugins.Settings.Droid.MvxAndroidSettings.GetValueOrDefault[String](System.String key, System.String defaultValue) [0x00000] in :0
at Myproject.Core.PCL\Data\UserPreferences.AddFavoriteService (System.String cityId, System.String serviceId) [0x00014] in c:\Myproject.Core.PCL\Data\UserPreferences.cs:45
Here the code of UserPreferences.cs
public class UserPreferences
{
#region Const & Field
private readonly ISettings _settingsProvider;
#endregion
public UserPreferences(ISettings settings)
{
_settingsProvider = settings;
}
public bool AddFavoriteService(string cityId, string serviceId)
{
try
{
var cf = _settingsProvider.GetValueOrDefault<string>(cityId, string.Empty);
var cfList = JsonConvert.DeserializeObject<List<string>>(cf);
if (cfList == null)
cfList = new List<string>();
var ele = cfList.Find(x => string.Compare(x, serviceId, StringComparison.CurrentCultureIgnoreCase) == 0);
if (ele == null)
{
cfList.Add(serviceId);
var newCfList = JsonConvert.SerializeObject(cfList);
_settingsProvider.AddOrUpdateValue(cityId, newCfList);
_settingsProvider.Save();
}
return true;
}
catch(Exception e)
{
Debug.WriteLine("An exception occurred at AddFavoriteService: {0} - StackTrace: {1}", e.Message,
e.StackTrace);
return false;
}
}
}
In that beta core packages were renamed, so updating of references is needed
Hello,
I was just doing the MvvmCross 4.0 update this morning and found that after updating your settings plugin it couldn't be added to my core project as the PCL profile is no longer supported. I am not sure if this is a deliberate change? It is PCL 4.5 - Profile259 using Xamarin Studio on a Mac.
This is the error :
Could not install package 'Cheesebaron.MvxPlugins.Settings 1.2.3'. You are trying to install this package into a project that targets 'portable-net45+win+wpa81+wp80+MonoTouch10+MonoAndroid10+xamarinmac20+xamarinios10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Cheers,
Ryan
Hi, from looking at the code in the repo it looks like this has not been updated yet. (At least the Settings plugin, which I use).
By using the contextual default shared preferences rather than a predefined static filename, a PreferenceActivity can interface seemlessly with the Settings Plugin. I'm not 100% sure how to pull from Git, so suggest Gist here: https://gist.github.com/ratsey/9863754
This is for the Android implementation of course.
Problem: I get System.IO.FileNotFoundException while bootstrapping Cheesebaron.MvxPlugins.DeviceInfo in my Universal Windows project.
Reference: Cheesebaron.MvxPlugins.DeviceInfo
Version: 2.2.2
Framework: uap10 (w/ netstandard 1.4)
Here's my bootstrap implementation:
public class DeviceInfoBootstrap : MvxPluginBootstrapAction<PluginLoader> { }
Following few exception details:
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.ni.dll
Additional information: Could not load file or assembly 'Cheesebaron.MvxPlugins.DeviceInfo.WindowsUWP, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Hello,
I have correctly working project with Cheesebaron.MvxPlugins.Settings 4.1.2. If I change the Nuget package to 5.0.0, the project compile, but the resulting app stuck at splash screen (tested on Android).
From debugging, I can tell that
public MainApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
public SplashScreen() : base(Resource.Layout.splash_screen)
are called (both have empty bodies) and that is all. No Initalize
or another code is called after that and when I stop the project I get "No compatible code running".
Any idea, what might be wrong?
Thanks,
Petr
The csproj file has the following reference:
....\submodules\MvvmCross\bin\Debug\Mvx\WindowsPhone\Cirrious.MvvmCross.Binding.dllThe submodules directory was there in previous versions but you are now using NuGet to manage most references and so the submodules directory has gone. Presumably this is not a serious error e.g. nothing actually references Cirrious.MvvmCross.Binding.dll?
Hey guys. It would be great to have the plugin in NuGet. It seems that referenced MvvxCross and ModernHttpClient (https://www.nuget.org/packages/modernhttpclient/1.2.2) are in NuGet already.
Thanks!
Problem: Failed to resolve parameter for parameter wifi of type IWifi
Reference: Cheesebaron.MvxPlugins.Connectivity
Version: 3.0.2
Framework: uap10 (w/ netstandard 1.4)
Here's my bootstrap implementation:
public class DeviceInfoBootstrap : MvxPluginBootstrapAction<PluginLoader> { }
Hello, I did a quick test of Settings plugin - both for Android and iOS. For Android all worked like a charm but after I added Settings plugin to the iOS project it failed. I realised the SettingsPluginBootstrap.cs and its Bootstrap folder are missing. After I created / added those manually the plugin loaded. Everybody will easily find a fix for this but if fixed it will save peoples' time I guess.
Have a great day :)
Jan
The mvvmcross Settings package from nuget for profile 158, downloads profile 78 dll instead
Hi!
I tried building the core project but XS keeps complaining that the project references Nuget packages that are missing.
I installed Microsoft.Net.Http etc. but I can see that most LIB folders under packages/Microsoft.Bcl.1.1.6 are empty.
This is with XS 4.2.3 on a Mac. I tried with profile 78 and profile 156.
MvvmCross.Platform.Exceptions.MvxIoCResolveException: Failed to resolve type MvvmCross.Platform.iOS.Views.IMvxIosModalHost
The nuspec file for DeviceInfo doesn't actually use the WindowsUWP project for anything.
The ability of a UWP MvvmCross UI application to consume this nuget successfully via Bootstrap.cs class declaration relies on the WindowsCommon lib, not WindowsUWP.
Related to #72
When running the Connectivity plugin on Android API24 and up, it fails to trigger Connection Change events.
This is due to the broadcast receiver not triggering on newer API levels unless you attach it directly to a valid Context (thanks, Android...).
James Montemagno's plugin does this by just attaching to Application Context.
I have been working with the very latest stable releases and Visual Studio 2015. VS went RC late April and I expect the final release to be out by the end of July. Prior to the RC, there was no Xamarin Support for Windows Phone 8.1 only Windows Phone 8.0 via Siliverlight 8.0. With the release of the RC we now have support for WP 8.1 via Silverlight 8.1 and support for WP 8.0 has been dropped.
Somewhat inconvenient I know, it means you need to retool for WP 8.1 but WP currently has low market share!
Microsoft created a new PCL Profile for Shared Projects that includes WP 8.1 as well as Windows 8.1. At some stage I might add the ViewPresenter for Windows 8.1, but there is a much more interesting Windows 10 Universal App coming with Windows 10 end of July. This target is slated to run on both Mobile devices and the desktop. I have joined the Xamarin preview group for W10 UAP.
Right now I have taken the Cheesebaron.MvxPlugins-master/Samples/FormsPresenters set and upgraded NeGet packages as well as changing the PCL to the new profile and changed the Windows Phone over to 8.1. The only files touched that are relevant are the packages.config and 3 Movies.*.csproj files. All three phone platforms I have tested and work.
_I can email the zip of these files, 12kb (Fork & pull), or I could get a shared access and push._
We need to be mindful that this change will be somewhat disruptive for developers still on VS 2013. However what I am working on is important as it will provide a set of starter VS Templates for various combinations of components one would like in a Xamarin Universal App and It would help to have a stable set of NuGet Packages including CheesBarron.
Things will get quite hot after the Windows 10 release.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.