Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent authored and vincent committed Mar 8, 2016
1 parent eee1e98 commit 07cc8a7
Show file tree
Hide file tree
Showing 16 changed files with 172 additions and 1,129 deletions.
172 changes: 0 additions & 172 deletions FeelingClient/AlamofireObjectMapper.swift

This file was deleted.

17 changes: 9 additions & 8 deletions FeelingClient/Library/UpLoader/PhotoUpLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SwiftyJSON

class PhotoUpLoader {

let jwt = JWTTools()
private var uploadMgr: TXYUploadManager!;
private var sign = "";
private var bucket = "habit";
Expand All @@ -19,20 +20,20 @@ class PhotoUpLoader {
sign = initSign()
}

let jwt = JWTTools()

func initSign() -> String {
if sign.length == 0 {
let headers = jwt.getHeader(jwt.token, myDictionary: Dictionary<String,String>())
NetApi().makeCall(Alamofire.Method.POST,section: "user/imageSign",headers: headers, params: [:]) {
NetApi().makeCall(Alamofire.Method.GET,section: "user/imageSign",headers: headers, params: [:]) {
responseObject, error in

print("responseObject = \(responseObject); error = \(error)")

if let json = responseObject {
let myJosn = JSON(json)
self.jwt.sign = myJosn.dictionary!["message"]!.stringValue
}
}
}
sleep(1)
return self.jwt.sign
}

Expand All @@ -44,17 +45,17 @@ class PhotoUpLoader {


/// 上传至万象优图
func uploadToTXY(image: UIImage,name: String) -> String {
func uploadToTXY(image: UIImage,name: String,completionHandler: String? -> ()) {
let data = getPath(image)
if data.length == 0 {
NSLog("没有data");
return ""
completionHandler("")
}


if self.sign.length == 0 {
NSLog("没有sign");
return ""
completionHandler("")
}
var path = ""

Expand Down Expand Up @@ -89,6 +90,6 @@ class PhotoUpLoader {
NSLog("stateChange:\(state)");
})
};
return path
completionHandler(path)
}
}
23 changes: 7 additions & 16 deletions FeelingClient/MVC/CenterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class CenterViewController: DesignableViewController , MKMapViewDelegate, CLLoca
@IBOutlet var hidden6: UIView!
@IBOutlet var sendButton: UIBarButtonItem!

let jwt = JWTTools()

var jwt = JWTTools()
var loader = PhotoUpLoader.init()
var latitude:Double = 0.0
var longitude:Double = 0.0

Expand All @@ -61,7 +61,6 @@ class CenterViewController: DesignableViewController , MKMapViewDelegate, CLLoca

override func viewDidLoad() {
super.viewDidLoad()

let image = UIImage(named: "lonely-children")//lonely-children
let blurredImage = image!.imageByApplyingBlurWithRadius(15)
self.view.layer.contents = blurredImage.CGImage
Expand Down Expand Up @@ -104,16 +103,6 @@ class CenterViewController: DesignableViewController , MKMapViewDelegate, CLLoca
return
}
//照片上传

// public static final String M_SECRET_ID = "AKIDSWWEVHp02vgtpFtSa4oFalHKm4V4P5Ia";
// public static final String M_SECRET_KEY = "tAj32v6ZQC385aP1oUeFCqljjUpJD4iC";
//
// public static final int APP_ID = 10005997;
// public static final String U_SECRET_ID= "AKIDnLdXqvdAkshrcjNYqYlMXIl8pK9uAai4";
// public static final String U_SECRET_KEY = "a91NDllhlVtSnIM5QAxn66olpEFflUcM";
// public static final String BUCKET = "habit"; //空间名
// public static final String YUN = ".image.myqcloud.com";
// public static final String DOMAIN = BUCKET+"-"+APP_ID+YUN; //空间名
// * @param to
// * @param limitDate
// * @param content
Expand All @@ -126,12 +115,14 @@ class CenterViewController: DesignableViewController , MKMapViewDelegate, CLLoca

let newDict = Dictionary<String,String>()
let headers = jwt.getHeader(jwt.token, myDictionary: newDict)
let loader = PhotoUpLoader.init()


var path:String = ""
for element in imageData {
let temp = loader.uploadToTXY(element, name: element.accessibilityIdentifier!)
path = path + "," + temp
loader.uploadToTXY(element, name: "000",completionHandler: { (temp:String? ) -> () in

path = path + "," + temp!
})
}


Expand Down
19 changes: 19 additions & 0 deletions FeelingClient/NetReachability/NetReachability.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// NetReachability.h
// NetReachability
//
// Created by 刘凡 on 15/4/6.
// Copyright (c) 2015年 joyios. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for NetReachability.
FOUNDATION_EXPORT double NetReachabilityVersionNumber;

//! Project version string for NetReachability.
FOUNDATION_EXPORT const unsigned char NetReachabilityVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <NetReachability/PublicHeader.h>


Loading

0 comments on commit 07cc8a7

Please sign in to comment.