Skip to content

Add ShareResult callback API + iOS Share Extension authoring helper#5036

Merged
shai-almog merged 5 commits into
masterfrom
share-result-callback-and-ios-extension-helper
May 25, 2026
Merged

Add ShareResult callback API + iOS Share Extension authoring helper#5036
shai-almog merged 5 commits into
masterfrom
share-result-callback-and-ios-extension-helper

Conversation

@shai-almog
Copy link
Copy Markdown
Collaborator

Summary

  • New ShareResult / ShareResultListener API surfaces the outcome of a share sheet (SHARED_TO(packageName), DISMISSED, FAILED). Plumbed through Display.share(...), ShareButton.setShareResultListener(...), and ShareService.deliverResult(...). iOS uses UIActivityViewController.completionWithItemsHandler; Android uses Intent.createChooser with an IntentSender callback (API 22+).
  • New IOSShareExtensionBuilder (maven plugin module) generates a complete .ios.appext bundle programmatically -- Info.plist with NSExtension activation rules, App Group entitlements, a ShareViewController.swift that posts the payload via UserDefaults(suiteName:), and buildSettings.properties. Composes with the existing IPhoneBuilder.extractAppExtensions pipeline so apps no longer need to bootstrap the extension target in Xcode.
  • Developer-guide coverage in docs/developer-guide/The-Components-Of-Codename-One.asciidoc (new sub-sections under the ShareButton entry).

Relation to #3427: this PR is complementary -- the builder emits exactly the artefact the existing server-side extractor consumes, and it would also fit a future ios/app_extensions/ directory pipeline if/when that lands. Provisioning-profile generation (the certificate-wizard piece of #3427) is intentionally out of scope.

Test plan

  • mvn -DskipTests=true compile clean on core and maven plugin modules
  • mvn test in codenameone-maven-plugin -- 11 new tests, all green (IOSShareExtensionBuilderTest)
  • mvn -DunitTests=true -Dtest='ShareResult*,ShareServiceResultDeliveryTest,ShareServiceTest,ShareButtonTest' test in core-unittests -- 16 tests, all green
  • CI green
  • Manual iOS device smoke test of the result callback (requires an iOS build pipeline)
  • Manual Android device smoke test of the result callback (requires an Android build pipeline)

\U0001F916 Generated with Claude Code

ShareService.share(...) and Display.share(...) can now report the
outcome of a share request through a ShareResultListener:
SHARED_TO(packageName), DISMISSED, or FAILED(message). iOS plumbs the
result via UIActivityViewController.completionWithItemsHandler;
Android plumbs the chosen target via Intent.createChooser's IntentSender
callback (API 22+) and documents that Android exposes no dismissal
signal. ShareButton exposes setShareResultListener(...).

IOSShareExtensionBuilder generates a complete .ios.appext bundle
(Info.plist with NSExtension activation rules, App Group entitlements,
a ShareViewController.swift that posts the payload via
UserDefaults(suiteName:), and buildSettings.properties) so apps no
longer need to bootstrap the extension target in Xcode. Composes with
the existing IPhoneBuilder.extractAppExtensions pipeline.

Developer-guide section added under The-Components-Of-Codename-One.
Unit tests cover ShareResult, ShareService delivery semantics, and the
extension builder file map / zip output / validation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

Developer Guide build artifacts are available for download from this workflow run:

Developer Guide quality checks:

  • AsciiDoc linter: No issues found (report)
  • Vale: No alerts found (report)
  • Paragraph capitalization: No paragraph capitalization issues (report)
  • LanguageTool: No grammar matches (report)
  • Image references: No unused images detected (report)

Vale flagged six contraction/foreign-phrase issues in the new sections
and LanguageTool flagged the British "normalises" / "synthesised" /
"customised" spellings that leaked from comments into the generated
HTML.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 24, 2026

Compared 110 screenshots: 110 matched.

