Show a visible three-second exit countdown inside the registration card

这个提交包含在:
mac 于 2026-11-02 16:16:52 +08:00 提交
1 父节点 c664991aa1
当前提交 90d6022520
4 个文件已更改
+14 -11

没有与搜索条件相匹配的文件

@@ -174,8 +174,10 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
self.progress.style = NSProgressIndicatorStyleBar; self.progress.indeterminate = YES; self.progress.translatesAutoresizingMaskIntoConstraints = NO;
self.retryButton = DYButton(@"检查中…",DYBlue(),NO,self,@selector(checkRegistration:));
self.keepButton = DYButton(@"查看功能介绍",DYColor(.20,.46,.94),YES,self,@selector(keepIntroduction:));
self.exitDetail = DYLabel(@"注册成功后,将显示 3 秒退出倒计时。",15,NSFontWeightSemibold,DYGreen());
[self.exitDetail.heightAnchor constraintGreaterThanOrEqualToConstant:38].active = YES;
NSStackView *registration = DYStack(@[DYHeading(@"puzzlepiece.extension",@"插件连接",DYBlue()),self.statusTitle,self.statusDetail,self.progress,
DYStack(@[self.retryButton,self.keepButton],NSUserInterfaceLayoutOrientationHorizontal,8)],NSUserInterfaceLayoutOrientationVertical,13);
self.exitDetail,DYStack(@[self.retryButton,self.keepButton],NSUserInterfaceLayoutOrientationHorizontal,8)],NSUserInterfaceLayoutOrientationVertical,13);
self.registrationCard = DYCard(DYBlue(),registration);
self.confirmationButton = DYButton(@"已确认正常,退出",DYGreen(),NO,self,@selector(confirmHost:));
self.confirmationButton.enabled = NO;
@@ -200,8 +202,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
NSStackView *row2 = DYStack(@[cards[2],cards[3]],NSUserInterfaceLayoutOrientationHorizontal,14);
[((NSView *)cards[0]).heightAnchor constraintEqualToAnchor:((NSView *)cards[1]).heightAnchor].active = YES;
[((NSView *)cards[2]).heightAnchor constraintEqualToAnchor:((NSView *)cards[3]).heightAnchor].active = YES;
self.exitDetail = DYLabel(@"注册成功后将自动退出,插件可继续在宿主中使用。",12,NSFontWeightRegular,DYSecondary()); self.exitDetail.alignment = NSTextAlignmentCenter;
NSStackView *content = DYStack(@[website,hero,top,DYHeading(@"sparkles",@"一套工具,完成你的色彩表达",NSColor.whiteColor),row1,row2,self.exitDetail],NSUserInterfaceLayoutOrientationVertical,18);
NSStackView *content = DYStack(@[website,hero,top,DYHeading(@"sparkles",@"一套工具,完成你的色彩表达",NSColor.whiteColor),row1,row2],NSUserInterfaceLayoutOrientationVertical,18);
DYPin(content,document,30);
for (NSView *view in content.arrangedSubviews) [view.widthAnchor constraintEqualToAnchor:content.widthAnchor].active = YES;
[document.heightAnchor constraintGreaterThanOrEqualToAnchor:scroll.contentView.heightAnchor].active = YES;
@@ -294,11 +295,11 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
NSAccessibilityPostNotificationWithUserInfo(self.window,NSAccessibilityAnnouncementRequestedNotification,
@{NSAccessibilityAnnouncementKey:self.statusTitle.stringValue,NSAccessibilityPriorityKey:@(NSAccessibilityPriorityHigh)});
if (success && !self.keepOpen) {
self.secondsRemaining = 5; [self updateCountdown];
self.secondsRemaining = 3; [self updateCountdown];
self.exitTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(exitTick:) userInfo:nil repeats:YES];
} else self.exitDetail.stringValue = success ? @"插件已就绪。关闭此窗口后,可继续在宿主中使用。" : @"注册尚未完成,应用会保留此窗口以便重试。";
}
- (void)updateCountdown { self.exitDetail.stringValue = [NSString stringWithFormat:@"注册成功,%ld 秒后自动退出 · 点击“查看功能介绍”可保留窗口",(long)self.secondsRemaining]; }
- (void)updateCountdown { self.exitDetail.stringValue = [NSString stringWithFormat:@"%ld 秒后自动退出\n点击“查看功能介绍”可保留窗口",(long)self.secondsRemaining]; }
- (void)exitTick:(NSTimer *)timer {
if (--self.secondsRemaining <= 0) {
[timer invalidate]; self.exitTimer = nil; self.diagnostics[@"terminationReason"] = @"registration-succeeded"; [self writeDiagnostics]; [NSApp terminate:nil];
+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.6.1</string>
<key>CFBundleVersion</key>
<string>43</string>
<string>44</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>