Skip to content

Commit

Permalink
disable sdk version warnings where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Jul 18, 2023
1 parent 6758485 commit cb7b28e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions AuthenticatorPro.Droid/src/Activity/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ protected override void OnCreate(Bundle savedInstanceState)
Window.SetStatusBarColor(Color.Transparent);
}

#pragma warning disable CA1416
Window.SetDecorFitsSystemWindows(false);
Window.SetNavigationBarColor(Color.Transparent);

Expand All @@ -185,6 +186,7 @@ protected override void OnCreate(Bundle savedInstanceState)
(int) WindowInsetsControllerAppearance.LightStatusBars,
(int) WindowInsetsControllerAppearance.LightStatusBars);
}
#pragma warning restore CA1416
}
else if (_preferences.TransparentStatusBar)
{
Expand Down
2 changes: 2 additions & 0 deletions AuthenticatorPro.Droid/src/AutoBackupWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ private void CreateNotificationChannel(NotificationContext context)
_ => throw new ArgumentOutOfRangeException(nameof(context))
};

#pragma warning disable CA1416
var channel = new NotificationChannel(idString, name, NotificationImportance.Low);
var manager = NotificationManagerCompat.From(_context);
manager.CreateNotificationChannel(channel);
#pragma warning restore CA1416
}

private void ShowNotification(NotificationContext context, bool openAppOnClick, IResult result = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,12 @@ private void ShowBatteryOptimisationDialog()

var powerManager = (PowerManager) Context.GetSystemService(Context.PowerService);

#pragma warning disable CA1416
if (powerManager.IsIgnoringBatteryOptimizations(Context.PackageName))
{
return;
}
#pragma warning restore CA1416

var builder = new MaterialAlertDialogBuilder(Context)
.SetTitle(Resource.String.batOptim)
Expand Down
2 changes: 2 additions & 0 deletions AuthenticatorPro.Droid/src/Util/PackageUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ public static string GetVersionName(PackageManager packageManager, string packag

if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
{
#pragma warning disable CA1416
var flags = PackageManager.PackageInfoFlags.Of(0);
packageInfo = packageManager.GetPackageInfo(packageName, flags);
#pragma warning restore CA1416
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion AuthenticatorPro.Test/src/Entity/AuthenticatorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void GetCodeWithOffset(AuthenticatorType type)
AuthenticatorType.Totp => new Totp(auth.Secret, auth.Period, auth.Algorithm, auth.Digits),
AuthenticatorType.MobileOtp => new MobileOtp(auth.Secret, auth.Pin),
AuthenticatorType.SteamOtp => new SteamOtp(auth.Secret),
AuthenticatorType.YandexOtp => new YandexOtp(auth.Secret, auth.Pin)
AuthenticatorType.YandexOtp => new YandexOtp(auth.Secret, auth.Pin),
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
};

var code = auth.GetCode(1000);
Expand Down
4 changes: 2 additions & 2 deletions AuthenticatorPro.WearOS/src/Activity/CodeActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ protected override void OnCreate(Bundle bundle)

if (hasCustomIcon)
{
#pragma warning disable 618
#pragma warning disable CA1422
// TODO: Use SDK 33 method
var bitmap = (Bitmap) Intent.Extras.GetParcelable("icon");
#pragma warning restore 618
#pragma warning restore CA1422

if (bitmap != null)
{
Expand Down

0 comments on commit cb7b28e

Please sign in to comment.