Skip to content

Commit a476768

Browse files
committed
Added Media card UI to Example app. [The project uses Cocoapods now]
1 parent ff9986f commit a476768

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3305
-73
lines changed

Examples/BeaconstacExample/BeaconstacExample.xcodeproj/project.pbxproj

Lines changed: 134 additions & 13 deletions
Large diffs are not rendered by default.

Examples/BeaconstacExample/BeaconstacExample.xcworkspace/contents.xcworkspacedata

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Examples/BeaconstacExample/BeaconstacExample/AppDelegate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// AppDelegate.h
33
// BeaconstacExample
44
//
5-
// Created by Kshitij-Deo on 15/06/15.
65
// Copyright (c) 2015 Mobstac. All rights reserved.
76
//
87

Examples/BeaconstacExample/BeaconstacExample/AppDelegate.m

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
// AppDelegate.m
33
// BeaconstacExample
44
//
5-
// Created by Kshitij-Deo on 15/06/15.
65
// Copyright (c) 2015 Mobstac. All rights reserved.
76
//
87

98
#import "AppDelegate.h"
109
#import <CoreLocation/CoreLocation.h>
1110

1211
@interface AppDelegate ()<CLLocationManagerDelegate>
13-
12+
{
13+
BOOL insideBeaconRegion;
14+
}
1415
@property (strong, nonatomic) CLLocationManager *locationManager;
1516

1617
@end
@@ -20,8 +21,22 @@ @implementation AppDelegate
2021

2122
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2223
{
24+
// Registering for receiving local notifications when a user enters a beacon region for iOS 8
25+
// and previous versions respectively.
26+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
27+
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) {
28+
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
29+
}
30+
#endif
2331
self.locationManager = [[CLLocationManager alloc] init];
2432
self.locationManager.delegate = self;
33+
34+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
35+
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
36+
[self.locationManager requestAlwaysAuthorization];
37+
}
38+
#endif
39+
2540
return YES;
2641
}
2742

@@ -32,31 +47,30 @@ - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegion
3247

3348
if (state == CLRegionStateInside) {
3449
notification.alertBody = [NSString stringWithFormat:@"You are inside region %@", region.identifier];
50+
insideBeaconRegion = YES;
3551
} else if (state == CLRegionStateOutside) {
3652
notification.alertBody = [NSString stringWithFormat:@"You are outside region %@", region.identifier];
53+
insideBeaconRegion = FALSE;
3754
} else {
3855
return;
3956
}
40-
41-
// Registering for receiving local notifications when a user enters a beacon region for iOS 8
42-
// and previous versions respectively.
43-
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
44-
if ([UIApplication instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) {
45-
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound categories:nil]];
46-
}
47-
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
48-
#else
4957
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
50-
#endif
5158
}
5259

60+
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
61+
{
62+
if (status == kCLAuthorizationStatusAuthorizedAlways) {
63+
64+
}
65+
}
5366

5467
- (void)applicationWillResignActive:(UIApplication *)application
5568
{
5669
}
5770

5871
- (void)applicationDidEnterBackground:(UIApplication *)application
5972
{
73+
NSLog(@"applicationDidEnterBackground");
6074
}
6175

6276
- (void)applicationWillEnterForeground:(UIApplication *)application
@@ -65,10 +79,7 @@ - (void)applicationWillEnterForeground:(UIApplication *)application
6579

6680
- (void)applicationDidBecomeActive:(UIApplication *)application
6781
{
68-
}
69-
70-
- (void)applicationWillTerminate:(UIApplication *)application
71-
{
82+
NSLog(@"applicationDidBecomeActive");
7283
}
7384

