Giter Club home page Giter Club logo

softeq / xtoolkit.whitelabel Goto Github PK

View Code? Open in Web Editor NEW
24.0 11.0 5.0 10.05 MB

Modular MVVM framework for fast creating powerful cross-platform applications with Xamarin & .NET for Mobile

Home Page: https://softeq.github.io/XToolkit.WhiteLabel/

License: MIT License

C# 99.92% Shell 0.08%
xtoolkit xamarin dotnet mvvm mvvm-framework ios android library mobile xamarin-library csharp whitelabel permissions androidx push-notifications connectivity hacktoberfest cross-platform dotnet6 maui

xtoolkit.whitelabel's Introduction

XToolkit.WhiteLabel

Build Status CodeFactor

XToolkit.WhiteLabel is a modular, cross-platform MVVM framework from "lego" components for fast create powerful cross-platform mobile applications with Xamarin.

Installation

This library is actively developed alongside production apps, and the API will evolve as we continue our way to version 2.0.

Please be fully prepared to deal with breaking changes.

Component NuGet
Common Softeq.XToolkit.Common
Bindings Softeq.XToolkit.Bindings
Permissions Softeq.XToolkit.Permissions
PushNotifications Softeq.XToolkit.PushNotifications
Remote Softeq.XToolkit.Remote
WhiteLabel Softeq.XToolkit.WhiteLabel
WhiteLabel.Essentials Softeq.XToolkit.WhiteLabel.Essentials

Documentation

Contributing

As an open source project, we're excited to accept contributions to the code from outside of Softeq and are striving to make that as easy and clean as possible.

License

The XToolkit.WhiteLabel project is available for free use, as described by the LICENSE (MIT).

  • Some bits of MvvmLight are redistributed and modified under MIT License
  • Tiny bits of MvvmCross are redistributed and modified under MIT License

xtoolkit.whitelabel's People

Contributors

alexandramash avatar andreysavitsky avatar dimysa avatar fryette avatar kirylakulich1 avatar nkrisko avatar pavel-leonenko avatar savikpavel avatar sleushunou avatar timofeyburak avatar vadimpylsky avatar vsverzhinsky avatar wcoder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xtoolkit.whitelabel's Issues

Refactor of using Xam.Plugins.Settings

Description

Common -> IInternalSettings

WL.Droid -> DroidInternalSettings
WL.iOS -> IosInternalSettings

  • DroidInternalSettings and IosInternalSettings implementations are duplicated.
  • WL.Forms doesn't contain implementation of IInternalSettings

Solution:

  • Add general implementation in WL.

Execute.OnUIThread() might cause deadlock

Description

iOS implementation of Execute.OnUIThread() is using Task.Wait(), which is not really safe as it might cause dead-locks

Steps to Reproduce

https://docs.microsoft.com/en-us/archive/msdn-magazine/2013/march/async-await-best-practices-in-asynchronous-programming#async-all-the-way

Expected Behavior

It is safe to use OnUIThread() anywhere

Actual Behavior

You should be cautious not to cause deadlocks

Basic Information

  • Version with issue: doesn't seem like we tracking versions, really.. latest master
  • Last known good version: none
  • IDE: JetBrains Rider 2019.3.3
  • Platform Target Frameworks:
    • iOS: 11.0

[AsyncCommand] Missing public method for raise CanExecuteChanged event

Description

Missing public method for raise CanExecuteChanged event from consumer code.

Steps to Reproduce

  1. create AsyncCommand instance
  2. check public methods

Expected Behavior

ViewModel should call RaiseCanExecuteChanged for an ICommand property whenever anything happens that might change the return value of the CanExecute method.

A call to RaiseCanExecuteChanged causes the AsyncCommand class to fire the CanExecuteChanged method. The UI Button has attached a handler for that event and responds by calling CanExecute again, and then enabling itself based on the return value of that method.

Actual Behavior

No chance to raise CanExecuteChanged event from consumer code, because internal:

CanExecuteChanged?.Invoke(this, EventArgs.Empty);

Additional

OS Version Support Documentation

It would be very helpful to have documented minimal versions of OSs that the whole library and separate projects support (like iOS 11+, Android 21+ for instance). We might also want to mention the latest versions with which the projects are properly working for sure.
We can do it here in Wiki: all gathered on a separate page + on each page that describes some of the features/components.

Update connectivity plugin

