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

View file

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

View file

@ -1,6 +1,7 @@
using Bit.App.Utilities; using Bit.App.Utilities;
using Foundation; using Foundation;
using System; using System;
using System.Diagnostics;
using UIKit; using UIKit;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS; using Xamarin.Forms.Platform.iOS;
@ -110,7 +111,7 @@ namespace Bit.iOS.Core.Views
} }
else 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) let item = try JSONDecoder().decode(type, from: decryptedData)
return item return item
} catch { } catch {
assertionFailure("Fail to decode item for keychain: \(error)") Log.e("Fail to decode item for keychain: \(error)")
return nil return nil
} }
} }