app icon indicating copy to clipboard operation
app copied to clipboard

Add Warning Dialog when HumHub doesn't support push

Open luke- opened this issue 1 year ago • 22 comments

The app should display a warning dialogue if the selected HumHub installation does not have a configured push module installed.

The status can be queried via: https://github.com/humhub/fcm-push/issues/37

Warn text could be, for example:

‘No push notifications are available for the selected HumHub installation. Contact the administrator for more information.’

@Semir1212 can you check the text please?

luke- avatar Jun 04 '24 15:06 luke-

@luke-

"Push notifications are not supported by this installation."

Semir1212 avatar Jun 04 '24 16:06 Semir1212

Route is /fcm-push/status

luke- avatar Jun 07 '24 08:06 luke-

Hey @luke-,

There is a minor issue here. The community page exposes ${manifest.baseUrl}/fcm-push/status to the public, allowing data access without authentication. For private instances like sometestproject12345 and Omrade, which require authentication, the status is inaccessible without logging in.

We use the dio package for communication with the REST API, which is not authenticated because authentication occurs inside the webview, where the user state is managed. The webview does not support advanced web client functionalities. It is possible to parse the returned HTML and extract JSON, but I would like to avoid that.

I would use JS message method, similar to how we did for registering the FCM token.

PrimozRatej avatar Jul 29 '24 20:07 PrimozRatej

@luke- @PrimozRatej Why not displaying this warning to logged admins only? I think the most important is to inform them their HumHub instance is not well configured for the mobile app and how to do it.

It might even be better not displaying the warning to non-admins, because maybe some communities will want to use the app without push feature.

What do you think?

marc-farre avatar Jul 30 '24 05:07 marc-farre

@luke- @PrimozRatej Why not displaying this warning to logged admins only? I think the most important is to inform them their HumHub instance is not well configured for the mobile app and how to do it.

It might even be better not displaying the warning to non-admins, because maybe some communities will want to use the app without push feature.

What do you think?

I believe this would also work better when https://github.com/humhub/fcm-push/issues/24 is implemented, I've also contributed a modified version of the P/R within this issue to implement the grant statuses with @luke-'s points in mind and can say overall it works rather well, but it could be updated to also handle this issue.

ArchBlood avatar Jul 30 '24 06:07 ArchBlood

@luke- @PrimozRatej Why not displaying this warning to logged admins only? I think the most important is to inform them their HumHub instance is not well configured for the mobile app and how to do it.

It might even be better not displaying the warning to non-admins, because maybe some communities will want to use the app without push feature.

What do you think?

We can also do it that way.

But if we only want to implement a warning for admins, we should implement this on the HumHub module side in the fcm-push module.

luke- avatar Jul 30 '24 09:07 luke-

on the HumHub module side

Maybe we could use the HumHub-Mobile user agent marker to detect when we're viewing HumHub from the mobile app: https://github.com/humhub/app/issues/182#issuecomment-2179376171

We could take this opportunity to create:

  • A new helper in humhub\modules\ui\helpers, e.g. UserAgentHelper, with static methods such as:
    • isHumHubMobileApp which will return str_contains(Yii::$app->request->getUserAgent(), 'HumHub-Mobile')
    • other methods which can be useful in cases such as https://github.com/humhub/humhub/blob/fef09e31bf2df95529ec3d6e8da3e72865110c68/protected/humhub/modules/user/components/User.php#L218-L218
  • A new JS module, e.g. ui.userAgent (even if we don't need it for the moment, but could be useful for some modules), with methods such as:
    • isHumHubMobileApp which will return /HumHub-Mobile/i.test(navigator.userAgent)
    • isMobileBrowser which will return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)
    • maybe other similar methods
  • A new class or data attribute on the html or body HTML tag, e.g. is-humhub-mobile-app?

Then, we could add the warning to the IncompleteSetupWarning widget?

marc-farre avatar Jul 30 '24 14:07 marc-farre

@marc-farre We already have some helper here: https://github.com/humhub/fcm-push/blob/master/helpers/MobileAppHelper.php#L58

