mirror of
https://github.com/bitwarden/mobile
synced 2025-12-10 21:33:36 +00:00
[PS-2520] Restore copy confirmation toast on Android 13+ (#2388)
* Restore copy notification toast on Android 13+ * fixed space
This commit is contained in:
@@ -49,12 +49,6 @@ namespace Bit.Droid.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCopyNotificationHandledByPlatform()
|
|
||||||
{
|
|
||||||
// Android 13+ provides built-in notification when text is copied to the clipboard
|
|
||||||
return (int)Build.VERSION.SdkInt >= 33;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CopyToClipboard(string text, bool isSensitive = true)
|
private void CopyToClipboard(string text, bool isSensitive = true)
|
||||||
{
|
{
|
||||||
var clipboardManager = Application.Context.GetSystemService(Context.ClipboardService) as ClipboardManager;
|
var clipboardManager = Application.Context.GetSystemService(Context.ClipboardService) as ClipboardManager;
|
||||||
|
|||||||
@@ -134,11 +134,7 @@ namespace Bit.App.Services
|
|||||||
|
|
||||||
public void ShowToastForCopiedValue(string valueNameCopied)
|
public void ShowToastForCopiedValue(string valueNameCopied)
|
||||||
{
|
{
|
||||||
if (!_clipboardService.IsCopyNotificationHandledByPlatform())
|
ShowToast("info", null, string.Format(AppResources.ValueHasBeenCopied, valueNameCopied));
|
||||||
{
|
|
||||||
ShowToast("info", null,
|
|
||||||
string.Format(AppResources.ValueHasBeenCopied, valueNameCopied));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsFido2()
|
public bool SupportsFido2()
|
||||||
|
|||||||
@@ -15,10 +15,5 @@ namespace Bit.Core.Abstractions
|
|||||||
/// <param name="expiresInMs">Expiration time in milliseconds of the copied text</param>
|
/// <param name="expiresInMs">Expiration time in milliseconds of the copied text</param>
|
||||||
/// <param name="isSensitive">Flag to mark copied text as sensitive</param>
|
/// <param name="isSensitive">Flag to mark copied text as sensitive</param>
|
||||||
Task CopyTextAsync(string text, int expiresInMs = -1, bool isSensitive = true);
|
Task CopyTextAsync(string text, int expiresInMs = -1, bool isSensitive = true);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if the platform provides its own notification when text is copied to the clipboard
|
|
||||||
/// </summary>
|
|
||||||
bool IsCopyNotificationHandledByPlatform();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,5 @@ namespace Bit.iOS.Core.Services
|
|||||||
ExpirationDate = clearSeconds > 0 ? NSDate.FromTimeIntervalSinceNow(clearSeconds) : null
|
ExpirationDate = clearSeconds > 0 ? NSDate.FromTimeIntervalSinceNow(clearSeconds) : null
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCopyNotificationHandledByPlatform()
|
|
||||||
{
|
|
||||||
// return true for any future versions of iOS that notify the user when text is copied to the clipboard
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user