Skip to content

Commit

Permalink
first working commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hungtruong committed Nov 19, 2014
1 parent 9ce3789 commit 8732773
Show file tree
Hide file tree
Showing 21 changed files with 779 additions and 9 deletions.
16 changes: 16 additions & 0 deletions .gitignore
@@ -0,0 +1,16 @@
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
@@ -0,0 +1,62 @@
{
"images" : [
{
"size" : "14.5x14.5",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "38mm"
},
{
"size" : "18x18",
"idiom" : "watch",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "42mm"
},
{
"size" : "29x29",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29.3x29.3",
"idiom" : "watch",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "42mm"
},
{
"size" : "86x86",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "38mm"
},
{
"size" : "98x98",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "42mm"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
@@ -0,0 +1,24 @@
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "watch",
"extent" : "full-screen",
"minimum-system-version" : "8.0",
"subtype" : "38mm",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "watch",
"extent" : "full-screen",
"minimum-system-version" : "8.0",
"subtype" : "42mm",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
35 changes: 35 additions & 0 deletions WatchFart Watch App/Info.plist
@@ -0,0 +1,35 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>WatchFart</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.hung-truong.WatchFart.watchapp</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>WKCompanionAppBundleIdentifier</key>
<string>com.hung-truong.WatchFart</string>
<key>WKWatchKitApp</key>
<true/>
</dict>
</plist>
47 changes: 47 additions & 0 deletions WatchFart Watch App/Interface.storyboard
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="6221" systemVersion="14B25" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="AgC-eL-Hgc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6213"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="3734"/>
</dependencies>
<scenes>
<!--Interface Controller-->
<scene sceneID="aou-V4-d1y">
<objects>
<controller id="AgC-eL-Hgc" customClass="InterfaceController">
<items>
<button width="1" alignment="left" title="Fart!" id="bzI-PC-o68">
<connections>
<action selector="fartButtonTapped:" destination="AgC-eL-Hgc" id="TjV-lS-qVC"/>
</connections>
</button>
</items>
</controller>
</objects>
<point key="canvasLocation" x="220" y="345"/>
</scene>
<!--Static Notification Interface Controller-->
<scene sceneID="AEw-b0-oYE">
<objects>
<notificationController id="YCC-NB-fut">
<items>
<label alignment="left" text="Alert Label" id="IdU-wH-bcW"/>
</items>
<notificationCategory key="notificationCategory" id="JfB-70-Muf"/>
<connections>
<outlet property="notificationAlertLabel" destination="IdU-wH-bcW" id="JKC-fr-R95"/>
<segue destination="4sK-HA-Art" kind="relationship" relationship="dynamicNotificationInterface" id="kXh-Jw-8B1"/>
</connections>
</notificationController>
</objects>
<point key="canvasLocation" x="220" y="643"/>
</scene>
<!--Notification Controller-->
<scene sceneID="ZPc-GJ-vnh">
<objects>
<controller id="4sK-HA-Art" customClass="NotificationController"/>
</objects>
<point key="canvasLocation" x="468" y="643"/>
</scene>
</scenes>
</document>
@@ -0,0 +1,20 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
38 changes: 38 additions & 0 deletions WatchFart WatchKit Extension/Info.plist
@@ -0,0 +1,38 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>WatchFart WatchKit Extension</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.hung-truong.WatchFart.watchkitextension</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>WKAppBundleIdentifier</key>
<string>com.hung-truong.WatchFart.watchapp</string>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.watchkit</string>
</dict>
<key>RemoteInterfacePrincipalClass</key>
<string>InterfaceController</string>
</dict>
</plist>
16 changes: 16 additions & 0 deletions WatchFart WatchKit Extension/InterfaceController.h
@@ -0,0 +1,16 @@
//
// InterfaceController.h
// WatchFart WatchKit Extension
//
// Created by Hung Truong on 11/18/14.
// Copyright (c) 2014 Hung Truong. All rights reserved.
//

#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@interface InterfaceController : WKInterfaceController
-(IBAction)fartButtonTapped:(id)sender;
@property (nonatomic, strong) AVAudioPlayer *avSound;

@end
54 changes: 54 additions & 0 deletions WatchFart WatchKit Extension/InterfaceController.m
@@ -0,0 +1,54 @@
//
// InterfaceController.m
// WatchFart WatchKit Extension
//
// Created by Hung Truong on 11/18/14.
// Copyright (c) 2014 Hung Truong. All rights reserved.
//

#import "InterfaceController.h"
#import "AppDelegate.h"
@interface InterfaceController()

@end


@implementation InterfaceController

- (instancetype)initWithContext:(id)context {
self = [super initWithContext:context];
if (self){
// Initialize variables here.
// Configure interface objects here.
NSLog(@"%@ initWithContext", self);

}
return self;
}

- (void)willActivate {
// This method is called when watch view controller is about to be visible to user
NSLog(@"%@ will activate", self);
}

- (void)didDeactivate {
// This method is called when watch view controller is no longer visible
NSLog(@"%@ did deactivate", self);
}

-(void)fartButtonTapped:(id)sender
{
NSURL *containerURL = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:@"group.fart"];

NSURL *soundURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@fart.mp3", containerURL]];
NSError *error;
self.avSound = [[AVAudioPlayer alloc]
initWithContentsOfURL:soundURL error:&error];

[self.avSound play];
}

@end



15 changes: 15 additions & 0 deletions WatchFart WatchKit Extension/NotificationController.h
@@ -0,0 +1,15 @@
//
// NotificationController.h
// WatchFart WatchKit Extension
//
// Created by Hung Truong on 11/18/14.
// Copyright (c) 2014 Hung Truong. All rights reserved.
//

#import <WatchKit/WatchKit.h>
#import <Foundation/Foundation.h>

@interface NotificationController : WKUserNotificationInterfaceController


@end

0 comments on commit 8732773

Please sign in to comment.