Feedback

Last Updated on : 2024-11-18 11:32:44download

The feedback methods mentioned in this topic will be deprecated. We recommend that you integrate FAQ UI BizBundle. After the integration, feedback history can be checked on your app and at Tuya IoT Development Platform > Operation > User Feedback.

All feedback features of Tuya Smart Life App SDK are implemented by the class TuyaSmartFeedback. For example, query a list of feedback sessions, query a list of feedback content, query a list of feedback types, and add a feedback session.

Description

Users can give feedback on the app through the following process if needed:

  • Add feedback: Users can select a feedback type, provide feedback content, and then submit the feedback.
  • Generate feedback: After the feedback is received, the system generates a feedback session based on the specified feedback type.
  • Process feedback: Users can continue to provide and submit feedback content in the same feedback session. The feedback content appears in the feedback list of the session.

Query the list of feedback sessions

Returns a list of sessions for the feedback submitted by users.

API description

- (void)getFeedbackTalkList:(void (^)(NSArray<TuyaSmartFeedbackTalkListModel *> *list))success failure:(TYFailureError)failure;

Parameters

Parameter Description
success The success callback. A list of feedback sessions is returned.
failure The failure callback.

Example

ObjC:

- (void)getFeedbackTalkList {
//    self.feedBack = [[TuyaSmartFeedback alloc] init];
	[self.feedBack getFeedbackTalkList:^(NSArray<TuyaSmartFeedbackTalkListModel *> *list) {
		NSLog(@"get feedback talk list success:%@", list);
	} failure:^(NSError *error) {
		NSLog(@"get feedback talk list failure:%@", error);
	}];
}

Swift:

func getFeedbackTalkList() {
    feedBack?.getTalkList({ (list) in
        print("get feedback talk list success: \(list)");
    }, failure: { (error) in
        if let e = error {
            print("get feedback talk list failure: \(e)")
        }
    })
}

Query the list of feedback content

Returns a list of feedback content in a feedback session. You can call TuyaSmartFeedbackTalkListModel to get the hdId and hdType field values.

API description

- (void)getFeedbackList:(NSString *)hdId
                 hdType:(NSUInteger)hdType
                success:(void (^)(NSArray<TuyaSmartFeedbackModel *> *list))success
                failure:(TYFailureError)failure;

Parameters

Parameter Description
hdId The feedback ID.
hdType The feedback type.
success The success callback. A list of feedback content is returned.
failure The failure callback.

Example

ObjC:

- (void)getFeedbackList {
//    self.feedBack = [[TuyaSmartFeedback alloc] init];
	[self.feedBack getFeedbackList:@"your_hdId" hdType:(NSInteger)hdType success:^(NSArray<TuyaSmartFeedbackModel *> *list) {
		NSLog(@"get feedback list success:%@", list);
	} failure:^(NSError *error) {
		NSLog(@"get feedback list failure:%@", error);
	}];
}

Swift:

func getFeedbackList() {
    feedBack?.getList("your_hdId", hdType: hdType, success: { (list) in
        print("get feedback list success: \(list)");
    }, failure: { (error) in
        if let e = error {
            print("get feedback list failure: \(e)")
        }
    })
}

Query a list of feedback types

Returns a list of feedback types that can be selected when users give feedback.

API description

- (void)getFeedbackTypeList:(void (^)(NSArray<TuyaSmartFeedbackTypeListModel *> *list))success failure:(TYFailureError)failure;

Parameters

Parameter Description
success The success callback. A list of feedback types is returned.
failure The failure callback.

Example

ObjC:

- (void)getFeedbackTypeList {
//    self.feedBack = [[TuyaSmartFeedback alloc] init];
	[self.feedBack getFeedbackTypeList:^(NSArray<TuyaSmartFeedbackTypeListModel *> *list) {
		NSLog(@"get feedback type list success:%@", list);
	} failure:^(NSError *error) {
		NSLog(@"get feedback type list failure:%@", error);
	}];
}

Swift:

func getFeedbackTalkList() {
    feedBack?.getTypeList({ (list) in
        print("get feedback type list success:\(list)");
    }, failure: { (error) in
        if let e = error {
            print("get feedback type list failure: \(e)")
        }
    })
}

Add feedback

Adds a feedback session and submits feedback contents entered by users. You can call TuyaSmartFeedbackTalkListModel to get the hdId and hdType field values.

API description

- (void)addFeedback:(NSString *)content
               hdId:(NSString *)hdId
             hdType:(NSUInteger)hdType
            contact:(NSString *)contact
            success:(TYSuccessHandler)success
            failure:(TYFailureError)failure

Parameters

Parameter Description
content The feedback content.
hdId The feedback ID.
hdType The feedback type.
contact The contact information of the user who submits feedback.
success The success callback.
failure The failure callback.

Example

ObjC:

- (void)addFeedback {
//    self.feedBack = [[TuyaSmartFeedback alloc] init];
	[self.feedBack addFeedback:@"your_feedback_content" hdId:@"your_hdId" hdType:(NSInteger)hdType contact:@"email..." success:^{
		NSLog(@"add feedback success");
	} failure:^(NSError *error) {
		NSLog(@"add feedback failure:%@", error);
	}];
}

Swift:

func getFeedbackTalkList() {
    feedBack?.add("your_feedback_content", hdId: "your_hdId", hdType: hdType, contact: "email...", success: {
        print("add feedback success");
    }, failure: { (error) in
        if let e = error {
            print("add feedback failure: \(e)")
        }
    })
}