Native Android coverage

  • 📊 Line coverage: 11.83% (6802/57481 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 9.62% (34150/354909), branch 4.15% (1400/33740), complexity 5.19% (1679/32374), method 9.01% (1364/15146), class 14.48% (304/2099)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

✅ Native Android screenshot tests passed.

Native Android coverage

  • 📊 Line coverage: 11.83% (6802/57481 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 9.62% (34150/354909), branch 4.15% (1400/33740), complexity 5.19% (1679/32374), method 9.01% (1364/15146), class 14.48% (304/2099)
    • Lowest covered classes
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysKt – 0.00% (0/6327 lines covered)
      • kotlin.collections.unsigned.kotlin.collections.unsigned.UArraysKt___UArraysKt – 0.00% (0/2384 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader – 0.00% (0/1519 lines covered)
      • kotlin.collections.kotlin.collections.CollectionsKt___CollectionsKt – 0.00% (0/1148 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.MethodWriter – 0.00% (0/923 lines covered)
      • kotlin.sequences.kotlin.sequences.SequencesKt___SequencesKt – 0.00% (0/730 lines covered)
      • kotlin.text.kotlin.text.StringsKt___StringsKt – 0.00% (0/623 lines covered)
      • org.jacoco.agent.rt.internal_b6258fc.asm.org.jacoco.agent.rt.internal_b6258fc.asm.Frame – 0.00% (0/564 lines covered)
      • kotlin.collections.kotlin.collections.ArraysKt___ArraysJvmKt – 0.00% (0/495 lines covered)
      • kotlinx.coroutines.kotlinx.coroutines.JobSupport – 0.00% (0/423 lines covered)

Benchmark Results

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 982.000 ms
Base64 CN1 encode 187.000 ms
Base64 encode ratio (CN1/native) 0.190x (81.0% faster)
Base64 native decode 1327.000 ms
Base64 CN1 decode 347.000 ms
Base64 decode ratio (CN1/native) 0.261x (73.9% faster)
Image encode benchmark status skipped (SIMD unsupported)

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 24, 2026

Compared 20 screenshots: 20 matched.
✅ JavaScript-port screenshot tests passed.

@github-actions
Copy link
Copy Markdown
Contributor

Cloudflare Preview

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 24, 2026

Compared 110 screenshots: 110 matched.
✅ Native iOS screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 276 seconds

Build and Run Timing

Metric Duration
Simulator Boot 71000 ms
Simulator Boot (Run) 1000 ms
App Install 16000 ms
App Launch 10000 ms
Test Execution 353000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 1130.000 ms
Base64 CN1 encode 1718.000 ms
Base64 encode ratio (CN1/native) 1.520x (52.0% slower)
Base64 native decode 495.000 ms
Base64 CN1 decode 1380.000 ms
Base64 decode ratio (CN1/native) 2.788x (178.8% slower)
Base64 SIMD encode 541.000 ms
Base64 encode ratio (SIMD/native) 0.479x (52.1% faster)
Base64 encode ratio (SIMD/CN1) 0.315x (68.5% faster)
Base64 SIMD decode 680.000 ms
Base64 decode ratio (SIMD/native) 1.374x (37.4% slower)
Base64 decode ratio (SIMD/CN1) 0.493x (50.7% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 127.000 ms
Image createMask (SIMD on) 39.000 ms
Image createMask ratio (SIMD on/off) 0.307x (69.3% faster)
Image applyMask (SIMD off) 287.000 ms
Image applyMask (SIMD on) 158.000 ms
Image applyMask ratio (SIMD on/off) 0.551x (44.9% faster)
Image modifyAlpha (SIMD off) 173.000 ms
Image modifyAlpha (SIMD on) 75.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.434x (56.6% faster)
Image modifyAlpha removeColor (SIMD off) 191.000 ms
Image modifyAlpha removeColor (SIMD on) 138.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.723x (27.7% faster)
Image PNG encode (SIMD off) 1266.000 ms
Image PNG encode (SIMD on) 1109.000 ms
Image PNG encode ratio (SIMD on/off) 0.876x (12.4% faster)
Image JPEG encode 566.000 ms

@shai-almog
Copy link
Copy Markdown
Collaborator Author

shai-almog commented May 24, 2026

Compared 110 screenshots: 110 matched.
✅ Native iOS Metal screenshot tests passed.

Benchmark Results

  • VM Translation Time: 0 seconds
  • Compilation Time: 189 seconds

Build and Run Timing

Metric Duration
Simulator Boot 58000 ms
Simulator Boot (Run) 1000 ms
App Install 11000 ms
App Launch 10000 ms
Test Execution 258000 ms

Detailed Performance Metrics

Metric Duration
Base64 payload size 8192 bytes
Base64 benchmark iterations 6000
Base64 native encode 693.000 ms
Base64 CN1 encode 1647.000 ms
Base64 encode ratio (CN1/native) 2.377x (137.7% slower)
Base64 native decode 453.000 ms
Base64 CN1 decode 1455.000 ms
Base64 decode ratio (CN1/native) 3.212x (221.2% slower)
Base64 SIMD encode 839.000 ms
Base64 encode ratio (SIMD/native) 1.211x (21.1% slower)
Base64 encode ratio (SIMD/CN1) 0.509x (49.1% faster)
Base64 SIMD decode 648.000 ms
Base64 decode ratio (SIMD/native) 1.430x (43.0% slower)
Base64 decode ratio (SIMD/CN1) 0.445x (55.5% faster)
Image encode benchmark iterations 100
Image createMask (SIMD off) 61.000 ms
Image createMask (SIMD on) 10.000 ms
Image createMask ratio (SIMD on/off) 0.164x (83.6% faster)
Image applyMask (SIMD off) 227.000 ms
Image applyMask (SIMD on) 78.000 ms
Image applyMask ratio (SIMD on/off) 0.344x (65.6% faster)
Image modifyAlpha (SIMD off) 172.000 ms
Image modifyAlpha (SIMD on) 83.000 ms
Image modifyAlpha ratio (SIMD on/off) 0.483x (51.7% faster)
Image modifyAlpha removeColor (SIMD off) 292.000 ms
Image modifyAlpha removeColor (SIMD on) 69.000 ms
Image modifyAlpha removeColor ratio (SIMD on/off) 0.236x (76.4% faster)
Image PNG encode (SIMD off) 1210.000 ms
Image PNG encode (SIMD on) 838.000 ms
Image PNG encode ratio (SIMD on/off) 0.693x (30.7% faster)
Image JPEG encode 636.000 ms

The trailing '}}' was flagged as 'right curly not followed by
whitespace' on JDK 8 quality gate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

✅ Continuous Quality Report

Test & Coverage

Static Analysis

  • SpotBugs [Report archive]
    • ByteCodeTranslator: 0 findings (no issues)
    • android: 0 findings (no issues)
    • codenameone-maven-plugin: 0 findings (no issues)
    • core-unittests: 0 findings (no issues)
    • ios: 0 findings (no issues)
  • PMD: 0 findings (no issues) [Report archive]
  • Checkstyle: 0 findings (no issues) [Report archive]

Generated automatically by the PR CI workflow.

shai-almog and others added 2 commits May 25, 2026 07:58
The version stamps were incorrect (actual current is 7.0.245). Remove
them from the new APIs' Javadoc, the IOSShareExtensionBuilder class
Javadoc, and the developer-guide prose. Leave pre-existing @SInCE
annotations in untouched code unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
IPhoneBuilder is an implementation detail of the maven plugin; the
public guide should refer to "the iOS build pipeline" without naming
the internal class.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@shai-almog shai-almog merged commit 004d920 into master May 25, 2026
28 checks passed
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