EC-602 Constants namespace fix (#2127)

This commit is contained in:
Federico Maccaroni 2022-10-11 17:47:52 -03:00 committed by GitHub
parent 2d35a00caa
commit d800e9a43e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 16 deletions

View file

@ -367,7 +367,7 @@ namespace Bit.Droid.Accessibility
public static string GetUri(AccessibilityNodeInfo root) public static string GetUri(AccessibilityNodeInfo root)
{ {
var uri = string.Concat(Constants.AndroidAppProtocol, root.PackageName); var uri = string.Concat(Core.Constants.AndroidAppProtocol, root.PackageName);
if (SupportedBrowsers.ContainsKey(root.PackageName)) if (SupportedBrowsers.ContainsKey(root.PackageName))
{ {
var browser = SupportedBrowsers[root.PackageName]; var browser = SupportedBrowsers[root.PackageName];

View file

@ -134,7 +134,7 @@ namespace Bit.Droid.Autofill
{ {
case CipherType.Login: case CipherType.Login:
intent.PutExtra("autofillFrameworkName", parser.Uri intent.PutExtra("autofillFrameworkName", parser.Uri
.Replace(Constants.AndroidAppProtocol, string.Empty) .Replace(Core.Constants.AndroidAppProtocol, string.Empty)
.Replace("https://", string.Empty) .Replace("https://", string.Empty)
.Replace("http://", string.Empty)); .Replace("http://", string.Empty));
intent.PutExtra("autofillFrameworkUri", parser.Uri); intent.PutExtra("autofillFrameworkUri", parser.Uri);

View file

@ -48,7 +48,7 @@ namespace Bit.Droid.Autofill
} }
else else
{ {
_uri = string.Concat(Constants.AndroidAppProtocol, PackageName); _uri = string.Concat(Core.Constants.AndroidAppProtocol, PackageName);
} }
return _uri; return _uri;
} }

View file

@ -150,9 +150,9 @@ namespace Bit.Droid
.GetAwaiter() .GetAwaiter()
.GetResult(); .GetResult();
if (Intent?.GetStringExtra(Constants.NotificationData) is string notificationDataJson) if (Intent?.GetStringExtra(Core.Constants.NotificationData) is string notificationDataJson)
{ {
var notificationType = JToken.Parse(notificationDataJson).SelectToken(Constants.NotificationDataType); var notificationType = JToken.Parse(notificationDataJson).SelectToken(Core.Constants.NotificationDataType);
if (notificationType.ToString() == PasswordlessNotificationData.TYPE) if (notificationType.ToString() == PasswordlessNotificationData.TYPE)
{ {
_pushNotificationListenerService.OnNotificationTapped(JsonConvert.DeserializeObject<PasswordlessNotificationData>(notificationDataJson)).FireAndForget(); _pushNotificationListenerService.OnNotificationTapped(JsonConvert.DeserializeObject<PasswordlessNotificationData>(notificationDataJson)).FireAndForget();
@ -211,7 +211,7 @@ namespace Bit.Droid
public async override void OnRequestPermissionsResult(int requestCode, string[] permissions, public async override void OnRequestPermissionsResult(int requestCode, string[] permissions,
[GeneratedEnum] Permission[] grantResults) [GeneratedEnum] Permission[] grantResults)
{ {
if (requestCode == Constants.SelectFilePermissionRequestCode) if (requestCode == Core.Constants.SelectFilePermissionRequestCode)
{ {
if (grantResults.Any(r => r != Permission.Granted)) if (grantResults.Any(r => r != Permission.Granted))
{ {
@ -230,7 +230,7 @@ namespace Bit.Droid
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{ {
if (resultCode == Result.Ok && if (resultCode == Result.Ok &&
(requestCode == Constants.SelectFileRequestCode || requestCode == Constants.SaveFileRequestCode)) (requestCode == Core.Constants.SelectFileRequestCode || requestCode == Core.Constants.SaveFileRequestCode))
{ {
Android.Net.Uri uri = null; Android.Net.Uri uri = null;
string fileName = null; string fileName = null;
@ -252,7 +252,7 @@ namespace Bit.Droid
return; return;
} }
if (requestCode == Constants.SaveFileRequestCode) if (requestCode == Core.Constants.SaveFileRequestCode)
{ {
_messagingService.Send("selectSaveFileResult", _messagingService.Send("selectSaveFileResult",
new Tuple<string, string>(uri.ToString(), fileName)); new Tuple<string, string>(uri.ToString(), fileName));
@ -433,7 +433,7 @@ namespace Bit.Droid
return; return;
} }
var channel = new NotificationChannel(Constants.AndroidNotificationChannelId, AppResources.AllNotifications, NotificationImportance.Default); var channel = new NotificationChannel(Core.Constants.AndroidNotificationChannelId, AppResources.AllNotifications, NotificationImportance.Default);
if(GetSystemService(NotificationService) is NotificationManager notificationManager) if(GetSystemService(NotificationService) is NotificationManager notificationManager)
{ {
notificationManager.CreateNotificationChannel(channel); notificationManager.CreateNotificationChannel(channel);

View file

@ -46,8 +46,8 @@ namespace Bit.Droid
{ {
RegisterLocalServices(); RegisterLocalServices();
var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService"); var deviceActionService = ServiceContainer.Resolve<IDeviceActionService>("deviceActionService");
ServiceContainer.Init(deviceActionService.DeviceUserAgent, Constants.ClearCiphersCacheKey, ServiceContainer.Init(deviceActionService.DeviceUserAgent, Core.Constants.ClearCiphersCacheKey,
Constants.AndroidAllClearCipherCacheKeys); Core.Constants.AndroidAllClearCipherCacheKeys);
InitializeAppSetup(); InitializeAppSetup();
// TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged // TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged

View file

@ -79,11 +79,11 @@ namespace Bit.Droid.Services
var context = Android.App.Application.Context; var context = Android.App.Application.Context;
var intent = new Intent(context, typeof(MainActivity)); var intent = new Intent(context, typeof(MainActivity));
intent.PutExtra(Constants.NotificationData, JsonConvert.SerializeObject(data)); intent.PutExtra(Core.Constants.NotificationData, JsonConvert.SerializeObject(data));
var pendingIntentFlags = AndroidHelpers.AddPendingIntentMutabilityFlag(PendingIntentFlags.UpdateCurrent, true); var pendingIntentFlags = AndroidHelpers.AddPendingIntentMutabilityFlag(PendingIntentFlags.UpdateCurrent, true);
var pendingIntent = PendingIntent.GetActivity(context, 20220801, intent, pendingIntentFlags); var pendingIntent = PendingIntent.GetActivity(context, 20220801, intent, pendingIntentFlags);
var builder = new NotificationCompat.Builder(context, Constants.AndroidNotificationChannelId) var builder = new NotificationCompat.Builder(context, Core.Constants.AndroidNotificationChannelId)
.SetContentIntent(pendingIntent) .SetContentIntent(pendingIntent)
.SetContentTitle(title) .SetContentTitle(title)
.SetContentText(message) .SetContentText(message)

View file

@ -321,7 +321,7 @@ namespace Bit.Droid.Services
intent.AddCategory(Intent.CategoryOpenable); intent.AddCategory(Intent.CategoryOpenable);
intent.PutExtra(Intent.ExtraTitle, fileName); intent.PutExtra(Intent.ExtraTitle, fileName);
activity.StartActivityForResult(intent, Constants.SaveFileRequestCode); activity.StartActivityForResult(intent, Core.Constants.SaveFileRequestCode);
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
@ -386,7 +386,7 @@ namespace Bit.Droid.Services
{ {
chooserIntent.PutExtra(Intent.ExtraInitialIntents, additionalIntents.ToArray()); chooserIntent.PutExtra(Intent.ExtraInitialIntents, additionalIntents.ToArray());
} }
activity.StartActivityForResult(chooserIntent, Constants.SelectFileRequestCode); activity.StartActivityForResult(chooserIntent, Core.Constants.SelectFileRequestCode);
return Task.FromResult(0); return Task.FromResult(0);
} }
@ -882,7 +882,7 @@ namespace Bit.Droid.Services
private void AskPermission(string permission) private void AskPermission(string permission)
{ {
ActivityCompat.RequestPermissions(CrossCurrentActivity.Current.Activity, new string[] { permission }, ActivityCompat.RequestPermissions(CrossCurrentActivity.Current.Activity, new string[] { permission },
Constants.SelectFilePermissionRequestCode); Core.Constants.SelectFilePermissionRequestCode);
} }
private List<IParcelable> GetCameraIntents(Android.Net.Uri outputUri) private List<IParcelable> GetCameraIntents(Android.Net.Uri outputUri)