Closed Ldoppea closed 7 months ago
Add another deep link to enable/disable logging to file and disable it by default
I think it may be needed before releasing.
Checks if GPS Memory logs are included
Currently, GPS Memory messages are logged to a cozy-minilog logger AND to react-native-background-geolocation logger. So it should. In the next weeks, I will try to not send them to Sentry, but I want to keep them in the console for debugging purpose.
Can't wait to see it in production. Will be very useful.
I added a new commit to this PR: https://github.com/cozy/cozy-flagship-app/pull/1137/commits/f121a8b5866e284eb206fa997865861d50f16243
This ones makes the feature "opt-in" and the user now needs to click a UL to enable login into files.
Also I found a bug on iOS when the app is connected. If for some reason the splashscreen is hidden while the email pane is opened, then the splashscreen plugin will hide the email pane instead (because it blindly hides the topmost view)
I'll have to find a workaround for this, either by showing an email_splashscreen
while the email pane is opened, or by finding a way to fix the bootsplash library so it always hide the correct view. I'm not sure yet on to do these
In theory the email_splashscreen
option would work great, but I have to find how to wait for the email pane to be closed. For now the method directly resolves its promise when called.
The sendLogFilesByEmail method shows a MFMAilComposeViewController and then resolves But this view's callback is the didFinishWithResult method which has no access to the promise. I'll have to find a way to keep the promise pointer between the two methods
This PR is ready for review, I fixed previous issue by patching react-native-file-logger package in https://github.com/cozy/cozy-flagship-app/pull/1137/commits/9157df2f39a93d2450236a4175bc3907e04fdbb7
In order to allow sending logs whatever if the app is logged or not, or even when the app is stuck on SplashScreen, the easiest way to trigger sending logs is to use deep links
By implementing this, user can now click on
cozy://enablelogs
orhttps://links.mycozy.cloud/flagship/enablelogs
links to tell the app to start recording logs into a local fileThey can then click on
cozy://sendlogs
orhttps://links.mycozy.cloud/flagship/sendlogs
links to trigger the OS send email intent pre-filled with log files and Cozy's support emailFinally then can click on
cozy://disablelogs
orhttps://links.mycozy.cloud/flagship/disablelogs
links to tell the app to stop recording logsThis method is not the most user friendly but it has the advantage to be resilient to UI bugs
We may want to find a more user friendly method in the future and keep this one for exceptional cases (or internal ones)
This feature is based on the react-native-file-logger plugin, that does not need to be configured with cozy-minilog as it captures all console calls and redirect them to a file
By default
react-native-file-logger
will redirect all logs to a file in the app's cache directoryDaily rolling is enabled and the max file size is 5 files of 1MB
We want to decrease the log level to
Info
so all the app's logs are redirectedFinally
${now} [${level}]
is added before all log in the resulting fileTODO:
hideSplashscreen()
calls to hide the email paneImprovement ideas: