diff --git a/Source/Xamarin/Prism.Forms/Navigation/INavigateInternal.cs b/Source/Xamarin/Prism.Forms/Navigation/INavigateInternal.cs deleted file mode 100644 index a064fe7201..0000000000 --- a/Source/Xamarin/Prism.Forms/Navigation/INavigateInternal.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Threading.Tasks; - -namespace Prism.Navigation -{ - internal interface INavigateInternal - { - Task GoBackInternal(INavigationParameters parameters, bool? useModalNavigation, bool animated); - - Task GoBackToRootInternal(INavigationParameters parameters); - - Task NavigateInternal(string name, INavigationParameters parameters, bool? useModalNavigation, bool animated); - - Task NavigateInternal(Uri uri, INavigationParameters parameters, bool? useModalNavigation, bool animated); - } -} diff --git a/Source/Xamarin/Prism.Forms/Navigation/INavigationServiceExtensions.cs b/Source/Xamarin/Prism.Forms/Navigation/INavigationServiceExtensions.cs index 18161a4b69..6f3e6ed451 100644 --- a/Source/Xamarin/Prism.Forms/Navigation/INavigationServiceExtensions.cs +++ b/Source/Xamarin/Prism.Forms/Navigation/INavigationServiceExtensions.cs @@ -19,7 +19,7 @@ public static class INavigationServiceExtensions /// If true a go back operation was successful. If false the go back operation failed. public static Task GoBackAsync(this INavigationService navigationService, INavigationParameters parameters = null, bool? useModalNavigation = null, bool animated = true) { - return ((INavigateInternal)navigationService).GoBackInternal(parameters, useModalNavigation, animated); + return ((IPlatformNavigationService)navigationService).GoBackAsync(parameters, useModalNavigation, animated); } /// @@ -30,7 +30,7 @@ public static Task GoBackAsync(this INavigationService naviga /// Only works when called from a View within a NavigationPage public static Task GoBackToRootAsync(this INavigationService navigationService, INavigationParameters parameters = null) { - return ((INavigateInternal)navigationService).GoBackToRootInternal(parameters); + return ((IPlatformNavigationService)navigationService).GoBackToRootAsync(parameters); } /// @@ -42,7 +42,7 @@ public static Task GoBackToRootAsync(this INavigationService /// If true the transition is animated, if false there is no animation on transition. public static Task NavigateAsync(this INavigationService navigationService, string name, INavigationParameters parameters = null, bool? useModalNavigation = null, bool animated = true) { - return ((INavigateInternal)navigationService).NavigateInternal(name, parameters, useModalNavigation, animated); + return ((IPlatformNavigationService)navigationService).NavigateAsync(name, parameters, useModalNavigation, animated); } /// @@ -58,7 +58,7 @@ public static Task NavigateAsync(this INavigationService navi /// public static Task NavigateAsync(this INavigationService navigationService, Uri uri, INavigationParameters parameters = null, bool? useModalNavigation = null, bool animated = true) { - return ((INavigateInternal)navigationService).NavigateInternal(uri, parameters, useModalNavigation, animated); + return ((IPlatformNavigationService)navigationService).NavigateAsync(uri, parameters, useModalNavigation, animated); } /// diff --git a/Source/Xamarin/Prism.Forms/Navigation/IPlatformNavigationService.cs b/Source/Xamarin/Prism.Forms/Navigation/IPlatformNavigationService.cs new file mode 100644 index 0000000000..cd7f2a4ff9 --- /dev/null +++ b/Source/Xamarin/Prism.Forms/Navigation/IPlatformNavigationService.cs @@ -0,0 +1,16 @@ +using System; +using System.Threading.Tasks; + +namespace Prism.Navigation +{ + public interface IPlatformNavigationService + { + Task GoBackAsync(INavigationParameters parameters, bool? useModalNavigation, bool animated); + + Task GoBackToRootAsync(INavigationParameters parameters); + + Task NavigateAsync(string name, INavigationParameters parameters, bool? useModalNavigation, bool animated); + + Task NavigateAsync(Uri uri, INavigationParameters parameters, bool? useModalNavigation, bool animated); + } +} diff --git a/Source/Xamarin/Prism.Forms/Navigation/PageNavigationService.cs b/Source/Xamarin/Prism.Forms/Navigation/PageNavigationService.cs index c6d9393802..0655d977eb 100644 --- a/Source/Xamarin/Prism.Forms/Navigation/PageNavigationService.cs +++ b/Source/Xamarin/Prism.Forms/Navigation/PageNavigationService.cs @@ -13,7 +13,7 @@ namespace Prism.Navigation /// /// Provides page based navigation for ViewModels. /// - public class PageNavigationService : INavigationService, INavigateInternal, IPageAware + public class PageNavigationService : INavigationService, IPlatformNavigationService, IPageAware { internal const string RemovePageRelativePath = "../"; internal const string RemovePageInstruction = "__RemovePage/"; @@ -61,6 +61,11 @@ public virtual Task GoBackAsync(INavigationParameters paramet return GoBackInternal(parameters, null, true); } + Task IPlatformNavigationService.GoBackAsync(INavigationParameters parameters, bool? useModalNavigation, bool animated) + { + return GoBackInternal(parameters, useModalNavigation, animated); + } + /// /// Navigates to the most recent entry in the back navigation history by popping the calling Page off the navigation stack. /// @@ -118,6 +123,11 @@ protected async virtual Task GoBackInternal(INavigationParame return result; } + Task IPlatformNavigationService.GoBackToRootAsync(INavigationParameters parameters) + { + return GoBackToRootInternal(parameters); + } + /// /// When navigating inside a NavigationPage: Pops all but the root Page off the navigation stack /// @@ -174,16 +184,6 @@ protected async virtual Task GoBackToRootInternal(INavigation } } - Task INavigateInternal.GoBackInternal(INavigationParameters parameters, bool? useModalNavigation, bool animated) - { - return GoBackInternal(parameters, useModalNavigation, animated); - } - - Task INavigateInternal.GoBackToRootInternal(INavigationParameters parameters) - { - return GoBackToRootInternal(parameters); - } - /// /// Initiates navigation to the target specified by the . /// @@ -203,6 +203,11 @@ public virtual Task NavigateAsync(string name, INavigationPar return NavigateInternal(name, parameters, null, true); } + Task IPlatformNavigationService.NavigateAsync(string name, INavigationParameters parameters, bool? useModalNavigation, bool animated) + { + return NavigateInternal(name, parameters, useModalNavigation, animated); + } + /// /// Initiates navigation to the target specified by the . /// @@ -218,11 +223,6 @@ protected virtual Task NavigateInternal(string name, INavigat return NavigateInternal(UriParsingHelper.Parse(name), parameters, useModalNavigation, animated); } - Task INavigateInternal.NavigateInternal(string name, INavigationParameters parameters, bool? useModalNavigation, bool animated) - { - return NavigateInternal(name, parameters, useModalNavigation, animated); - } - /// /// Initiates navigation to the target specified by the . /// @@ -250,6 +250,11 @@ public virtual Task NavigateAsync(Uri uri, INavigationParamet return NavigateInternal(uri, parameters, null, true); } + Task IPlatformNavigationService.NavigateAsync(Uri uri, INavigationParameters parameters, bool? useModalNavigation, bool animated) + { + return NavigateInternal(uri, parameters, useModalNavigation, animated); + } + /// /// Initiates navigation to the target specified by the . /// @@ -296,11 +301,6 @@ protected async virtual Task NavigateInternal(Uri uri, INavig } } - Task INavigateInternal.NavigateInternal(Uri uri, INavigationParameters parameters, bool? useModalNavigation, bool animated) - { - return NavigateInternal(uri, parameters, useModalNavigation, animated); - } - protected virtual async Task ProcessNavigation(Page currentPage, Queue segments, INavigationParameters parameters, bool? useModalNavigation, bool animated) { if (segments.Count == 0)