|
1 | 1 | <?php |
2 | 2 |
|
3 | | -/* @var $this \humhub\modules\ui\view\components\View */ |
4 | | - |
| 3 | +use humhub\components\View; |
5 | 4 | use humhub\helpers\DeviceDetectorHelper; |
6 | | -use humhub\libs\Html; |
| 5 | +use humhub\helpers\Html; |
7 | 6 | use humhub\modules\fcmPush\models\FcmUser; |
| 7 | +use humhub\widgets\bootstrap\Button; |
8 | 8 | use yii\helpers\Json; |
9 | 9 | use yii\helpers\Url; |
10 | 10 |
|
11 | | - |
| 11 | +/* @var $this View */ |
12 | 12 | ?> |
13 | 13 |
|
14 | | - |
15 | 14 | <div class="row"> |
16 | | - <div class="col-md-12"> |
| 15 | + <div class="col-lg-12"> |
17 | 16 | <div class="panel panel-default"> |
18 | 17 | <div class="panel-heading"> |
| 18 | + <?= Button::back(['/fcm-push/admin/index'])->sm() ?> |
19 | 19 | <strong>Mobile App</strong> Debug Page |
20 | 20 | </div> |
| 21 | + |
21 | 22 | <div class="panel-body"> |
22 | 23 |
|
23 | 24 | <?php if (DeviceDetectorHelper::isAppRequest()): ?> |
|
41 | 42 | </p> |
42 | 43 | <?php endif; ?> |
43 | 44 |
|
44 | | - <?= Html::a('Show Opener', '#', ['class' => 'btn btn-default postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'showOpener'])]) ?> |
45 | | - <?= Html::a('Hide Opener', '#', ['class' => 'btn btn-default postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'hideOpener'])]) ?> |
46 | | - <?= Html::a('Open this page as POST Request', ['mobile-app'], ['data-method' => 'POST', 'class' => 'btn btn-default']) ?> |
47 | | - <?= Html::a('Open native console', '#', ['class' => 'btn btn-default postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'openNativeConsole'])]) ?> |
| 45 | + <?= Html::a('Show Opener', '#', ['class' => 'btn btn-light postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'showOpener'])]) ?> |
| 46 | + <?= Html::a('Hide Opener', '#', ['class' => 'btn btn-light postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'hideOpener'])]) ?> |
| 47 | + <?= Html::a('Open this page as POST Request', ['mobile-app'], ['data-method' => 'POST', 'class' => 'btn btn-light']) ?> |
| 48 | + <?= Html::a('Open native console', '#', ['class' => 'btn btn-light postFlutterMsgLink', 'data-message' => Json::encode(['type' => 'openNativeConsole'])]) ?> |
48 | 49 | </div> |
49 | 50 | </div> |
50 | 51 | <div class="panel panel-default"> |
51 | 52 | <div class="panel-body"> |
52 | 53 | <h4>Test Push Notification</h4> |
53 | 54 |
|
54 | 55 | <p>Make sure the <code>Mobile</code> checkbox is enabled for <a |
55 | | - href="<?= Url::to(['/notification/user']); ?>"> |
| 56 | + href="<?= Url::to(['/notification/user']); ?>"> |
56 | 57 | Administrative Notifications!</a>. It may take a few minutes. |
57 | 58 | </p> |
58 | 59 |
|
59 | | - <?= Html::a('Trigger "HumHub Update" notification', ['mobile-app', 'triggerNotification' => 1], ['class' => 'btn btn-primary pull-right']) ?> |
| 60 | + <div class="clearfix"> |
| 61 | + <?= Button::primary('Trigger "HumHub Update" notification') |
| 62 | + ->link(['mobile-app', 'triggerNotification' => 1]) |
| 63 | + ->right() ?> |
| 64 | + </div> |
60 | 65 |
|
61 | 66 | </div> |
62 | 67 | </div> |
|
68 | 73 |
|
69 | 74 | <p>Set Notification Count to a number between 100 and 200.</p> |
70 | 75 |
|
71 | | - <?php |
72 | | - $message = Json::encode(['type' => 'updateNotificationCount', 'count' => rand(100, 200)]); |
73 | | - ?> |
| 76 | + <?php $message = Json::encode(['type' => 'updateNotificationCount', 'count' => rand(100, 200)]); ?> |
74 | 77 |
|
75 | | - <p><code><?= $message; ?></code></p> |
| 78 | + <p><code><?= $message ?></code></p> |
76 | 79 |
|
77 | | - <?= Html::a( |
78 | | - 'Execute via JS Channel', |
79 | | - '#', |
80 | | - ['class' => 'btn btn-primary pull-right postFlutterMsgLink', 'data-message' => $message] |
81 | | - ) ?> |
| 80 | + <div class="clearfix"> |
| 81 | + <?= Html::a( |
| 82 | + 'Execute via JS Channel', |
| 83 | + '#', |
| 84 | + ['class' => 'btn btn-primary float-end postFlutterMsgLink', 'data-message' => $message], |
| 85 | + ) ?> |
| 86 | + </div> |
82 | 87 | </div> |
83 | 88 | </div> |
84 | 89 | <div class="panel panel-default"> |
85 | 90 | <div class="panel-body"> |
86 | 91 | <h4>Registered FireBase Devices (Current User)</h4> |
87 | 92 |
|
88 | | - <?php |
89 | | - $tokens = FcmUser::find()->where(['user_id' => Yii::$app->user->id])->orderBy('created_at DESC')->all(); |
90 | | - ?> |
| 93 | + <?php $tokens = FcmUser::find()->where(['user_id' => Yii::$app->user->id])->orderBy('created_at DESC')->all(); ?> |
91 | 94 |
|
92 | 95 | <?php if (count($tokens) === 0): ?> |
93 | 96 | <p class="alert alert-danger"> |
|
133 | 136 |
|
134 | 137 | <h4>Send `registerFcmDevice` message </h4> |
135 | 138 |
|
136 | | - <?php |
137 | | - $json = ['type' => 'registerFcmDevice', 'url' => Url::to(['/fcm-push/token/update-mobile-app'], true)]; |
138 | | - $message = Json::encode($json); |
139 | | - ?> |
| 139 | + <?php $json = ['type' => 'registerFcmDevice', 'url' => Url::to(['/fcm-push/token/update-mobile-app'], true)]; ?> |
| 140 | + <?php $message = Json::encode($json); ?> |
140 | 141 |
|
141 | | - <p><code><?= $message; ?></code></p> |
| 142 | + <p><code><?= $message ?></code></p> |
142 | 143 |
|
143 | 144 |
|
144 | 145 | <p> |
|
156 | 157 | <li>400 - No `token` in payload</li> |
157 | 158 | </ul> |
158 | 159 |
|
159 | | - <?= Html::a( |
160 | | - 'Execute via JS Channel', |
161 | | - '#', |
162 | | - ['class' => 'btn btn-primary pull-right postFlutterMsgLink', 'data-message' => $message] |
163 | | - ) ?> |
| 160 | + <div class="clearfix"> |
| 161 | + <?= Html::a( |
| 162 | + 'Execute via JS Channel', |
| 163 | + '#', |
| 164 | + ['class' => 'btn btn-primary float-end postFlutterMsgLink', 'data-message' => $message], |
| 165 | + ) ?> |
| 166 | + </div> |
164 | 167 | </div> |
165 | 168 | </div> |
166 | 169 | <div class="panel panel-default"> |
167 | 170 | <div class="panel-body"> |
168 | 171 |
|
169 | 172 | <h4>Send `unregisterFcmDevice` message </h4> |
170 | 173 |
|
171 | | - <?php |
172 | | - $json = ['type' => 'unregisterFcmDevice', 'url' => Url::to(['/fcm-push/token/delete-mobile-app'], true)]; |
173 | | - $message = Json::encode($json); |
174 | | - ?> |
| 174 | + <?php $json = ['type' => 'unregisterFcmDevice', 'url' => Url::to(['/fcm-push/token/delete-mobile-app'], true)]; ?> |
| 175 | + <?php $message = Json::encode($json); ?> |
175 | 176 |
|
176 | | - <p><code><?= $message; ?></code></p> |
| 177 | + <p><code><?= $message ?></code></p> |
177 | 178 |
|
178 | 179 |
|
179 | 180 | <p> |
|
191 | 192 | <li>400 - No `token` in payload</li> |
192 | 193 | </ul> |
193 | 194 |
|
194 | | - <?= Html::a( |
195 | | - 'Execute via JS Channel', |
196 | | - '#', |
197 | | - ['class' => 'btn btn-primary pull-right postFlutterMsgLink', 'data-message' => $message] |
198 | | - ) ?> |
| 195 | + <div class="clearfix"> |
| 196 | + <?= Html::a( |
| 197 | + 'Execute via JS Channel', |
| 198 | + '#', |
| 199 | + ['class' => 'btn btn-primary float-end postFlutterMsgLink', 'data-message' => $message], |
| 200 | + ) ?> |
| 201 | + </div> |
199 | 202 | </div> |
200 | 203 | </div> |
201 | 204 |
|
|
217 | 220 | alert("Could not send message! Message: " + JSON.stringify(message)); |
218 | 221 | } |
219 | 222 | }); |
220 | | - |
221 | 223 | </script> |
0 commit comments