@bobfrankston/rmfmail 1.2.203 → 1.2.204

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@ using Windows.ApplicationModel;
24
24
  using Windows.ApplicationModel.Activation;
25
25
  using Windows.ApplicationModel.DataTransfer;
26
26
  using Windows.ApplicationModel.DataTransfer.ShareTarget;
27
+ using WinRT; // CastExtensions.As<T> — AOT-safe WinRT QueryInterface
27
28
  using Windows.Storage;
28
29
 
29
30
  internal static class Program
@@ -65,12 +66,29 @@ internal static class Program
65
66
  catch (Exception ex) { activationError = ex.Message; }
66
67
  Log($"activated: kind={(activation == null ? $"null ({activationError})" : activation.Kind.ToString())}");
67
68
 
68
- if (activation is ShareTargetActivatedEventArgs share)
69
+ // AOT trap (field-diagnosed 2026-07-30 via this very log): the
70
+ // idiomatic `activation is ShareTargetActivatedEventArgs` returns
71
+ // FALSE under NativeAOT — .NET type-identity casts on projected
72
+ // WinRT classes fail when trimming drops the projection metadata,
73
+ // even though Kind reads ShareTarget through the base interface.
74
+ // That silently took the "plain launch" branch: no pending file,
75
+ // no --handoff, bare launch → replace-on-launch restarted the
76
+ // whole app on every share. Branch on Kind and cast via WinRT
77
+ // QueryInterface (`.As<T>()`), which is AOT-safe.
78
+ if (activation != null && activation.Kind == ActivationKind.ShareTarget)
69
79
  {
70
- HandleShare(share).GetAwaiter().GetResult();
71
- // Handoff launch: a RUNNING daemon consumes pending-share.json
72
- // via fs.watch; the spawned mailx.js must exit instead of
73
- // replace-on-launch restarting the whole app (Bob 2026-07-30).
80
+ try
81
+ {
82
+ var share = activation.As<ShareTargetActivatedEventArgs>();
83
+ HandleShare(share).GetAwaiter().GetResult();
84
+ }
85
+ catch (Exception ex)
86
+ {
87
+ Log($"share handling FAILED: {ex}");
88
+ ShowError($"Share to rmfmail failed:\n{ex.Message}");
89
+ }
90
+ // Handoff launch either way — a share was intended; never
91
+ // restart the running daemon out from under the user.
74
92
  LaunchDaemon(handoff: true);
75
93
  }
76
94
  else
package/bin/rmfshare.exe CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.2.203",
3
+ "version": "1.2.204",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",