Skip to content

Commit

Permalink
Merge pull request #58 from humhub/fix/ios-app-detection
Browse files Browse the repository at this point in the history
Fix: iOS mobile app detection for iPad devices
  • Loading branch information
luke- authored Nov 6, 2024
2 parents 50c165a + 773f352 commit 45202c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

2.1.1 (unreleased)
------------------------
- Fix #58: iOS mobile app detection for iPad devices

2.1.0 (October 21, 2024)
------------------------
- Fix #51: Firebase not working anymore for web push notifications
Expand Down
14 changes: 4 additions & 10 deletions helpers/MobileAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,10 @@ private static function sendFlutterMessage($msg)
Yii::$app->view->registerJs('if (window.flutterChannel) { window.flutterChannel.postMessage(\'' . $msg . '\'); }');
}

public static function isIosApp()
public static function isIosApp(): bool
{
$headers = Yii::$app->request->headers;

if (static::isAppRequest() &&
$headers->has('user-agent') &&
str_contains($headers->get('user-agent', '', true), 'iPhone')) {

return true;
}
return
static::isAppRequest()
&& Yii::$app->request->headers->get('x-humhub-app-is-ios');
}

}
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"humhub": {
"minVersion": "1.14"
},
"version": "2.1.0",
"version": "2.1.1",
"screenshots": [
"resources/screenshot1.PNG",
"resources/screenshot2.PNG"
Expand Down

0 comments on commit 45202c6

Please sign in to comment.