Skip to content

refactor: update capacitor page layout and logic for better readability and maintainability#42

Merged
damiant merged 13 commits intomainfrom
angular21-upgrade
Feb 5, 2026
Merged

refactor: update capacitor page layout and logic for better readability and maintainability#42
damiant merged 13 commits intomainfrom
angular21-upgrade

Conversation

@damiant
Copy link
Owner

@damiant damiant commented Jan 30, 2026

fix: remove unused CommonModule imports across various components

style: enhance privacy policy page formatting and structure

chore: add browserslist configuration for better compatibility

docs: create AI agent instructions for WebNative app detailing architecture and workflows

fix: update main.ts to include provideZoneChangeDetection for improved performance

refactor: streamline home page template with structural directives for better clarity

refactor: optimize shortcut component template with conditional rendering

refactor: clean up slide component by removing unnecessary imports

Summary by CodeRabbit

  • Documentation

    • Added comprehensive developer and workflow instructions.
  • Improvements

    • Upgraded core frameworks and tooling (Angular, Capacitor, TypeScript, etc.).
    • Updated browser compatibility targets and build/compiler settings.
    • Increased Android/iOS deployment SDK targets and app version to 1.36.
  • UI Changes

    • Adjusted rendering and form behavior across home, capacitor, privacy, slides, and shortcut screens.
  • CI / Build

    • Updated build setup and toolchain steps for mobile builds.

✏️ Tip: You can customize this high-level summary in your review settings.

…ty and maintainability

fix: remove unused CommonModule imports across various components

style: enhance privacy policy page formatting and structure

chore: add browserslist configuration for better compatibility

docs: create AI agent instructions for WebNative app detailing architecture and workflows

fix: update main.ts to include provideZoneChangeDetection for improved performance

refactor: streamline home page template with structural directives for better clarity

refactor: optimize shortcut component template with conditional rendering

refactor: clean up slide component by removing unnecessary imports
@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

Dependency and platform targets updated (Angular → 21, Capacitor → 8, Node, Android SDK, iOS deployment), app version bumped to 1.36; many templates switch from Angular structural directives to block-style @if/@for; CommonModule removed from several standalone components; reactive form and connect logic introduced on Home; repo guidance doc added.

Changes

Cohort / File(s) Summary
Versioning & Platform Targets
android/app/build.gradle, android/variables.gradle, ios/App/.../project.pbxproj, ios/App/Podfile
App version incremented to 1.36; Android compileSdk bumped to 36 and versionCode->45; iOS deployment target moved to 16.0 (project and Podfile) with Podfile CDN and post_install target propagation.
Package Manifest & Tooling
package.json, tsconfig.json, .browserslistrc
Angular dependencies upgraded to v21, Capacitor to v8, TypeScript/dev tooling updated; browserslist entries added and browserslist removed from package.json; tsconfig set module: "esnext" and skipLibCheck: true.
CI Workflow
.github/workflows/app-android.yml
Adds Node.js setup (actions/setup-node@v4, node 22) step into Android CI job.
Repository Guidance
.github/copilot-instructions.md
New long-form repository guidance/manual covering architecture, build/dev commands, Capacitor workflows, testing, and common development tasks.
Template Syntax Migration
src/app/capacitor/capacitor.page.html, src/app/home/home.page.html, src/app/privacy/privacy.page.html, src/app/shortcut/shortcut.component.html, src/app/slides/slides.component.html
Replaced Angular structural directives (*ngIf, *ngFor) with block-style @if/@for constructs across several templates; content and event bindings preserved but template syntax changed.
Standalone Component Imports
src/app/capacitor/capacitor.page.ts, src/app/privacy/privacy.page.ts, src/app/shortcut/shortcut.component.ts, src/app/slide/slide.component.ts
Removed CommonModule imports from multiple standalone component metadata (imports arrays adjusted).
Home: Reactive Forms & Connect Logic
src/app/home/home.page.ts, src/app/home/home.page.html
Introduced urlForm (FormGroup/FormControl), switched template binding to reactive forms, changed connect(url?: string, save?: boolean) to source URL from the form with client-side validation and a short delay before navigation.
Provider Addition at Bootstrap
src/main.ts
Added provideZoneChangeDetection() to the bootstrapApplication providers array.
Shortcut Styles
src/app/shortcut/shortcut.component.scss
Replaced .icon selector with ion-icon and set font-size: 2rem.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped the versions, tidy and fleet,
Templates rebloom with a new little beat,
Forms hum gently and providers awake,
Docs for the burrow, a big carrot cake,
I nibble the diff — a celebratory treat.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title broadly references refactoring the capacitor page, but the PR encompasses far more substantial changes across multiple files including Angular 21 upgrade, Capacitor 8 upgrade, iOS/Android version bumps, template syntax migration, and dependency updates. Revise the title to reflect the primary change: consider 'chore: upgrade to Angular 21 and Capacitor 8 with template syntax migration' or similar to better capture the scope of this major upgrade.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch angular21-upgrade

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 30, 2026

