Feedback Kit
Introductionβ
Feedback Kit for IOS is a wrapper SDK for Mappls's feedback API. It allows developers to integrate feedback module in their application. Using feedback module user can submit location related feedback to Mappls's server.
Note: Sample for UI view controllers with source code is also provided by Mappls which user can directly use to show feedback screen. Information about how to use UI sample is also provided in this documentation.
If you don't want to implement own logic and use sample from Mappls Jump to Sample UI Kit section.
Setup your Projectβ
Using CocoaPodsβ
To install the MapplsFeedbackKit
using CocoaPods:
Create a Podfile with the following specification:
pod 'MapplsFeedbackKit', '1.0.0'
Run pod repo update && pod install
and open the resulting Xcode workspace.
Authorizationβ
MapplsAPICoreβ
It is required to set Mappls keys to use any MAPPL's SDK. Please refer the documenatation here
Usageβ
Steps to submit feedback:
An authoraization key i.e moduleId (provided by Mappls) against which feedback will be submitted wiil be required to use this SDK .
List of categories need to be fetched first under which feedback will be submitted. For more informatatio see here.
Notes:
Fetched report categories can be saved for offline use or to prevent fetching report categories multiple times.
It will require to separate out them on basis of parentId i.e Separate as Parent and Child Categories, where if parent Id is null means they are parent categories otherwise child of some parent category. Note: ParentId of a child category is reportId of parent category.
On basis of parent and child categories, different User Interfaces or scenarios can be designed as per requirements.
User must pass have location oordinate for which feedback will be submitted.
After selecting of parent and child category user must take some input as a text for feedback.
After Collection all values i.e Module Id, Location Coordinates, Parent Category, Child Category and Feedback Text, feedback can be submitted using functions available in this SDK. See here.
Get Report Categoriesβ
Categories for reporting can be fetched using getReportCategories method of MapplsFeedBackKitManager class by using shared instance.
In response you will receive an error or an array of MapplsReportCategories. Yo will find below useful properties in reportCategories object which is an array of ParentCategories
:
ParentCategories
ChildCategories
SubChildCategories
Swiftβ
MapplsFeedBackKitManager.shared.getReportCategories { (reportCategories, error) in
if let error = error {
print(error.localizedDescription)
self.dismiss(animated: true, completion: nil)
} else {
let categories = reportCategories ?? [ParentCategories]()
if categories.count > 0 {
self.allReportCategories = categories
print(self.allReportCategories.first?.id)
self.currentStep = 1
} else {
print("No report categories found")
self.dismiss(animated: true, completion: nil)
}
}
Submit Feedbackβ
To submit feedback to Mappls's server you can use saveUserData
function of MapplsSaveUserDataAPIManager
class by using shared instance.
saveUserData
function will accept an object of MapplsSaveUserDataOptions
class.
To create instance of MapplsSaveUserDataOptions user provide following parameters.
Mandatory Parametersβ
- location(String) : It can be either Mappls Pin (The 6-digit alphanumeric code for any location) or coordinate (latitude, longitude) in
string
format. - parentCategory(Integer) : Parent category of the report.
- childCategory (Integer) : Child category of the report.
Optional Parametersβ
- placeName(string) : Name of the place where the event is taking place. It should be derived on the basis of Mappls Pin and coordinates.
- desription(String) : A description about your event. Min length 10 characters and Max length 250 characters.
- subChildCategory(Integer)(Internal) : Sub Child category of the report.
- flag(Integer) : If navroute is active then 1 else 0.
- speed(Integer) : User's speed in kilometers.
- alt(Integer) : Altitude of the userβs location, in meters.
- quality(Integer) : Quality of user's location.
- bearing(Integer) : Bearing of the userβs location, in degrees.
- accuracy(Integer) : Accuracy of user's location.
- utc(Long) : Date time in unix timestamp format.
- expiry(Long) : Date time in unix timestamp format to set expiry for the report.
- zeroId(String) : to be used only incase of NAVIMAPS .
- pushEvent(Boolean)(internal) : to be used only when traffic events are to be pushed back to the traffic event editor. Allowed values: a) true b) false
- appVersion(String) : Version of the app
- osVersionoptional(String) : Version of the os
- deviceName(String) : Name of the device
Swiftβ
let saveOptions = MapplsSaveUserDataOptions(location: "MMI000", parentCategory: parentCategory.id ?? 0, childCategory: childCategory.id ?? 0, description: "This is descriptions", subChildCategory: self.selectedSubChildCategories?.id, accuracy: 3)
MapplsSaveUserDataAPIManager.shared.saveUserData(saveOptions, { (isSucess, error) in
if let error = error {
print(error.localizedDescription)
} else if isSucess {
print("feedback submited successfully")
self.dismiss(animated: true, completion: nil)
} else {
print("No results")
}
})
Mappls Feedback UI Kitβ
A UI control MapplsFeedbackUIKit
is available to use SDK MapplsFeedbackKit. To know more about it see here.