Skip to content

Commit

Permalink
[8ball] watchOS 3 version
Browse files Browse the repository at this point in the history
  • Loading branch information
conceptdev committed Sep 10, 2016
1 parent 11c7610 commit feec3af
Show file tree
Hide file tree
Showing 56 changed files with 2,096 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Watch8Ball/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
Watch8Ball
========

Apple Watch version of the classic toy :-) on watchOS 2 everything runs locally!
Apple Watch version of the classic toy :-) on watchOS 2 and later everything runs locally!

There are two versions:

* WatchKit on iOS 8 (watchOS 1)
* watchOS 2
* watchOS 3

![](WatchOS3/Screenshots/8ball.png)

There are also Xamarin [docs for Watch Kit](http://developer.xamarin.com/guides/ios/watch/).

Expand Down
17 changes: 17 additions & 0 deletions Watch8Ball/WatchOS3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Watch8Ball (watchOS 3)
==========

'getting started' example using watchOS 3 with Xamarin.iOS (based on this [Xamarin.Forms sample](https://github.com/conceptdev/xamarin-forms-samples/tree/master/MagicEightBall)).

Think of a question, and force-touch on the Eight Ball to get your answer :)

![screenshot](Screenshots/8ball.png "watch")


There are also Xamarin [docs for Watch Kit](http://developer.xamarin.com/guides/ios/watch/).

*watch screenshots use [Bezel](http://infinitapps.com/bezel/) courtesy of [infinitapps](http://infinitapps.com/)* :)

*watch bezel art courtesy of [Max Rudberg](http://blog.maxrudberg.com/post/110056879433/apple-watch-bezels-for-bezel)*

*eightball icon from [iconarchive](http://www.iconarchive.com/show/pool-ball-icons-by-barkerbaggies/Ball-8-icon.html) ([license](http://creativecommons.org/licenses/by-nc-sa/4.0/))*
Binary file added Watch8Ball/WatchOS3/Screenshots/8ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 81 additions & 0 deletions Watch8Ball/WatchOS3/Watch8Ball.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Watch8BallApp", "Watch8Ball\Watch8BallApp.csproj", "{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Watch8BallApp.W8Ball", "Watch8BallApp.W8Ball\Watch8BallApp.W8Ball.csproj", "{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Watch8BallApp.W8BallExtension", "Watch8BallApp.W8BallExtension\Watch8BallApp.W8BallExtension.csproj", "{0500728C-B5E0-47E0-823C-B22914E9C26B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Ad-Hoc|iPhone = Ad-Hoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.AppStore|iPhone.Build.0 = AppStore|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Debug|iPhone.ActiveCfg = Debug|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Debug|iPhone.Build.0 = Debug|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Release|iPhone.ActiveCfg = Release|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Release|iPhone.Build.0 = Release|iPhone
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{28CD10DC-0E75-4EEE-991D-FBC85F599DAA}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{93B84D07-1876-4845-9070-C780E017299F}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.AppStore|iPhone.Build.0 = AppStore|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.Debug|iPhone.ActiveCfg = Debug|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.Debug|iPhone.Build.0 = Debug|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{93B84D07-1876-4845-9070-C780E017299F}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{93B84D07-1876-4845-9070-C780E017299F}.Release|iPhone.ActiveCfg = Release|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.Release|iPhone.Build.0 = Release|iPhone
{93B84D07-1876-4845-9070-C780E017299F}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{93B84D07-1876-4845-9070-C780E017299F}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.AppStore|iPhone.Build.0 = AppStore|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Debug|iPhone.ActiveCfg = Debug|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Debug|iPhone.Build.0 = Debug|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Release|iPhone.ActiveCfg = Release|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Release|iPhone.Build.0 = Release|iPhone
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{99202340-56DA-4049-B368-A8F2D9D6C3E2}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Debug|iPhone.ActiveCfg = Debug|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Debug|iPhone.Build.0 = Debug|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Release|iPhone.ActiveCfg = Release|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Release|iPhone.Build.0 = Release|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.AppStore|iPhone.ActiveCfg = Release|iPhone
{D37D3C0A-BEFD-4CA1-896E-74E12FC1B5CF}.AppStore|iPhone.Build.0 = Release|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Debug|iPhone.ActiveCfg = Debug|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Debug|iPhone.Build.0 = Debug|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Release|iPhone.ActiveCfg = Release|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Release|iPhone.Build.0 = Release|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.AppStore|iPhone.ActiveCfg = Release|iPhone
{0500728C-B5E0-47E0-823C-B22914E9C26B}.AppStore|iPhone.Build.0 = Release|iPhone
EndGlobalSection
EndGlobal
98 changes: 98 additions & 0 deletions Watch8Ball/WatchOS3/Watch8Ball/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
using System;
using System.Linq;
using System.Collections.Generic;

using Foundation;
using UIKit;

namespace Watch8Ball
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{

public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
{
// show an alert
new UIAlertView(notification.AlertAction, "!" + notification.AlertBody, null, "OK", null).Show();

// reset our badge
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
}
public override void HandleAction (UIApplication application, string actionIdentifier, NSDictionary remoteNotificationInfo, Action completionHandler)
{
Console.WriteLine ("Handle Remote Notification");
}
// iOS 8
public override void HandleAction (UIApplication application, string actionIdentifier, UILocalNotification localNotification, Action completionHandler)
{
// show an alert
new UIAlertView(localNotification.AlertAction, "?" + localNotification.AlertBody, null, "OK", null).Show();

// reset our badge
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
}

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// check for a notification
if (launchOptions != null)
{
// check for a local notification
if (launchOptions.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey))
{
var localNotification = launchOptions[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
if (localNotification != null)
{
new UIAlertView(localNotification.AlertAction, localNotification.AlertBody, null, "OK", null).Show();
// reset our badge
UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
}
}
}

// iOS 7
//UIApplication.SharedApplication.RegisterForRemoteNotificationTypes (UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge);

// iOS 8
var settings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null);
UIApplication.SharedApplication.RegisterUserNotificationSettings (settings);
UIApplication.SharedApplication.RegisterForRemoteNotifications ();

return true;
}
// class-level declarations

public override UIWindow Window {
get;
set;
}

// This method is invoked when the application is about to move from active to inactive state.
// OpenGL applications should use this method to pause.
public override void OnResignActivation (UIApplication application)
{
}

// This method should be used to release shared resources and it should store the application state.
// If your application supports background exection this method is called instead of WillTerminate
// when the user quits.
public override void DidEnterBackground (UIApplication application)
{
}

// This method is called as part of the transiton from background to active state.
public override void WillEnterForeground (UIApplication application)
{
}

// This method is called when the application is about to terminate. Save data, if needed.
public override void WillTerminate (UIApplication application)
{
}
}
}

6 changes: 6 additions & 0 deletions Watch8Ball/WatchOS3/Watch8Ball/Entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>
40 changes: 40 additions & 0 deletions Watch8Ball/WatchOS3/Watch8Ball/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>8Ball</string>
<key>CFBundleIdentifier</key>
<string>co.conceptdev.WatchEight</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<key>CFBundleVersion</key>
<string>1.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MinimumOSVersion</key>
<string>10.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>MainStoryboard</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>XSAppIconAssets</key>
<string>Resources/Images.xcassets/AppIcon.appiconset</string>
<key>CFBundleName</key>
<string>8Ball</string>
</dict>
</plist>
20 changes: 20 additions & 0 deletions Watch8Ball/WatchOS3/Watch8Ball/Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;

using Foundation;
using UIKit;

namespace Watch8Ball
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
50 changes: 50 additions & 0 deletions Watch8Ball/WatchOS3/Watch8Ball/MainStoryboard.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733.0"/>
</dependencies>
<scenes>
<!--class Prefix:identifier View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="Watch8BallViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="3"/>
<viewControllerLayoutGuide type="bottom" id="4"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="5" translatesAutoresizingMaskIntoConstraints="NO">
<rect key="frame" x="137" y="89" width="46" height="30"/>
<state key="normal" title="Notify">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="shakeButton_TouchUpInside:" destination="vXZ-lx-hvc" id="9" eventType="touchUpInside"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="5" firstAttribute="top" secondItem="3" secondAttribute="bottom" constant="69" id="6"/>
<constraint firstItem="5" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" constant="137" id="7"/>
<constraint firstItem="kh9-bI-dsS" firstAttribute="trailing" secondItem="5" secondAttribute="trailing" constant="137" id="8"/>
</constraints>
</view>
<connections>
<outlet property="shakeButton" destination="5" id="name-outlet-5"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit feec3af

Please sign in to comment.