Deploying webnative-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: 06e7181
Status: ✅  Deploy successful!
Preview URL: https://298bedcc.webnative-app.pages.dev
Branch Preview URL: https://angular21-upgrade.webnative-app.pages.dev

View logs

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In @.github/copilot-instructions.md:
- Around line 3-4: Replace the bare URL in the "## Project Overview" paragraph
with a Markdown link; locate the sentence mentioning "Deployed to App/Play
Stores and https://webnative.app" and change the plain URL to a Markdown link
(for example, use descriptive link text like
[webnative.app](https://webnative.app)) so the line reads "Deployed to App/Play
Stores and [webnative.app](https://webnative.app)".
- Around line 71-81: The fenced code block showing the src/app/ tree in
.github/copilot-instructions.md lacks a language identifier; update the opening
fence from ``` to ```text so the block becomes a labeled plain-text code block,
which will satisfy MD040 and improve readability while leaving the block
contents unchanged.

In `@package.json`:
- Line 70: Upgrade to `@ionic/angular` 8.x requires ensuring Angular 16+ in
package.json and updating code and configs: update package.json to use Angular
16+ packages, replace all imports/usages of IonBackButtonDelegate with
IonBackButton (search for IonBackButtonDelegate symbol), remove legacy form
control syntax on Checkbox/Input components (search components like IonCheckbox,
IonInput and replace deprecated ngModel/formControl patterns as per migration
guide), remove size and accept attributes on IonInput usages, and update
browserslist configuration to target Safari/iOS >= 15; follow the Ionic v8
migration guide and the BREAKING.md for exact API replacements and validation
after changes.

In `@src/app/privacy/privacy.page.html`:
- Around line 15-44: In the Use of Cookies section, fix the duplicated word in
the paragraph under the <h2>Use of Cookies</h2> heading by changing "Cookies may
be used when when visiting a website within the WebNative App." to "Cookies may
be used when visiting a website within the WebNative App." so the sentence reads
correctly; update the paragraph text in the element containing that sentence.
🧹 Nitpick comments (9)
tsconfig.json (1)

16-19: ESNext module output + skipLibCheck: verify toolchain compatibility.
Please confirm bundlers/test runners still work with module: "esnext" and moduleResolution: "bundler". Also consider re‑enabling skipLibCheck in CI or running a periodic full typecheck to avoid masking dependency typing issues.

src/app/home/home.page.ts (1)

44-57: Deduplicate the standalone imports list.

The same Ionic components are listed twice; removing duplicates keeps the metadata clean.

♻️ Suggested cleanup
   imports: [
     ShortcutComponent,
     FormsModule,
     IonContent,
     IonFab,
     IonFabButton,
     IonIcon,
     IonSpinner,
-    IonContent,
-    IonFab,
-    IonFabButton,
-    IonIcon,
-    IonSpinner
   ],
src/app/shortcut/shortcut.component.html (1)

4-12: Consider an @else if chain for mutually exclusive icon cases.

This makes exclusivity explicit and avoids evaluating multiple conditions.

♻️ Suggested refactor
-    `@if` (!service.icon && !service.port) {
-      <ion-icon size="large" name="document-text-outline"></ion-icon>
-    }
-    `@if` (!service.icon && service.port) {
-      <img src="assets/cap-icon.svg" />
-    }
-    `@if` (service.icon) {
-      <img draggable="false" class="icon" [src]="safeUrl(service.icon)" (error)="service.icon = undefined" />
-    }
+    `@if` (service.icon) {
+      <img draggable="false" class="icon" [src]="safeUrl(service.icon)" (error)="service.icon = undefined" />
+    } `@else` if (service.port) {
+      <img src="assets/cap-icon.svg" />
+    } `@else` {
+      <ion-icon size="large" name="document-text-outline"></ion-icon>
+    }
package.json (1)

85-88: Consider using consistent version specifiers for ESLint packages.

The @angular-eslint/* packages use bare version "21" without a caret or tilde, while other Angular packages use "^21.1.2". This inconsistency could lead to unexpected behavior during dependency resolution.

Proposed fix for version consistency
-    "@angular-eslint/builder": "21",
-    "@angular-eslint/eslint-plugin": "21",
-    "@angular-eslint/eslint-plugin-template": "21",
-    "@angular-eslint/template-parser": "21",
+    "@angular-eslint/builder": "^21.0.0",
+    "@angular-eslint/eslint-plugin": "^21.0.0",
+    "@angular-eslint/eslint-plugin-template": "^21.0.0",
+    "@angular-eslint/template-parser": "^21.0.0",
src/app/capacitor/capacitor.page.html (3)

8-13: Template formatting appears broken.

The closing tags for the paragraph, divs, and structural elements are misaligned. This appears to be a formatting issue introduced during the refactoring that affects readability.

Proposed formatting fix
       <div class="rows">
         <p>The WebNative app detects and displays <a href="https://capacitorjs.com" target="_blank">Capacitor</a> apps launched from the <a
-      href="https://marketplace.visualstudio.com/items?itemName=WebNative.webnative">Webnative VS Code Extension</a> (click
-      <i>Run</i> > <i>Web</i>).
-    </p>
-  </div>
-</div>
+          href="https://marketplace.visualstudio.com/items?itemName=WebNative.webnative">Webnative VS Code Extension</a> (click
+          <i>Run</i> > <i>Web</i>).
+        </p>
+      </div>
+    </div>

26-39: QR code panel text content has awkward line breaks.

The "App Store" and "Play Store" text is split across lines in a way that could cause rendering issues or make the template harder to maintain.

Proposed fix for cleaner formatting
             <qrcode elementType="svg" [margin]="0" [qrdata]="appStoreUrl" [width]="160" [errorCorrectionLevel]="'M'">
             </qrcode>
-            <p class="store" (click)="openAppStore()"><ion-icon name="logo-apple-appstore"></ion-icon>&nbsp;App Store
-          </p>
+            <p class="store" (click)="openAppStore()"><ion-icon name="logo-apple-appstore"></ion-icon>&nbsp;App Store</p>
         </div>
       }
       `@if` (!isIOS()) {
         <div class="panel">
           <qrcode elementType="svg" [margin]="0" [qrdata]="playStoreUrl" [width]="160" [errorCorrectionLevel]="'M'">
           </qrcode>
-          <p class="store" (click)="openPlayStore()"><ion-icon name="logo-google-playstore"></ion-icon>&nbsp;Play
-        Store</p>
+          <p class="store" (click)="openPlayStore()"><ion-icon name="logo-google-playstore"></ion-icon>&nbsp;Play Store</p>
       </div>

86-93: Consider using a unique identifier for the track expression.

Using track plugin tracks by object reference. If the plugin objects have a unique identifier (like name or id), tracking by that property is more robust and can prevent unnecessary re-renders when the array is replaced but contains the same items.

Proposed improvement
-@for (plugin of plugins; track plugin) {
+@for (plugin of plugins; track plugin.name) {
src/app/home/home.page.html (2)

28-35: Control flow migration looks good; consider a stable track expression.

The @if and @for blocks correctly implement the new Angular control flow syntax. However, track service tracks by object reference. If service has a unique identifier (e.g., id, name, or url), tracking by that property would be more stable.

Proposed improvement if service has a unique identifier
     `@if` (!vm.busy) {
       <div class="shortcut-container">
-        `@for` (service of vm.services; track service) {
+        `@for` (service of vm.services; track service.id) {
           <app-shortcut (clicked)="open($event, service)"
           [service]="service"></app-shortcut>
         }
       </div>
     }

67-70: Commented code still uses old *ngFor syntax.

The commented history section at lines 67-70 still uses *ngFor. If this code is intended to be re-enabled in the future, consider updating it to the new @for syntax for consistency, or remove it if no longer needed.

…endencies

- Changed IPHONEOS_DEPLOYMENT_TARGET from 14.0 to 16.0 in project.pbxproj.
- Updated Podfile to set platform to iOS 16.0 and adjusted pod deployment targets.
- Upgraded Capacitor and related community plugins to version 8.0.0 or higher in package.json and Podfile.lock.
- Updated devDependencies for Angular ESLint and Capacitor CLI to their latest versions.
- Adjusted jsdom and vitest versions for compatibility.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ios/App/Podfile (1)

8-14: ⚠️ Potential issue | 🟡 Minor

Duplicate install! directives—only the last one takes effect.

There are two install! calls (lines 9 and 14). CocoaPods only honors the last one, so the :warn_for_unused_master_specs_repo => false option on line 9 is silently ignored.

Consolidate into a single directive:

🔧 Proposed fix
-# Disable input/output paths warning for Xcode caching
-install! 'cocoapods', :disable_input_output_paths => true, :warn_for_unused_master_specs_repo => false
-
 # workaround to avoid Xcode caching of Pods that requires
 # Product -> Clean Build Folder after new Cordova plugins installed
 # Requires CocoaPods 1.6 or newer
-install! 'cocoapods', :disable_input_output_paths => true
+install! 'cocoapods', :disable_input_output_paths => true, :warn_for_unused_master_specs_repo => false
🤖 Fix all issues with AI agents
In `@package.json`:
- Around line 42-68: Update the Capacitor 8 upgrade checklist: review and remove
android.adjustMarginsForEdgeToEdge from capacitor.config.json and switch to
System Bars + CSS safe-area usage; verify iOS appendUserAgent behavior and
adjust string formatting if relying on double-space; ensure Node.js 22+, Xcode
26+/iOS deployment target >=15.0, and Android Studio Otter 2025.2.1+; update
Android native settings referenced by "@capacitor/android" and related packages
by setting minSdk=24, compileSdk=36, targetSdk=36 in variables.gradle, bump AGP
to 8.13.0, Gradle wrapper to 8.14.3, migrate deprecated Gradle property
assignments to '=' syntax, and upgrade Kotlin to 2.2.x using compilerOptions {}
instead of kotlinOptions {}; verify native template changes (iOS SPM vs
CocoaPods behavior for npx cap add ios and Android bridge_layout_main.xml rename
to capacitor_bridge_layout_main.xml) and review plugin behavior notes for
`@capacitor/barcode-scanner`, `@capacitor/screen-orientation`, and
`@capacitor/geolocation` adjusting app code for scanOrientation/lock()/timeout
changes.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ios/App/Podfile (1)

8-15: 🛠️ Refactor suggestion | 🟠 Major

Consolidate duplicate install! to prevent losing options.

The second install! call (line 14) overwrites the first one, causing :warn_for_unused_master_specs_repo => false to be dropped. Merge both into a single install! statement with all options.

Suggested fix
-# Disable input/output paths warning for Xcode caching
-install! 'cocoapods', :disable_input_output_paths => true, :warn_for_unused_master_specs_repo => false
-
-# workaround to avoid Xcode caching of Pods that requires
-# Product -> Clean Build Folder after new Cordova plugins installed
-# Requires CocoaPods 1.6 or newer
-install! 'cocoapods', :disable_input_output_paths => true
+# Disable input/output paths warning for Xcode caching
+# workaround to avoid Xcode caching of Pods that requires
+# Product -> Clean Build Folder after new Cordova plugins installed
+# Requires CocoaPods 1.6 or newer
+install! 'cocoapods',
+         :disable_input_output_paths => true,
+         :warn_for_unused_master_specs_repo => false
🤖 Fix all issues with AI agents
In `@package.json`:
- Around line 31-75: The package "@capacitor-community/camera-preview" is pinned
to 7.0.3 which targets Capacitor 7; update package.json to use a Capacitor
8-compatible release (or replace it with the maintained alternative
"@cap-go/capacitor-camera-preview") so the native APIs align with Capacitor 8;
after updating the dependency entry for "@capacitor-community/camera-preview"
(or swapping to "@cap-go/capacitor-camera-preview") run npm/yarn install and
rebuild native projects (capacitor sync/prepare and Android/iOS build) to verify
no native build/runtime incompatibilities remain.

- Updated various Capacitor community plugins to their latest versions:
  - @capacitor-community/bluetooth-le to 8.0.1
  - @capacitor-community/camera-preview to 7.0.4
  - @capacitor-community/keep-awake to 8.0.0
  - @capacitor/action-sheet to 8.0.0
  - @capacitor/app to 8.0.0
  - @capacitor/barcode-scanner to 3.0.1
  - @capacitor/browser to 8.0.0
  - @capacitor/camera to 8.0.0
  - @capacitor/clipboard to 8.0.0
  - @capacitor/device to 8.0.0
  - @capacitor/dialog to 8.0.0
  - @capacitor/file-viewer to 2.0.0
  - @capacitor/filesystem to 8.1.0
  - @capacitor/geolocation to 8.0.0
  - @capacitor/haptics to 8.0.0
  - @capacitor/inappbrowser to 3.0.1
  - @capacitor/keyboard to 8.0.0
  - @capacitor/local-notifications to 8.0.0
  - @capacitor/motion to 8.0.0
  - @capacitor/network to 8.0.0
  - @capacitor/preferences to 8.0.0
  - @capacitor/screen-orientation to 8.0.0
  - @capacitor/screen-reader to 8.0.0
  - @capacitor/share to 8.0.0
  - @capacitor/splash-screen to 8.0.0
  - @capacitor/status-bar to 8.0.0
  - @capacitor/text-zoom to 8.0.0
  - @capacitor/toast to 8.0.0
  - @capawesome/capacitor-file-picker to 8.0.1
  - @vitest/ui to 4.0.18

- Updated Angular dependencies to version 21.1.3 for:
  - @angular/common
  - @angular/core
  - @angular/forms
  - @angular/platform-browser
  - @angular/platform-browser-dynamic
  - @angular/router
  - @angular/compiler
  - @angular/compiler-cli
  - @angular/language-service

- Increased iOS deployment target from 16.0 to 26.0 in Xcode project settings.
@damiant damiant merged commit 51469ff into main Feb 5, 2026
4 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