mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03:00
activity key and unsub when activity destroyed
This commit is contained in:
parent
cd60c3da2a
commit
028ebff102
1 changed files with 10 additions and 2 deletions
|
@ -29,6 +29,8 @@ namespace Bit.Droid
|
|||
[Register("com.x8bit.bitwarden.MainActivity")]
|
||||
public class MainActivity : Xamarin.Forms.Platform.Android.FormsAppCompatActivity
|
||||
{
|
||||
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
|
||||
|
||||
private IDeviceActionService _deviceActionService;
|
||||
private IMessagingService _messagingService;
|
||||
private IBroadcasterService _broadcasterService;
|
||||
|
@ -39,7 +41,7 @@ namespace Bit.Droid
|
|||
private PendingIntent _lockAlarmPendingIntent;
|
||||
private PendingIntent _clearClipboardPendingIntent;
|
||||
private AppOptions _appOptions;
|
||||
private const string HockeyAppId = "d3834185b4a643479047b86c65293d42";
|
||||
private string _activityKey = $"{nameof(MainActivity)}_{Java.Lang.JavaSystem.CurrentTimeMillis().ToString()}";
|
||||
private Java.Util.Regex.Pattern _otpPattern =
|
||||
Java.Util.Regex.Pattern.Compile("^.*?([cbdefghijklnrtuv]{32,64})$");
|
||||
|
||||
|
@ -84,7 +86,7 @@ namespace Bit.Droid
|
|||
_appOptions = GetOptions();
|
||||
LoadApplication(new App.App(_appOptions));
|
||||
|
||||
_broadcasterService.Subscribe(nameof(MainActivity), (message) =>
|
||||
_broadcasterService.Subscribe(_activityKey, (message) =>
|
||||
{
|
||||
if(message.Command == "scheduleLockTimer")
|
||||
{
|
||||
|
@ -227,6 +229,12 @@ namespace Bit.Droid
|
|||
}
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
_broadcasterService.Unsubscribe(_activityKey);
|
||||
}
|
||||
|
||||
private void ListenYubiKey(bool listen)
|
||||
{
|
||||
if(!_deviceActionService.SupportsNfc())
|
||||
|
|
Loading…
Reference in a new issue