-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore:removing bulkfyle from mobile-app #3241
Conversation
WalkthroughArre bhai, kya badlav ho gaye hain! Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range comments (1)
src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.html (1)
The shell script results show significant bulk mode functionality still present in both component files. Let me generate the final response:
Arre baap re! Bulk mode ka poora khandan abhi bhi zinda hai!
Dosto, component files mein bulk mode ka sara saman abhi bhi dhoom macha raha hai:
camera-preview.component.ts
mein:
@Input() isBulkMode
property@Input() isBulkModePromptShown
propertychanges.isBulkMode
ka check
capture-receipt.component.ts
mein toh full party chal rahi hai:
isBulkMode
variableshowBulkModeToastMessage()
functionbulkModeToastMessageRef
toast notificationsonBulkCapture()
method- Bulk mode tracking code
- Bulk mode modal creation
Template mein se bulk mode ka UI hatane se kya fayda, jab backend mein sara logic dance kar raha hai? Pehle in sab ko bhi proper tareeke se clean up karna padega, tabhi bulk mode ka retirement party complete hoga! 😄
🔗 Analysis chain
Line range hint
71-94
: Arre bhai bhai bhai! Bulk mode ka sara masala abhi bhi pada hai!Dekho ji, PR ka maksad tha bulkfyle ko completely hatana, lekin code mein abhi bhi bulk mode ke bahut sare tadke masale bache hue hain:
- Bulk mode switching ka sara logic
- "Bulk Mode" text displays
- Bulk mode ke icons
isBulkMode
variable ka useChaliye, ek baar check kar lete hain ki component file mein kya scene hai:
Suggestion hai ki in sab cheezon ko bhi remove kar dein:
- <div class="camera-preview__bottom-container__icon-block text-center"> - <ng-container *ngIf="noOfReceipts === 0; else receiptPreviewIcon"> - <div (click)="onSwitchMode()"> - <img - class="camera-preview__bottom-container__icon-block__icon" - [ngClass]="{ 'camera-preview__bottom-container__icon-block--highlight': isBulkModePromptShown }" - [src]="isBulkMode ? '../../../../assets/images/single-mode.png' : '../../../../assets/images/bulk-mode.png'" - alt="Mode" - /> - <div class="camera-preview__bottom-container__text--secondary"> - {{ !isBulkMode ? 'Bulk Mode' : 'Single Mode' }} - </div> - </div> - </ng-container> + <div class="camera-preview__bottom-container__icon-block text-center"> + <ng-container *ngIf="noOfReceipts === 0; else receiptPreviewIcon"> + <div> + <img + class="camera-preview__bottom-container__icon-block__icon" + src="../../../../assets/images/single-mode.png" + alt="Mode" + /> + <div class="camera-preview__bottom-container__text--secondary"> + Single Mode + </div> + </div> + </ng-container>🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Let's investigate the component file for bulk mode references rg -i "bulk" src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.ts # Also check if the parent component still passes bulk mode props rg -i "bulk" src/app/shared/components/capture-receipt/capture-receipt.component.tsLength of output: 1424
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (6)
- src/app/fyle/my-expenses/my-expenses.page.spec.ts (4 hunks)
- src/app/fyle/my-expenses/my-expenses.page.ts (0 hunks)
- src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.html (1 hunks)
- src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.ts (0 hunks)
- src/app/shared/components/capture-receipt/capture-receipt.component.html (0 hunks)
- src/app/shared/components/capture-receipt/capture-receipt.component.ts (0 hunks)
💤 Files with no reviewable changes (4)
- src/app/fyle/my-expenses/my-expenses.page.ts
- src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.ts
- src/app/shared/components/capture-receipt/capture-receipt.component.html
- src/app/shared/components/capture-receipt/capture-receipt.component.ts
🧰 Additional context used
🔇 Additional comments (4)
src/app/fyle/my-expenses/my-expenses.page.spec.ts (4)
Line range hint
518-536
: Arre bhai bhai, nice test coverage for enabled features!The test properly verifies that
isNewReportsFlowEnabled
,isInstaFyleEnabled
,isMileageEnabled
andisPerDiemEnabled
are set correctly when org settings enable these features. Good job with the assertions, ekdum first class!
Line range hint
537-564
: Arey waah, disabled features ka test bhi kar liya!Test verifies that all feature flags are set to false when org settings disable them. Mast comprehensive coverage hai boss!
Line range hint
565-588
: Sahi pakde hain edge cases, not allowed features ka test!Test checks that features are disabled when they are not allowed in org settings, even if enabled. Bilkul detective ki tarah har angle cover kar liya!
Line range hint
589-611
: Undefined settings ka test, ekdum solid!Test verifies that feature flags are set to undefined when org settings are undefined. Edge case testing on point hai guru!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix lint errors and unit tests
There was a problem hiding this 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
🧹 Outside diff range comments (3)
src/app/shared/components/capture-receipt/capture-receipt.component.ts (3)
Line range hint
28-32
: Type definition ko thoda aur strict banate hain! 💪Ye
Image
type definition ko thoda improve kar sakte hain:-type Image = Partial<{ +interface Image { source: string; base64Image: string; -}>; +}Kyunki dono fields hamesha required hain (dekho
base64ImagesWithSource.push()
calls), tohPartial
ki zarurat nahi hai. Interface use karne se code aur readable ho jayega!
Line range hint
391-397
: Performance ka chakkar babu bhaiya! 🚀
addPerformanceTrackers
method mein unnecessary subscription ho rahi hai:addPerformanceTrackers(): void { - this.orgService.getOrgs().subscribe((orgs) => { + this.orgService.getOrgs().pipe( + take(1) + ).subscribe((orgs) => {Ek baar performance track karne ke baad baar baar subscription ki kya zarurat?
take(1)
operator use karke subscription ko limit kar dete hain! 😎
Based on the shell script results, I can now provide a final response:
Arre bhai, bulk functionality ko completely hatana hi padega! 🎯
Dekho, search results se clear ho gaya hai ki bulk functionality ka removal org settings level se shuru hona chahiye. Code mein ye saare references mil gaye hain:
- Core models mein
BulkFyleSettings
interface (org_user_settings.model.ts
)- Org settings mein
bulk_fyle_settings
configuration- UI components mein bulk mode ke controls
- Templates mein
isBulkMode
bindingsAur capture-receipt component mein toh bulk mode ka poora setup hai:
- Camera preview mein bulk mode toggle
- Bulk mode toast messages
- Bulk capture workflow
Ye PR incomplete hai kyunki:
- Org settings level se bulk fyle ka removal nahi hua
- UI se bulk mode ke controls abhi bhi maujood hain
- Core models mein bulk fyle ke interfaces abhi bhi hain
Ek proper cleanup ke liye in sab files ko touch karna padega. Bulk functionality ko properly hatane ke liye systematic approach chahiye, starting from the data models down to the UI.
🔗 Analysis chain
Line range hint
1-500
: Arre bhai bhai bhai! Bulk functionality toh abhi bhi zinda hai! 🤔Dekho ji, PR ka objective hai "removing bulkfyle from mobile-app", lekin code mein bulk capture ka sara functionality abhi bhi maujood hai. For example:
isBulkMode
propertyonBulkCapture()
method- Bulk mode toast messages
- Bulk receipt preview modal
Let's verify if bulk functionality should be completely removed:
If bulk functionality needs to be removed as per PR objective, here's what needs to be cleaned up:
- isBulkMode: boolean; - bulkModeToastMessageRef: MatSnackBarRef<ToastMessageComponent>; - showBulkModeToastMessage(): void {...} - onSwitchMode(): void {...} - onBulkCapture(): void {...}Aur bhi bahut saare changes honge, lekin pehle ye clear karna padega - kya bulk functionality ko completely remove karna hai ya sirf
isBulkFyleEnabled
flag ko? 🤔Main ek comprehensive cleanup PR generate kar sakta hoon bulk functionality ko remove karne ke liye. Batao, kya ye helpful rahega? 😊
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for other bulk-related code in the codebase echo "Searching for bulk-related code..." rg -i "bulk.*fyle|bulkfyle" --type ts # Search for bulk mode UI elements in templates echo "Searching for bulk mode UI elements..." rg -i "bulkMode|bulk-mode" --type htmlLength of output: 6192
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (2)
- src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.ts (5 hunks)
- src/app/shared/components/capture-receipt/capture-receipt.component.ts (1 hunks)
🧰 Additional context used
🪛 Biome
src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.ts
[error] 103-103: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
🔇 Additional comments (2)
src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.ts (2)
59-59
: Waah! TypeScript ke guru, kya baat hai!Return types add kar diye, code ko ekdum clean and type-safe bana diya. Typescript compiler ko bhi khushi ho gayi hogi!
Also applies to: 80-80, 99-99, 107-107, 119-119, 132-132, 137-137, 141-141, 146-146, 151-151, 157-157, 162-162
Line range hint
16-16
: Bulk feature ka cleanup adhura lag raha hai, dost!While
allowBulkFyle
has been removed, I notice we still have other bulk-related properties and logic:
isBulkMode
input property- Bulk mode change handling in
ngOnChanges
Let's verify if these should also be removed for consistency.
Also applies to: 162-168
//Stop camera only if it is in RUNNING state | ||
if (this.cameraState === CameraState.RUNNING) { | ||
this.cameraState = CameraState.STOPPING; | ||
from(this.cameraPreviewService.stop()).subscribe((_) => (this.cameraState = CameraState.STOPPED)); | ||
from(this.cameraPreviewService.stop()).subscribe(() => (this.cameraState = CameraState.STOPPED)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arre bhai bhai bhai, thoda readable banate hain!
Assignment ko expression ke andar rakhna thoda confusing hai. Chalo ise alag line mein likhte hain.
Here's a cleaner way to write it:
- from(this.cameraPreviewService.stop()).subscribe(() => (this.cameraState = CameraState.STOPPED));
+ from(this.cameraPreviewService.stop()).subscribe(() => {
+ this.cameraState = CameraState.STOPPED;
+ });
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
from(this.cameraPreviewService.stop()).subscribe(() => (this.cameraState = CameraState.STOPPED)); | |
from(this.cameraPreviewService.stop()).subscribe(() => { | |
this.cameraState = CameraState.STOPPED; | |
}); |
🧰 Tools
🪛 Biome
[error] 103-103: The assignment should not be in an expression.
The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.(lint/suspicious/noAssignInExpressions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range comments (1)
src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.spec.ts (1)
Line range hint
236-251
: Oho! Bulk mode ke test cases abhi bhi party mein invited hain!Dekho bhai, PR ka maksad hai bulkFyle ko remove karna, lekin yeh test cases abhi bhi bulk mode ke liye nach rahe hain. Inko bhi vida kar dena chahiye!
Cleanup karne ke liye yeh changes zaruri hain:
- describe('ngOnChanges():', () => { - it('should show message if bulk mode is turned on', fakeAsync(() => { - component.ngOnChanges({ - isBulkMode: new SimpleChange(false, true, true), - }); - - expect(component.showModeChangedMessage).toEqual(true); - tick(1500); - expect(component.showModeChangedMessage).toEqual(false); - })); - - it('should not change state if no change detected', () => { - component.showModeChangedMessage = false; - - component.ngOnChanges({}); - expect(component.showModeChangedMessage).toEqual(false); - }); - });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
- src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.spec.ts (1 hunks)
🔇 Additional comments (1)
src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.spec.ts (1)
93-102
: Arre wah! Zabardast web platform test case likha hai!Test case ekdum sahi hai, lekin ek choti si baat check kar len - kya humne component ke template mein web platform ke liye koi special UI handling toh nahi bhool gaye?
✅ Verification successful
The previous command might have failed because we were too specific. Let's check the actual implementation to understand if there are any platform-specific UI considerations that need testing.
Arre bhai bhai bhai! Sab ekdum first class hai!
Dekho, maine code ka full inspection kar liya hai aur kya pata chala:
- Web platform ke liye UI mein koi special handling ki zarurat hi nahi hai
- Component automatically handle kar raha hai platform differences:
- Web pe permissions check skip karta hai
- Flash mode sirf non-web platforms pe show hota hai (
*ngIf="flashMode"
andif (this.devicePlatform !== 'web')
)- Camera preview ka basic UI sabke liye same hai
Matlab test case bilkul sahi hai, aur implementation bhi perfect! Koi tension nahi lene ka, code ekdum solid hai! 😄
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check if there are any web-specific UI elements or conditions in the template rg -g "*.html" "devicePlatform === 'web'" src/app/shared/components/capture-receipt/camera-preview/Length of output: 107
Script:
#!/bin/bash # Let's check the template file directly to see all UI conditions fd "camera-preview.component.html" src/app/shared/components/capture-receipt/ --exec cat {} # Also check the component file to understand platform-specific logic fd "camera-preview.component.ts" src/app/shared/components/capture-receipt/ --exec cat {}Length of output: 9335
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
📒 Files selected for processing (1)
- src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.spec.ts (3 hunks)
🔇 Additional comments (2)
src/app/shared/components/capture-receipt/camera-preview/camera-preview.component.spec.ts (2)
94-103
: Arre wah! Web platform ke liye naya test case, ekdum first class! 🎯Bahut badhiya test case add kiya hai web platform ke liye. Camera permissions ka chakkar hi nahi, seedha preview shuru!
Line range hint
1-235
: Test coverage ka full package, lekin ek choti si baat! 🤔Bhai test coverage toh mast hai, lekin PR objectives mein code coverage report ki baat ki thi.
Let's check if the coverage report is available:
Coverage report nahi mil raha toh main help kar sakta hun generate karne mein. Batao, karna hai kya?
@@ -211,16 +223,16 @@ describe('CameraPreviewComponent', () => { | |||
isBulkMode: new SimpleChange(false, true, true), | |||
}); | |||
|
|||
expect(component.showModeChangedMessage).toEqual(true); | |||
expect(component.showModeChangedMessage).toBeTrue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Assertion ka style update kar diya, smart move! 👌
.toEqual(true/false)
se .toBeTrue()/.toBeFalse()
mein change kar diya. Ekdum sahi kiya boss! Ye wala syntax boolean assertions ke liye zyada specific hai.
Ek suggestion hai, baaki test cases mein bhi boolean assertions ko isi tarah update kar sakte hain, consistency ke liye. Karna hai kya?
Also applies to: 228-228, 235-235
|
Clickup
https://app.clickup.com/t/86cwmcry2
Code Coverage
Please add code coverage here
UI Preview
Please add screenshots for UI changes
Summary by CodeRabbit
New Features
Bug Fixes
Documentation