mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-12-23 15:38:47 -05:00
Async loading of Challenge file
This commit is contained in:
parent
8c15b38036
commit
147c0e19b6
@ -20,7 +20,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>False</Optimize>
|
<Optimize>False</Optimize>
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
|
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<ConsolePause>False</ConsolePause>
|
<ConsolePause>False</ConsolePause>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -276,14 +276,8 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
if (_keyFileOrProvider == KeyProviderIdChallenge)
|
if (_keyFileOrProvider == KeyProviderIdChallenge)
|
||||||
{
|
{
|
||||||
if (!LoadChalFile()) break;
|
LoadChalFile();
|
||||||
Intent chalIntent = new Intent("com.yubichallenge.NFCActivity.CHALLENGE");
|
|
||||||
chalIntent.PutExtra("challenge", _chalInfo.Challenge);
|
|
||||||
chalIntent.PutExtra("slot", 2);
|
|
||||||
IList<ResolveInfo> activities = PackageManager.QueryIntentActivities(chalIntent, 0);
|
|
||||||
bool isIntentSafe = activities.Count > 0;
|
|
||||||
if (isIntentSafe)
|
|
||||||
StartActivityForResult(chalIntent, RequestCodeChallengeYubikey);
|
|
||||||
} else {
|
} else {
|
||||||
LoadOtpFile ();
|
LoadOtpFile ();
|
||||||
}
|
}
|
||||||
@ -330,31 +324,59 @@ namespace keepass2android
|
|||||||
).Execute();
|
).Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool LoadChalFile()
|
private void LoadChalFile()
|
||||||
{
|
{
|
||||||
//TODO make async!
|
new LoadingDialog<object, object, object>(this, true,
|
||||||
try
|
//doInBackground
|
||||||
{
|
delegate
|
||||||
IFileStorage fileStorage = App.Kp2a.GetOtpAuxFileStorage(_ioConnection);
|
{
|
||||||
IOConnectionInfo iocAux = fileStorage.GetFilePath(fileStorage.GetParentPath(_ioConnection),
|
|
||||||
fileStorage.GetFilenameWithoutPathAndExt(_ioConnection) + ".xml");
|
|
||||||
|
|
||||||
_chalInfo = ChallengeInfo.Load(iocAux);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Kp2aLog.Log(e.ToString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_chalInfo == null)
|
try
|
||||||
{
|
{
|
||||||
Toast.MakeText(this,
|
IFileStorage fileStorage =
|
||||||
GetString(Resource.String.CouldntLoadChalAuxFile) + " " + GetString(Resource.String.CouldntLoadChalAuxFile_Hint)
|
App.Kp2a.GetOtpAuxFileStorage(_ioConnection);
|
||||||
, ToastLength.Long).Show();
|
IOConnectionInfo iocAux =
|
||||||
return false;
|
fileStorage.GetFilePath(
|
||||||
}
|
fileStorage.GetParentPath(_ioConnection),
|
||||||
return true;
|
fileStorage.GetFilenameWithoutPathAndExt(_ioConnection) +
|
||||||
|
".xml");
|
||||||
|
|
||||||
|
_chalInfo = ChallengeInfo.Load(iocAux);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Kp2aLog.Log(e.ToString());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
, delegate
|
||||||
|
{
|
||||||
|
if (_chalInfo == null)
|
||||||
|
{
|
||||||
|
Toast.MakeText(this,
|
||||||
|
GetString(Resource.String.CouldntLoadChalAuxFile) +
|
||||||
|
" " +
|
||||||
|
GetString(
|
||||||
|
Resource.String.CouldntLoadChalAuxFile_Hint)
|
||||||
|
, ToastLength.Long).Show();
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
Intent chalIntent = new Intent("com.yubichallenge.NFCActivity.CHALLENGE");
|
||||||
|
chalIntent.PutExtra("challenge", _chalInfo.Challenge);
|
||||||
|
chalIntent.PutExtra("slot", 2);
|
||||||
|
IList<ResolveInfo> activities = PackageManager.QueryIntentActivities(chalIntent, 0);
|
||||||
|
bool isIntentSafe = activities.Count > 0;
|
||||||
|
if (isIntentSafe)
|
||||||
|
{
|
||||||
|
StartActivityForResult(chalIntent, RequestCodeChallengeYubikey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//TODO message no plugin!
|
||||||
|
}
|
||||||
|
}).Execute();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowOtpEntry(IList<string> prefilledOtps)
|
private void ShowOtpEntry(IList<string> prefilledOtps)
|
||||||
|
6968
src/keepass2android/Resources/Resource.designer.cs
generated
6968
src/keepass2android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -30,7 +30,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Debug</OutputPath>
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;INCLUDE_KEYBOARD;INCLUDE_FILECHOOSER;INCLUDE_JAVAFILESTORAGE;INCLUDE_KEYTRANSFORM</DefineConstants>
|
<DefineConstants>DEBUG;EXCLUDE_TWOFISH;EXCLUDE_KEYBOARD;EXCLUDE_FILECHOOSER;EXCLUDE_JAVAFILESTORAGE;EXCLUDE_KEYTRANSFORM</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<ConsolePause>False</ConsolePause>
|
<ConsolePause>False</ConsolePause>
|
||||||
@ -171,7 +171,6 @@
|
|||||||
<Compile Include="app\AppTask.cs" />
|
<Compile Include="app\AppTask.cs" />
|
||||||
<Compile Include="views\TextWithHelp.cs" />
|
<Compile Include="views\TextWithHelp.cs" />
|
||||||
<Compile Include="addons\KeeChallenge\KeeChallenge.cs" />
|
<Compile Include="addons\KeeChallenge\KeeChallenge.cs" />
|
||||||
<Compile Include="NfcChalActivity.cs" />
|
|
||||||
<Compile Include="addons\KeeChallenge\ChallengeInfo.cs" />
|
<Compile Include="addons\KeeChallenge\ChallengeInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user