Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

[WIP]Mission3 #53

Open
wants to merge 3 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
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions KZM/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ぜんです。
よろしくお願いします。
18 changes: 18 additions & 0 deletions KZM/iOS-client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Mac
.DS_Store

# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
13 changes: 13 additions & 0 deletions KZM/iOS-client/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MOA_XCODEBUILD?=$(shell which xcodebuild)
MOA_SCHEME?="My1DayApp"
MOA_DESTINATION?='platform=iOS Simulator,name=iPhone 6'
MOA_CONFIGURATION?=Test

all:

test:
$(MOA_XCODEBUILD) \
-scheme $(MOA_SCHEME) \
-destination $(MOA_DESTINATION) \
-configuration $(MOA_CONFIGURATION) \
test
507 changes: 507 additions & 0 deletions KZM/iOS-client/My1DayApp.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions KZM/iOS-client/My1DayApp/APIRequest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// APIRequest.swift
// My1DayApp
//
// Created by 清 貴幸 on 2015/05/11.
// Copyright (c) 2015年 VOYAGE GROUP, inc. All rights reserved.
//

import Foundation

class APIRequest {
static let baseURLString = "http://localhost:8888/"

class func getMessages(completionHandler: ((NSData!, NSURLResponse!, NSError!) -> Void)?) {
let URL = NSURL(string: APIRequest.baseURLString + Endpoint.Messages.rawValue)!
let request = NSURLRequest(URL: URL)
let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request, completionHandler: completionHandler)
task.resume()
}

// Mission1-4 画像を投稿できるようにする
class func postMessage(message: String, username: String, completionHandler: ((NSData!, NSURLResponse!, NSError!) -> Void)?) {
let request = NSMutableURLRequest(URL: NSURL(string: APIRequest.baseURLString + Endpoint.Messages.rawValue)!)
request.HTTPMethod = "POST"
request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type")

var error: NSError?
request.HTTPBody = NSJSONSerialization.dataWithJSONObject(["username":username, "body":message], options: NSJSONWritingOptions.allZeros, error: &error)

if error != nil{
println(error)
return
}

let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request, completionHandler: completionHandler)
task.resume()
}

class func deleteMessage(messageID: String, completionHandler: ((NSData!, NSURLResponse!, NSError!) -> Void)?) {
let request = NSMutableURLRequest(URL: NSURL(string: APIRequest.baseURLString + Endpoint.Messages.rawValue + "/" + messageID)!)
request.HTTPMethod = "DELETE"

let session = NSURLSession.sharedSession()
let task = session.dataTaskWithRequest(request, completionHandler: completionHandler)
task.resume()
}

enum Endpoint: String {
case Messages = "messages"
}
}
46 changes: 46 additions & 0 deletions KZM/iOS-client/My1DayApp/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// AppDelegate.swift
// My1DayApp
//
// Created by 三浦裕典 on 2015/04/15.
// Copyright (c) 2015年 VOYAGE GROUP, inc. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


}

41 changes: 41 additions & 0 deletions KZM/iOS-client/My1DayApp/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015年 三浦裕典. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="My1DayApp" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
Loading