feat: added web redirect#2087
Conversation
Greptile SummaryThis PR adds a web-redirect fallback for paid plugin purchases on non-Play-Store builds: when
Confidence Score: 4/5The web-redirect logic is sound, but the error branch in the installer callback can leave a non-IAP build in a broken state. The src/lib/config.js — specifically the error callback of Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[config.js loaded] --> B[IAP_AVAILABLE = true]
B --> C[system.getInstaller called]
C --> D{Callback result}
D -- success --> E{installer == com.android.vending AND typeof iap != undefined?}
E -- Yes --> F[IAP_AVAILABLE = true]
E -- No --> G[IAP_AVAILABLE = false]
D -- error --> H[IAP_AVAILABLE = true]
F --> I[User taps Buy]
G --> I
H --> I
I --> J{config.IAP_AVAILABLE?}
J -- Yes --> K[Native IAP flow: iap.getProducts]
J -- No --> L[auth.getLoggedInUser]
L --> M{User logged in?}
M -- No --> N[Open login page in CustomTabs]
M -- Yes --> O[Open plugin purchase page in CustomTabs]
Reviews (5): Last reviewed commit: "fix: undefined error" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
ddf8061
into
Acode-Foundation:ajit/fix-fetch-auth-config
* Refactor API calls to use fetch instead of ajax and update configuration imports - Replaced ajax calls with fetch in sponsor, sponsors, and themeSetting pages. - Updated constants import to config in various files for better configuration management. - Improved error handling for API responses. - Adjusted logic for premium theme checks based on new config settings. - Enhanced cookie management in the Authenticator plugin for better security. - Fixed minor typos and improved code readability across multiple files. * fix: update BASE_URL to production and enhance plugin loading feedback * fix: update cookie settings to include HttpOnly for enhanced security * fix: hooks not working on free version (#2075) * fix: hooks not working on free version * Update hooks/post-process.js Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Update post-process.js --------- * fix: JSON formatting for UI zoom setting description * fix: JSON formatting and update translations * fix: JSON formatting and update translations * feat: IAP_AVAILABLE (#2086) * feat: IAP_AVAILABLE * fix: removed useless logs * feat: added web redirect (#2087) * feat: added web redirect * fix: removed useless code * fix: removed useless code * fix: added try/catch * fix: check owned before launching webpage * feat: added api to get installer package * feat: added installer check * format * fix: undefined error * Update src/lib/config.js Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * fix: syntax error (#2096) * Refactor plugin installation and purchase handling - Enhanced HandleIntent function to validate plugin installation requests. - Modified getLoggedInUser method to return a Promise. - Removed IAP_AVAILABLE from config and adjusted related logic. - Improved main.js to handle app installation source and define appInstallSource. - Refactored plugin page to streamline plugin installation and purchase logic. - Added external purchase handling in plugin view and buttons. - Updated IAP plugin to track availability status. - Enhanced ListItem component to manage plugin installation and purchase flow. - Introduced shouldAllowExternalPurchase helper function for better purchase logic. * fix: update Android version and improve XML formatting * feat: add login prompt for viewing owned plugins and update language files * fix: formatting * fix --------- Co-authored-by: Ajit Kumar <dellevenjack@gmail> Co-authored-by: Rohit Kushvaha <oldisg131@gmail.com> Co-authored-by: Emmanuel Lobo <76094069+UnschooledGamer@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Raunak Raj <71929976+bajrangCoder@users.noreply.github.com>
%%{init: {'theme': 'neutral'}}%% flowchart TD A[config.js loaded] --> B[IAP_AVAILABLE = true] B --> C[system.getInstaller called] C --> D{Callback result} D -- success --> E{installer == com.android.vending AND typeof iap != undefined?} E -- Yes --> F[IAP_AVAILABLE = true] E -- No --> G[IAP_AVAILABLE = false] D -- error --> H[IAP_AVAILABLE = true] F --> I[User taps Buy] G --> I H --> I I --> J{config.IAP_AVAILABLE?} J -- Yes --> K[Native IAP flow: iap.getProducts] J -- No --> L[auth.getLoggedInUser] L --> M{User logged in?} M -- No --> N[Open login page in CustomTabs] M -- Yes --> O[Open plugin purchase page in CustomTabs]