2019-03-01 18:59:39 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-03-01 18:59:39 +08:00
|
|
|
|
using System;
|
|
|
|
|
using Foundation;
|
2022-12-12 06:26:13 +08:00
|
|
|
|
using Microsoft.Maui.Devices;
|
2022-02-04 17:58:29 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-01 18:59:39 +08:00
|
|
|
|
using osu.Game;
|
2019-12-20 12:50:57 +08:00
|
|
|
|
using osu.Game.Updater;
|
2021-04-09 07:34:35 +08:00
|
|
|
|
using osu.Game.Utils;
|
2019-03-01 18:59:39 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.iOS
|
|
|
|
|
{
|
2022-11-27 00:59:38 +08:00
|
|
|
|
public partial class OsuGameIOS : OsuGame
|
2019-03-01 18:59:39 +08:00
|
|
|
|
{
|
2019-03-01 22:20:34 +08:00
|
|
|
|
public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString());
|
2020-10-06 12:09:42 +08:00
|
|
|
|
|
|
|
|
|
protected override UpdateManager CreateUpdateManager() => new SimpleUpdateManager();
|
2021-04-09 07:34:35 +08:00
|
|
|
|
|
2021-04-12 22:52:12 +08:00
|
|
|
|
protected override BatteryInfo CreateBatteryInfo() => new IOSBatteryInfo();
|
2021-04-10 05:55:41 +08:00
|
|
|
|
|
2022-02-04 21:10:49 +08:00
|
|
|
|
protected override Edges SafeAreaOverrideEdges =>
|
2022-02-04 17:58:29 +08:00
|
|
|
|
// iOS shows a home indicator at the bottom, and adds a safe area to account for this.
|
|
|
|
|
// Because we have the home indicator (mostly) hidden we don't really care about drawing in this region.
|
|
|
|
|
Edges.Bottom;
|
|
|
|
|
|
2021-04-12 22:52:12 +08:00
|
|
|
|
private class IOSBatteryInfo : BatteryInfo
|
2021-04-09 07:34:35 +08:00
|
|
|
|
{
|
2022-07-30 20:26:19 +08:00
|
|
|
|
public override double? ChargeLevel => Battery.ChargeLevel;
|
2021-04-09 07:34:35 +08:00
|
|
|
|
|
2022-07-30 20:26:19 +08:00
|
|
|
|
public override bool OnBattery => Battery.PowerSource == BatteryPowerSource.Battery;
|
2021-04-09 07:34:35 +08:00
|
|
|
|
}
|
2019-03-01 18:59:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|