This commit includes significant updates to the application, focusing on configuration changes, UI enhancements, and new features: - Updated `appsettings.json` to change the database name and add a new connection string for encryption. - Modified `launchSettings.json` to allow the application to listen on all network interfaces. - Introduced new image assets and SVG icons to improve visual elements. - Added `UserPreferencesService` to manage user acceptance of terms and conditions. - Expanded `OnboardingViewModel` to manage onboarding steps and user interactions. - Created new popup ViewModels for managing user agreements and subscription offers. - Restructured various XAML files to improve layout consistency and data binding. - Updated project files to reflect version changes and improve organization. - Introduced a new `SubscriptionModel` class to manage subscription data in the UI. Overall, these changes enhance the application's structure, usability, and responsiveness.
671 lines
29 KiB
C#
671 lines
29 KiB
C#
using CommunityToolkit.Maui;
|
|
using gehGassi.LocalNotifications;
|
|
using gehGassiApp.Constants;
|
|
using gehGassiApp.Core.Data;
|
|
using gehGassiApp.Core.Interfaces;
|
|
using gehGassiApp.Core.Interfaces.Synchronization;
|
|
using gehGassiApp.Core.Services;
|
|
using gehGassiApp.Core.Services.Synchronization;
|
|
using gehGassiApp.Data;
|
|
using gehGassiApp.Helper;
|
|
using gehGassiApp.Services;
|
|
using gehGassiApp.ViewModels;
|
|
using gehGassiApp.ViewModels.Account;
|
|
using gehGassiApp.ViewModels.Advertisements;
|
|
using gehGassiApp.ViewModels.Dogs;
|
|
using gehGassiApp.ViewModels.Jobs;
|
|
using gehGassiApp.ViewModels.Messages;
|
|
using gehGassiApp.ViewModels.More;
|
|
using gehGassiApp.ViewModels.News;
|
|
using gehGassiApp.ViewModels.Owners;
|
|
using gehGassiApp.ViewModels.Partners;
|
|
using gehGassiApp.ViewModels.Payment;
|
|
using gehGassiApp.ViewModels.Ratings;
|
|
using gehGassiApp.ViewModels.Report;
|
|
using gehGassiApp.ViewModels.Walkers;
|
|
using gehGassiApp.ViewModels.Walks;
|
|
using gehGassiApp.Views;
|
|
using gehGassiApp.Views.Account;
|
|
using gehGassiApp.Views.Advertisements;
|
|
using gehGassiApp.Views.Dogs;
|
|
using gehGassiApp.Views.Jobs;
|
|
using gehGassiApp.Views.Listings;
|
|
using gehGassiApp.Views.Messages;
|
|
using gehGassiApp.Views.More;
|
|
using gehGassiApp.Views.News;
|
|
using gehGassiApp.Views.Owners;
|
|
using gehGassiApp.Views.Partners;
|
|
using gehGassiApp.Views.Payments;
|
|
using gehGassiApp.Views.Ratings;
|
|
using gehGassiApp.Views.Report;
|
|
using gehGassiApp.Views.Walkers;
|
|
using gehGassiApp.Views.Walks;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using AdvertisementsViewModel = gehGassiApp.ViewModels.Advertisements.AdvertisementsViewModel;
|
|
using ConversationsView = gehGassiApp.Views.Messages.ConversationsView;
|
|
using ConversationsViewModel = gehGassiApp.ViewModels.Messages.ConversationsViewModel;
|
|
using ListingsViewModel = gehGassiApp.ViewModels.Listings.ListingsViewModel;
|
|
using LoginViewModel = gehGassiApp.ViewModels.Account.LoginViewModel;
|
|
using NewsView = gehGassiApp.Views.News.NewsView;
|
|
using PasswordLostView = gehGassiApp.Views.Account.PasswordLostView;
|
|
using PasswordLostViewModel = gehGassiApp.ViewModels.Account.PasswordLostViewModel;
|
|
using ResendConfirmationView = gehGassiApp.Views.Account.ResendConfirmationView;
|
|
using ResendConfirmationViewModel = gehGassiApp.ViewModels.Account.ResendConfirmationViewModel;
|
|
using Microsoft.Maui.Controls.Compatibility.Hosting;
|
|
using Microsoft.Maui.Controls.PlatformConfiguration;
|
|
using Microsoft.Maui.Handlers;
|
|
using Microsoft.Maui.Platform;
|
|
using Path = System.IO.Path;
|
|
using WalkersViewModel = gehGassiApp.ViewModels.Walkers.WalkersViewModel;
|
|
using Camera.MAUI;
|
|
using gehGassiApp.ViewModels.Subscriptions;
|
|
using gehGassiApp.Views.Subscriptions;
|
|
using TinyInsights;
|
|
using gehGassiApp.Views.Onboarding;
|
|
using gehGassiApp.ViewModels.Onboarding;
|
|
using gehGassiApp.Views.Popups;
|
|
using gehGassiApp.ViewModels.Popups;
|
|
|
|
|
|
|
|
|
|
|
|
#if ANDROID
|
|
using gehGassiApp.Platforms.Android;
|
|
using Android.Content.Res;
|
|
using Android.Graphics;
|
|
using Color = Android.Graphics.Color;
|
|
#endif
|
|
|
|
#if IOS
|
|
using gehGassiApp.Platforms.iOS;
|
|
using UIKit;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
#endif
|
|
|
|
namespace gehGassiApp;
|
|
|
|
public static class MauiProgram
|
|
{
|
|
public static MauiApp CreateMauiApp()
|
|
{
|
|
System.Diagnostics.Debug.WriteLine(".......................... CreateMauiApp ...................");
|
|
var builder = MauiApp.CreateBuilder();
|
|
|
|
builder
|
|
.UseMauiApp<App>()
|
|
.UseMauiCommunityToolkit()
|
|
.UseMauiCameraView()
|
|
.ConfigureFonts(fonts =>
|
|
{
|
|
fonts.AddFont("Inter-Regular.ttf", "InterRegular");
|
|
fonts.AddFont("Inter-Medium.ttf", "InterMedium");
|
|
fonts.AddFont("Inter-SemiBold.ttf", "InterSemiBold");
|
|
fonts.AddFont("icomoon.ttf", "IconMoon");
|
|
fonts.AddFont("MaterialIcons-Regular.ttf", "IconFont");
|
|
}).UseLocalNotifications()
|
|
.ConfigureMauiHandlers((handlers) =>
|
|
{
|
|
#if IOS16_0_OR_GREATER
|
|
//handlers.AddHandler(typeof(Shell), typeof(CustomShellRenderer)); //BUG: https://github.com/dotnet/maui/issues/11309 && https://github.com/xamarin/Xamarin.Forms/issues/14938 //TODO: Prüfen ob das wieder benötigt wird
|
|
#endif
|
|
});
|
|
|
|
//builder.DisplayContentBehindBars();
|
|
#if ANDROID
|
|
//builder.SetDefaultStatusBarAppearance(Colors.Transparent, false);
|
|
#endif
|
|
|
|
//#if ANDROID
|
|
// .ConfigureMauiHandlers(h => {
|
|
// h.AddHandler(typeof(CollectionView), typeof(CollectionViewHandlerEx));
|
|
// })
|
|
//#endif
|
|
// ;
|
|
|
|
//MemoryCache
|
|
builder.Services.AddMemoryCache();
|
|
|
|
#region DB
|
|
|
|
var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "gehgassidb.db");
|
|
if (DeviceInfo.Platform == DevicePlatform.iOS)
|
|
{
|
|
//Hinzugefügt, da der Library Folder anscheinend nicht in der I-Cloud gesichert wird
|
|
databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Resources), "gehgassidb.db");
|
|
}
|
|
|
|
//var dbOptions = new DbContextOptionsBuilder().UseSqlite($"Filename={databasePath}", o => { o.CommandTimeout(120);}).Options;
|
|
|
|
//builder.Services.AddDbContext<>()
|
|
//TODO: Connection Pooling deaktiviert wegen: https://github.com/dotnet/efcore/issues/29952
|
|
builder.Services.AddDbContext<LocalDbContext>(o => o.UseSqlite($"Filename={databasePath};Pooling=false", sqlLiteOptions => { sqlLiteOptions.CommandTimeout(120); }));
|
|
builder.Services.AddTransient<DbInitializer>();
|
|
builder.Services.AddSingleton<IMauiInitializeService, DatabaseInitializer>();
|
|
builder.Services.AddSingleton<IUnitOfWork, UnitOfWork>();
|
|
|
|
#endregion
|
|
|
|
#region Service
|
|
|
|
var address = Preferences.Get(Storage.ServerAddress, string.Empty);
|
|
if (string.IsNullOrEmpty(address))
|
|
{
|
|
#if DEBUG
|
|
Preferences.Set(Storage.ServerAddress, "https://192.168.0.65:5001/"); //TODO: Adresse lokaler Server setzen: z.B.: https://localhost:xxxxx
|
|
#elif STAGING
|
|
Preferences.Set(Storage.ServerAddress, "");
|
|
#elif DEBUGSTAGING
|
|
Preferences.Set(Storage.ServerAddress, "");
|
|
#else
|
|
Preferences.Set(Storage.ServerAddress, "https://backend.gehgassi.com"); //Achtung - Live Server
|
|
#endif
|
|
}
|
|
address = Preferences.Get(Storage.ServerAddress, string.Empty);
|
|
|
|
var hubAddress = Preferences.Get(Storage.HubAddress, string.Empty);
|
|
if (string.IsNullOrEmpty(hubAddress))
|
|
{
|
|
#if DEBUG
|
|
Preferences.Set(Storage.ServerAddress, "https://192.168.0.65:5001/"); //TODO: Adresse lokaler Server setzen: z.B.: https://localhost:xxxxx
|
|
|
|
#elif STAGING
|
|
Preferences.Set(Storage.HubAddress, "");
|
|
#elif DEBUGSTAGING
|
|
Preferences.Set(Storage.HubAddress, "");
|
|
#else
|
|
Preferences.Set(Storage.HubAddress, "https://backend.gehgassi.com"); //Achtung - Live Server
|
|
#endif
|
|
}
|
|
hubAddress = Preferences.Get(Storage.HubAddress, string.Empty);
|
|
|
|
var webServerAddress = Preferences.Get(Storage.WebServerAddress, string.Empty);
|
|
if (string.IsNullOrEmpty(webServerAddress))
|
|
{
|
|
#if DEBUG
|
|
Preferences.Set(Storage.ServerAddress, "https://192.168.0.65:5001/"); //TODO: Adresse lokaler Server setzen: z.B.: https://localhost:xxxxx
|
|
|
|
#elif STAGING
|
|
Preferences.Set(Storage.WebServerAddress, "");
|
|
#elif DEBUGSTAGING
|
|
Preferences.Set(Storage.WebServerAddress, "");
|
|
#else
|
|
Preferences.Set(Storage.WebServerAddress, "https://backend.gehgassi.com"); //Achtung - Live Server
|
|
#endif
|
|
}
|
|
webServerAddress = Preferences.Get(Storage.WebServerAddress, string.Empty);
|
|
|
|
var applicationInsightsConnectionString = Preferences.Get(Storage.ApplicationInsights, string.Empty);
|
|
//webServerAddress = string.Empty;
|
|
if (string.IsNullOrEmpty(applicationInsightsConnectionString))
|
|
{
|
|
#if DEBUG
|
|
Preferences.Set(Storage.ApplicationInsights, "InstrumentationKey=437c7a86-0275-4400-aadd-40d1347a87c6;IngestionEndpoint=https://germanywestcentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://germanywestcentral.livediagnostics.monitor.azure.com/;ApplicationId=4e3538b6-2378-49e2-a27e-d6fc98944c04");
|
|
#elif STAGING
|
|
Preferences.Set(Storage.ApplicationInsights, "InstrumentationKey=437c7a86-0275-4400-aadd-40d1347a87c6;IngestionEndpoint=https://germanywestcentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://germanywestcentral.livediagnostics.monitor.azure.com/;ApplicationId=4e3538b6-2378-49e2-a27e-d6fc98944c04");
|
|
#elif DEBUGSTAGING
|
|
Preferences.Set(Storage.ApplicationInsights, "InstrumentationKey=437c7a86-0275-4400-aadd-40d1347a87c6;IngestionEndpoint=https://germanywestcentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://germanywestcentral.livediagnostics.monitor.azure.com/;ApplicationId=4e3538b6-2378-49e2-a27e-d6fc98944c04");
|
|
#else
|
|
Preferences.Set(Storage.ApplicationInsights, "InstrumentationKey=d9367ea7-b2f2-41df-b990-d4c08abefa4e;IngestionEndpoint=https://germanywestcentral-1.in.applicationinsights.azure.com/;LiveEndpoint=https://germanywestcentral.livediagnostics.monitor.azure.com/;ApplicationId=09f0fc61-d7ee-4ea8-ad37-684c3a24eecb");
|
|
#endif
|
|
}
|
|
applicationInsightsConnectionString = Preferences.Get(Storage.ApplicationInsights, string.Empty);
|
|
|
|
builder.UseTinyInsights(applicationInsightsConnectionString, (p) =>
|
|
{
|
|
p.IsAutoTrackPageViewsEnabled = false;
|
|
p.IsTrackCrashesEnabled = true;
|
|
p.IsTrackDependencyEnabled = true;
|
|
p.IsTrackErrorsEnabled = true;
|
|
p.IsTrackEventsEnabled = true;
|
|
p.IsTrackPageViewsEnabled = true;
|
|
});
|
|
|
|
var pushnotificationAddress = Preferences.Get(Storage.PushnotificationAddress, string.Empty);
|
|
if (string.IsNullOrEmpty(pushnotificationAddress))
|
|
{
|
|
Preferences.Set(Storage.PushnotificationAddress, "Endpoint=sb://gehgassihub.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=RKQtt6KT/KoxUQtpJ7o59V4qheSidpg2I9yzF7sw8yU=");
|
|
}
|
|
|
|
var pushnotificationHubname = Preferences.Get(Storage.PushnotificationHubname, string.Empty);
|
|
if (string.IsNullOrEmpty(pushnotificationHubname))
|
|
{
|
|
Preferences.Set(Storage.PushnotificationHubname, "gehgassihub");
|
|
}
|
|
|
|
//var automapperConfig = new MapperConfiguration(cfg =>
|
|
//{
|
|
// var profile = new MappingProfile();
|
|
// cfg.AddProfile(profile);
|
|
//});
|
|
//var mapper = new AutoMapper.Mapper(automapperConfig);
|
|
//builder.Services.AddSingleton<IMapper>(mapper);
|
|
|
|
builder.Services.AddSingleton<ICommunicationService>(s => new CommunicationService(address, ServiceHelper.GetService<ISettingsService>(), ServiceHelper.GetService<IAppReportingService>()));
|
|
builder.Services.AddSingleton<IAppHubService>(s => new AppHubService(hubAddress));
|
|
builder.Services.AddSingleton<IDialogService, DialogService>();
|
|
builder.Services.AddSingleton<ILocationService, LocationService>();
|
|
builder.Services.AddSingleton<IAccountService, AccountService>();
|
|
builder.Services.AddSingleton<ICountryService, CountryService>();
|
|
builder.Services.AddSingleton<ISyncService, SyncService>();
|
|
builder.Services.AddSingleton<ISyncInfoPullService, SyncInfoPullService>();
|
|
builder.Services.AddSingleton<ISyncInfoPushService, SyncInfoPushService>();
|
|
builder.Services.AddSingleton<ISettingsService, SettingsService>();
|
|
builder.Services.AddSingleton<ILocalPushNotificationService, LocalPushNotificationService>();
|
|
#if ANDROID
|
|
builder.Services.AddSingleton<IDeviceInstallationService, DeviceInstallationServiceAndroid>();
|
|
#endif
|
|
#if IOS
|
|
builder.Services.AddSingleton<IDeviceInstallationService, DeviceInstallationServiceIos>();
|
|
#endif
|
|
builder.Services.AddSingleton<IPushnotificationService, PushnotificationService>();
|
|
builder.Services.AddSingleton<IAppReportingService, AppReportingService>();
|
|
|
|
builder.Services.AddSingleton<IUserService, UserService>();
|
|
builder.Services.AddSingleton<IWalkerProfileService, WalkerProfileService>();
|
|
builder.Services.AddSingleton<INewsService, NewsService>();
|
|
builder.Services.AddSingleton<ILookupService, LookupService>();
|
|
builder.Services.AddSingleton<IConversationService, ConversationService>();
|
|
builder.Services.AddSingleton<IMessageService, MessageService>();
|
|
builder.Services.AddSingleton<IListingService, ListingService>();
|
|
builder.Services.AddSingleton<IBannerService, BannerService>();
|
|
builder.Services.AddSingleton<IAdvertisementService, AdvertisementService>();
|
|
builder.Services.AddSingleton<IDogRaceService, DogRaceService>();
|
|
builder.Services.AddSingleton<IDogService, DogService>();
|
|
builder.Services.AddSingleton<IPublicWalkRequestService, PublicWalkRequestService>();
|
|
builder.Services.AddSingleton<IPublicWalkResponseService, PublicWalkResponseService>();
|
|
builder.Services.AddSingleton<IWalkService, WalkService>();
|
|
builder.Services.AddSingleton<IDogWalkerService, DogWalkerService>();
|
|
builder.Services.AddSingleton<IDogOwnerService, DogOwnerService>();
|
|
builder.Services.AddSingleton<IWalkingTimeService, WalkingTimeService>();
|
|
builder.Services.AddSingleton<IRatingService, RatingService>();
|
|
builder.Services.AddSingleton<IFeedbackService, FeedbackService>();
|
|
builder.Services.AddSingleton<IFavouriteService, FavouriteService>();
|
|
builder.Services.AddSingleton<ISystemMessageService, SystemMessageService>();
|
|
builder.Services.AddSingleton<IPaymentService, PaymentService>();
|
|
builder.Services.AddSingleton<ITransactionFeeService, TransactionFeeService>();
|
|
builder.Services.AddSingleton<IAppVersionService, AppVersionService>();
|
|
builder.Services.AddSingleton<IVoucherService, VoucherService>();
|
|
builder.Services.AddSingleton<ISubscriptionService, SubscriptionService>();
|
|
builder.Services.AddSingleton<ISubscriptionValidationService, SubscriptionValidationService>();
|
|
|
|
//Mockups!!!!!
|
|
|
|
|
|
#endregion
|
|
|
|
#region Viewmodels
|
|
|
|
builder.Services.AddSingleton<AppShellViewModel>();
|
|
builder.Services.AddSingleton<HomeViewModel>();
|
|
builder.Services.AddSingleton<HomeWalkerViewModel>();
|
|
builder.Services.AddSingleton<LoginViewModel>();
|
|
builder.Services.AddSingleton<LoginFormViewModel>();
|
|
builder.Services.AddSingleton<LoadingViewModel>();
|
|
builder.Services.AddTransient<RegisterViewModel>();
|
|
builder.Services.AddTransient<RegisterExternalViewModel>();
|
|
builder.Services.AddTransient<PermissionViewModel>();
|
|
builder.Services.AddTransient<NoConnectionViewModel>();
|
|
builder.Services.AddTransient<DeleteViewModel>();
|
|
|
|
builder.Services.AddSingleton<AdvertisementsViewModel>();
|
|
builder.Services.AddTransient<AdvertisementViewModel>();
|
|
|
|
builder.Services.AddTransient<OnboardingViewModel>();
|
|
|
|
builder.Services.AddSingleton<FavouritesViewModel>();
|
|
builder.Services.AddSingleton<ProfileViewModel>();
|
|
builder.Services.AddSingleton<ProfileWalkerViewModel>();
|
|
builder.Services.AddSingleton<PasswordViewModel>();
|
|
|
|
builder.Services.AddSingleton<DogsViewModel>();
|
|
builder.Services.AddTransient<DogAddViewModel>();
|
|
builder.Services.AddTransient<DogUpdateViewModel>();
|
|
builder.Services.AddTransient<DogShowViewModel>();
|
|
|
|
builder.Services.AddSingleton<WalkersViewModel>();
|
|
builder.Services.AddTransient<WalkerViewModel>();
|
|
builder.Services.AddTransient<OwnerViewModel>();
|
|
|
|
builder.Services.AddSingleton<WalksViewModel>();
|
|
builder.Services.AddSingleton<WalksWalkerViewModel>();
|
|
builder.Services.AddSingleton<JobsViewModel>();
|
|
builder.Services.AddSingleton<PublicWalkRequestCreateViewModel>();
|
|
builder.Services.AddTransient<PublicWalkRequestShowViewModel>();
|
|
builder.Services.AddTransient<PublicWalkRequestDetailsViewModel>();
|
|
builder.Services.AddTransient<PublicWalkResponseShowViewModel>();
|
|
builder.Services.AddTransient<WalkWalkerViewModel>();
|
|
builder.Services.AddTransient<WalkViewModel>();
|
|
builder.Services.AddSingleton<BookWalkViewModel>();
|
|
builder.Services.AddSingleton<PayWalkViewModel>();
|
|
builder.Services.AddSingleton<PaymentSuccessViewModel>();
|
|
builder.Services.AddSingleton<PaymentFailedViewModel>();
|
|
builder.Services.AddTransient<IdentityProofViewModel>();
|
|
|
|
builder.Services.AddTransient<PasswordLostViewModel>();
|
|
builder.Services.AddTransient<PasswordLostSuccessViewModel>();
|
|
builder.Services.AddTransient<ResendConfirmationViewModel>();
|
|
|
|
builder.Services.AddSingleton<ConversationsViewModel>();
|
|
builder.Services.AddTransient<MessagesViewModel>();
|
|
builder.Services.AddTransient<MessagesIosViewModel>();
|
|
builder.Services.AddTransient<SelectTargetViewModel>();
|
|
builder.Services.AddTransient<SystemMessagesViewModel>();
|
|
|
|
builder.Services.AddSingleton<OffersViewModel>();
|
|
builder.Services.AddSingleton<ListingsViewModel>();
|
|
builder.Services.AddTransient<ListingViewModel>();
|
|
|
|
builder.Services.AddSingleton<NewsViewModel>();
|
|
builder.Services.AddTransient<NewsDetailsViewModel>();
|
|
|
|
builder.Services.AddSingleton<MoreViewModel>();
|
|
builder.Services.AddSingleton<MoreWalkerViewModel>();
|
|
builder.Services.AddTransient<SettingsViewModel>();
|
|
builder.Services.AddTransient<ShowTextPageViewModel>();
|
|
builder.Services.AddTransient<WalkingTimesViewModel>();
|
|
builder.Services.AddTransient<BecomeWalkerViewmodel>();
|
|
builder.Services.AddTransient<AddPaymentUserViewModel>();
|
|
builder.Services.AddTransient<WalletsViewModel>();
|
|
builder.Services.AddTransient<BankAccountViewModel>();
|
|
builder.Services.AddSingleton<PayoutsViewModel>();
|
|
builder.Services.AddTransient<PayoutViewModel>();
|
|
|
|
builder.Services.AddTransient<RatingDogViewModel>();
|
|
builder.Services.AddTransient<RatingWalkerViewModel>();
|
|
builder.Services.AddTransient<RatingOwnerViewModel>();
|
|
builder.Services.AddTransient<RatingsMyViewModel>();
|
|
builder.Services.AddTransient<RatingShowViewModel>();
|
|
|
|
builder.Services.AddTransient<FeedbackViewModel>();
|
|
|
|
builder.Services.AddTransient<SystemMessageViewModel>();
|
|
|
|
builder.Services.AddSingleton<BlockedAppUsersViewModel>();
|
|
builder.Services.AddTransient<ReportViewModel>();
|
|
|
|
builder.Services.AddTransient<SubscriptionsViewModel>();
|
|
#endregion
|
|
|
|
#region Views
|
|
|
|
builder.Services.AddSingleton<LoadingView>();
|
|
builder.Services.AddSingleton<AppShell>();
|
|
builder.Services.AddSingleton<HomeView>();
|
|
builder.Services.AddSingleton<HomeWalkerView>();
|
|
builder.Services.AddSingleton<LoginView>();
|
|
builder.Services.AddSingleton<LoginFormView>();
|
|
builder.Services.AddTransient<RegisterView>();
|
|
builder.Services.AddTransient<RegisterExternalView>();
|
|
builder.Services.AddTransient<PasswordView>();
|
|
builder.Services.AddTransient<PermissionView>();
|
|
builder.Services.AddTransient<NoConnectionView>();
|
|
builder.Services.AddTransient<DeleteView>();
|
|
|
|
builder.Services.AddSingleton<AdvertisementsView>();
|
|
builder.Services.AddTransient<AdvertisementView>();
|
|
|
|
builder.Services.AddTransient<OnboardingView>();
|
|
|
|
builder.Services.AddSingleton<FavouritesView>();
|
|
builder.Services.AddSingleton<ProfileView>();
|
|
builder.Services.AddSingleton<ProfileWalkerView>();
|
|
|
|
builder.Services.AddSingleton<DogsView>();
|
|
builder.Services.AddTransient<DogAddView>();
|
|
builder.Services.AddTransient<DogUpdateView>();
|
|
builder.Services.AddTransient<DogShowView>();
|
|
|
|
builder.Services.AddSingleton<WalkersView>();
|
|
builder.Services.AddTransient<WalkerView>();
|
|
builder.Services.AddTransient<OwnerView>();
|
|
|
|
builder.Services.AddSingleton<WalksView>();
|
|
builder.Services.AddSingleton<WalksWalkerView>();
|
|
builder.Services.AddSingleton<JobsView>();
|
|
builder.Services.AddSingleton<PublicWalkRequestCreateView>();
|
|
builder.Services.AddTransient<PublicWalkRequestShowView>();
|
|
builder.Services.AddTransient<PublicWalkRequestDetailsView>();
|
|
builder.Services.AddTransient<PublicWalkResponseShowView>();
|
|
builder.Services.AddTransient<WalkWalkerView>();
|
|
builder.Services.AddTransient<WalkView>();
|
|
builder.Services.AddSingleton<BookWalkView>();
|
|
builder.Services.AddSingleton<PayWalkView>();
|
|
builder.Services.AddSingleton<PaymentSuccessView>();
|
|
builder.Services.AddSingleton<PaymentFailedView>();
|
|
builder.Services.AddTransient<IdentityProofView>();
|
|
|
|
builder.Services.AddTransient<PasswordLostView>();
|
|
builder.Services.AddTransient<PasswordLostSuccessView>();
|
|
builder.Services.AddTransient<ResendConfirmationView>();
|
|
|
|
builder.Services.AddSingleton<ConversationsView>();
|
|
builder.Services.AddTransient<MessagesView>();
|
|
builder.Services.AddTransient<MessagesIosView>();
|
|
builder.Services.AddTransient<SelectTargetView>();
|
|
builder.Services.AddTransient<SystemMessagesView>();
|
|
|
|
builder.Services.AddSingleton<OffersView>();
|
|
builder.Services.AddSingleton<ListingsView>();
|
|
builder.Services.AddTransient<ListingView>();
|
|
|
|
builder.Services.AddSingleton<NewsView>();
|
|
builder.Services.AddTransient<NewsDetailsView>();
|
|
|
|
builder.Services.AddSingleton<MoreView>();
|
|
builder.Services.AddSingleton<MoreWalkerView>();
|
|
builder.Services.AddTransient<SettingsView>();
|
|
builder.Services.AddTransient<ShowTextPageView>();
|
|
builder.Services.AddTransient<WalkingTimesView>();
|
|
builder.Services.AddTransient<BecomeWalkerView>();
|
|
builder.Services.AddTransient<AddPaymentUserView>();
|
|
builder.Services.AddTransient<WalletsView>();
|
|
builder.Services.AddTransient<BankAccountView>();
|
|
builder.Services.AddSingleton<PayoutsView>();
|
|
builder.Services.AddTransient<PayoutView>();
|
|
|
|
builder.Services.AddTransient<RatingDogView>();
|
|
builder.Services.AddTransient<RatingWalkerView>();
|
|
builder.Services.AddTransient<RatingOwnerView>();
|
|
builder.Services.AddTransient<RatingsMyView>();
|
|
builder.Services.AddTransient<RatingShowView>();
|
|
|
|
builder.Services.AddTransient<FeedbackView>();
|
|
|
|
builder.Services.AddTransient<SystemMessageView>();
|
|
|
|
builder.Services.AddSingleton<BlockedAppUsersView>();
|
|
builder.Services.AddTransient<ReportView>();
|
|
|
|
builder.Services.AddTransient<SubscriptionsView>();
|
|
|
|
#endregion
|
|
|
|
SetHandler();
|
|
|
|
return builder.Build();
|
|
}
|
|
|
|
#region Handler
|
|
|
|
/// <summary>
|
|
/// Handler um das Verhalten von Controls zu verändern
|
|
/// </summary>
|
|
private static void SetHandler()
|
|
{
|
|
|
|
Microsoft.Maui.Handlers.EntryHandler.Mapper.AppendToMapping("EntryCustomization", (handler, view) =>
|
|
{
|
|
if (view is Entry)
|
|
{
|
|
#if ANDROID
|
|
handler.PlatformView.Background = null;
|
|
#endif
|
|
#if IOS
|
|
handler.PlatformView.BorderStyle = UITextBorderStyle.None;
|
|
handler.PlatformView.SecureTextEntry = false;
|
|
#endif
|
|
}
|
|
|
|
});
|
|
|
|
Microsoft.Maui.Handlers.EditorHandler.Mapper.AppendToMapping("EditorCustomization", (handler, view) =>
|
|
{
|
|
if (view is Editor)
|
|
{
|
|
#if ANDROID
|
|
handler.PlatformView.Background = null;
|
|
#endif
|
|
}
|
|
|
|
});
|
|
|
|
Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping("PickerCustomization", (handler, view) =>
|
|
{
|
|
if (view is Picker)
|
|
{
|
|
#if ANDROID
|
|
handler.PlatformView.Background = null;
|
|
#endif
|
|
#if IOS
|
|
handler.PlatformView.BorderStyle = UITextBorderStyle.None;
|
|
#endif
|
|
}
|
|
|
|
});
|
|
|
|
Microsoft.Maui.Handlers.DatePickerHandler.Mapper.AppendToMapping("DatePickerCustomization", (handler, view) =>
|
|
{
|
|
if (view is DatePicker)
|
|
{
|
|
#if ANDROID
|
|
handler.PlatformView.Background = null;
|
|
#endif
|
|
}
|
|
#if IOS
|
|
handler.PlatformView.BorderStyle = UITextBorderStyle.None;
|
|
#endif
|
|
|
|
});
|
|
|
|
Microsoft.Maui.Handlers.TimePickerHandler.Mapper.AppendToMapping("TimePickerCustomization", (handler, view) =>
|
|
{
|
|
if (view is TimePicker)
|
|
{
|
|
#if ANDROID
|
|
handler.PlatformView.Background = null;
|
|
#endif
|
|
#if IOS
|
|
handler.PlatformView.BorderStyle = UITextBorderStyle.None;
|
|
#endif
|
|
}
|
|
|
|
});
|
|
|
|
#region Deaktiviert mit .net 8
|
|
// Microsoft.Maui.Handlers.SwitchHandler.Mapper.AppendToMapping(nameof(ISwitch.IsOn), (handler, view) =>
|
|
// {
|
|
// if (view is Switch)
|
|
// {
|
|
//#if ANDROID
|
|
// handler.PlatformView.TrackTintList = ColorStateList.ValueOf(new Color(120,120,128,32));
|
|
//#endif
|
|
//#if IOS
|
|
// //siehe https://github.com/dotnet/maui/issues/10099
|
|
// if (view == null)
|
|
// return;
|
|
|
|
// var uiSwitch = handler.PlatformView;
|
|
// if (uiSwitch == null)
|
|
// return;
|
|
|
|
// var uIView = OperatingSystem.IsIOSVersionAtLeast(13) || OperatingSystem.IsTvOSVersionAtLeast(13)
|
|
// ? uiSwitch.Subviews?[0]?.Subviews?[0]
|
|
// : uiSwitch.Subviews?[0]?.Subviews?[0]?.Subviews?[0];
|
|
|
|
// if (uIView is null)
|
|
// return;
|
|
|
|
// if (!view.IsOn)
|
|
// {
|
|
// // iOS 13+ uses the UIColor.SecondarySystemFill to support Light and Dark mode
|
|
// // else, use the RGBA equivalent of UIColor.SecondarySystemFill in Light mode
|
|
// uIView.BackgroundColor = OperatingSystem.IsIOSVersionAtLeast(13)
|
|
// ? UIKit.UIColor.SecondarySystemFill
|
|
// : UIKit.UIColor.FromRGBA(120, 120, 128, 32);
|
|
// }
|
|
// else if (view.TrackColor is not null)
|
|
// {
|
|
// uiSwitch.OnTintColor = view.TrackColor.ToPlatform();
|
|
// uIView.BackgroundColor = uiSwitch.OnTintColor;
|
|
// }
|
|
//#endif
|
|
// }
|
|
|
|
// });
|
|
#endregion
|
|
|
|
//SIEHE: https://github.com/dotnet/maui/issues/3559
|
|
Microsoft.Maui.Handlers.ToolbarHandler.Mapper.AppendToMapping("CustomNavigationView", (handler, view) =>
|
|
{
|
|
#if ANDROID
|
|
handler.PlatformView.ContentInsetStartWithNavigation = 0;
|
|
handler.PlatformView.SetContentInsetsAbsolute(0, 0);
|
|
#endif
|
|
});
|
|
|
|
//SIEHE: https://github.com/dotnet/maui/discussions/5492
|
|
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(Label.LineBreakMode), (handler, label) =>
|
|
{
|
|
#if ANDROID
|
|
if (label is Label controlsLabel && handler.PlatformView.Ellipsize == Android.Text.TextUtils.TruncateAt.End && controlsLabel.MaxLines != -1)
|
|
{
|
|
handler.PlatformView.SetMaxLines(controlsLabel.MaxLines);
|
|
}
|
|
#endif
|
|
#if IOS
|
|
if (label is Label controlsLabel && handler.PlatformView.LineBreakMode == UILineBreakMode.TailTruncation && controlsLabel.MaxLines != -1)
|
|
{
|
|
handler.PlatformView.Lines = controlsLabel.MaxLines;
|
|
}
|
|
#endif
|
|
});
|
|
|
|
//SIEHE: https://github.com/dotnet/maui/discussions/5492
|
|
Microsoft.Maui.Handlers.LabelHandler.Mapper.AppendToMapping(nameof(Label.MaxLines), (handler, label) =>
|
|
{
|
|
#if ANDROID
|
|
if (label is Label controlsLabel && handler.PlatformView.Ellipsize == Android.Text.TextUtils.TruncateAt.End && controlsLabel.MaxLines != -1)
|
|
{
|
|
handler.PlatformView.SetMaxLines(controlsLabel.MaxLines);
|
|
}
|
|
#endif
|
|
#if IOS
|
|
if (label is Label controlsLabel && handler.PlatformView.LineBreakMode == UILineBreakMode.TailTruncation && controlsLabel.MaxLines != -1)
|
|
{
|
|
handler.PlatformView.Lines = controlsLabel.MaxLines;
|
|
}
|
|
#endif
|
|
});
|
|
|
|
//Spezieller Handler für das Problem der Bild-Crashes. Siehe: https://github.com/dotnet/maui/issues/10032
|
|
//TODO: sollte behoben sein ab Version 7.0.59. Wird hier gelassen, falls das nicht der fall sein sollte
|
|
//#if ANDROID
|
|
// ImageHandler.Mapper.PrependToMapping(nameof(Microsoft.Maui.IImage.Source), (handler, view) => PrependToMappingImageSource(handler, view));
|
|
//#endif
|
|
|
|
|
|
}
|
|
|
|
//#if ANDROID
|
|
// public static void PrependToMappingImageSource(IImageHandler handler, Microsoft.Maui.IImage image)
|
|
// {
|
|
// handler.PlatformView?.Clear();
|
|
// }
|
|
//#endif
|
|
|
|
|
|
#endregion
|
|
}
|