-
-
Notifications
You must be signed in to change notification settings - Fork 963
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
Major Android Update: Introducing Offline Support and Resolving CORS Issues #3554
Major Android Update: Introducing Offline Support and Resolving CORS Issues #3554
Conversation
…roject. This is just a demo to verify functionality; future work will focus on better integration.
…branch (for capacitor)
…o FullscreenActivity launch process for determining app launch behavior
- Added buildFrontend:prodCapacitorAndroid and buildFrontend:stageCapacitorAndroid for building Angular frontend (production and staging). - Introduced sync:android for syncing Capacitor configuration with the Android platform. - Added assemble:android:prod and assemble:android:stage for assembling Android APKs (production and debug). - Created buildAllCapacitor:android:prod and buildAllCapacitor:android:stage to handle full build processes for Android (production and staging). - Added dist:android for Android staging distribution and dist:android:prod for production APK distribution. - Created optional dist:all to distribute all platforms, including Android and Electron.
…ation) and used it in dist:android for easier debugging. No impact on production environment
- Added recommendation to use Offline Mode in the online.md document with an explanation of benefits. - Clarified behavior in offline.md, indicating it is intended for new installations and online mode. - Provided detailed steps for configuring Offline Mode and Online Mode in separate documentation files. - Linked mode-specific documentation from the main README for easier navigation.
- Added install:android to install debug APK, install:android:prod to install release APK to connected device
f18735b
to
287596b
Compare
This is really awesome! Thank you so much for your hard work!! I've been testing this and it seems to work very well. Some questions:
|
@johannesjo Thank you so much for your kind words and for testing the changes!
Additionally, I have been thoroughly testing these changes during the holidays and have resolved any issues that arose. I encourage you to test the PR as well to ensure everything works smoothly. Looking forward to your feedback and any further suggestions! 🍺🎉 |
After further research, I agree that a monorepo would be more suitable, especially given the context of using Capacitor. However, the transition will involve significant changes, particularly with merging the two repositories. Here’s a proposal I’m considering:
Let me know your thoughts on this approach. |
I took a look at Fastlane, and it seems quite interesting. It’s definitely worth exploring further for future automation. For now, though, I was thinking that we could proceed with manually generating the Android release APK. This way, we can move forward in parallel: users can start testing the app early in a staged roll-out, while we continue researching and developing the automated build process at our own pace. To generate the APK, you can run What do you think of this approach? 🙂 |
@johannesjo I tried setting LAUNCH_MODE=2 and ONLINE_SERVICE_HOST=test-app.super-productivity.com on real Android devices (Xiaomi 14 Pro - Android 14 and Huawei Mate 60 Pro - Android 12/HarmonyOS) and emulator (Pixel 8 - Android 14) but couldn’t reproduce the issue. In fact, when LAUNCH_MODE is set to 2, it forces a switch to the new mode, which doesn’t involve ONLINE_SERVICE_HOST, so it might not be related to ONLINE_SERVICE_HOST. I’m concerned that another issue may be causing this. Could you please share the Java crash stack trace there? That would help me better investigate the problem.
|
When the error occurred yesterday logcat wasn't showing anything interesting unfortunately. Not sure if the debugger was attached when the error was thrown though. Thank you for outlining the approach to merge this into one. I think that's exactly how we should do it. I have to say that I am really impressed by how you approach these problems and how clean and well documented everything is. Your work will have a big impact on how we can move the project forward. I can't stress enough how much I appreciate this! Thank you! How would you like to proceed? Can I start merging this soon or are there any additional changes you'd like to make first? |
Thank you so much for your kind words. Like you, I have a deep passion for programming and contributing to open-source projects. It’s truly inspiring to see how much time and effort you’ve put into this fantastic software, which I use daily myself. I’m honored to be a part of this, and I believe we’re helping each other achieve something great. Regarding the PR: Since this PR has been thoroughly tested and validated, I believe it’s ready to be merged. We can proceed with that and manually compile a Release APK for users to start testing right away. In the coming days, I plan to open two more PRs:
Regarding the Java crash issue, I’ll keep an eye on it. If you encounter it again, please share the Java stack trace, and I’ll do my best to take a look when I have time. Once again, thank you for everything, and I look forward to our continued collaboration! EDIT: I just submitted a new git commit to update documentation for Connectivity-Free Mode and terminology improvements. There is no change to the code logic, so it can be merged directly. |
@jiongxuan I encountered an issue and was hoping you might help with it: |
Thanks for bringing this up! For now, let’s hold off on releasing the new version until we’ve fully resolved this issue. I’ll work on verifying the problem and try to fix it as soon as possible. Also, thank you for your thorough testing, and I appreciate your efforts to test it further.
|
Regarding the two PRs I mentioned earlier, it seems like you’ve already implemented most of the changes. Is there anything else that still needs to be done, or should we continue waiting to verify the outcome? Additionally, I found a few issues that might be related. If the validation goes well, we could consider marking these as resolved (closed):
This could help keep everything tidy and up to date. One more thing: If possible, we could also consider marking the |
No, I think it's done for now. I'm very happy about it! Next step for me would be to setup fastlane to make releasing quicker and hopefully easier. The next big subject besides creating an iOS app will be decoupling the issue providers integrations from projects and to add an inbox feature along with it. Do you have any thoughts or preferences about this? I'm still in the conceptual phase. |
I’m glad to hear you’re happy with the progress! Regarding the next steps, I think focusing on “from scratch” features should take priority—things like the iOS app and Android offline notifications, which address core pain points, would be more impactful. For the Issue Provider integration, I agree that it could benefit from a redesign. It does feel a bit bloated, but the exact approach needs more thought. As for the Inbox, the current version works well for me, though I’d be interested to hear feedback from other users. In fact, I believe the app already has a lot of advanced features, and perhaps some could be hidden to streamline the user experience and attract a broader audience. We could consider opening a discussion on this to gather more user feedback—what do you think? |
Thank you very much for your feedback. I did exactly that. Should have thought about that before! :D |
Description
This pull request introduces offline support and resolves CORS issues in the Android application. It integrates Capacitor for better performance and a modern architecture, replacing Cordova after evaluating their differences and benefits. To ensure compatibility with existing users, a new CapacitorMainActivity is added, allowing new installations to utilize the offline capabilities without affecting the current FullscreenActivity used by existing users. Additionally, the codebase has been modularized by introducing the LaunchDecider and WebViewRequestHandler classes to manage app launch behavior and WebView request handling respectively.
Problem:
Lack of Offline Support: The existing Android application requires an active internet connection to function, preventing users from accessing core features when offline.
CORS (Cross-Origin Resource Sharing) Issues: The app encounters CORS-related problems, limiting its ability to interact securely with local or self-hosted resources.
Security Concerns: There are significant security vulnerabilities related to network hijacking, which could lead to data breaches or unauthorized access if the app relies solely on external servers without proper safeguards.
Objective:
Enable Offline Functionality: Allow users to utilize the Android app's core features without needing an internet connection, enhancing accessibility and reliability.
Resolve CORS Issues: Configure WebView appropriately to eliminate CORS-related problems, ensuring secure and flexible interactions with various resources.
Enhance Security: Implement measures to prevent network hijacking and other security threats, ensuring that data interactions remain secure even when offline.
User Experience:
Enhanced Accessibility: Users can now access and use the app's functionalities even without an internet connection, making the app more reliable and user-friendly.
Seamless Experience for Existing Users: Existing users upgrading from older versions will continue using the app without any disruptions, maintaining data integrity and consistent functionality.
Offline Mode for New Installations: New installations will have offline capabilities enabled by default, allowing users to work without constant internet access.
Future Migration Plans: While the new offline solution is available for fresh installations, plans are in place to develop migration strategies to transition existing users to the new offline mode without affecting their current usage.
Technical Changes:
Introduced Capacitor:
Added
CapacitorMainActivity
:FullscreenActivity
, preventing mutual interference and ensuring stable operation for both new and existing users.Introduced
LaunchDecider
Class:SharedPreferences
,PackageInfo
, and file existence checks to determine the appropriate launch mode (MODE_ONLINE
for existing users andMODE_OFFLINE
for new installations).FullscreenActivity
orCapacitorMainActivity
) based on their installation status.Extracted
WebViewRequestHandler
:shouldOverrideUrlLoading
andshouldInterceptRequest
methods, ensuring consistent behavior and streamlined request processing.Updated
AndroidManifest.xml
:FullscreenActivity
as the default launcher activity and declaredCapacitorMainActivity
appropriately without a launcher intent filter.FullscreenActivity
manages the transition toCapacitorMainActivity
based on the launch decision logic.Refactored
FullscreenActivity
:LaunchDecider
to determine the appropriate activity to launch duringonCreate
.wvContainer
from causing crashes by verifying its initialization before attempting to remove views inonDestroy
.Issues Resolved
Check List