As I know Android & iOS have new features to detect internet connection state. So we need review and update our implementation for connectivity.

[iOS 13] NavBar items can't be handle events

Description

NavBar items can't be handle events after navigation.

Steps to Reproduce

  1. Launch Playground App
  2. Push to NavBar icon -> Navigate to Empty Page
  3. Go back to the Main Page
  4. Repeat from step 2

Expected Behavior

New attempt to navigate to the Empty Page will be the same as in step 2

Actual Behavior

  1. Navigation to Empty Page can't be made.

For that need to redraw navbar (via display system bar or something else)

  1. After going back to the MainPage (step 3) - TableView scroll jumped (seems like Navbar change the TableView scroll)

Screenshots

Good: iPhone SE - iOS 11.1 Good: iPhone X - iOS 12 Wrong: iPhone 11 Pro - iOS 13

Basic Information

  • IDE: VS4Mac 8.4.8, Xcode 11.3.1
  • Platform Target Frameworks:
    • iOS: 13
  • Affected Devices: all iPhones with iOS 13+

[Draft] Validation Spec

Spec

/// <summary>
/// Provides a way for an object to be validated.
/// </summary>
/// <typeparam name="T">Type of the data to be validated</typeparam>
interface IValidatable
{
    /// <summary>
    /// The value indicating whether the validation succeeded.
    /// </summary>
    bool IsValid { get; }

    /// <summary>
    /// Used to  perform the validations of the property
    /// </summary>
    /// <returns>Gets a value indicating whether the validation succeeded.</returns> 
    bool Validate();
}
class ValidatableObject<T> : ObservableObject, IValidatable
{
    /// ...

    /// <summary>
    /// Reference value is attempting to assign to the property.
    /// </summary>
    T Value { get; }
    
    /// <summary>
    /// List of standards or validations you specify before the user can save the record
    /// </summary>
    IList<IValidator> Validators { get; }

    /// <summary>
    /// List of errors users have before can save the record
    /// </summary>
    IList<string> Errors { get; }
}

Proposal to depends on FluentValidation

Bindings null-values cause crash

Description

It would be more convenient if Bindings will use some kind of null-propagation: if one of the properties in the expression is null - then the value of the source would consider null

Steps to Reproduce

  1. Create ViewModel for screen
  2. Implement SubViewModel class with string Message
  3. Add property of type SubViewModel to screen ViewModel
  4. Set SubViewModel to null by default
  5. Apply binding like following
    this.Bind(() => ViewModel.SubViewModel.Message, () => Label.Text)

Expected Behavior

Source value (ViewModel.SubViewModel.Message) is interpreted as null, so target property (Label.Text) is set to null. Also, as SubViewModel value is changed - Binding should react and recalculate source value

Actual Behavior

NullReferenceException, as expression () => ViewModel.SubViewModel.Message is used to calculate source value

Basic Information

  • Version with issue: doesn't seem like we tracking versions, really.. latest master
  • Last known good version: none
  • IDE: JetBrains Rider 2019.3.3
  • Platform Target Frameworks:
    • iOS: 11.0

Messenger, Unregister flow

To remove the action from Messenger you need to call

Messenger.Default.Unregister<YourClass>(this, HandleMessege);

I'm not sure, but why we need HandleMessege for unregistering?
It would be much clear if we remove action for Unregister method

To unregister everything we need is:

  1. Message type
  2. object

We no need to pass action for unregistering process

Empty ConsoleLogger after release

Description

ConsoleLogger uses Debug class for the logging. When we create release build for NuGet we lose the ability to logging via this class.

Proposal: Replace Debug to Trace class.

Steps to Reproduce

  1. Install Common via NuGet.
  2. Create an instance of ConsoleLogger
  3. Call any methods

Expected Behavior

A message should be written on the console.

Actual Behavior

Console log is empty.

Basic Information

  • Version with issue: 1.1.0-beta3
  • Nuget Packages: 1.1.0-beta3
  • Affected versions: all

[Deprecated] iOS open device settings categories

Description

  • prefs - not working;
  • App-Prefs:* - opening device settings page.

var prefsUrl = new NSUrl($"prefs{url}");
var nativeUrl = UIApplication.SharedApplication.CanOpenUrl(prefsUrl) ? prefsUrl : new NSUrl($"App-Prefs{url}");

Any Apple URL schemes that are not officially documented should be considered private API.
https://forums.developer.apple.com/message/186656#186656

