Skip to content

Commit 7ed16a0

Browse files
Merge pull request #171 from TakayukiHoshi1984/modify_help_html
dConnectBrowserのヘルプ画面の調整
2 parents 5796476 + a3a8c80 commit 7ed16a0

28 files changed

Lines changed: 535 additions & 285 deletions

File tree

dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostMediaStreamRecording/Recorders/Photo/DPHostCameraRecorder.m

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
// Released under the MIT license
77
// http://opensource.org/licenses/mit-license.php
88
//
9-
9+
#import <UserNotifications/UserNotifications.h>
1010
#import <Photos/Photos.h>
1111
#import <MobileCoreServices/UTCoreTypes.h>
1212
#import "DPHostCameraRecorder.h"
1313
#import "DPHostRecorder.h"
1414
#import "DPHostUtils.h"
1515
#import "DPHostRecorderUtils.h"
16-
@interface DPHostCameraRecorder()
16+
17+
static NSString *const kDPHostStartPreviewNotificationId = @"kDPHostStartPreviewNotificationId";
18+
@interface DPHostCameraRecorder()<UNUserNotificationCenterDelegate>
1719
@property (nonatomic) DPHostSimpleHttpServer *httpServer;
1820
/// Preview APIでプレビュー画像URIの配送を行うかどうか。
1921
@property (nonatomic) BOOL sendPreview;
@@ -117,14 +119,15 @@ - (void)takePhotoWithSuccessCompletion:(void (^)(NSURL *assetURL))successComplet
117119
}
118120
[weakSelf saveFileWithCompletionHandler:^(NSURL *assetURL, NSError *error) {
119121

120-
if ([weakSelf.session isRunning]) {
122+
if ([weakSelf.session isRunning] && !weakSelf.sendPreview) {
121123
[weakSelf.session stopRunning];
122124
}
123125
if (error) {
124126
failCompletion(error.localizedDescription);
125127
} else {
126128
successCompletion(assetURL);
127129
}
130+
128131
}];
129132
}];
130133
}
@@ -179,6 +182,7 @@ - (void)startWebServerWithSuccessCompletion:(void (^)(NSString *uri))successComp
179182
failCompletion(@"MJPEG Server cannot running.");
180183
return;
181184
}
185+
[self showPreviewNotification];
182186
successCompletion(url);
183187
}
184188

@@ -193,7 +197,7 @@ - (void)stopWebServer
193197
self.sendPreview = NO;
194198
// 次回プレビュー開始時に影響を与えない為に、初期値(無効値)を設定する。
195199
self.lastPreviewTimestamp = kCMTimeInvalid;
196-
200+
[self hidePreviewNotification];
197201
}
198202

199203
#pragma mark - Private Method
@@ -420,4 +424,60 @@ - (void) sendPreviewDataWithSampleBuffer:(CMSampleBufferRef)sampleBuffer
420424
}
421425

422426
}
427+
428+
#pragma mark - Notification Control
429+
- (void)showPreviewNotification
430+
{
431+
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
432+
content.title = @"カメラ撮影中(iOS Host Camera Preview)";
433+
content.body = @"タップして撮影を停止します。";
434+
// Deliver the notification in five seconds.
435+
UNTimeIntervalNotificationTrigger* trigger = [UNTimeIntervalNotificationTrigger
436+
triggerWithTimeInterval:1
437+
repeats:NO];
438+
UNNotificationRequest* nRequest = [UNNotificationRequest
439+
requestWithIdentifier:kDPHostStartPreviewNotificationId
440+
content:content
441+
trigger:trigger];
442+
443+
// Schedule the notification.
444+
dispatch_async(dispatch_get_main_queue(), ^{
445+
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
446+
center.delegate = self;
447+
[center addNotificationRequest:nRequest
448+
withCompletionHandler:^(NSError * _Nullable error) {
449+
}];
450+
451+
});
452+
}
453+
454+
- (void)hidePreviewNotification
455+
{
456+
UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
457+
[center getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> * _Nonnull notifications) {
458+
for (UNNotification *notification in notifications) {
459+
NSString *currentId = notification.request.identifier;
460+
if ([currentId isEqualToString:kDPHostStartPreviewNotificationId]) {
461+
[center removeDeliveredNotificationsWithIdentifiers:@[kDPHostStartPreviewNotificationId]];
462+
return;
463+
}
464+
}
465+
}];
466+
467+
}
468+
#pragma mark - Notification Delegate
469+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
470+
didReceiveNotificationResponse:(UNNotificationResponse *)response
471+
withCompletionHandler:(void (^)(void))completionHandler {
472+
completionHandler();
473+
[self stopWebServer];
474+
}
475+
476+
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
477+
willPresentNotification:(UNNotification *)notification
478+
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
479+
completionHandler(UNNotificationPresentationOptionBadge |
480+
UNNotificationPresentationOptionSound |
481+
UNNotificationPresentationOptionAlert);
482+
};
423483
@end

dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostNotificationProfile.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ - (instancetype)init
5252
_notificationInfoDict = @{}.mutableCopy;
5353

5454
[self setNotificationIdLength: 3];
55-
56-
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
57-
center.delegate = self;
55+
dispatch_async(dispatch_get_main_queue(), ^{
56+
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
57+
center.delegate = self;
58+
});
5859

5960
// API登録(didReceivePostNotifyRequest相当)
6061
NSString *postNotifyRequestApiPath = [self apiPath: nil

dConnectDevicePlugin/dConnectDeviceTheta/dConnectDeviceTheta/Classes/DPOmnidirectionalImageProfile.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// DPOmnidirectionalImageProfile.m
33
// dConnectDeviceTheta
44
//
5-
// Created by 星 貴之 on 2015/08/23.
6-
// Copyright (c) 2015年 DOCOMO. All rights reserved.
5+
// Copyright (c) 2015 NTT DOCOMO, INC.
6+
// Released under the MIT license
7+
// http://opensource.org/licenses/mit-license.php
78
//
89

10+
911
#import "DPOmnidirectionalImageProfile.h"
1012

1113
NSString *const DPOmnidirectionalImageProfileName = @"omnidirectionalImage";

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/accordion.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ img.plus {
2727

2828
.ac_menu div.ac_content {
2929
box-shadow:0px 1px 5px #AAA inset;
30+
border-bottom: thin solid #558BCA;
3031
background :#f4f4f4;
3132
-webkit-transition: all 0.5s;
3233
-moz-transition: all 0.5s;

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/checker.css

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ body {
33
margin: 0px;
44
padding: 0px;
55
}
6+
div.title {
7+
background-color: #5B9CFC;
8+
padding: 10px;
9+
font-weight: bold;
10+
color: #FFFFFF;
11+
}
12+
a.back{
13+
color:#FFFFFF;
14+
}
615

716
div.request_param {
817
padding: 12px 8px 8px 8px;
@@ -200,12 +209,31 @@ div.test {
200209
input, select {
201210
vertical-align: middle;
202211
}
203-
div.title {
204-
background-color: #5B9CFC;
205-
padding: 10px;
206-
font-weight: bold;
207-
color: #FFFFFF;
212+
213+
label {
214+
animation-name: fadeIn;
215+
animation-duration: 0.3s;
216+
animation-iteration-count: 1;
217+
animation-timing-function: ease-out;
218+
animation-fill-mode: backwards;
208219
}
209-
a.back{
210-
color:#FFFFFF;
220+
221+
.ac_menu div.ac_content {
222+
animation-name: fadeIn;
223+
animation-duration: 0.3s;
224+
animation-iteration-count: 1;
225+
animation-timing-function: ease-out;
226+
animation-fill-mode: backwards;
227+
}
228+
229+
@keyframes fadeIn {
230+
from {
231+
transform:translateY(300px);
232+
opacity: 0.0;
233+
}
234+
235+
to {
236+
transform:translateY(0px);
237+
opacity: 1.0;
238+
}
211239
}

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/index.css

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
body {
77
background-color: #FBFBFB;
88
}
9+
div.title {
10+
background-color: #5B9CFC;
11+
padding: 10px;
12+
font-weight: bold;
13+
color: #FFFFFF;
14+
}
15+
a.back{
16+
color:#FFFFFF;
17+
}
918

1019
img.icon {
1120
width: 42px;
@@ -38,20 +47,28 @@ div.profileName {
3847
border-right: solid 1px #E5E5E5;
3948
box-shadow: 0px 0px 2px #F3F3F3;
4049
color: #5B9CFC;
41-
}
4250

51+
animation-name: fadeIn;
52+
animation-duration: 0.3s;
53+
animation-iteration-count: 1;
54+
animation-timing-function: cubic-bezier(0, 1.1, 1, 1.1);
55+
animation-fill-mode: backwards;
56+
}
4357

4458
a { text-decoration: none; }
4559
a:link { color: #5B9CFC; }
4660
a:visited { color: #5B9CFC; }
4761
a:hover { color: #5B9CFC; }
4862
a:active { color: #5B9CFC; }
49-
div.title {
50-
background-color: #5B9CFC;
51-
padding: 10px;
52-
font-weight: bold;
53-
color: #FFFFFF;
54-
}
55-
a.back{
56-
color:#FFFFFF;
63+
64+
@keyframes fadeIn {
65+
from {
66+
transform: scale(0.0, 0.0);
67+
opacity: 0.0;
68+
}
69+
70+
to {
71+
transform: scale(1.0, 1.0);
72+
opacity: 1.0;
73+
}
5774
}

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/css/resource.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ div.title {
1010
a.back{
1111
color:#FFFFFF;
1212
}
13+

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<script id="profileCell" type="text/x-template">
1818
<a href="{#url}">
1919
<div class="grid">
20-
<div>
20+
<div style="animation-delay: {#delay}s;">
2121
<img class="icon" src="{#icon}"><br>
2222
<div class="profileName">{#content}</div>
2323
</div>

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/js/checker.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11

22
var main = (function(parent, global) {
33

4+
var delay = 0;
5+
46
function init() {
57
util.init(function(name, json) {
68
createSupportApis(json);
79
});
10+
811
}
912
parent.init = init;
1013

1114
function back() {
1215
location.href = "./index.html?serviceId=" + util.getServiceId();
1316
}
1417
parent.back = back;
15-
1618
function onChangeValue(nav, name) {
1719
var elem = document.forms[nav];
1820
elem['t_' + name].value = elem[name].value;
@@ -124,15 +126,15 @@ var main = (function(parent, global) {
124126
setRequestText(nav, createRequest(method + " " + path));
125127

126128
if (method == 'PUT') {
127-
dConnect.addEventListener(uri, function(json) {
129+
util.addEventListener(uri, function(json) {
128130
setEventText(nav, createEvent(util.formatJSON(json)));
129131
}, function(json) {
130132
setResponseText(nav, createResponse(util.formatJSON(JSON.stringify(json))));
131133
}, function(errorCode, errorMessage) {
132134
setResponseText(nav, createResponse("errorCode=" + errorCode + " errorMessage=" + errorMessage));
133135
});
134136
} else {
135-
dConnect.removeEventListener(uri, function(json) {
137+
util.removeEventListener(uri, function(json) {
136138
setResponseText(nav, createResponse(util.formatJSON(JSON.stringify(json))));
137139
}, function(errorCode, errorMessage) {
138140
setResponseText(nav, createResponse("errorCode=" + errorCode + " errorMessage=" + errorMessage));
@@ -246,7 +248,6 @@ var main = (function(parent, global) {
246248
};
247249
return util.createTemplate('param_slider', data);
248250
}
249-
250251
function createBooleanParam(name, value, on) {
251252
var data = {
252253
'name' : name,
@@ -256,6 +257,7 @@ var main = (function(parent, global) {
256257
};
257258
return util.createTemplate('param_boolean', data);
258259
}
260+
259261

260262
function createRequest(body) {
261263
var data = {
@@ -346,8 +348,10 @@ var main = (function(parent, global) {
346348
var data = {
347349
'title': method.toUpperCase() + ' ' + createDConnectPath(basePath, path),
348350
'nav' : method + '_' + path,
349-
'content' : createParameter(method, basePath, path, param['x-type'], param.parameters)
351+
'content' : createParameter(method, basePath, path, param['x-type'], param.parameters),
352+
'delay' : delay
350353
};
354+
delay += 0.1;
351355
return util.createTemplate('command', data);
352356
}
353357

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/demo/js/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ var main = (function(parent, global) {
2525
'connection' : 'images/icon33_connect6.png',
2626
};
2727

28+
var delay = 0;
29+
2830
function init() {
2931
util.init(function(name, json) {
3032
createProfileList(json.supports);
@@ -39,8 +41,10 @@ var main = (function(parent, global) {
3941
var data = {
4042
'url' : url,
4143
'content' : content,
42-
'icon' : icon
44+
'icon' : icon,
45+
'delay' : delay
4346
};
47+
delay += 0.08;
4448
return util.createTemplate('profileCell', data);
4549
}
4650

0 commit comments

Comments
 (0)