7485
@end
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!--
2+
Copyright 2014 Google Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<!DOCTYPE html>
17+
<html>
18+
<head>
19+
<style>
20+
body { margin: 0; width:100%%; height:100%%; background-color:#000000; }
21+
html { width:100%%; height:100%%; background-color:#000000; }
22+
23+
.embed-container iframe,
24+
.embed-container object,
25+
.embed-container embed {
26+
position: absolute;
27+
top: 0;
28+
left: 0;
29+
width: 100%% !important;
30+
height: 100%% !important;
31+
}
32+
</style>
33+
</head>
34+
<body>
35+
<div class="embed-container">
36+
<div id="player"></div>
37+
</div>
38+
<script src="https://www.youtube.com/iframe_api"></script>
39+
<script>
40+
var player;
41+
var error = false;
42+
43+
YT.ready(function() {
44+
player = new YT.Player('player', %@);
45+
player.setSize(window.innerWidth, window.innerHeight);
46+
window.location.href = 'ytplayer://onYouTubeIframeAPIReady';
47+
48+
// this will transmit playTime frequently while playng
49+
function getCurrentTime() {
50+
var state = player.getPlayerState();
51+
if (state == YT.PlayerState.PLAYING) {
52+
time = player.getCurrentTime()
53+
window.location.href = 'ytplayer://onPlayTime?data=' + time;
54+
}
55+
}
56+
57+
window.setInterval(getCurrentTime, 500);
58+
59+
});
60+
61+
function onReady(event) {
62+
window.location.href = 'ytplayer://onReady?data=' + event.data;
63+
}
64+
65+
function onStateChange(event) {
66+
if (!error) {
67+
window.location.href = 'ytplayer://onStateChange?data=' + event.data;
68+
}
69+
else {
70+
error = false;
71+
}
72+
}
73+
74+
function onPlaybackQualityChange(event) {
75+
window.location.href = 'ytplayer://onPlaybackQualityChange?data=' + event.data;
76+
}
77+
78+
function onPlayerError(event) {
79+
if (event.data == 100) {
80+
error = true;
81+
}
82+
window.location.href = 'ytplayer://onError?data=' + event.data;
83+
}
84+
85+
window.onresize = function() {
86+
player.setSize(window.innerWidth, window.innerHeight);
87+
}
88+
</script>
89+
</body>
90+
</html>

Examples/BeaconstacExample/BeaconstacExample/Base.lproj/LaunchScreen.xib

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9059" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
56
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
67
</dependencies>
78
<objects>
@@ -14,15 +15,22 @@
1415
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 Mobstac. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
1516
<rect key="frame" x="20" y="439" width="441" height="21"/>
1617
<fontDescription key="fontDescription" type="system" pointSize="17"/>
17-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
18+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
1819
<nil key="highlightedColor"/>
1920
</label>
2021
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BeaconstacExample" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
2122
<rect key="frame" x="20" y="140" width="441" height="43"/>
2223
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
23-
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
24+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
2425
<nil key="highlightedColor"/>
2526
</label>
27+
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="mobstac" translatesAutoresizingMaskIntoConstraints="NO" id="aCa-xr-a34">
28+
<rect key="frame" x="150" y="208" width="180" height="64"/>
29+
<constraints>
30+
<constraint firstAttribute="width" constant="180" id="9y6-PV-AQp"/>
31+
<constraint firstAttribute="height" constant="64" id="Sbb-qy-ecp"/>
32+
</constraints>
33+
</imageView>
2634
</subviews>
2735
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
2836
<constraints>
@@ -31,11 +39,16 @@
3139
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
3240
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
3341
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
42+
<constraint firstItem="aCa-xr-a34" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="Znx-ia-1k4"/>
43+
<constraint firstItem="aCa-xr-a34" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="aQt-eI-IfF"/>
3444
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
3545
</constraints>
3646
<nil key="simulatedStatusBarMetrics"/>
3747
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
3848
<point key="canvasLocation" x="548" y="455"/>
3949
</view>
4050
</objects>
51+
<resources>
52+
<image name="mobstac" width="179" height="67"/>
53+
</resources>
4154
</document>

Examples/BeaconstacExample/BeaconstacExample/Base.lproj/Main.storyboard

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7531" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="xu6-6k-HFM">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="xu6-6k-HFM">
33
<dependencies>
4-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
56
</dependencies>
67
<scenes>
78
<!--Navigation Controller-->

Examples/BeaconstacExample/BeaconstacExample/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
{
22
"images" : [
33
{
4-
"idiom" : "iphone",
54
"size" : "29x29",
5+
"idiom" : "iphone",
6+
"filename" : "icon58.png",
67
"scale" : "2x"
78
},
89
{
9-
"idiom" : "iphone",
1010
"size" : "29x29",
11+
"idiom" : "iphone",
12+
"filename" : "icon87.png",
1113
"scale" : "3x"
1214
},
1315
{
14-
"idiom" : "iphone",
1516
"size" : "40x40",
17+
"idiom" : "iphone",
18+
"filename" : "icon80.png",
1619
"scale" : "2x"
1720
},
1821
{
19-
"idiom" : "iphone",
2022
"size" : "40x40",
23+
"idiom" : "iphone",
24+
"filename" : "icon120.png",
2125
"scale" : "3x"
2226
},
2327
{
24-
"idiom" : "iphone",
2528
"size" : "60x60",
29+
"idiom" : "iphone",
30+
"filename" : "icon120-1.png",
2631
"scale" : "2x"
2732
},
2833
{
29-
"idiom" : "iphone",
3034
"size" : "60x60",
35+
"idiom" : "iphone",
36+
"filename" : "icon180.png",
3137
"scale" : "3x"
3238
}
3339
],
16.8 KB
Loading
16.8 KB
Loading

0 commit comments

Comments
 (0)