Skip to content

Commit fac4ce1

Browse files
iPadでも+ボタンを出すように修正
1 parent f7bb8ef commit fac4ce1

3 files changed

Lines changed: 26 additions & 37 deletions

File tree

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/Info.plist

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,21 @@
4646
<true/>
4747
</dict>
4848
<key>NSAppleMusicUsageDescription</key>
49-
<string>端末のメディアを再生できます</string>
49+
<string>端末のメディアを再生することができます</string>
5050
<key>NSBluetoothPeripheralUsageDescription</key>
51-
<string>Bluetoothの状態を取得します</string>
51+
<string>Bluetoothの状態を取得することができます</string>
5252
<key>NSCameraUsageDescription</key>
53-
<string>写真を撮影します</string>
53+
<string>写真を撮影することができます</string>
5454
<key>NSHumanReadableCopyright</key>
5555
<string>Copyright © 2016年 NTT DOCOMO, INC. All rights reserved.</string>
5656
<key>NSLocationAlwaysUsageDescription</key>
57-
<string>常に位置情報を使用します</string>
57+
<string>位置情報を使用することができます</string>
5858
<key>NSLocationWhenInUseUsageDescription</key>
5959
<string>アプリ使用時のみ位置情報を使用します。</string>
6060
<key>NSMicrophoneUsageDescription</key>
61-
<string>電話をかけます</string>
61+
<string>電話をかけることができます</string>
6262
<key>NSPhotoLibraryUsageDescription</key>
63-
<string>写真を参照します</string>
63+
<string>写真を参照することができます</string>
6464
<key>UILaunchStoryboardName</key>
6565
<string>LaunchScreen</string>
6666
<key>UIMainStoryboardFile</key>

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/classes/GHBookmarkTopController.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,6 @@ - (void)setEdiMode:(BOOL)edit
141141
self.folderBtn.enabled = NO;
142142
[self.editBtn setTitle:@"編集"];
143143
}
144-
145-
//iPadは常に完了ボタンを非表示
146-
if ([GHUtils isiPad]) {
147-
self.doneBtn.enabled = NO;
148-
self.doneBtn.tintColor = nil;
149-
self.navigationItem.rightBarButtonItem = nil;
150-
}
151144
}
152145

153146

dConnectSDK/dConnectBrowserForIOS9/dConnectBrowserForIOS9/classes/GHDeviceUtil.m

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,23 @@ - (void)debug:(DConnectArray*)array
7070
- (void)updateDeviceList
7171
{
7272
__weak GHDeviceUtil *_self = self;
73-
// タイミングによりアクセストークンが保存されない
7473
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
75-
[self callRequestAccessTokenAPI];
76-
77-
[self discoverDevices:^(DConnectArray *result) {
78-
_self.currentDevices = result;
79-
_self.recieveDeviceList(result);
74+
[self callRequestAccessTokenAPI:^(DConnectArray *result) {
75+
[self discoverDevices:^(DConnectArray *result) {
76+
_self.currentDevices = result;
77+
_self.recieveDeviceList(result);
78+
}];
8079
}];
80+
8181
});
8282
}
8383

8484
- (void)discoverDevices:(DiscoverDeviceCompletion)completion
8585
{
8686
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
8787
NSString *accessToken = [def stringForKey:ACCESS_TOKEN];
88-
if (!accessToken) {
88+
BOOL isLocalOAuth = [def boolForKey:IS_USE_LOCALOAUTH];
89+
if (!accessToken && isLocalOAuth) {
8990
completion(nil);
9091
return;
9192
}
@@ -105,31 +106,28 @@ - (void)discoverDevices:(DiscoverDeviceCompletion)completion
105106
return;
106107
}
107108
}
108-
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
109-
[def removeObjectForKey:ACCESS_TOKEN];
110-
[def synchronize];
111-
[self callRequestAccessTokenAPI];
112-
[self discoverDevices:completion];
113-
109+
if (isLocalOAuth) {
110+
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
111+
[def removeObjectForKey:ACCESS_TOKEN];
112+
[def synchronize];
113+
[self callRequestAccessTokenAPI:^(DConnectArray *result) {
114+
[self discoverDevices:completion];
115+
}];
116+
}
114117
}];
115118
}
116119

117-
- (void)callRequestAccessTokenAPI {
120+
- (void)callRequestAccessTokenAPI:(DiscoverDeviceCompletion)completion {
118121
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
119122
NSString *accessToken = [def stringForKey:ACCESS_TOKEN];
120123
if (accessToken) {
124+
completion(nil);
121125
return;
122126
}
123127
NSArray *scopes = [@[DConnectServiceDiscoveryProfileName]
124128
sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];;
125129

126130

127-
/* セマフォ準備 */
128-
dispatch_semaphore_t semaphore = dispatch_semaphore_create(1);
129-
dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * DPSemaphoreTimeout);
130-
131-
/* 応答が返るまでWait */
132-
dispatch_semaphore_wait(semaphore, timeout);
133131

134132
[DConnectUtil asyncAuthorizeWithOrigin: [self packageName]
135133
appName: @"Browser"
@@ -138,13 +136,11 @@ - (void)callRequestAccessTokenAPI {
138136
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
139137
[def setObject:accessToken forKey:ACCESS_TOKEN];
140138
[def synchronize];
141-
/* Wait解除 */
142-
dispatch_semaphore_signal(semaphore);
139+
completion(nil);
143140

144141
}
145142
error:^(DConnectMessageErrorCodeType errorCode){
146-
/* Wait解除 */
147-
dispatch_semaphore_signal(semaphore);
143+
completion(nil);
148144

149145
}];
150146
}

0 commit comments

Comments
 (0)