Maybe we could copy that, for now somewhere into the core.

At some point we should think about integrating at least some app parts of the fcm-push module directly into the core.

luke- avatar Jul 30 '24 16:07 luke-

@luke- done:

  • core PR: https://github.com/humhub/humhub/pull/7144
  • fcm-push module PR: https://github.com/humhub/fcm-push/pull/45

marc-farre avatar Jul 31 '24 06:07 marc-farre

@luke- Do you want me to add the warning to the IncompleteSetupWarning widget using the new DeviceDetectorHelper?

marc-farre avatar Aug 01 '24 09:08 marc-farre

@marc-farre Yes, that would be fine! Thanks!

luke- avatar Aug 02 '24 12:08 luke-

@luke- PR https://github.com/humhub/humhub/pull/7166

What do you think about this view? image

I had to rework the "Open documentation" button, because it's not the same link for the push notification configuration. I didn't find a better solution than display twice the same button for the 2 cron job warning.

marc-farre avatar Aug 12 '24 10:08 marc-farre

@marc-farre Thanks, the PR looks good!

@Eladnarlea Can you please check the buttons?

luke- avatar Aug 12 '24 10:08 luke-

@luke- I would suggest to do it in the style of the alert/prerequisites design.

In case you do not wish to implement it yet, we could only implement the icon-button help-link first, but also add one icon-button view documentation to the bottom of the window

Screenshot 2024-08-13 at 1 22 40 PM

EDIT: in terms of layout and sizes I am unsure how your suggestion would look like, implemented, @marc-farre. I find it difficult to evaluate your design & button positions for this reason. Could you please provide the whole screen for mobile and desktop, @marc-farre ? :)

Eladnarlea avatar Aug 13 '24 11:08 Eladnarlea

@Eladnarlea Thanks, unfortunately I don't have time for the Requirement Redesign topic at the moment. But I would like to take a closer look at the design here before implement.

So I would suggest that we first add buttons (or a simple link) and not change the design at all. Later in the requirement redesign we can also consider this sidebar element.

@marc-farre Can you please add a simple plain link regarding the app for now. We'll hopefully redesign this soon.

luke- avatar Aug 13 '24 13:08 luke-

@luke- @Eladnarlea commit https://github.com/humhub/humhub/pull/7166/commits/b452871b144007144f40e40aa1c6baa2681b6d22

image

Or did you want to keep the existent "Documentation" button for cron jobs and add a warning about the mobile app bellow?

marc-farre avatar Aug 15 '24 11:08 marc-farre

The help buttons looks a bit strange vor me. Maybe just? image

luke- avatar Aug 15 '24 14:08 luke-

@luke- Commit https://github.com/humhub/humhub/pull/7166/commits/77aedf1ef8cc3fca7ac0ba53f4a180329b86494b

image

marc-farre avatar Aug 15 '24 19:08 marc-farre

@luke- in order to unify the software, could we please try to use the unified version like in the prerequisites used, already? Meaning using the [icon] Help "ghost button?

I think, what you didn't like about the help button was not the button itself, rather the styling of the link-icon- If @marc-farre could just make it the same font-size as the help font size itself, as well as using capitalisation "H"elp AND for now maybe using fnot-weight: 500 for Help? I think that would do the job. @luke- what do you reckon?

Eladnarlea avatar Aug 16 '24 07:08 Eladnarlea

@Eladnarlea I haven't had a closer look at the new Prereq design yet... so I don't want to already start implementing it in this unrelated task.

luke- avatar Aug 16 '24 08:08 luke-

@luke- Is my PR fine, or you want changes on it?

marc-farre avatar Aug 16 '24 09:08 marc-farre

@marc-farre Thanks, it's fine. But there will be UI changes as soon we refactoring the PreReq page :-)

luke- avatar Aug 16 '24 09:08 luke-

@luke- I close this issue. We can open a new one about UI refactoring.

marc-farre avatar Sep 19 '24 08:09 marc-farre