iOS Settings URL Schemes: https://gist.github.com/deanlyoung/368e274945a6929e0ea77c4eca345560#note

Basic Information

  • Platform Target Frameworks:
    • iOS: 13+

Navigation when app in background mode

We need to extend our Navigation Services to support navigation between Activities and Fragments when application try to call navigate() methods in background mode.

Add ability for set custom tabBarControllerFactory

_tabBarController = UiTabBarControllerHelper.CreateForViewModels(
ViewModel.TabViewModels,
ViewModel.TabViewModels.Select(GetTabBarItem).ToArray(),
Dependencies.IocContainer.Resolve<IViewLocator>());

CreateForViewModels(...) metod has additional optional argument:
Func<UITabBarController> tabBarControllerFactory = null that need for use custom implementation of UITabBarController.

OnInitialize is not called in Android ViewModels

ViewModelBase has virtual OnInitialize method.
ActivityBase calls it in OnCreate (ActivityBase.cs:115). But the only code that will be called is "IsInitialized = true" from OnInitialize in ViewModelBase itself, no overridden code from derived viewmodels will be called.

Update FFmageLoading

Current: 2.4.4.859
Latest: 2.4.11.982
Diff: luberda-molinet/FFImageLoading@v2.4.4...v2.4.11

Releases: https://github.com/luberda-molinet/FFImageLoading/releases

Affected

Mono.Linker.MarkException: Error processing method: 'System.Void Softeq.XToolkit.WhiteLabel.Droid.Views.FullScreenImageDialogFragment::OnViewCreated(Android.Views.View,Android.OS.Bundle)' in assembly: 'Softeq.XToolkit.WhiteLabel.Droid.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Threading.Tasks.Task`1<FFImageLoading.Work.IScheduledWork> FFImageLoading.TaskParameterPlatformExtensions::IntoAsync(FFImageLoading.Work.TaskParameter,FFImageLoading.Views.ImageViewAsync)

Integration with Xamarin.Essentials

WL

Currently, WL has that features from XE:

  • Main Thread
  • Launcher
  • File System Helpers
  • Phone Dialer
  • Preferences

Basic support:

  • App Information
  • Device Display Information
  • Open Browser
  • Email
  • Geolocation

Support via native libraries:

  • Connectivity

XE

Another Xamarin.Essentials features:

  • Accelerometer
  • Barometer
  • Battery
  • Clipboard
  • Color Converters
  • Compass
  • Detect Shake
  • Flashlight
  • Geocoding
  • Gyroscope
  • Magnetometer
  • Maps
  • Orientation Sensor
  • Platform Extensions(Size, Rect, Point)
  • Secure Storage
  • Share
  • SMS
  • Text-to-Speech
  • Unit Converters
  • Version Tracking
  • Vibrate

Make ILauncherService calls thread-safe

Detailed Description

Reported by @Synthezator

Simple

Mark ILauncherService as not thread-safe

Advanced

Rework ILauncherService implementations to use Execute.BeginOnUIThread or Execute.OnUIThreadAsync.

Workaround

  1. Decorator for ILauncherService
  2. Wrap in Execute.BeginOnUIThread

Basic Information

  • Component which need this feature: WhiteLabel
  • Version which need this feature: Latest
  • Nuget Packages: < 2.0.0-beta7

[iOS] Alert dialog with options

Is your feature request related to a problem? Please describe.

Extend/rework ActionsSheetControl for support aler dialogs with options.

var controller = new SupportRotationAlertController(_actionHeaderTitle, _actionHeaderMessage,
UIAlertControllerStyle.ActionSheet);

Describe the solution you'd like

Easy: Export the property for customizing controllerStyle argument of internal AlertViewController.

Complex: Separate dialog builder (for share internal behaviors of ActionsheetController, StoryboardDialogsService)

Common interface for *FluentNavigator classes

It is will provide a common approach to describing navigation, the possibility of reusing navigation behavior between page and frame navigation).

Current

// frame navigation flow
frameNavigationService      <- IFrameNavigationService
    .For<GreenViewModel>()  <- FrameFluentNavigator
    .Navigate();

// page navigation flow
pageNavigationService       <- IPageNavigationService
    .For<YellowViewModel>() <- PageFluentNavigator
    .Navigate();

Proposal

IFluentNavigator navigator = frameNavigationService.GetNavigator();
// navigator = pageNavigationService.GetNavigator();

