Skip to content

Commit

Permalink
fix compatible code
Browse files Browse the repository at this point in the history
  • Loading branch information
moonheart committed Nov 28, 2024
1 parent bc23fef commit cbca2c3
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion MementoMori.AssetDownloader/AssetDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private static async Task SendNotification(string message)
if (string.IsNullOrEmpty(token) || string.IsNullOrEmpty(chatId))
return;
TelegramBotClient botClient = new(token);
await botClient.SendTextMessageAsync(chatId, message);
await botClient.SendMessage(chatId, message);
}


Expand Down
7 changes: 5 additions & 2 deletions MementoMori.Maui/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ public partial class App : Application
public App()
{
InitializeComponent();
}

MainPage = new MainPage();
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new MainPage());
}
}
}
}
3 changes: 2 additions & 1 deletion MementoMori.Maui/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MementoMori.Maui"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
x:Class="MementoMori.Maui.MainPage"
BackgroundColor="{DynamicResource PageBackgroundColor}">

Expand All @@ -15,7 +16,7 @@
<ListView x:Name="LogList" RowHeight="20" SelectionMode="None">
<ListView.ItemTemplate>
<DataTemplate>
<Label FontSize="12" LineHeight="14" Text="{Binding}"></Label>
<Label FontSize="12" LineHeight="14" Text="{Binding}" x:DataType="{x:Type system:String}"></Label>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Expand Down
7 changes: 4 additions & 3 deletions MementoMori.Maui/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ public static MauiApp CreateMauiApp()
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });

Directory.SetCurrentDirectory(FileSystem.Current.AppDataDirectory);
var embeddedFileProvider = new EmbeddedFileProvider(typeof(App).Assembly);
IFileProvider fileProvider = new PhysicalFileProvider(FileSystem.Current.AppDataDirectory);
builder.Services.AddSingleton(fileProvider);

builder.Configuration.AddJsonFile(embeddedFileProvider, "appsettings.json", false, false);
builder.Configuration.AddJsonFile("appsettings.user.json", true, true);
builder.Configuration.AddJsonFile(new EmbeddedFileProvider(typeof(App).Assembly), "appsettings.json", false, false);
builder.Configuration.AddJsonFile(fileProvider, "appsettings.user.json", true, true);
builder.Services.AddMauiBlazorWebView();
builder.Services.AddMudServices();
builder.Services.AddMudMarkdownServices();
Expand Down
1 change: 0 additions & 1 deletion MementoMori.Maui/MementoMori.Maui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>net9.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net9.0-tizen</TargetFrameworks> -->

Expand Down
2 changes: 1 addition & 1 deletion MementoMori.Maui/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:supportsRtl="true" ></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="34" />
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="35" />
</manifest>
3 changes: 2 additions & 1 deletion MementoMori.Maui/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"AuthOption": {
"AuthUrl": null,
"DeviceToken": "",
"AppVersion": "3.0.0",
"AppVersion": "3.2.2",
"OSVersion": "Android OS 13 / API-33 (TKQ1.220829.002/V14.0.12.0.TLACNXM)",
"ModelName": "Xiaomi 2203121C"
},
Expand All @@ -23,6 +23,7 @@
"AutoFreeGacha": true, // 自动免费抽卡
"AutoRankUpCharacter": true // 自动合成角色
},
"ServerUrl": "http://localhost:5134/",
"LocalRaid": {
"RewardItems": [
{
Expand Down
11 changes: 8 additions & 3 deletions MementoMori.WebUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
using Ortega.Common.Manager;
using MudBlazor;
using Refit;
using MagicOnion;
using Microsoft.Extensions.FileProviders;

internal class Program
{
Expand All @@ -42,8 +44,11 @@ public static void Main(string[] args)
o.IsGlobalModeEnabled = true;
});

builder.Configuration.AddJsonFile("appsettings.other.json", true, true);
builder.Configuration.AddJsonFile("appsettings.user.json", true, true);
IFileProvider physicalProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory());
builder.Services.AddSingleton(physicalProvider);

builder.Configuration.AddJsonFile(physicalProvider, "appsettings.other.json", true, true);
builder.Configuration.AddJsonFile(physicalProvider, "appsettings.user.json", true, true);

builder.Services.AddMudServices();
builder.Services.AddMudMarkdownServices();
Expand Down Expand Up @@ -89,7 +94,7 @@ public static void Main(string[] args)
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment()) app.UseExceptionHandler("/Error");

app.UseStaticFiles();
app.MapStaticAssets();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddAdditionalAssemblies(typeof(Index).Assembly)
Expand Down
3 changes: 2 additions & 1 deletion MementoMori.WebUI/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"AuthOption": {
"ClientKey": "",
"DeviceToken": "",
"AppVersion": "3.0.0",
"AppVersion": "3.2.2",
"OSVersion": "Android OS 13 / API-33 (TKQ1.220829.002/V14.0.12.0.TLACNXM)",
"ModelName": "Xiaomi 2203121C",
"AdverisementId": "",
Expand All @@ -25,6 +25,7 @@
"AutoFreeGacha": true, // 自动免费抽卡
"AutoRankUpCharacter": true // 自动合成角色
},
"ServerUrl": "http://localhost:5134/",
"LocalRaid": {
"RewardItems": [
{
Expand Down

0 comments on commit cbca2c3

Please sign in to comment.