Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update uialertview #255

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
path = modules/google-cast
url = https://github.com/ConnectSDK/Connect-SDK-iOS-Google-Cast.git
branch = dev
[submodule "core"]
path = core
url = https://github.com/ConnectSDK/Connect-SDK-iOS-Core.git
branch = dev
[submodule "modules/firetv"]
path = modules/firetv
url = https://github.com/ConnectSDK/Connect-SDK-iOS-FireTV.git
3 changes: 2 additions & 1 deletion ConnectSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ Pod::Spec.new do |s|
sp.exclude_files = (non_arc_files.dup << "core/ConnectSDK*Tests/**/*" << "core/Frameworks/LGCast/**/*.h")
sp.private_header_files = "core/**/*_Private.h"
sp.requires_arc = true

sp.dependency 'GCDWebServer', '~> 3.2'

sp.dependency 'ConnectSDK/no-arc'
sp.ios.vendored_frameworks = 'core/Frameworks/LGCast/LGCast.xcframework', 'core/Frameworks/LGCast/GStreamerForLGCast.xcframework'
sp.preserve_paths = 'core/Frameworks/LGCast/LGCast.xcframework', 'core/Frameworks/LGCast/GStreamerForLGCast.xcframework'
Expand Down
156 changes: 6 additions & 150 deletions ConnectSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion core
Submodule core deleted from fca71f
24 changes: 24 additions & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Xcode
.DS_Store
build
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap

#CocoaPods
Pods

#GoogleCast
ConnectSDK/Frameworks/GoogleCast.framework
3 changes: 3 additions & 0 deletions core/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#Contributing to Connect SDK

Please see our [contributing guidelines](https://github.com/ConnectSDK/Connect-SDK-iOS/blob/master/CONTRIBUTING.md) in the main [Connect-SDK-iOS](https://github.com/ConnectSDK/Connect-SDK-iOS) repo.
43 changes: 43 additions & 0 deletions core/ConnectSDK-Prefix.pch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
// Copyright (c) 2015 LG Electronics.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#define CONNECT_SDK_VERSION @"1.6.0"

#ifdef __OBJC__
#import <Foundation/Foundation.h>
#endif

// Uncomment this line to enable SDK logging
//#define CONNECT_SDK_ENABLE_LOG

#ifndef kConnectSDKWirelessSSIDChanged
#define kConnectSDKWirelessSSIDChanged @"Connect_SDK_Wireless_SSID_Changed"
#endif

#ifdef CONNECT_SDK_ENABLE_LOG
// credit: http://stackoverflow.com/a/969291/2715
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
#else
# define DLog(...)
#endif
66 changes: 66 additions & 0 deletions core/ConnectSDK.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// ConnectSDK.h
// Connect SDK
//
// Created by Andrew Longstaff on 9/6/13.
// Copyright (c) 2014 LG Electronics.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import <Foundation/Foundation.h>

#import "DiscoveryManager.h"
#import "DiscoveryManagerDelegate.h"
#import "DiscoveryProviderDelegate.h"

#import "ConnectableDevice.h"
#import "ConnectableDeviceDelegate.h"

#import "DevicePicker.h"
#import "DevicePickerDelegate.h"

#import "ServiceAsyncCommand.h"
#import "ServiceCommand.h"
#import "ServiceCommandDelegate.h"
#import "ServiceSubscription.h"

#import "CapabilityFilter.h"
#import "ExternalInputControl.h"
#import "KeyControl.h"
#import "TextInputControl.h"
#import "Launcher.h"
#import "MediaControl.h"
#import "PlayListControl.h"
#import "MediaPlayer.h"
#import "MouseControl.h"
#import "PowerControl.h"
#import "SubtitleInfo.h"
#import "ToastControl.h"
#import "TVControl.h"
#import "VolumeControl.h"
#import "WebAppLauncher.h"

#import "AppInfo.h"
#import "ChannelInfo.h"
#import "ExternalInputInfo.h"
#import "ImageInfo.h"
#import "MediaInfo.h"
#import "TextInputStatusInfo.h"
#import "ProgramInfo.h"
#import "LaunchSession.h"
#import "WebAppSession.h"

@interface ConnectSDK : NSObject

@end
102 changes: 102 additions & 0 deletions core/ConnectSDKAcceptanceTests/AirPlayServiceAcceptanceTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
//
// AirPlayServiceAcceptanceTests.m
// ConnectSDK
//
// Created by Eugene Nikolskyi on 2015-02-06.
// Copyright (c) 2015 LG Electronics. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "AirPlayService.h"
#import "DiscoveryManager.h"
#import "ZeroConfDiscoveryProvider.h"

#import "OCMArg+ArgumentCaptor.h"
#import "OCMStubRecorder+SpectaAsync.h"

SpecBegin(AirPlayService)

describe(@"ConnectSDK", ^{
__block DiscoveryManager *manager;
__block id delegateStub;

beforeEach(^{
manager = [DiscoveryManager new];
manager.deviceStore = nil;

delegateStub = OCMProtocolMock(@protocol(DiscoveryManagerDelegate));
manager.delegate = delegateStub;

[AirPlayService setAirPlayServiceMode:AirPlayServiceModeMedia];
[manager registerDeviceService:[AirPlayService class]
withDiscovery:[ZeroConfDiscoveryProvider class]];
});

context(@"after AppleTV device is connected", ^{
__block ConnectableDevice *appleTV;

beforeEach(^{
waitUntil(^(DoneCallback done) {
[OCMStub([delegateStub discoveryManager:manager
didFindDevice:[OCMArg captureTo:&appleTV]])
andDoneWaiting:done];

[manager startDiscovery];
});

expect([appleTV serviceWithName:kConnectSDKAirPlayServiceId]).notTo.beNil();
});

it(@"should display photo", ^{
NSURL *url = [[NSBundle bundleForClass:self.class]
URLForResource:@"the-san-francisco-peaks-of-flagstaff-718x544"
withExtension:@"jpg"];
MediaInfo *mediaInfo = [[MediaInfo alloc] initWithURL:url
mimeType:@"image/jpg"];

waitUntil(^(DoneCallback done) {
MediaPlayerSuccessBlock successBlock = ^(MediaLaunchObject *_) {
// the delay is not required here, but allows to visually
// check if the image is indeed displayed
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .5 * NSEC_PER_SEC),
dispatch_get_main_queue(),
^{
done();
});
};
FailureBlock failureBlock = ^(NSError *error) {
failure([NSString stringWithFormat:@"should not happen: %@",
error]);
done();
};
[[appleTV mediaPlayer] displayImageWithMediaInfo:mediaInfo
success:successBlock
failure:failureBlock];
});
});

afterEach(^{
[appleTV disconnect];
appleTV = nil;
});
});

afterEach(^{
[manager stopDiscovery];
delegateStub = nil;
manager = nil;
});
});

