T3-11/14/15 + M2 잔여: 권한 정책 UI(PermissionGate/PermissionRequested 다이얼로그+SavesInProfile), 추적 방지(TrackerBlocklist/WebResourceRequested 차단+실드 배지·팝업), 주소창 진행 바+파라미터 제거 복사(UrlCleaner/NavProgressTracker), U5 완료 알림(Mobile.Core 감지기+Plugin.LocalNotification), 재생중 ongoing 미디어 알림, 썸네일/해상도 API(Thumbnailer 사이드카 캐시+/thumb)+라이브러리 그리드, 외부망 안내(ConnectionTroubleshoot). 147 tests GREEN

This commit is contained in:
Yun Chan 2026-08-15 18:11:49 +09:00
parent 27c91c04dd
commit 46c6c321f2
26 changed files with 1058 additions and 30 deletions

View file

@ -0,0 +1,21 @@
namespace VideoDownloader.Mobile;
/// <summary>
/// 외부망/네트워크 불통 안내(MOBILE_PLAN §7 성공 기준) —
/// "같은 네트워크 필요 / 외부망에서는 Tailscale 등 VPN 안내".
/// </summary>
public static class ConnectionTroubleshoot
{
public const string NotConfigured = "먼저 연결 탭에서 PC 와 페어링하세요";
public const string Unreachable =
"PC 에 연결할 수 없습니다. 폰과 PC 가 같은 네트워크(Wi-Fi)에 있는지 확인하세요. " +
"외부망에서 접속하려면 Tailscale 등 VPN 으로 PC 의 사설망에 접근해야 합니다.";
public static string Message(bool isConfigured, string? lastError)
{
if (!isConfigured) return NotConfigured;
if (!string.IsNullOrEmpty(lastError)) return Unreachable;
return "";
}
}

View file

@ -0,0 +1,72 @@
using System.Text.Json;
namespace VideoDownloader.Mobile;
public sealed record OfflineItem(string Id, string FileName, long SizeBytes);
/// <summary>
/// 폰 오프라인 저장(U4): 라이브러리 항목을 앱 전용 폴더에 저장·목록·삭제.
/// manifest.json(id→파일명)으로 서버 항목과 매핑한다.
/// </summary>
public sealed class OfflineStore
{
private readonly string _dir;
private readonly string _manifestPath;
private readonly object _gate = new();
private Dictionary<string, string> _manifest;
/// <summary>baseDir 아래 offline/ 폴더 사용(호스트가 앱 데이터 디렉터리 주입).</summary>
public OfflineStore(string baseDir)
{
_dir = Path.Combine(baseDir, "offline");
_manifestPath = Path.Combine(_dir, "manifest.json");
try
{
if (File.Exists(_manifestPath))
_manifest = JsonSerializer.Deserialize<Dictionary<string, string>>(File.ReadAllText(_manifestPath)) ?? new();
}
catch { }
_manifest ??= new Dictionary<string, string>();
}
public string Directory => _dir;
public string PathFor(string id) => Path.Combine(_dir, id + Path.GetExtension(_manifest.GetValueOrDefault(id, ".mp4")));
public bool Exists(string id) { lock (_gate) { var p = PathFor(id); return File.Exists(p) && _manifest.ContainsKey(id); } }
/// <summary>다운로드 완료 후 등록.</summary>
public void Record(string id, string fileName)
{
lock (_gate)
{
System.IO.Directory.CreateDirectory(_dir);
_manifest[id] = fileName;
Save();
}
}
public void Delete(string id)
{
lock (_gate)
{
try { if (File.Exists(PathFor(id))) File.Delete(PathFor(id)); } catch { }
_manifest.Remove(id);
Save();
}
}
public List<OfflineItem> List()
{
lock (_gate)
return _manifest.Select(kv =>
{
var p = PathFor(kv.Key);
return new OfflineItem(kv.Key, kv.Value, File.Exists(p) ? new FileInfo(p).Length : 0);
}).Where(i => i.SizeBytes > 0).ToList();
}
private void Save()
{
try { System.IO.Directory.CreateDirectory(_dir); File.WriteAllText(_manifestPath, JsonSerializer.Serialize(_manifest)); } catch { }
}}

View file

@ -0,0 +1,18 @@
namespace VideoDownloader.Mobile;
/// <summary>U5 완료 알림: 이전/다음 큐 스냅샷에서 새로 완료("완료")된 항목 ID 감지.
/// 이전 스냅샷이 비면(앱 시작 직후 첫 폴링) 무시 — 과거 완료 알림 스팸 방지.</summary>
public sealed class QueueCompletionDetector
{
public IReadOnlyList<string> Detect(
IReadOnlyList<(string Id, string Status)> previous,
IReadOnlyList<(string Id, string Status)> next)
{
if (previous.Count == 0) return Array.Empty<string>();
var prev = previous.ToDictionary(x => x.Id, x => x.Status);
return next
.Where(n => n.Status == "완료" && prev.TryGetValue(n.Id, out var s) && s != "완료")
.Select(n => n.Id)
.ToList();
}
}

View file

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>VideoDownloader.Mobile</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
</Project>