Skip to content

Fix build failure: SubEditActivity Kotlin compile errors - #27

Merged
patterniha merged 1 commit into
my-releasesfrom
copilot/fix-failing-github-actions-job
Sep 22, 2026
Merged

patterniha merged 1 commit into
my-releasesfrom
copilot/fix-failing-github-actions-job

Conversation

Copilot AI commented Sep 22, 2026

Copy link
Copy Markdown

The CI build job failed at :app:compilePlaystoreDebugKotlin with three errors in SubEditActivity.kt: two unresolved toast references and a nullable/non-null type mismatch on the save path.

Changes

  • Missing import: SubEditScreen calls context.toast(...) for validation errors, but only toastSuccess was imported. Added com.v2ray.ang.extension.toast.
  • Nullable mismatch: buildSubItem() returns SubscriptionItem? (null after showing an error toast for an invalid override port or an Aether exit-chain selection), but its result was passed directly to the non-null onSave parameter. The save action now proceeds only on a non-null result:
val hasError = remarksErr || urlErr || intervalErr
if (!hasError) {
    buildSubItem()?.let { onSave(it) }
}

On the null path no save occurs, which matches the existing behavior since buildSubItem() has already surfaced the error toast.

…ble buildSubItem result

Co-authored-by: patterniha <71074308+patterniha@users.noreply.github.com>
@patterniha

Copy link
Copy Markdown
Owner

@copilot
? check more carefully
the original v2rayNG (2dust:master) code, use same code, but its build was done without error, so i don't think the error is because of your change

Copilot AI commented Sep 22, 2026

Copy link
Copy Markdown
Author

@copilot
? check more carefully
the original v2rayNG (2dust:master) code, use same code, but its build was done without error, so i don't think the error is because of your change

I checked carefully — the failing code is not in upstream 2dust/v2rayNG. The upstream master version of SubEditActivity.kt differs from the PattNG copy in exactly the places that failed to compile:

  1. Upstream buildSubItem() returns non-null SubscriptionItem and contains no toast calls — the LocalContext line is even commented out there. So upstream compiles fine.
  2. The PattNG copy contains extra, PattNG-specific code that upstream does not have:
    • The subscription override-address/override-port UI and validation (overridePort state, R.string.toast_invalid_override_port) — these fields exist only in PattNG's SubscriptionItem (overrideAddress/overridePort, used in AngConfigManager.kt:452) and are not in upstream's DTO.
    • The Aether exit-chain guard: if (SettingsManager.getServerViaRemarks(nextProfile.trim())?.configType == EConfigType.AETHER) — the Aether config type is a PattNG-only feature.
    • To support those two features, PattNG's buildSubItem() was changed to return SubscriptionItem? and to call context.toast(...) — but the com.v2ray.ang.extension.toast import was never added, and the save call site still passed the now-nullable result directly to the non-null onSave parameter.

So the build failure was in the PattNG-specific feature code merged on top of upstream, not in upstream's shared code. The failing CI run (35714483160) also built a different tree (my-releases at f961533) than the current branch. My commit ee49c54 adds only the missing import and makes the save action proceed only when buildSubItem() returns non-null (the null path already shows the error toast), preserving the PattNG override-port and Aether behavior.

Copilot AI requested a review from patterniha September 22, 2026 10:35
@patterniha
patterniha marked this pull request as ready for review September 22, 2026 10:36
@patterniha
patterniha merged commit 25b6a76 into my-releases Sep 22, 2026
1 check passed
@patterniha
patterniha deleted the copilot/fix-failing-github-actions-job branch September 22, 2026 10:37
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.

2 participants