SpecEnd
114 changes: 114 additions & 0 deletions core/ConnectSDKAcceptanceTests/DLNAServiceAcceptanceTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//
// DLNAServiceAcceptanceTests.m
// ConnectSDK
//
// Created by Eugene Nikolskyi on 5/26/15.
// Copyright (c) 2015 LG Electronics. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "DiscoveryManager.h"
#import "DLNAService.h"
#import "SSDPDiscoveryProvider.h"

#import "EXPMatchers+matchRegex.h"
#import "OCMStubRecorder+SpectaAsync.h"

#pragma mark - Environment-specific constants

static NSString *const kExpectedDeviceName = @"Living Room - Sonos PLAY:1 Media Renderer";
static NSString *const kExpectedIPAddressRegex = @"192\\.168\\.1\\.\\d{1,3}";

#pragma mark -

SpecBegin(DLNAService)

describe(@"ConnectSDK", ^{
__block ConnectableDevice *device;

beforeEach(^{
// the official way to access DiscoveryManager is through the singleton,
// but that's no good for tests
DiscoveryManager *manager = [DiscoveryManager new];
// don't need to save any state information
manager.deviceStore = nil;

// use a custom delegate to avoid showing any UI and get the discovery
// callbacks
id delegateStub = OCMProtocolMock(@protocol(DiscoveryManagerDelegate));
manager.delegate = delegateStub;

// use DLNA service only
[manager registerDeviceService:[DLNAService class]
withDiscovery:[SSDPDiscoveryProvider class]];

// wait for a matching device
waitUntil(^(DoneCallback done) {
OCMStub([delegateStub discoveryManager:manager
didFindDevice:[OCMArg checkWithBlock:^BOOL(ConnectableDevice *dev) {
if ([kExpectedDeviceName isEqualToString:dev.friendlyName]) {
device = dev;
done();
}

return YES;
}]]);

[manager startDiscovery];
});

[manager stopDiscovery];
});

it(@"should discover Sonos device in the network", ^{
expect(device.address).matchRegex(kExpectedIPAddressRegex);
expect(device.id).notTo.beNil();
expect([device serviceWithName:kConnectSDKDLNAServiceId]).notTo.beNil();
});

it(@"should not send wrong volume error when mute changes", ^{
id deviceDelegateStub = OCMProtocolMock(@protocol(ConnectableDeviceDelegate));
device.delegate = deviceDelegateStub;

waitUntil(^(DoneCallback done) {
[OCMStub([deviceDelegateStub connectableDeviceReady:device])
andDoneWaiting:done];

[device connect];
});

waitUntil(^(DoneCallback done) {
[device.volumeControl subscribeVolumeWithSuccess:nil
failure:^(NSError *error) {
failure(@"should not send volume error %@", error);
done();
}];

[device.volumeControl getMuteWithSuccess:^(BOOL mute) {
[device.volumeControl setMute:!mute
success:^(id _) {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC),
dispatch_get_main_queue(),
^{
done();
});
}
failure:nil];
}
failure:nil];
});
});
});

SpecEnd
Loading