Skip to content

Commit 7d207a6

Browse files
authored
Merge pull request #69 from humhub/enh/share-intend
Enh/share intend
2 parents 820f972 + 6530363 commit 7d207a6

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

Events.php

+3
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public static function onLayoutAddonInit($event)
118118
Yii::$app->session->remove(MobileAppHelper::SESSION_VAR_SHOW_OPENER);
119119
}
120120

121+
// Get info for the Share intend feature (uploading files from the mobile app)
122+
MobileAppHelper::getFileUploadSettings();
123+
121124
if (!Yii::$app->user->isGuest) {
122125
static::registerAssets();
123126
}

docs/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
2.1.5 (unreleased)
5+
-----------------------
6+
- Enh: Add Share intend feature for the mobile app
7+
48
2.1.4 (January 24, 2025)
59
-----------------------
610
- Enh #66: Add "Open native console" button for the mobile app

helpers/MobileAppHelper.php

+28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace humhub\modules\fcmPush\helpers;
44

55
use humhub\helpers\DeviceDetectorHelper;
6+
use humhub\modules\file\Module;
67
use Yii;
78
use yii\helpers\Json;
89
use yii\helpers\Url;
@@ -63,6 +64,33 @@ public static function unregisterNotificationScript(): void
6364
self::sendFlutterMessage($message);
6465
}
6566

67+
/**
68+
* @since 2.1.5
69+
*/
70+
public static function getFileUploadSettings(): void
71+
{
72+
/** @var Module $module */
73+
$module = Yii::$app->getModule('file');
74+
75+
$json = [
76+
'type' => 'fileUploadSettings',
77+
'fileUploadUrl' => Url::to(['/file/file/upload'], true),
78+
'contentCreateUrl' => Url::to(['/content/share-intend/target'], true),
79+
'maxFileSize' => $module->settings->get('maxFileSize'),
80+
'allowedExtensions' => $module->settings->get('allowedExtensions'),
81+
'imageMaxResolution' => $module->imageMaxResolution,
82+
'imageJpegQuality' => $module->imageJpegQuality,
83+
'imagePngCompressionLevel' => $module->imagePngCompressionLevel,
84+
'imageWebpQuality' => $module->imageWebpQuality,
85+
'imageMaxProcessingMP' => $module->imageMaxProcessingMP,
86+
'denyDoubleFileExtensions' => $module->denyDoubleFileExtensions,
87+
'converterOptions' => $module->converterOptions,
88+
];
89+
90+
$message = Json::encode($json);
91+
self::sendFlutterMessage($message);
92+
}
93+
6694
private static function sendFlutterMessage($msg): void
6795
{
6896
Yii::$app->view->registerJs('if (window.flutterChannel) { window.flutterChannel.postMessage(\'' . $msg . '\'); }');

module.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
],
1010
"homepage": "https://github.com/humhub/fcm-push",
1111
"humhub": {
12-
"minVersion": "1.17"
12+
"minVersion": "1.17.2"
1313
},
14-
"version": "2.1.4",
14+
"version": "2.1.5",
1515
"screenshots": [
1616
"resources/screenshot1.PNG",
1717
"resources/screenshot2.PNG"

0 commit comments

Comments
 (0)