Skip to content

Conversation

@zensgit
Copy link
Owner

@zensgit zensgit commented Sep 28, 2025

Scope

  • Upgrade Share API usage to instance-based form using SharePlus.instance with ShareParams
  • Touched files only:
    • jive-flutter/lib/services/share_service.dart
    • jive-flutter/lib/widgets/qr_code_generator.dart

Notes

  • This PR intentionally contains no unrelated refactors. Analyzer warnings elsewhere are preexisting and will be handled by context-cleanup batches.
  • Locally verified analyzer/tests on the cleanup branch; this branch focuses strictly on API migration.

Follow-ups

  • If desired, we can further modernize usage (sharePositionOrigin, downloadFallbackEnabled) in a tiny follow-up.

@zensgit
Copy link
Owner Author

zensgit commented Sep 30, 2025

Batch 8 additions included here for efficiency:\n- ThemeShareDialog: messenger capture + mounted guards\n- InviteMemberDialog: const-eval fix in _buildInfoRow\n- PermissionGuard: non-null children for Elevated/Text/Filled\n- LoadingIndicator/QRCode: remove invalid consts\n- TemplateAdminPage: messenger/navigator capture + mounted guards\n\nAll tests pass locally; analyzer warnings reduced. Remaining conservative warnings (e.g., delete_family_dialog) planned for follow-up. Next, I will add lightweight smoke tests for Share service (text and files) using SharePlus platform interface fakes, and submit in a small PR.

@zensgit zensgit marked this pull request as ready for review September 30, 2025 06:59
@Copilot Copilot AI review requested due to automatic review settings September 30, 2025 07:00
@zensgit zensgit enabled auto-merge (squash) September 30, 2025 07:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the SharePlus API usage from deprecated static methods to the instance-based form using SharePlus.instance with ShareParams. The migration focuses strictly on API compatibility while maintaining existing functionality.

  • Switch from Share.share() and Share.shareXFiles() to SharePlus.instance.share() with ShareParams
  • Add test infrastructure for the new API in ShareService
  • Update QR code sharing implementation to use the new API pattern

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

File Description
jive-flutter/lib/services/share_service.dart Core migration from static Share methods to SharePlus.instance with ShareParams, includes test infrastructure
jive-flutter/lib/widgets/qr_code_generator.dart Update QR code sharing to use new SharePlus API
jive-flutter/test/services/share_service_test.dart New test file for ShareService with ShareParams validation
Other files Unrelated cleanup changes (const/non-const widgets, context.mounted fixes)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

child: Center(
child: CircularProgressIndicator(),
child: const Center(
child: const CircularProgressIndicator(),
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double const keyword is redundant. Remove the second 'const' keyword from the CircularProgressIndicator constructor.

Suggested change
child: const CircularProgressIndicator(),
child: CircularProgressIndicator(),

Copilot uses AI. Check for mistakes.

🏠 账本:$familyName
${transaction.tags.isNotEmpty ? '🏷️ 标签:${transaction.tags.join(', ')}' : ''}
${transaction.tags?.isNotEmpty == true ? '🏷️ 标签:${transaction.tags!.join(', ')}' : ''}
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The null-aware check followed by a force unwrap (!.) is risky. Consider using transaction.tags?.join(', ') directly or a more defensive pattern to avoid potential null reference exceptions.

Suggested change
${transaction.tags?.isNotEmpty == true ? '🏷️ 标签:${transaction.tags!.join(', ')}' : ''}
${transaction.tags?.isNotEmpty == true ? '🏷️ 标签:${transaction.tags?.join(', ')}' : ''}

Copilot uses AI. Check for mistakes.

try {
final xFiles = images.map((file) => XFile(file.path)).toList();
await Share.shareXFiles(xFiles, text: text);
final List<XFile> xFiles = images.map((file) => XFile(file.path)).toList();
Copy link

Copilot AI Sep 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The explicit type annotation List<XFile> is redundant since the type can be inferred from the map operation and toList() call.

Suggested change
final List<XFile> xFiles = images.map((file) => XFile(file.path)).toList();
final xFiles = images.map((file) => XFile(file.path)).toList();

Copilot uses AI. Check for mistakes.

@zensgit zensgit merged commit ae8def9 into main Sep 30, 2025
9 checks passed
@zensgit zensgit deleted the flutter/shareplus-migration-step2 branch September 30, 2025 07:05
@zensgit zensgit mentioned this pull request Oct 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant