EC-868 clear console logging (#2265)

This commit is contained in:
Federico Maccaroni 2022-12-29 15:00:13 -03:00 committed by GitHub
parent cbccd10271
commit 1cdba5f73d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 14 deletions

View file

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Globalization;
using Bit.App.Abstractions;
using Bit.App.Models;
@ -25,13 +26,13 @@ namespace Bit.Droid.Services
try
{
var fallback = ToDotnetFallbackLanguage(new PlatformCulture(netLanguage));
Console.WriteLine(netLanguage + " failed, trying " + fallback + " (" + e1.Message + ")");
Debug.WriteLine(netLanguage + " failed, trying " + fallback + " (" + e1.Message + ")");
ci = new CultureInfo(fallback);
}
catch (CultureNotFoundException e2)
{
// iOS language not valid .NET culture, falling back to English
Console.WriteLine(netLanguage + " couldn't be set, using 'en' (" + e2.Message + ")");
Debug.WriteLine(netLanguage + " couldn't be set, using 'en' (" + e2.Message + ")");
ci = new CultureInfo("en");
}
}
@ -40,7 +41,7 @@ namespace Bit.Droid.Services
private string AndroidToDotnetLanguage(string androidLanguage)
{
Console.WriteLine("Android Language:" + androidLanguage);
Debug.WriteLine("Android Language:" + androidLanguage);
var netLanguage = androidLanguage;
if (androidLanguage.StartsWith("zh"))
{
@ -79,13 +80,13 @@ namespace Bit.Droid.Services
// ONLY use cultures that have been tested and known to work
}
}
Console.WriteLine(".NET Language/Locale:" + netLanguage);
Debug.WriteLine(".NET Language/Locale:" + netLanguage);
return netLanguage;
}
private string ToDotnetFallbackLanguage(PlatformCulture platCulture)
{
Console.WriteLine(".NET Fallback Language:" + platCulture.LanguageCode);
Debug.WriteLine(".NET Fallback Language:" + platCulture.LanguageCode);
var netLanguage = platCulture.LanguageCode; // use the first part of the identifier (two chars, usually);
switch (platCulture.LanguageCode)
{
@ -95,7 +96,7 @@ namespace Bit.Droid.Services
// add more application-specific cases here (if required)
// ONLY use cultures that have been tested and known to work
}
Console.WriteLine(".NET Fallback Language/Locale:" + netLanguage + " (application-specific)");
Debug.WriteLine(".NET Fallback Language/Locale:" + netLanguage + " (application-specific)");
return netLanguage;
}

View file

@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Globalization;
using Bit.App.Abstractions;
using Bit.App.Models;
@ -31,13 +32,13 @@ namespace Bit.iOS.Core.Services
try
{
var fallback = ToDotnetFallbackLanguage(new PlatformCulture(netLanguage));
Console.WriteLine(netLanguage + " failed, trying " + fallback + " (" + e1.Message + ")");
Debug.WriteLine(netLanguage + " failed, trying " + fallback + " (" + e1.Message + ")");
ci = new CultureInfo(fallback);
}
catch (CultureNotFoundException e2)
{
// iOS language not valid .NET culture, falling back to English
Console.WriteLine(netLanguage + " couldn't be set, using 'en' (" + e2.Message + ")");
Debug.WriteLine(netLanguage + " couldn't be set, using 'en' (" + e2.Message + ")");
ci = new CultureInfo("en");
}
}
@ -47,7 +48,7 @@ namespace Bit.iOS.Core.Services
private string iOSToDotnetLanguage(string iOSLanguage)
{
Console.WriteLine("iOS Language:" + iOSLanguage);
Debug.WriteLine("iOS Language:" + iOSLanguage);
var netLanguage = iOSLanguage;
if (iOSLanguage.StartsWith("zh-Hant") || iOSLanguage.StartsWith("zh-HK"))
{
@ -77,13 +78,13 @@ namespace Bit.iOS.Core.Services
}
}
Console.WriteLine(".NET Language/Locale:" + netLanguage);
Debug.WriteLine(".NET Language/Locale:" + netLanguage);
return netLanguage;
}
private string ToDotnetFallbackLanguage(PlatformCulture platCulture)
{
Console.WriteLine(".NET Fallback Language:" + platCulture.LanguageCode);
Debug.WriteLine(".NET Fallback Language:" + platCulture.LanguageCode);
// Use the first part of the identifier (two chars, usually);
var netLanguage = platCulture.LanguageCode;
switch (platCulture.LanguageCode)
@ -97,7 +98,7 @@ namespace Bit.iOS.Core.Services
// add more application-specific cases here (if required)
// ONLY use cultures that have been tested and known to work
}
Console.WriteLine(".NET Fallback Language/Locale:" + netLanguage + " (application-specific)");
Debug.WriteLine(".NET Fallback Language/Locale:" + netLanguage + " (application-specific)");
return netLanguage;
}

View file

@ -1,6 +1,7 @@
using Bit.App.Utilities;
using Foundation;
using System;
using System.Diagnostics;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
@ -110,7 +111,7 @@ namespace Bit.iOS.Core.Views
}
else
{
Console.WriteLine("Toast needs a keyWindows to display.");
Debug.WriteLine("Toast needs a keyWindows to display.");
}
}

View file

@ -34,7 +34,7 @@ public class CryptoService{
let item = try JSONDecoder().decode(type, from: decryptedData)
return item
} catch {
assertionFailure("Fail to decode item for keychain: \(error)")
Log.e("Fail to decode item for keychain: \(error)")
return nil
}
}