<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abanoub Fakhery on Medium]]></title>
        <description><![CDATA[Stories by Abanoub Fakhery on Medium]]></description>
        <link>https://medium.com/@abanoub728?source=rss-7732cd5d3132------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ICChAit-Agl-8Pj9</url>
            <title>Stories by Abanoub Fakhery on Medium</title>
            <link>https://medium.com/@abanoub728?source=rss-7732cd5d3132------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:13:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abanoub728/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[8 Thinking Traps That Fail You on the PSM II Exam and How to Avoid Them]]></title>
            <link>https://medium.com/@abanoub728/8-thinking-traps-that-fail-you-on-the-psm-ii-exam-and-how-to-avoid-them-03b8a84079be?source=rss-7732cd5d3132------2</link>
            <guid isPermaLink="false">https://medium.com/p/03b8a84079be</guid>
            <category><![CDATA[psm-1]]></category>
            <category><![CDATA[psm-2]]></category>
            <category><![CDATA[scrum-master]]></category>
            <category><![CDATA[scrum-guide]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Abanoub Fakhery]]></dc:creator>
            <pubDate>Sun, 25 Oct 2026 12:06:06 GMT</pubDate>
            <atom:updated>2026-10-25T12:08:36.774Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xFHkVtKTE2MVm85Bo8iVGQ.png" /></figure><h3>What I learned from working through dozens of Scrum Master scenario questions</h3><p>When I started preparing for the Professional Scrum Master II (PSM II) assessment, I thought knowing the Scrum Guide well would be enough. It wasn’t.</p><p>PSM I asks you what Scrum says. PSM II asks what you would do in a messy, realistic situation, where three of the four answers sound reasonable. After working through a large set of scenario questions, I noticed that my wrong answers weren’t random. They came from a small number of recurring thinking traps.</p><p>Here are the eight traps I saw most often, with paraphrased scenarios showing what the better answer looks like and why.</p><h3>Trap 1: Treating the forecast as the commitment</h3><p><strong>The scenario:</strong> Halfway through a Sprint, a worried Product Owner tells you the Developers won’t finish everything they selected during Sprint Planning. What do you say?</p><p>The tempting answers are to motivate the team, add more Developers, or push harder. The better answer is to remind the Product Owner that <strong>the Scrum Team commits to the Sprint Goal, not to the full list of selected items.</strong> The selected work is a forecast, and forecasts change as the team learns more.</p><p>The same trap shows up at the end of Sprint Planning. Imagine the timebox is about to expire and the Product Owner and Developers still disagree on item order, but the business objective is clear. You don’t extend the timebox or postpone the Sprint. You craft a Sprint Goal from the objective, let the Developers forecast the work most likely to achieve it, start the Sprint, and let the plan emerge.</p><p><strong>The lesson:</strong> Commitment in Scrum means committing to goals and supporting each other. It doesn’t mean promising to deliver a fixed scope. Questions about the value of commitment often reward answers like <em>focusing on the Sprint Goal</em>, <em>communicating openly about progress and challenges</em>, and <em>seeking feedback from stakeholders</em>. “Finishing every forecasted item” and “increasing velocity” don’t qualify.</p><h3>Trap 2: Acting like a manager</h3><p><strong>The scenario:</strong> Human Resources asks you, the Scrum Master, to write a performance evaluation for a Developer, assuming you are the team’s manager.</p><p>You may want to just do it to be helpful, or to give only positive feedback to protect the person. The stronger answers are to suggest peer feedback from the other Developers, and to work with HR on rethinking individual performance reviews in a team-based environment.</p><p>This trap appears in many forms:</p><ul><li><strong>Updating the burndown chart.</strong> Scrum doesn’t require a burndown chart, and tracking progress isn’t the Scrum Master’s job.</li><li><strong>Assigning tasks to Developers.</strong> Developers decide how to turn Product Backlog items into a Done Increment.</li><li><strong>Taking minutes and documenting every meeting.</strong> That isn’t part of the accountability.</li><li><strong>Removing every impediment personally.</strong> The goal is to make sure impediments get removed. Often the better move is to build the team’s ability to remove them itself.</li></ul><p><strong>The lesson:</strong> When an answer puts the Scrum Master in control of people, tasks, or reporting, be suspicious. The Scrum Master’s accountabilities are about the effectiveness of the Scrum Team, coaching self-management and cross-functionality, and helping the organization understand and adopt Scrum and empiricism.</p><h3>Trap 3: Taking sides instead of serving everyone</h3><p>This was the trap that caught me most often.</p><p><strong>The scenario:</strong> The Developers adopt a #noestimates approach. The CIO and COO want traditional time-based estimates and hold you responsible for the gap.</p><p>I chose the answer that explains the Developers’ reasoning to leadership and highlights why traditional estimation is flawed. It sounded professional and pro-agile, but it was wrong. The better answer was to <strong>understand leadership’s need for estimates and the Developers’ reasons for #noestimates, then facilitate a solution that works for both sides.</strong></p><p>The Scrum Master serves the Scrum Team <em>and</em> the organization. An answer that turns you into an advocate for one side, even the “agile” side, is usually weaker than one that helps both sides understand each other.</p><p>You’ll see the same pattern when:</p><ul><li><strong>The relationship between the Product Owner and Developers is deteriorating.</strong> The better answer is to facilitate a dialogue, often in the Sprint Retrospective. Telling the Developers “the Product Owner decides, so accept it” is weaker.</li><li><strong>Requirements keep changing.</strong> The better answer is to bring both sides together to explore <em>why</em> the requirements change and how the changes affect value. HR involvement or team-building trips are weaker.</li><li><strong>A stakeholder announces a budget cut and an emotional argument breaks out in the Sprint Review.</strong> The better answer is to facilitate, for example by calling a short break so people can come back and discuss it objectively. Stepping back with “the Product Owner owns this event” is weaker.</li></ul><p><strong>The lesson:</strong> If one answer picks a winner and another helps people reach shared understanding, the second one is usually the PSM II answer.</p><h3>Trap 4: Confusing self-management with doing nothing</h3><p>The opposite of the manager trap is the passive Scrum Master who hides behind “the team is self-managing.”</p><p><strong>The scenario:</strong> One Developer keeps skipping the Daily Scrum because he thinks it’s a waste of time. Some teammates agree, others don’t, and nobody has done anything about it.</p><p>“Let them self-manage and don’t intervene” sounds respectful, but the team has <em>already shown</em> it isn’t resolving the issue. Talking to the Developer privately and demanding attendance is too controlling. The better answer is to <strong>bring the Developers together soon and ask what they gain when everyone attends and what might go wrong when someone is missing.</strong> You use powerful questions so the team reaches its own conclusion.</p><p>A related scenario: the team wants to adopt an improvement that conflicts with an organizational policy and cites self-management as permission. Self-management works within organizational constraints. The better answer is to work with the policy owner on a trial period. If they don’t agree, the team follows the current policy while preparing a stronger case.</p><p><strong>The lesson:</strong> Good PSM II answers are neither controlling nor passive. They make problems transparent and help the team solve them.</p><h3>Trap 5: Trading transparency for speed or cost</h3><p>Many scenarios tempt you to weaken quality “just this once.”</p><ul><li><strong>Performance is a key requirement</strong>, but a manager wants performance testing only every other Sprint because it’s expensive.</li><li><strong>Users find user acceptance testing (UAT) annoying</strong> and want it deferred to the end of the project.</li><li><strong>The team proposes a “hardening Sprint”</strong> to stabilize the product before release.</li><li><strong>The Product Owner wants to relax the Definition of Done</strong> to hit a release date.</li></ul><p>In every case, the better answer protects the transparency of the Increment. Skipping a quality check doesn’t remove the work. It hides the risk and delays feedback, which undermines empiricism.</p><p>When the risk of technical debt needs to be explained, the strongest arguments are that weakening the Definition of Done raises defect rates and slows the team down over time. Also, technical debt is often invisible to users, so the system looks better than it really is.</p><p>And if work doesn’t meet the Definition of Done at the end of the Sprint, the answer is simple. <strong>It isn’t part of the Increment.</strong> It goes back to the Product Backlog for the Product Owner to decide what happens next. There is no “90% done,” and partial work doesn’t count toward velocity.</p><p><strong>The lesson:</strong> The Definition of Done is the guard rail of transparency. Answers that weaken it to save time or money are almost always wrong.</p><h3>Trap 6: Measuring output instead of value</h3><p><strong>The scenario:</strong> A manager wants to standardize velocity across four Scrum Teams so the organization can compare them and assess value.</p><p>Velocity is a planning tool the Developers use within their own team. It isn’t comparable across teams, and it has no direct relationship with value. Tie incentives to it and you’ll get inflated estimates, not better products.</p><p>A related Retrospective scenario: the team couldn’t produce a usable Increment because of integration problems, but some Developers point out that velocity went up. The better response is to remind the team that working, usable Increments matter more than velocity, and to help them adjust their process to deliver every Sprint, even if velocity drops.</p><p><strong>The lesson:</strong> When you see “velocity” in an answer, ask yourself whether it’s being used to plan or to judge. Scrum supports only the first.</p><h3>Trap 7: Bending events to fit the calendar</h3><p>Scheduling problems are some of the most common scenarios, and the convenient answer is usually wrong.</p><ul><li><strong>Holding the Daily Scrum twice a week</strong> because some Developers are part-time or remote leads to fewer chances to inspect and adapt, a less reliable plan, and impediments surfacing later. Solve the scheduling problem instead, for example by meeting online.</li><li><strong>Cancelling the Sprint Retrospective</strong> for a corporate event sets a bad precedent. Push back on the cancellation and offer to move the Retrospective to another day in the same Sprint.</li><li><strong>A Daily Scrum that always runs long</strong> because one Developer gives long updates calls for raising it with the team so they can find a solution together. A private conversation about the purpose of the event can help too. Strict speaking time limits, or the Scrum Master running the meeting, aren’t the answer.</li></ul><p><strong>The lesson:</strong> Events are there because they create opportunities to inspect and adapt. Change <em>how</em> you hold them, not <em>whether</em> you hold them.</p><h3>Trap 8: Assuming scaling is simple math</h3><p><strong>The scenario:</strong> A team has a stable velocity of 24. Extra funding arrives and a second team joins the same product. What happens to the original team’s velocity in the short term?</p><p>It drops. Onboarding, knowledge transfer, and integration take time. Adding people to a team never guarantees a proportional increase in value.</p><p>Other scaling scenarios follow consistent rules:</p><ul><li><strong>One product means one Product Backlog and one Product Owner</strong>, even with several teams. Assigning three Product Owners to one product weakens accountability.</li><li><strong>One Product Owner can own several products</strong>, and can delegate work while staying accountable.</li><li><strong>Coordination between teams is the teams’ responsibility.</strong> They organize so they can produce at least one integrated Increment every Sprint, and the Scrum Master teaches them how. A coordinating architect or “integration Sprints” aren’t the answer.</li><li><strong>When a specialist’s skills are needed across teams</strong>, grow the skills inside the teams, for example through volunteers who learn the domain or a team built around the specialist. Don’t make everyone depend on one person.</li></ul><p><strong>The lesson:</strong> Scaling increases the need for transparency, integration, and shared standards. It doesn’t multiply output.</p><h3>A quick checklist before you choose an answer</h3><p>When a PSM II question has several plausible answers, I now run through these questions:</p><ol><li><strong>Does this answer protect empiricism and transparency, or trade them for speed?</strong></li><li><strong>Does it serve everyone involved, or take one side?</strong></li><li><strong>Does it build the team’s ability to solve the problem, or does the Scrum Master solve it for them?</strong></li><li><strong>Does it address the root cause, or only the symptom?</strong></li><li><strong>Does it treat the Sprint Goal as the commitment and the selected items as a forecast?</strong></li><li><strong>Is it neither passive nor controlling?</strong></li></ol><p>The answer that passes most of these checks is usually the right one.</p><h3>Final thoughts</h3><p>PSM II isn’t a memory test. It checks whether you think like a Scrum Master who has been in difficult situations: someone who protects transparency, serves both the team and the organization, and resists both control and passivity.</p><p>The best preparation I found was to analyze <em>why</em> a wrong answer felt right, not just to read the Scrum Guide again. Every trap above came from one of my own wrong answers.</p><p><em>Note: the scenarios in this article are paraphrased examples for learning. They aren’t actual questions from Scrum.org assessments.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03b8a84079be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Connect Firebase with BrowserStack App Live (Flutter, Android & iOS)]]></title>
            <link>https://medium.com/@abanoub728/how-to-connect-firebase-with-browserstack-app-live-flutter-android-ios-f20e31cae5eb?source=rss-7732cd5d3132------2</link>
            <guid isPermaLink="false">https://medium.com/p/f20e31cae5eb</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[browserstack]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[mobile-browserstack]]></category>
            <dc:creator><![CDATA[Abanoub Fakhery]]></dc:creator>
            <pubDate>Mon, 18 May 2026 12:24:22 GMT</pubDate>
            <atom:updated>2026-05-18T13:08:14.852Z</atom:updated>
            <content:encoded><![CDATA[<p>Testing Firebase-enabled apps on real devices is a crucial step when your application relies on backend services such as firebase services or some integrations.</p><p>In this guide, you’ll learn how to connect your Firebase project with <strong>BrowserStack App Live</strong> using OAuth credentials.</p><p>This works for:</p><ul><li>Flutter applications</li><li>Native Android applications</li><li>Native iOS applications</li><li>React Native applications</li><li>Xamarin applications</li></ul><h3>Why Connect Firebase with BrowserStack?</h3><p>Integrating Firebase with BrowserStack helps you:</p><ul><li>Run Firebase-connected apps on real devices</li><li>Import builds directly from Firebase</li><li>Improve QA testing workflows</li><li>Share builds easily with teams</li><li>Eliminate manual APK/IPA uploads</li></ul><h3>Firebase App Distribution vs BrowserStack App Live vs Firebase Test Lab</h3><p>Many developers confuse these three services because they all help with mobile app testing and distribution — but they serve very different purposes.</p><h3>📦 Firebase App Distribution</h3><p>Used to <strong>distribute pre-release apps to testers</strong>.</p><ul><li>Focus: Beta distribution (QA, internal testers)</li><li>Platform: Firebase ecosystem</li><li>How it works: Upload APK/IPA → send invites to testers</li><li>Testing type: Manual testing only</li><li>Devices: Real testers’ devices (not controlled by Firebase)</li><li>Best for: Sharing builds with QA teams before release</li></ul><p>👉 Think of it as: <strong>“Send my app to testers”</strong></p><h3>🌐 BrowserStack App Live</h3><p>Used to <strong>test apps on real cloud devices interactively</strong>.</p><ul><li>Focus: Manual testing on real devices in the cloud</li><li>Platform: BrowserStack cloud</li><li>How it works: Upload app or connect Firebase → open real device session</li><li>Testing type: Manual + exploratory testing</li><li>Devices: Real Android &amp; iOS devices hosted in BrowserStack</li><li>Best for: Cross-device UI/UX testing, debugging, Firebase validation</li></ul><p>👉 Think of it as: <strong>“Use a real phone in the cloud”</strong></p><h3>🧪 Firebase Test Lab</h3><p>Used to <strong>automate testing on Google-managed devices</strong>.</p><ul><li>Focus: Automated testing (instrumentation &amp; Robo tests)</li><li>Platform: Google Cloud</li><li>How it works: Upload app + test scripts → run on device farm</li><li>Testing type: Automated testing only</li><li>Devices: Google-managed physical devices &amp; emulators</li><li>Best for: CI/CD, regression testing, crash detection</li></ul><p>👉 Think of it as: <strong>“Run automated tests on thousands of devices”</strong></p><h3>🧠 Simple Way to Remember</h3><ul><li><strong>App Distribution</strong> → send builds to people</li><li><strong>BrowserStack</strong> → test on real phones yourself</li><li><strong>Test Lab</strong> → let Google run automated tests</li></ul><p>Now Let’s Start.</p><h3>Step 1 — Ensure Your App is Connected to Firebase</h3><p>Before integrating with BrowserStack, your mobile app must already be configured with Firebase and at least released one artificat (apk, ipa) to Firebase App Distribution using any CI/CD tools like Githbut Actions.</p><h3>Step 2 — Open Google Cloud Console</h3><p>Go to <a href="https://console.cloud.google.com/">Google Cloud Console</a></p><p>Select your Firebase project from the project list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bpku1w1tMtcciJt3" /></figure><h3>Step 3 — Open APIs &amp; Services</h3><p>From the left sidebar:</p><p>👉 Click <strong>APIs &amp; Services</strong></p><p>You will see:</p><ul><li>Enabled Apis &amp; services</li><li>Library</li><li>Credentials</li><li>OAuth Consent Screen</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*s-ccNsjLYVbiV7Bp" /></figure><h3>Step 4 — Open OAuth Consent Screen</h3><p>Navigate to:</p><p>👉 <strong>APIs &amp; Services → OAuth Consent Screen</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/0*3qIW_kqWEb9yJs6s" /></figure><p>Click on Create new consent then enter the requested information but the important step is Scopes that you will need is to select User Type as “External”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/0*fTl0iqsUMXMAN22f" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-BD2qY6PELpCbmsJ" /></figure><h3>Step 5 — Go to Credentials</h3><p>Navigate to: 👉 <strong>APIs &amp; Services → Credentials</strong></p><p>Click on Create Credential → OAuth client ID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*kvEy68xksw0xsfxa" /></figure><p>Select the Application type as “Web application” then enter a name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0jC9RnkWjrdNYCXt" /></figure><p>Then in Authorized redirect URIs section enter this URL <br>“<a href="https://app-live.browserstack.com/firebase/oauth">https://app-live.browserstack.com/firebase/oauth</a>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mOPiIZ4C7eR_xhtA" /></figure><p>Then click on Create button, A popup dialog will appear to you with option to download a json config file, So download it to reuse later</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*BJNpngqoZlT_kE0O" /></figure><h3>Step 6 — Publish OAuth Consent Screen</h3><p>Now back to: 👉 <strong>OAuth Consent Screen → Audience</strong></p><p>Click: 👉 <strong>Publish to Production</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BN7ZwSW7dfzJ-C2X" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/0*Cou2O4rzam_fDsDb" /></figure><h3>Step 7 — Connect Firebase in BrowserStack</h3><p>Now open:</p><p>👉 <a href="https://www.browserstack.com/app-live">https://www.browserstack.com/app-live</a></p><p>Go to:</p><p>👉 <strong>App Live → Connect with Firebase</strong></p><p>Upload the OAuth JSON file that we download it before in <strong>Step 5</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iIbRg1zdTHiO1FRZ" /></figure><h3>🎉 Done</h3><p>Your Firebase project is now connected to BrowserStack App Live.</p><p>You can now:</p><ul><li>Import Firebase builds automatically</li><li>Test apps on real devices</li><li>Validate Firebase features (Auth, Firestore, FCM, etc.)</li><li>Share builds with QA teams</li></ul><h3>Common Issues</h3><h3>Redirect URI Mismatch</h3><p>Ensure this exact URI is used:</p><pre>https://app-live.browserstack.com/firebase/oauth</pre><h3>OAuth App Not Working</h3><ul><li>Ensure OAuth consent screen is <strong>published to production</strong></li><li>Ensure correct Firebase project is selected</li></ul><h3>Invalid Config File</h3><p>Make sure you upload:</p><p>✔ OAuth Client JSON<br>❌ NOT Firebase service account JSON</p><h3>Useful Links</h3><ul><li>BrowserStack App Live: <a href="https://www.browserstack.com/app-live">https://www.browserstack.com/app-live</a></li><li>Firebase Console: <a href="https://console.firebase.google.com/">https://console.firebase.google.com/</a></li><li>Google Cloud Console: <a href="https://console.cloud.google.com/">https://console.cloud.google.com/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f20e31cae5eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Cursor: How to Request Tasks Efficiently, Minimize Tokens, and Maximize Performance]]></title>
            <link>https://medium.com/@abanoub728/mastering-cursor-how-to-request-tasks-efficiently-minimize-tokens-and-maximize-performance-8d9df8e7b00e?source=rss-7732cd5d3132------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d9df8e7b00e</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cursor]]></category>
            <category><![CDATA[token]]></category>
            <dc:creator><![CDATA[Abanoub Fakhery]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 09:41:38 GMT</pubDate>
            <atom:updated>2026-02-12T08:50:49.176Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By Abanoub Fakhry</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBdM6hGr_yrxpXaENexmUg.png" /></figure><p>AI-powered IDEs like <strong>Cursor</strong> are reshaping how we build software. Used correctly, Cursor feels like a capable junior engineer working directly inside your codebase.</p><p>Used poorly, it becomes noisy, expensive, and unpredictable.</p><p>The difference comes down to <strong>how you communicate with it</strong>.</p><p>In this article, we’ll cover practical, production-proven techniques to:</p><ul><li>Request tasks precisely</li><li>Minimize token usage</li><li>Get deterministic, high-quality results</li><li>Configure persistent project rules</li><li>Choose the right agents (or Auto mode)</li><li>Treat Cursor like an engineering teammate — not a chatbot</li></ul><p>Although examples lean toward Flutter, the principles apply to any stack.</p><h3>Why Token Discipline Matters</h3><p>Cursor operates directly on your repository. Every prompt you send:</p><ul><li>Consumes tokens (cost)</li><li>Expands context (slower reasoning)</li><li>Increases hallucination risk</li><li>Produces larger diffs</li></ul><h3><strong>More words do <em>not</em> mean better results.</strong></h3><p><strong>Precision always beats verbosity.</strong></p><p>Think of Cursor like a compiler: it prefers structured technical input over conversational language.</p><h3>Think Like a developer, Not a User</h3><p>Avoid unclear descriptions:</p><blockquote>❌ <em>“My Flutter app feels slow sometimes.”</em></blockquote><p>Prefer engineering language:</p><blockquote>✅ <em>“Profile navigation freeze. Check for synchronous work on main isolate during route push/pop.”</em></blockquote><p>Good prompts when have:</p><ul><li>Clear goals</li><li>Narrow scope</li><li>Technical terminology</li><li>No storytelling</li></ul><p>Cursor performs best when you communicate like a senior engineer.</p><h3>A Simple Prompt Structure That Works</h3><p>Use this format whenever possible:</p><pre>Context:<br>Goal:<br>Constraints:<br>Expected Output:</pre><h3>Example</h3><pre>Context:<br>Flutter app using Riverpod. Navigation freezes on ContentDetailsScreen.<br><br>Goal:<br>Identify blocking operations and propose fixes.<br><br>Constraints:<br>- Do not refactor architecture<br>- Keep Riverpod<br>- Touch navigation-related code only<br><br>Expected Output:<br>- Root cause<br>- Minimal code changes</pre><p>This removes ambiguity and saves tokens.</p><h3>One Task Per Prompt</h3><p>Do not bundle unrelated work:</p><p>❌ Fix upload<br>❌ Improve UI<br>❌ Add validation<br>❌ Refactor providers</p><p>Instead, split into focused tasks:</p><ul><li>Fix PDF upload provider blocking UI</li><li>Adjust button height to 50</li><li>Add validation</li></ul><p>Cursor behaves much better when each prompt represents a <strong>single Jira-style ticket</strong>.</p><h3>Pass Design Specs Like a Machine</h3><p>Avoid subjective language:</p><p>❌ “Make it similar to Figma.”</p><p>Provide exact values:</p><pre>Button height: 50  <br>Inner padding: 16.5  <br>Prefix/suffix icon: 24x24</pre><p>Cursor is deterministic. Give numbers, not vibes.</p><h3>Ultra-Short Prompts Work Best</h3><p>Cursor does not need politeness.</p><p>This is enough:</p><pre>Separate thumbnail upload provider from PDF upload.<br>Thumbnail must not block PDF progress.<br>Minimal change.</pre><p><strong>Skip greetings (ex: thank you, great work, nice, …etc). Save tokens.</strong></p><h3>Explicitly Tell Cursor What NOT to Do</h3><p>This is surprisingly powerful:</p><pre>Do NOT rename variables.<br>Do NOT change public APIs.<br>Do NOT add new packages.</pre><p>These guardrails prevent cascading edits.</p><h3>Setting Permanent Project Rules with .cursor/rules.md</h3><p>One of Cursor’s most powerful features is persistent project instructions.</p><p>Create:</p><pre>.cursor/rules.md</pre><p>Cursor automatically applies this file to every prompt.</p><p>Think of it as your project’s <strong>AI engineering constitution</strong>.</p><h3>Example:</h3><pre># Cursor Rules<br><br>## General<br>Think before coding.<br>Minimal changes only.<br>Do not break existing behavior.<br>Prefer simple, readable, optimal solutions.<br>Ask only if requirements are unclear.<br>Always consider Android and iOS.<br><br>## Flutter<br>Follow Clean Architecture.<br>Use Riverpod for state management.<br>Build small, composable widgets.<br>No business or state logic in UI.<br>Use camelCase for variables and methods.<br><br>## UI<br>Do not introduce magic values unless explicitly provided.<br><br>## State &amp; Async<br>Avoid rebuild loops.<br>Avoid duplicate API calls.<br>Always handle loading, error, and success states.<br><br>## Performance<br>Avoid unnecessary rebuilds.<br>Use const constructors where possible.<br>Dispose controllers and listeners.<br><br>## Code Quality<br>Write testable code.<br>Avoid duplication.<br>Prefer named constructors.<br>Comment only for non-obvious logic.<br><br>## Problem Solving<br>Find root cause first.<br>Apply minimal fix.<br>Consider side effects.<br>Ensure production safety.<br><br>## Response<br>Brief reasoning.<br>Relevant code only.</pre><p>Commit this file to git so your entire team benefits.</p><p>This alone dramatically <strong>improves consistency and reduces token usage</strong>.</p><h3>Choosing the Right Models in Cursor for Maximum Efficiency</h3><p>Cursor supports a wide range of cutting-edge coding models from <strong>OpenAI, Anthropic, Google, xAI, and Cursor’s own models</strong>. Choosing the right model can <strong>save tokens, speed up responses, and improve accuracy</strong>.</p><p><strong>Key Benefits for Developers:</strong></p><ul><li><strong>Flexibility:</strong> Choose a model that fits the complexity of your task.</li><li><strong>Performance:</strong> Use models with larger context windows for big codebases.</li><li><strong>Cost Efficiency:</strong> Smaller models or lightweight agents consume fewer tokens.</li></ul><h3>Auto Mode: Let Cursor Pick for You</h3><p>If you’re unsure which model to pick, <strong>enable Auto Mode</strong>. Cursor will:</p><ul><li>Detect the task complexity</li><li>Pick the model that’s most reliable for your current request</li><li>Automatically switch if a model’s output degrades</li></ul><p><strong>Benefits of Auto Mode:</strong></p><ul><li>Saves time deciding which model to use</li><li>Balances cost vs performance automatically</li><li>Ensures consistent quality</li></ul><p><strong>Auto Mode token usage (approximate API rates):</strong></p><ul><li>Input + Cache Write: $1.25 / 1M tokens</li><li>Output: $6 / 1M tokens</li><li>Cache Read: $0.25 / 1M tokens</li></ul><p>This is often cheaper than selecting the heaviest models for every task.</p><h3>Max Mode: For Big, Complex Tasks</h3><p>Some models support <strong>Max Mode</strong>, which extends the context window up to <strong>1M tokens</strong>.</p><p><strong>When to use it:</strong></p><ul><li>Large files or multi-file refactors</li><li>Deep debugging or performance profiling</li><li>Complex architecture decisions</li></ul><p><strong>Trade-offs:</strong> Max Mode consumes more tokens and is slightly slower, but allows <strong>Cursor to “see” more code at once</strong>, producing smarter, more complete solutions.</p><h3>Model Picker: Manual Control</h3><p>If you prefer full control:</p><ul><li>You can select <strong>any model manually</strong></li><li>Token usage is based on the selected model’s API rates</li><li>Ideal for teams managing budgets or optimizing workflows</li></ul><p><strong>Quick tip:</strong> For <strong>small edits, UI tweaks, or formatting</strong>, use lightweight models to save tokens. For <strong>debugging, refactoring, or architecture tasks</strong>, pick stronger models or rely on Auto Mode.</p><h3>Auto Mode: Let Cursor Decide</h3><p>Cursor also provides <strong>Auto mode</strong>, which automatically selects the agent based on task complexity.</p><p>This works surprisingly well.</p><p>Auto mode is ideal when:</p><ul><li>You frequently switch between small and large tasks</li><li>You don’t want to manage models manually</li><li>You want balanced cost vs quality</li></ul><p>Think of Auto mode as:</p><blockquote><em>A smart dispatcher routing easy tasks to cheap models and hard tasks to powerful ones.</em></blockquote><p>For most workflows, <strong>Auto mode is the best default.</strong></p><h3>Token-Aware Prompting (Advanced)</h3><p>You can explicitly tell Cursor to be lightweight:</p><pre>Use lightweight reasoning.<br>Minimal output.<br>Relevant code only.</pre><p>Or:</p><pre>Small task. Keep changes minimal.</pre><p>Cursor respects these hints.</p><p>Combined with .cursor/rules.md, this creates an extremely efficient workflow.</p><h3>A Practical Strategy</h3><ul><li>Default to Auto mode</li><li>Use lightweight agents for trivial edits</li><li>Use strong agents for debugging and architecture</li><li>Always request minimal diffs</li></ul><p>Treat Cursor agents like teammates:</p><ul><li>Junior → UI tweaks</li><li>Mid-level → refactors</li><li>Senior → architecture &amp; performance</li></ul><p>Don’t send a senior engineer to change padding.</p><h3>How to Know You’re Prompting Correctly</h3><p>You’re doing it right when:</p><ul><li>Cursor edits fewer files</li><li>Diffs stay small</li><li>Answers feel deterministic</li><li>No surprise refactors</li><li>Less back-and-forth</li></ul><p>If not, your prompts are probably too broad.</p><figure><img alt="Model pricing Cursor plans include usage at the model API rates. For example, $20 of included usage on the Pro plan will be consumed based on your model selection and its price. Usage limits are shown in editor based on your current consumption. All prices are per million tokens." src="https://cdn-images-1.medium.com/max/1024/1*3ptDytVAW_7yNlhyiqbd6A.png" /><figcaption>’<a href="https://cursor.com/docs/models#model-pricing">Model pricing</a></figcaption></figure><p>Cursor <a href="https://cursor.com/docs/account/pricing">plans</a> include usage at the model API rates. For example, $20 of included usage on the Pro plan will be consumed based on your model selection and its price.</p><p>Got it — here’s a <strong>Medium-ready version</strong> with cleaner flow, stronger headings, and a more “article-like” tone while keeping your content intact:</p><h3>💰 Understanding Cursor Pricing (Without the Confusion)</h3><p>Cursor pricing is <strong>token-based</strong>, which means you’re not just paying for “using AI” — you’re paying for <strong>how</strong> you use it.</p><p>Your real cost depends on three main factors:</p><ul><li>Which model you choose</li><li>How much context you provide</li><li>How often you interact with the assistant</li></ul><p>That’s why two developers on the same plan can end up with very different usage.</p><p>Let’s simplify things.</p><h3>🔄 Auto Mode vs Manual Model Selection</h3><p>Cursor gives you two ways to work with models: <strong>Auto Mode</strong> and <strong>Manual Selection</strong>.</p><p>Understanding the difference can save you both time and money.</p><h3>Auto Mode</h3><p>Auto Mode automatically selects what Cursor believes is the best model for your current task.</p><p><strong>Pros</strong></p><ul><li>No decisions required</li><li>Great default for everyday development</li><li>Works well for small to medium tasks</li></ul><p><strong>Cons</strong></p><ul><li>You don’t control which model is used</li><li>It may switch to more expensive models silently</li><li>Credits can drain faster during large operations</li></ul><p><strong>Best for</strong></p><p>Quick fixes, light refactoring, exploration, and small features.</p><h3>Manual Model Selection</h3><p>Manual mode lets you explicitly choose the model, giving you full control over quality and cost.</p><p><strong>Pros</strong></p><ul><li>Predictable usage</li><li>Complete cost control</li><li>Ideal for heavy or complex tasks</li></ul><p><strong>Cons</strong></p><ul><li>Requires understanding model differences</li><li>Slightly more setup</li></ul><p><strong>Best for</strong></p><p>Large refactors, architecture design, and deep debugging sessions.</p><h3>📊 How Your Choice Affects Cost (A Practical View)</h3><p>Instead of thinking in tokens, think in real-world scenarios:</p><p>ScenarioRecommended ModeCost ImpactSmall editsAutoLowDaily codingAuto / Light modelMediumLarge refactorsManual (strong model)HighFull repository analysisManual (top model)Very High</p><p>The more files and context you include, the faster your credits disappear.</p><p>Context is the biggest hidden cost.</p><h3>🧠 Practical Usage Tips</h3><p>From real-world experience:</p><ul><li>Use Auto Mode for most daily tasks</li><li>Switch to Manual mode for long or heavy sessions</li><li>Avoid repeating large prompts</li><li>Clear unnecessary context whenever possible</li></ul><p>Small habits add up to big savings over time.</p><h3>📌 Simple Rule of Thumb</h3><ul><li>Want speed? → Use Auto Mode</li><li>Want control? → Pick the model manually</li><li>Want balance? → Mix both</li></ul><p>That’s the real optimization.</p><h3>💰 Understanding Cursor’s Pricing Table (With Real Context)</h3><p>Cursor displays pricing per <strong>1M tokens</strong> for input, output, and cache usage.</p><p>You’ll typically see numbers like:</p><ul><li>~$0.25 per 1M tokens (cache reads)</li><li>~$1+ per 1M tokens (input + cache writes)</li><li>~$5+ per 1M tokens (output on stronger models)</li></ul><p>At first glance, this can feel overwhelming.</p><p>But the important part isn’t the raw numbers — it’s how they translate to your daily workflow.</p><h3>What You Actually Pay For</h3><p>In practice, every prompt mainly costs you based on:</p><ul><li>The size of your context (input tokens)</li><li>The model being used</li><li>The length of the response (output tokens)</li></ul><p>Large files or full-repo prompts increase <strong>input cost</strong>.<br>Long, detailed answers increase <strong>output cost</strong>.</p><p>That’s it.</p><h3>How Auto Mode Fits In</h3><p>Auto Mode follows the exact same pricing table.</p><p>There’s no special “Auto Mode rate.”</p><p>Instead, Auto Mode simply selects a model for you — and applies that model’s token pricing.</p><p>So when Auto Mode switches to a stronger model, your usage goes up automatically.</p><h3>The Right Mental Model</h3><p>Think of Cursor’s pricing table as a <strong>rate card</strong>, not a fixed bill.</p><ul><li>Small context → small cost</li><li>Large context + strong model → higher usage</li></ul><p>Once you see it this way, Cursor’s pricing becomes predictable — and manageable.</p><p>Usage limits are shown in editor based on your current consumption. All prices are per million tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSDxlxAUi6X-xr_7Qq6uZQ.png" /></figure><h3>Final Thoughts</h3><p>Cursor is not magic.</p><p>It’s a <strong>junior engineer with infinite memory</strong>.</p><p>When you:</p><ul><li>Scope tasks tightly</li><li>Minimize tokens</li><li>Request small diffs</li><li>Separate concerns</li><li>Define global rules</li><li>Choose the right agents</li></ul><p>You get:</p><p>⚡ Faster iterations<br>🎯 Precise changes<br>💰 Lower costs<br>🧠 Higher code quality</p><p>Mastering Cursor is mostly about mastering communication.</p><h3>Contact</h3><p><strong>Abanoub Fakhry</strong><br>Senior Cross Platform Software Engineer</p><p>If you’d like to discuss Flutter, Cursor workflows, or mobile architecture:</p><ul><li><a href="https://www.linkedin.com/in/abanoub-fakhry-553a67166/">LinkedIn</a></li><li><a href="https://github.com/AbanoubFakheryMakram">GitHub</a></li><li><a href="http://abanoub728@gmail.com/">Email</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d9df8e7b00e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Send automated message to MS Team through Codemagic.]]></title>
            <link>https://medium.com/@abanoub728/send-automated-message-to-ms-team-through-codemagic-9df718978a0e?source=rss-7732cd5d3132------2</link>
            <guid isPermaLink="false">https://medium.com/p/9df718978a0e</guid>
            <category><![CDATA[ci-cd-devops]]></category>
            <category><![CDATA[microsoft-teams]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[build-automation]]></category>
            <category><![CDATA[notifications]]></category>
            <dc:creator><![CDATA[Abanoub Fakhery]]></dc:creator>
            <pubDate>Fri, 30 May 2025 13:04:44 GMT</pubDate>
            <atom:updated>2026-05-06T07:19:29.180Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*zkoe6J1VXiESa9LaRVd-Tw.png" /></figure><p>In today’s fast-paced development environment, staying updated on build statuses is crucial. This guide will show you how to set up automated build notifications from Codemagic CI/CD directly to a Microsoft Teams channel. By configuring a webhook in Teams and integrating it with Codemagic, you can receive real-time updates on build statuses, including successes, failures, and other key metrics.</p><h3>1. Teams Incoming Webhook Setup</h3><p>To begin, you’ll need to set up an incoming webhook in Microsoft Teams:</p><ul><li><strong>Generate a Webhook URL:</strong> Create a webhook URL in Microsoft Teams that will receive messages.</li><li><strong>Store Securely:</strong> Securely store this URL in Codemagic as an environment variable to ensure safe communication.</li></ul><h3>2. Codemagic Script Execution</h3><p>Next, you’ll execute a script in Codemagic:</p><ul><li><strong>Send JSON Payload:</strong> Use a Bash script (or YAML workflow) to send a JSON payload to the Teams webhook.</li><li><strong>Payload Contents:</strong> The payload should include:</li><li><strong>Build Status:</strong> Indicate whether the build was successful or failed.</li><li><strong>Branch Name:</strong> Specify the branch being built.</li><li><strong>Build Version:</strong> Include the version of the build.</li><li><strong>Link to Build Logs:</strong> Provide a direct link to the Codemagic build logs for easy access.</li></ul><h3>3. Teams Adaptive Card Formatting</h3><p>Finally, format the message for Teams:</p><ul><li><strong>Rich Adaptive Card:</strong> The message will appear as a rich Adaptive Card in Teams, enhancing visibility and interaction.</li><li><strong>Visual Elements:</strong> The card can include:</li><li><strong>Color-Coded Status:</strong> Use ✅ green for success and ❌ red for failure.</li><li><strong>Navigation Buttons:</strong> Add buttons for quick navigation to build logs.</li><li><strong>Commit Details:</strong> Integrate with GitHub, GitLab, or Bitbucket to display commit details.</li></ul><h3><strong>Now let’s do it.</strong></h3><p>1- First open your MS Team application.<br>Form your MS teams navbar options click on the horizontal dots icon and search for “<strong>Workflows”</strong> as shown in the image below and click on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*3i2-jeduuAy_DA9ubYJA7g.png" /></figure><p>2- When clicking on wait a few seconds and some templates will appear for you, from them search for “<strong>Post to a chat when a webhook request is received</strong>”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*ud5pP0FWyH57Bt3ECRxI_A.png" /></figure><p>3- This will enable to create a new flow, you can edit this flow name or keep it, then click on “<strong>Next</strong>” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*c1cwN0hlDVU20z0s5MWq-Q.png" /></figure><p>4- In this step you will be asked to select the channel “Group” that will receive the automated text, then click on “<strong>Create flow</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*NEb82927IWmoNHZzjuazdQ.png" /></figure><p>5- Congratulations! 🎉. Your Workflow is Ready for Notifications, the final step involves using the webhook API URL generated in Teams to receive real-time notifications. Copy and save this API, we will need it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*grKQZQXBGBok7FN_g2HI7g.png" /></figure><p>6- Go to Codemagic and open your workflow editor then scroll down to bottom, click on the selected icon on image, this will open you a text area to write a bash script, where we will write our script to send the message to MS Team’s channel through the provided API we obtained previously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*3g4Wn60h8QhH0pEMWt6P0w.png" /></figure><p>Or if you are using the YAML config file you will write the next script in the “script section” as shown below.</p><pre>workflows:<br>  your-workflow-name:<br>    scripts:<br>      - name: Send adaptive card to MS Teams <br>        script: |     <br>          # here you will write the script</pre><p>Now let’s write the script.</p><pre>#!/bin/sh<br><br>set -e<br><br># Skip notification if the build failed<br>if [ &quot;${FCI_BUILD_STEP_STATUS:-success}&quot; != &quot;success&quot; ]; then<br>  echo &quot;Build failed — skipping Teams notification.&quot;<br>  exit 0<br>fi<br><br>WEBHOOK_URL=&quot;${TEAMS_FLOW_WEBHOOK:-$TEAMS_WEBHOOK_URL}&quot;<br><br>if [ -z &quot;$WEBHOOK_URL&quot; ]; then<br>  echo &quot;Webhook URL is missing.&quot;<br>  exit 1<br>fi<br><br>PLATFORM=&quot;${FCI_PLATFORM:-Android, iOS}&quot;<br><br>APP_VER=&quot;$(grep &#39;^version:&#39; pubspec.yaml | awk &#39;{print $2}&#39;)&quot;<br>[ -z &quot;$APP_VER&quot; ] &amp;&amp; APP_VER=&quot;unknown&quot;<br><br>NOTES_FILE=&quot;release_notes.txt&quot;<br><br>if [ -f &quot;$NOTES_FILE&quot; ] &amp;&amp; [ -s &quot;$NOTES_FILE&quot; ]; then<br>  REL_NOTES=&quot;$(cat &quot;$NOTES_FILE&quot;)&quot;<br>else<br>  REL_NOTES=&quot;${CM_RELEASE_NOTES:-No release notes}&quot;<br>fi<br><br>export APP_VER<br>export REL_NOTES<br>export PLATFORM<br><br>PAYLOAD=&quot;$(<br>  python3 - &lt;&lt;&#39;PY&#39;<br>import json<br>import os<br><br>version = os.environ.get(&quot;APP_VER&quot;, &quot;unknown&quot;)<br>notes = os.environ.get(&quot;REL_NOTES&quot;, &quot;&quot;)<br>platform = os.environ.get(&quot;PLATFORM&quot;, &quot;Unknown&quot;)<br><br>card = {<br>    &quot;type&quot;: &quot;message&quot;,<br>    &quot;attachments&quot;: [<br>        {<br>            &quot;contentType&quot;: &quot;application/vnd.microsoft.card.adaptive&quot;,<br>            &quot;content&quot;: {<br>                &quot;$schema&quot;: &quot;http://adaptivecards.io/schemas/adaptive-card.json&quot;,<br>                &quot;type&quot;: &quot;AdaptiveCard&quot;,<br>                &quot;version&quot;: &quot;1.4&quot;,<br>                &quot;body&quot;: [<br>                    {<br>                        &quot;type&quot;: &quot;TextBlock&quot;,<br>                        &quot;size&quot;: &quot;large&quot;,<br>                        &quot;weight&quot;: &quot;bolder&quot;,<br>                        &quot;text&quot;: &quot;✅ Build Published to Firebase App Distribution&quot;,<br>                        &quot;wrap&quot;: True,<br>                    },<br>                    {<br>                        &quot;type&quot;: &quot;FactSet&quot;,<br>                        &quot;facts&quot;: [<br>                            {<br>                                &quot;title&quot;: &quot;Version&quot;,<br>                                &quot;value&quot;: version,<br>                            },<br>                            {<br>                                &quot;title&quot;: &quot;Platform&quot;,<br>                                &quot;value&quot;: platform,<br>                            },<br>                        ],<br>                    },<br>                    {<br>                        &quot;type&quot;: &quot;TextBlock&quot;,<br>                        &quot;text&quot;: &quot;Release Notes&quot;,<br>                        &quot;weight&quot;: &quot;bolder&quot;,<br>                        &quot;spacing&quot;: &quot;medium&quot;,<br>                    },<br>                    {<br>                        &quot;type&quot;: &quot;TextBlock&quot;,<br>                        &quot;text&quot;: notes,<br>                        &quot;wrap&quot;: True,<br>                    },<br>                ],<br>            },<br>        }<br>    ],<br>}<br><br>print(json.dumps(card))<br>PY<br>)&quot;<br><br>if ! curl -sSf --max-time 30 -X POST \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &quot;$PAYLOAD&quot; \<br>  &quot;$WEBHOOK_URL&quot;; then<br>  echo &quot;Failed to POST to Teams webhook.&quot;<br>  exit 1<br>fi<br><br>echo &quot;Teams notification sent.&quot;</pre><h3>Conclusion</h3><p>By following these steps, you can streamline your development workflow and ensure that your team is always informed about the latest build statuses. Implementing automated notifications not only saves time but also enhances collaboration and responsiveness within your team.</p><p>Need help? you can contact me on <a href="https://www.linkedin.com/in/abanoub-fakhry-553a67166/"><strong>Linkedin</strong></a> 🚀</p><p>Happy coding! 💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9df718978a0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating UAE Pass on iOS Flutter app using API.]]></title>
            <link>https://medium.com/@abanoub728/integrating-uae-pass-on-ios-flutter-app-with-api-221a08af36a0?source=rss-7732cd5d3132------2</link>
            <guid isPermaLink="false">https://medium.com/p/221a08af36a0</guid>
            <category><![CDATA[ios-development]]></category>
            <category><![CDATA[flutter-webview]]></category>
            <category><![CDATA[oauth-authentication]]></category>
            <category><![CDATA[uae-pass-integration]]></category>
            <dc:creator><![CDATA[Abanoub Fakhery]]></dc:creator>
            <pubDate>Mon, 12 May 2025 10:22:02 GMT</pubDate>
            <atom:updated>2025-05-30T12:24:01.846Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*peKanEv9EltljTG5.png" /></figure><p>UAE Pass is the national digital identity solution that allows UAE residents and citizens to securely log in, authenticate, and digitally sign documents. <a href="https://www.expertappdevs.com/technologies/flutter-app-development"><strong>Integrating UAE Pass in a Flutter application</strong></a> provides a seamless and secure authentication experience without requiring manual user registration.</p><p>You can follow the UAE Pass <a href="https://docs.uaepass.ae/feature-guides/authentication/mobile-application/guide/api"><strong>documentation</strong></a><strong> </strong>for deep understanding.</p><h3>1. Understanding UAE Pass Authentication in Flutter</h3><p>UAE Pass follows the OAuth 2.0 authorization framework, where users log in via a web portal, authorize the app, and receive an authentication token.</p><p><strong>Workflow</strong></p><ol><li>User Initiates Login → Redirects to UAE Pass authentication page.</li><li>User Grants Permission → UAE Pass returns an authorization code to the app.</li><li>App Exchanges Code for Token → The app requests an access token from UAE Pass.</li><li>Retrieve User Data → The app uses the token to fetch user profile details.</li></ol><h3>2. Setting Up UAE Pass Integration</h3><p><strong>-&gt; Register Your App</strong></p><p>Before integrating, register your application on the UAE Pass Developer Portal and obtain:<br>1. Client ID<br>2. Client Secret<br>3. Redirect URI</p><p><strong>Add Required Dependencies</strong></p><p>Add the necessary Flutter packages to handle web authentication and API requests.</p><p>Open your app pubspec.yaml file and add the following.</p><pre>flutter_inappwebview: latest_version<br>dio: latest_version<br>url_launcher: latest_version</pre><h3><strong>3. Implementing UAE Pass Authentication.</strong></h3><p>The actions are goes here.</p><pre>class UAEPassServiceImpl implements UAEPassService {<br><br>  @override<br>  final UaepassRequestModel config;<br><br>  @override<br>  final UAE_PassEndpoints endpoints;<br><br>  @override<br>  final AuthService authService;<br><br>  UAEPassServiceImpl({required this.config, required this.endpoints, required this.authService});<br><br>  String? _successUrl;<br>  String? _failureUrl;<br>  String? _codeVerifier;<br>  String? _state;<br><br>  @override<br>  Future&lt;Map&lt;String, dynamic&gt;?&gt; authenticate(BuildContext context) async {<br>    final isInstalled = await isUaePassAppInstalled();<br><br>    _state = AppUAEPassUtils.generateNonce();<br>    _codeVerifier = AppUAEPassUtils.generateNonce();<br><br>    final acrValues = isInstalled<br>        ? &#39;urn:digitalid:authentication:flow:mobileondevice&#39;<br>        : &#39;urn:safelayer:tws:policies:authentication:level:low&#39;;<br><br>    final authUrl = &#39;${endpoints.authorizeUrl}?&#39;<br>        &#39;response_type=code&amp;&#39;<br>        &#39;ui_locales=${config.localization}&amp;&#39;<br>        &#39;client_id=${config.uaepassClientID}&amp;&#39;<br>        &#39;scope=urn:uae:digitalid:profile:general&amp;&#39;<br>        &#39;state=$_state&amp;&#39;<br>        &#39;redirect_uri=${config.redirectUrl}&amp;&#39;<br>        &#39;acr_values=$acrValues&amp;&#39;<br>        &#39;code_challenge=${AppUAEPassUtils.generateCodeChallenge(_codeVerifier!)}&amp;&#39;<br>        &#39;code_challenge_method=S256&#39;;<br><br>    var result = await _showInAppWebView(context, authUrl, isInstalled);<br>    return result;<br>  }<br><br>  Future&lt;Map&lt;String, dynamic&gt;?&gt; _showInAppWebView(<br>      BuildContext context, String initialUrl, bool isUaePassInstalled) async {<br>    Map&lt;String, dynamic&gt;? result;<br>    double progress = 0;<br>    bool isLoading = true;<br><br>    await InAppWebViewController.clearAllCache();<br>    await CookieManager.instance().deleteAllCookies();<br><br>    if (context.mounted) {<br>      // Create a controller to manage the bottom sheet<br>      await showModalBottomSheet(<br>        context: context,<br>        isScrollControlled: true,<br>        builder: (context) {<br>          return StatefulBuilder(<br>            builder: (BuildContext context, StateSetter setState) {<br>              return Container(<br>                height: MediaQuery.of(context).size.height * 0.9,<br>                padding: const EdgeInsets.only(top: 12),<br>                decoration: const BoxDecoration(<br>                  color: Colors.white,<br>                  borderRadius: BorderRadius.vertical(top: Radius.circular(12)),<br>                ),<br>                child: Column(<br>                  children: [<br>                    // Draggable handle<br>                    Container(<br>                      width: 40,<br>                      height: 4,<br>                      margin: const EdgeInsets.only(bottom: 12),<br>                      decoration: BoxDecoration(<br>                        color: Colors.grey[300],<br>                        borderRadius: BorderRadius.circular(2),<br>                      ),<br>                    ),<br><br>                    // Loading indicator<br>                    if (isLoading)<br>                      LinearProgressIndicator(<br>                        value: progress,<br>                        backgroundColor: Colors.grey[200],<br>                        valueColor: const AlwaysStoppedAnimation&lt;Color&gt;(AppColors.green),<br>                      ),<br><br>                    // WebView<br>                    Expanded(<br>                      child: InAppWebView(<br>                        key: ValueKey(initialUrl),<br>                        initialUrlRequest: URLRequest(url: WebUri(initialUrl)),<br>                        initialSettings: InAppWebViewSettings(<br>                          clearCache: true,<br>                          cacheEnabled: false,<br>                          cacheMode: CacheMode.LOAD_NO_CACHE,<br>                          clearSessionCache: true,<br>                        ),<br>                        onProgressChanged: (controller, newProgress) {<br>                          setState(() {<br>                            progress = newProgress / 100;<br>                            isLoading = progress &lt; 1.0;<br>                          });<br>                        },<br>                        onLoadStart: (controller, url) {<br>                          setState(() {<br>                            isLoading = true;<br>                          });<br>                        },<br>                        onLoadStop: (controller, url) {<br>                          setState(() {<br>                            isLoading = false;<br>                          });<br>                        },<br>                        shouldOverrideUrlLoading: (controller, navigationAction) async {<br>                          final url = navigationAction.request.url.toString();<br><br>                          // Handle UAE PASS deep linking<br>                          if (url.startsWith(_isProduction ? &#39;uaepass://&#39; : &#39;uaepassstg://&#39;)) {<br>                            final uri = Uri.parse(url);<br>                            final params = uri.queryParameters;<br><br>                            _successUrl = params[&#39;successURL&#39;];<br>                            _failureUrl = params[&#39;failureURL&#39;];<br><br>                            if (_successUrl != null &amp;&amp; _failureUrl != null) {<br>                              final rewrittenUrl = url<br>                                  .replaceFirst(<br>                                    &#39;successURL=$_successUrl&#39;,<br>                                    &#39;successURL=${UAEPassScheme.appScheme}:///resume_authn?url=${Uri.encodeComponent(_successUrl!)}&#39;,<br>                                  )<br>                                  .replaceFirst(<br>                                    &#39;failureURL=$_failureUrl&#39;,<br>                                    &#39;failureURL=${UAEPassScheme.appScheme}:///resume_authn?url=${Uri.encodeComponent(_failureUrl!)}&#39;,<br>                                  );<br><br>                              if (await canLaunchUrl(Uri.parse(rewrittenUrl))) {<br>                                await launchUrl(Uri.parse(rewrittenUrl));<br>                                return NavigationActionPolicy.CANCEL;<br>                              }<br>                            }<br>                          }<br><br>                          // Handle our app&#39;s custom scheme<br>                          if (url.startsWith(&#39;${UAEPassScheme.appScheme}://&#39;)) {<br>                            final uri = Uri.parse(url);<br>                            final params = uri.queryParameters;<br><br>                            if (uri.path.contains(&#39;resume_authn&#39;)) {<br>                              final originalUrl = params[&#39;url&#39;];<br>                              if (originalUrl != null) {<br>                                controller.loadUrl(urlRequest: URLRequest(url: WebUri(originalUrl)));<br>                                return NavigationActionPolicy.CANCEL;<br>                              }<br>                            }<br><br>                            if (params.containsKey(&#39;code&#39;)) {<br>                              final token = await authService.getAccessToken(<br>                                  config: config,<br>                                  tokenUrl: endpoints.tokenUrl,<br>                                  code: params[&#39;code&#39;]!,<br>                                  codeVerifier: _codeVerifier!);<br>                              final userInfo =<br>                                  await authService.getUserInfo(token: token, userInfoUrl: endpoints.userInfoUrl);<br>                              result = userInfo;<br>                              Navigator.of(context).pop();<br>                              return NavigationActionPolicy.CANCEL;<br>                            }<br>                          }<br><br>                          // Handle redirect to our redirect URL<br>                          if (url.startsWith(config.redirectUrl)) {<br>                            final uri = Uri.parse(url);<br>                            if (uri.queryParameters.containsKey(&#39;code&#39;)) {<br>                              final token = await await authService.getAccessToken(<br>                                  config: config,<br>                                  tokenUrl: endpoints.tokenUrl,<br>                                  code: uri.queryParameters[&#39;code&#39;]!,<br>                                  codeVerifier: _codeVerifier!);<br>                              ;<br>                              final userInfo =<br>                                  await authService.getUserInfo(token: token, userInfoUrl: endpoints.userInfoUrl);<br>                              result = userInfo;<br>                              Navigator.of(context).pop();<br>                              return NavigationActionPolicy.CANCEL;<br>                            }<br>                          }<br><br>                          return NavigationActionPolicy.ALLOW;<br>                        },<br>                      ),<br>                    ),<br>                  ],<br>                ),<br>              );<br>            },<br>          );<br>        },<br>      );<br>    }<br><br>    return result;<br>  }<br><br>  bool get _isProduction =&gt; config.environment == UaepassEnvironmentEnum.production;<br><br>  @override<br>  Future&lt;bool&gt; isUaePassAppInstalled() async {<br>    // iOS<br>    final scheme = _isProduction ? UAEPassScheme.schemeIOSProduction : UAEPassScheme.schemeIOSStaging;<br>    return await canLaunchUrl(Uri.parse(scheme));<br>  }<br>}</pre><pre>class UAEPassScheme {<br>  // Package and scheme identifiers of uae pass ios app<br>  static String schemeIOSProduction = &#39;uaepass://&#39;;<br>  static String schemeIOSStaging = &#39;uaepassstg://&#39;;<br><br>  // app&#39;s custom scheme for deep linking<br>  static String appScheme = &#39;custom_scheme&#39;;<br>}</pre><pre>class UAE_PassEndpoints {<br>  final String authorizeUrl;<br>  final String tokenUrl;<br>  final String userInfoUrl;<br><br>  UAE_PassEndpoints({<br>    required this.authorizeUrl,<br>    required this.tokenUrl,<br>    required this.userInfoUrl,<br>  });<br><br>  factory UAE_PassEndpoints.forEnvironment(UaepassEnvironmentEnum environment) {<br>    return environment == UaepassEnvironmentEnum.production<br>        ? UAE_PassEndpoints(<br>            authorizeUrl: &#39;https://id.uaepass.ae/idshub/authorize&#39;,<br>            tokenUrl: &#39;https://id.uaepass.ae/idshub/token&#39;,<br>            userInfoUrl: &#39;https://id.uaepass.ae/idshub/userinfo&#39;,<br>          )<br>        : UAE_PassEndpoints(<br>            authorizeUrl: &#39;https://stg-id.uaepass.ae/idshub/authorize&#39;,<br>            tokenUrl: &#39;https://stg-id.uaepass.ae/idshub/token&#39;,<br>            userInfoUrl: &#39;https://stg-id.uaepass.ae/idshub/userinfo&#39;,<br>          );<br>  }<br>}</pre><pre>class UaepassRequestModel {<br>  final String scheme;<br>  final String uaepassClientID;<br>  final String uaepassClientSecret;<br>  final String redirectUrl;<br>  final UaepassEnvironmentEnum environment; //qa 0 1 staging 2 production<br>  final String localization; // &quot;en&quot;, &quot;ar&quot;<br><br>  UaepassRequestModel({<br>    this.scheme = &quot;app_scheme&quot;,<br>    this.uaepassClientID = &quot;sandbox_stage&quot;,<br>    this.uaepassClientSecret = &quot;sandbox_stage&quot;,<br>    this.redirectUrl = &quot;https://oauthtest.com/authorization/return&quot;,<br>    this.environment = UaepassEnvironmentEnum.staging,<br>    this.localization = &quot;en&quot;,<br>  });<br><br>  Map&lt;String, dynamic&gt; toJson() =&gt; {<br>        &quot;scheme&quot;: scheme,<br>        &quot;clientId&quot;: uaepassClientID,<br>        &quot;clientSecret&quot;: uaepassClientSecret,<br>        &quot;redirectUrl&quot;: redirectUrl,<br>        &quot;environment&quot;: environment.enumValue,<br>        &quot;localization&quot;: localization,<br>      };<br>}</pre><p>Let’s break down the provided Dart code for the `UAEPassServiceImpl` class, which implements the `UAEPassService` interface. <br><br>class UAEPassServiceImpl implements UAEPassService {<br><br>- **Class Declaration**: This class implements the `UAEPassService` interface, meaning it must provide implementations for all the methods defined in that interface.</p><p>### Member Variables</p><pre>@override<br>final UaepassRequestModel config;<br>@override<br>final UAE_PassEndpoints endpoints;<br>@override<br>final AuthService authService;</pre><p>### Private Variables</p><pre>  String? _successUrl;<br>  String? _failureUrl;<br>  String? _codeVerifier;<br>  String? _state;</pre><p>- **Private Variables**: These are used to store values related to the authentication process, such as URLs for success and failure callbacks, a code verifier for OAuth, and a state parameter for security.</p><p>### Authentication Method</p><pre>@override<br>Future&lt;Map&lt;String, dynamic&gt;?&gt; authenticate(BuildContext context) async {</pre><pre>Authenticate Method**: This method initiates the authentication process. It checks if the UAE Pass app is installed and constructs an authorization URL.<br>#### Key Steps in `authenticate` Method:</pre><ol><li>**Check App Installation**:</li></ol><pre>final isInstalled = await isUaePassAppInstalled();</pre><p>2. **Generate Nonce Values**:</p><pre>_state = AppUAEPassUtils.generateNonce();<br>_codeVerifier = AppUAEPassUtils.generateNonce();</pre><p>3. **Determine ACR Values**: Depending on whether the app is installed, it sets the appropriate ACR (Authentication Context Class Reference) values.</p><p>4. **Construct Authorization URL**:<br><br> final authUrl = ‘${endpoints.authorizeUrl}?…’;<br><br> — This URL includes various parameters required for the OAuth 2.0 authorization flow.</p><p>5. **Show WebView**:</p><pre>var result = await _showInAppWebView(context, authUrl, isInstalled);</pre><p>### In-App WebView Method<br>Future&lt;Map&lt;String, dynamic&gt;?&gt; _showInAppWebView(BuildContext context, String initialUrl, bool isUaePassInstalled) async {<br><br>- **WebView Method**: This method displays a modal bottom sheet with a web view for the user to log in through the UAE Pass.</p><p>#### Key Steps in `_showInAppWebView` Method:</p><ol><li>**Clear Cache**:</li></ol><pre>await InAppWebViewController.clearAllCache();<br>await CookieManager.instance().deleteAllCookies();</pre><p>2. **Show Modal Bottom Sheet**: The web view is displayed in a modal bottom sheet with a progress indicator.</p><p>3. **WebView Configuration**: The `InAppWebView` widget is configured to handle various events:<br> — **Progress Changes**: Updates the loading progress.<br> — **URL Loading**: Handles deep linking and redirects based on the URL loaded.</p><p>4. **Handle Authentication Responses**:<br> — If the URL contains a success or failure URL, it processes those.<br> — If a code is received, it exchanges the code for an access token and retrieves user information.</p><p>### Utility Methods</p><pre>bool get _isProduction =&gt; config.environment == UaepassEnvironmentEnum.production;</pre><pre>@override<br>Future&lt;bool&gt; isUaePassAppInstalled() async {<br>- **_isProduction**: A getter to check if the current environment is production.<br>- **isUaePassAppInstalled**: Checks if the UAE Pass app is installed on the device by attempting to launch a specific URL scheme.</pre><p>### Summary</p><p>The `UAEPassServiceImpl` class is designed to handle authentication via the UAE Pass service. It manages the entire flow, from checking if the app is installed, generating necessary parameters for the OAuth flow, constructing the authorization URL, and handling the response from the web view. This implementation encapsulates the complexities of the authentication process while providing a clean interface through the `UAEPassService`.</p><h3>Testing &amp; Debugging Tips</h3><p>✅ <strong>Test in Staging</strong> (stg-id.uaepass.ae) before going live.<br>✅ <strong>Log all redirects</strong> to debug deep linking issues.<br>✅ <strong>Clear cache</strong> between tests to avoid stale sessions.</p><h3>Conclusion</h3><p>By using InAppWebView<strong> and proper deep link handling</strong>, you can ensure a smooth UAE Pass integration in iOS—even when the UAE Pass app is installed.</p><p>Need help? you can contact me on <a href="https://www.linkedin.com/in/abanoub-fakhry-553a67166/"><strong>Linkedin</strong></a> 🚀</p><p>🔹 <strong>Key Takeaways:</strong><br>✔ Force authentication in a <strong>WebView</strong> to avoid app interference.<br>✔ Handle <strong>deep linking</strong> manually for UAE Pass redirects.<br>✔ Always test in <strong>staging</strong> before production.</p><p>Happy coding! 💻🇦🇪</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=221a08af36a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>