Skip to content

Commit

Permalink
add feed back
Browse files Browse the repository at this point in the history
  • Loading branch information
trawor committed Jan 19, 2014
1 parent 0c86705 commit 14169cc
Show file tree
Hide file tree
Showing 6 changed files with 243 additions and 58 deletions.
10 changes: 8 additions & 2 deletions VZ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
1F0F989418388E0E000CE764 /* VZCommentCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F0F989318388E0E000CE764 /* VZCommentCell.m */; };
1F0F98971838987C000CE764 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 1F0F98951838987C000CE764 /* [email protected] */; };
1F0F98981838987C000CE764 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 1F0F98961838987C000CE764 /* [email protected] */; };
1F49C110188AB05300767851 /* VZFeedbackC.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F49C10F188AB05300767851 /* VZFeedbackC.m */; };
1F4C5C121849B6ED00AB3696 /* VZNavC.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F4C5C111849B6ED00AB3696 /* VZNavC.m */; };
1F664F8B182375A500DA43F1 /* VZPostViewC.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F664F8A182375A500DA43F1 /* VZPostViewC.m */; };
1F7721F11812D3680080308A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F7721F01812D3680080308A /* Foundation.framework */; };
Expand Down Expand Up @@ -70,6 +71,8 @@
1F0F989318388E0E000CE764 /* VZCommentCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VZCommentCell.m; sourceTree = "<group>"; };
1F0F98951838987C000CE764 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
1F0F98961838987C000CE764 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
1F49C10E188AB05300767851 /* VZFeedbackC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VZFeedbackC.h; sourceTree = "<group>"; };
1F49C10F188AB05300767851 /* VZFeedbackC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VZFeedbackC.m; sourceTree = "<group>"; };
1F4C5C101849B6ED00AB3696 /* VZNavC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VZNavC.h; sourceTree = "<group>"; };
1F4C5C111849B6ED00AB3696 /* VZNavC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VZNavC.m; sourceTree = "<group>"; };
1F664F89182375A500DA43F1 /* VZPostViewC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VZPostViewC.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -264,6 +267,8 @@
1F80241018797A80005F4005 /* VZStatusListC.m */,
1F043A14187C18CC00EFA890 /* VZWebViewC.h */,
1F043A15187C18CC00EFA890 /* VZWebViewC.m */,
1F49C10E188AB05300767851 /* VZFeedbackC.h */,
1F49C10F188AB05300767851 /* VZFeedbackC.m */,
);
name = C;
sourceTree = "<group>";
Expand Down Expand Up @@ -444,6 +449,7 @@
1F7722241812D7EA0080308A /* VZPostListC.m in Sources */,
1F7722011812D3680080308A /* VZAppDelegate.m in Sources */,
1F7721FD1812D3680080308A /* main.m in Sources */,
1F49C110188AB05300767851 /* VZFeedbackC.m in Sources */,
1FE18C55183C983E009E7938 /* VZStacView.m in Sources */,
1FC0819118252A13005CAFBB /* VZNearC.m in Sources */,
1F94FF58183763C0001114B4 /* VZNavView.m in Sources */,
Expand Down Expand Up @@ -553,7 +559,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "VZ/VZ-Prefix.pch";
INFOPLIST_FILE = "VZ/VZ-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "39BACF4F-15FE-4870-AFA4-326464A0FEFF";
VALID_ARCHS = "armv7 armv7s arm64";
Expand All @@ -575,7 +581,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "VZ/VZ-Prefix.pch";
INFOPLIST_FILE = "VZ/VZ-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "39BACF4F-15FE-4870-AFA4-326464A0FEFF";
WRAPPER_EXTENSION = app;
Expand Down
5 changes: 2 additions & 3 deletions VZ/VZAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotifi
}

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
//[AVAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
[AVPush handlePush:userInfo];
[AVAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
}

-(BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{
Expand All @@ -193,7 +192,7 @@ - (void)applicationDidBecomeActive:(UIApplication *)application

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
application.applicationIconBadgeNumber=0;
}

@end
13 changes: 13 additions & 0 deletions VZ/VZFeedbackC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// VZFeedbackC.h
// VZ
//
// Created by Travis on 14-1-18.
// Copyright (c) 2014年 Plumn LLC. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "VZM.h"
@interface VZFeedbackC : UIViewController

@end
131 changes: 131 additions & 0 deletions VZ/VZFeedbackC.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
//
// VZFeedbackC.m
// VZ
//
// Created by Travis on 14-1-18.
// Copyright (c) 2014年 Plumn LLC. All rights reserved.
//

#import "VZFeedbackC.h"
#import <SIAlertView/SIAlertView.h>
@interface AVAnalyticsUtils : NSObject

+(NSMutableDictionary *)deviceInfo;

@end

@interface VZFeedbackC ()
@property(nonatomic,weak) IBOutlet UITextView *textView;
@end

@implementation VZFeedbackC

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}

-(IBAction)send:(id)a{
if (self.textView.text.length<6) {
SIAlertView *alertView = [[SIAlertView alloc] initWithTitle:@"提示" andMessage:@"请您再多说几句吧"];

[alertView addButtonWithTitle:@"确定"
type:SIAlertViewButtonTypeDefault
handler:^(SIAlertView *alert) {

}];

alertView.transitionStyle = SIAlertViewTransitionStyleDropDown;

[alertView show];
}else{
[self.textView resignFirstResponder];
self.view.userInteractionEnabled=NO;

AVObject *fb=[AVObject objectWithClassName:@"Feedback"];
if ([VZUser currentUser]) {
[fb setObject:[VZUser currentUser] forKey:@"from"];
}

[fb setObject:[AVAnalyticsUtils deviceInfo] forKey:@"deviceInfo"];

[fb setObject:self.textView.text forKey:@"text"];

__weak typeof(self) ws=self;
[fb saveEventually:^(BOOL succeeded, NSError *error) {
ws.view.userInteractionEnabled=YES;

NSString *title=succeeded?@"发送成功":@"发送失败";

NSString *msg=succeeded?@"谢谢您的反馈,这对我们非常重要.":[error.userInfo objectForKey:NSLocalizedDescriptionKey];

SIAlertView *alertView = [[SIAlertView alloc] initWithTitle:title andMessage:msg];

if (succeeded) {
[alertView addButtonWithTitle:@"确定"
type:SIAlertViewButtonTypeDefault
handler:^(SIAlertView *alert) {
[ws.navigationController popToRootViewControllerAnimated:YES];
}];
}else{
[alertView addButtonWithTitle:@"重试"
type:SIAlertViewButtonTypeDefault
handler:^(SIAlertView *alert) {
[ws send:Nil];
}];
[alertView addButtonWithTitle:@"取消"
type:SIAlertViewButtonTypeCancel
handler:^(SIAlertView *alert) {
[ws.navigationController popToRootViewControllerAnimated:YES];
}];

}



alertView.transitionStyle = SIAlertViewTransitionStyleDropDown;

[alertView show];
}];
}
}

-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.textView becomeFirstResponder];
[AVAnalytics beginLogPageView:@"意见反馈"];
}

-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[AVAnalytics endLogPageView:@"意见反馈"];
}

- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor=[UIColor colorWithPatternImage:[VZTheme bgImage]];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/

@end
20 changes: 19 additions & 1 deletion VZ/VZSettingsC.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,23 @@ -(void)clearCache{

}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
switch (indexPath.row) {
case 0:

break;

case 1:
{

[self.navigationController
pushViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"FeedbackC"]
animated:YES];
}
break;

default:
break;
}
}
@end
Loading

0 comments on commit 14169cc

Please sign in to comment.