2024-06-01 04:38:12 +00:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.AspNetCore.Components.WebView;
|
|
|
|
|
using Microsoft.AspNetCore.Components.WebView.Maui;
|
2024-06-18 00:02:03 +00:00
|
|
|
|
using Neighbourhood.omg.lol.Models;
|
|
|
|
|
using System.ComponentModel;
|
2024-05-31 13:16:09 +00:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
namespace Neighbourhood.omg.lol {
|
2024-05-30 01:06:08 +00:00
|
|
|
|
public partial class MainPage : ContentPage {
|
2024-06-01 04:38:12 +00:00
|
|
|
|
|
2024-06-18 00:02:03 +00:00
|
|
|
|
private State State { get; set; }
|
|
|
|
|
|
2024-05-30 01:06:08 +00:00
|
|
|
|
public MainPage() {
|
|
|
|
|
InitializeComponent();
|
2024-06-18 00:02:03 +00:00
|
|
|
|
State = IPlatformApplication.Current!.Services.GetService<State>()!;
|
|
|
|
|
BindingContext = State;
|
|
|
|
|
State.PropertyChanged += State_PropertyChanged;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void State_PropertyChanged(object? sender, PropertyChangedEventArgs e) {
|
|
|
|
|
if (e.PropertyName == nameof(State.CanRefresh) || e.PropertyName == nameof(State.AtTop)) {
|
|
|
|
|
refreshView.IsEnabled = State.CanRefresh && State.AtTop;
|
|
|
|
|
}
|
2024-05-30 01:06:08 +00:00
|
|
|
|
}
|
2024-05-31 13:16:09 +00:00
|
|
|
|
|
|
|
|
|
private void BlazorUrlLoading(object? sender, UrlLoadingEventArgs e) {
|
|
|
|
|
if(e.Url.Host == "home.omg.lol" && e.Url.AbsolutePath == "/oauth/authorize") {
|
|
|
|
|
e.UrlLoadingStrategy = UrlLoadingStrategy.CancelLoad;
|
|
|
|
|
Shell.Current.GoToAsync(nameof(LoginWebViewPage));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-30 01:06:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|