// shared navigation when ViewModels reused with PN & FN
navigator                   <- IFluentNavigator
    .For<NewViewModel>()
    .Navigate();

Cleanup .csproj

Folders ItemGroup can be safely removed

Originally posted by @Synthezator in #138

Unsubscription support for commands

Is your feature request related to a problem? Please describe.
Reinitialization of reusable cells, for example for UITableView on iOS, sometimes required also reinitialization of the button-click actions. Currently, we use SetCommand(ICommand) extension for that, which cannot be undone.

Describe the solution you'd like
It would be nice to be able to set commands in DoAttachBindings method, and clear it in DoDettachBindings method

Describe alternatives you've considered
Currently, the only alternative is to set command during cell initialization with lambda looking like this:
Button.SetCommand(() => ViewModel.ButtonCommand.Execute(null))
which is not really convenient

Dialog service not always show dialog on top

Current result:
Dialog service show dialog not on the top

Expected Result:
Dialog service should always show dialog over all Views and Windows

Steps to reproduce:

var window = UIApplication.SharedApplication.Windows.FirstOrDefault(x => x.WindowLevel == UIWindowLevel.Normal);
window.AddSubview(new UIView(BackgroundColor.Red));
_dialogService.ShowDialog();

Simplify setup from nuget

Register

Currently, each app must register that services:

builder.Singleton<ConsoleLogManager, ILogManager>();
builder.Singleton<PageNavigationService, IPageNavigationService>();
builder.Singleton<BackStackManager, IBackStackManager>();

That can be simplified, moved to the WL default registration.

BindingGeneric: Double converter wrapping when used IConverter

When used method SetConverter(IConverter):

public Binding SetConverter(IConverter<TTarget, TSource> converter)

Will be add delegates of IConverter instance:

ConvertSourceToTarget(x => _valueConverter.ConvertValue(x));
ConvertTargetToSource(x => _valueConverter.ConvertValueBack(x));

After than method ConvertSourceToTarget set delegate to internal converter:

public Binding<TSource, TTarget> ConvertSourceToTarget(Func<TSource, TTarget> convert)
{
_converter.SetConvert(convert);
ForceUpdateValueFromSourceToTarget();

Internal converter:

private readonly SimpleConverter _converter = new SimpleConverter();

A converter is private, implementation is weakref.

Android: crash after backgrounding/foregrounding if DialogFragment is opened

Description

There's no mechanism of restoring ViewModel for DialogFragmentBase.

Steps to Reproduce

  1. Open DialogFragmentBase (using DroidFragmentDialogService, for instance)
  2. Background the app
  3. Trigger fragment recreation (for instance, by changing display settings, like font size)
  4. Foreground the app

Expected Behavior

The same Dialog is opened in the same state

Actual Behavior

NullReferenceException, because newly created DialogFragment does not have a reference to view model

Basic Information

  • Version with issue: commit 8a94092
  • Last known good version: none
  • IDE: Rider 2020.2
  • Platform Target Frameworks:
    • Android: 10

SetCommand causes UIKitThreadAccessException on iOS

Description

Using SetCommand() extension method with AsyncCommand causes UIKitThreadAccessException if command is executed on background thread. It relates to the manipulation of "Enabled" property, triggered by CanExecuteChanged event

Steps to Reproduce

In ViewDidLoad() of UIViewController do the following (assuming that Button - is and instance of UIButton class):

var command = new AsyncCommand(() => Task.Delay(TimeSpan.FromSeconds(5)));
Button.SetCommand(command);
Task.Run(async () =>
{
        await command.ExecuteAsync(null);  <-- throws exception
});

Another possible case, which also true for RelayCommand:

var command = new AsyncCommand(() => Task.Delay(TimeSpan.FromSeconds(5)));
Button.SetCommand(command);
Task.Run(() =>
{
        command.RaiseCanExecuteChanged();  <-- throws exception
});

Expected Behavior

It should be possible to run commands on any thread without causing exceptions

Actual Behavior

Commands, executed on background thread, may cause exceptions and as a result - leave UI in invalid state

Possible Fix

Detect if SetCommand() extensions are used with UI elements and handle updates of UI elements properly (on UI thread).

Basic Information

  • Version with issue: master branch (3d7c987)
  • Last known good version: None
  • IDE: Rider 2020.1.1
  • Xcode: 11.4
  • Platform Target Frameworks:
    • iOS: 11.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.