shayokh144 / ic-survey-swiftui-combine Goto Github PK
View Code? Open in Web Editor NEWThe goal of this project is to use swiftui and combie to develop a survey app in iOS.
License: MIT License
The goal of this project is to use swiftui and combie to develop a survey app in iOS.
License: MIT License
At the final step, logged in users must be able to submit their responses. The mobile app must show the Submit button instead of the Next button to inform users that the app will submit their response on the next action.
Call POST /api/v1/responses
endpoint with the following body:
{
"survey_id": "{{survey-id}}",
"questions": [
{{question-id-with-answers}},
...
]
}
For question-id-with-answers, there are two possible types of this data structure:
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{answer-id}}"
}
]
}
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{answer-id}}",
"answer": "{{answer}}"
}
]
}
As users can sign in, the app must have an option for users to sign out. Signing out should completely remove any account-related footprints of the user.
Call POST /api/v1/oauth/revoke
to sign out with the following body:
{
"token": "{{user_access_token}}",
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}"
}
At the final step, logged in users must be able to submit their responses.
Upon tapping the Submit button, perform the Submit Survey Response request with the survey id and the user's answers.
If the request is successful,
Otherwise, display the error message on a modal alert dialog with an OK button
Write unit test
Need to integrate login api.
For Star Rating questions, users can rate their satisfaction by tapping on the star emoji.
For Star Rating questions,
Logged in users can see their account's name and avatar. The account menu will serve as the navigation for account-related options for users to manage their account
When a user happens to forget his/her password, the app should offers a way to recover it through the Forget Password feature.
So, in the Login screen, we will display the Forgot Password button to begin the flow to reset his/her password.
forget password
take the user to forget password
screenWhen the Reset button is tapped, call the reset password request with the email in the Email text input.
ok
button to dismiss. The text will be: Whoops, it seems the email is incorrect. Please check and try again.
Otherwise, Display a modal alert dialog with the returned error message with an OK button
Write unit test
Need to setup splash screen
For thumbs up rating questions, users can rate their satisfaction by tapping on the 👍 emoji.
For thumbs up Rating questions,
Need to automatically refresh my access token when it expired.
Automatically use a refresh token to renew an access token when it expired.
If fail then log the user out
Write unit test to verify the behaviour
As our API will send the reset password instructions to the email that a user signed in with, the app should instruct the user to go check their email inbox once the email is successfully sent.
We've sent you instructions to reset your password.
Need to fetch surveys list from API.
/api/v1/surveys
with the following query parameters:page[number]: 1
page[size]: 10
For Heart Rating questions, users can rate their satisfaction by tapping on the heart emoji. This works like a normal rating from 1-5 stars question, but we will use heart emojis instead of stars
For Heart Rating questions,
As users can sign in, the app must have an option for users to sign out. Signing out should completely remove any account-related footprints of the user.
When a user confirms to log out, perform the Logout request.
If the request is successful,
Otherwise, display the error message on a native modal dialog with an OK button.
When a user selects Cancel
, do nothing.
Write unit test
Need to show survey home page after login success so that users can navigate through a list of surveys that they can take. The mobile app will show the basic info of survey as they scroll through each survey.
Use the survey cover image as the background image
Append l to the image url to get the high-resolution image
For the date label, show the survey's created_at.
Today
on the second lineUse the survey title as the title label
Use the survey description as the description label
The number of page indicators must match with the number of surveys
Don't ad any code for user icon
behaviour
Write unit test to make sure all functionalities are working perfectly
Logged in users can see their account's name and avatar. The account menu will serve as the navigation for account-related options for users to manage their account
Need to setup swiftui project.
Debug
, Staging
, Production
Logged in users must be able to see survey questions after clicking on Start survey
button.
X
button to quit the survey at top-right cornerWhen a user happens to forget his/her password, the app should offers a way to recover it through the Forget Password feature.
So, in the Login screen, we will display the Forgot Password button to begin the flow to reset his/her password.
At the final step, users must be able to submit their responses. The mobile app must show the Submit button instead of the Next button to inform users that the app will submit their response on the next action.
Need to write unit test for login flow.
Logged in users can see their account's name and avatar. The account menu will serve as the navigation for account-related options for users to manage their account.
Use the avatar url as the image url of the Account button
In the side menu,
If the avatar url is invalid or null, use the placeholder image (grey circle)
Write unit test
As our API will send the reset password instructions to the email that a user signed in with, the app should instruct the user to go check their email inbox once the email is successfully sent.
When showing an in-app notification to inform the user of the reset password email,
For NPS rating questions, users can rate their satisfaction by tapping on the number.
For NPS Rating questions,
Not likely att all
and Extremely likely
in left aligned and right aligned positionsLogged in users must be able to see survey questions after clicking on Start survey
button.
X
button to quit the survey at top-right cornerWhen a Question model has display_type
as dropdown,
When a Question model has display_type
as smiley
,
When a Question model has display_type
as heart
,
When a Question model has display_type
as star
,
For type thumbs up or other emoji follow star rating system
When a Question model has display_type
as nps
,
When a Question model has display_type
as choice
AND
pick
as one
,
When a Question model has display_type
as choice
AND
pick
as any,
When a Question model has display_type
as outro
or intro
,
When a Question model has display_type
as textarea
,
When a Question model has display_type
as textfield
,
Display a textfield question
Use the answers to show as textfields
Apply the answer's text as its textfield placeholder
Write unit test to test the behaviour
When a user happens to forget his/her password, the app should offers a way to recover it through the Forget Password feature.
So, in the Login screen, we will display the Forgot Password button to begin the flow to reset his/her password.
Call POST /api/v1/passwords
to send the reset password instructions with the following body:
{
"user": {
"email": "{{email}}"
},
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}"
}
As users can sign in, the app must have an option for users to sign out. Signing out should completely remove any account-related footprints of the user.
Need to show survey home page after login success as users should be able to see the full preview of the details so that they can decide whether or not the survey matching their expectation.
Need to setup CI.
Github Action
CI for each pull request action.fastlane
Need to create login screen according to Figma
nimble
logoNeed to Implement horizontal pull to refresh in survey home page because user can load new list of survey by pulling at the end of the current item.
Fetch list of surveys when pull to refresh event occurs
Show list of new surveys
The navigation indicator dots must be dynamic and based on the API response
After successful request cache the surveys list onto device
After unsuccessful request show error popup
Map the new survey data into UI based on this issue
Write unit test to make sure all cases are working fine
Need to show lazy loading view before survey appears.
Need to setup CD to deploy IPA into firebase.
fastlane
and github action
Need to setup automatically refresh my access token system when it expired.
{
"grant_type": "refresh_token",
"refresh_token": {{refresh_token}},
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}"
}
-After successful request, update an access and a refresh token in local storage.
When a logged in user decides to start taking a survey, the mobile app should retrieve the survey's questionnaires by fetching the whole survey details.
Add Start Survey
button action following below rules,
Perform the Survey Details request with the survey id
Change the Start Survey button to the loading state when the request is ongoing
Change the Start Survey button to the idle state when the request is completed
Write unit test to verify the behaviour
For dropdown questions, users can select their answer from multiple options.
When a Question model has display_type as dropdown,
For Smile rating questions, users can rate their satisfaction by tapping on the 😊 emoji.
For smile Rating questions,
Need to Implement horizontal pull to refresh in survey home page because user can load new list of survey by pulling at the end of the current item.
Choice questions allow users to pick the most suitable option to answer since the mobile app will lay out all the options.
For choice questions,
There are two No-action questions; Intro and Outro. They serve as an instructive question or appreciative question. These types of question does not require any action apart from proceeding to the next question.
For No-action questions,
A text-area question type is a question type that allows a user to fill in a multi-line text input. It is commonly used when we would like to ask an open-end question, such as asking for suggestions or comments.
For text-area questions,
For textfield questions,
When a logged in user decides to start taking a survey, the mobile app should show survey details.
no maximum number of lines
Start Survey
buttonOK
buttonLogged in users must be able to answer survey questions after clicking on Start survey button.
When tapping the Next button (or the Submit button) on a Dropdown question, store the currently selected option.
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-id}}"
}
]
}
When tapping the Next button (or the Submit button) on a Smiley Rating question, store the currently selected option,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-id}}"
}
]
}
When tapping the Next button (or the Submit button) on a Heart Rating question, store the currently selected option,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-id}}"
}
]
}
When tapping the Next button (or the Submit button) on a Star Rating question, store the currently selected option,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-id}}"
}
]
}
When tapping the Next button (or the Submit button) on n NPS question, store the currently selected option,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-id}}"
}
]
}
When tapping the Next button (or the Submit button) on a Single-choice question, store the currently selected option,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-id}}"
}
]
}
When tapping the Next button (or the Submit button) on a Multiple-choice question, store the currently selected option(s),
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{selected-answer-1-id}}"
},
{
"id: "{{selected-answer-2-id}}"
},
...
]
}
When tapping the Next button (or the Submit button) on a text-area question, store the user's answer,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{first-answer-id}}",
"answer": "{{text-input}}"
}
]
}
When tapping the Next button (or the Submit button) on a textfield question, store the user's answer,
{
"id": "{{question-id}}",
"answers": [
{
"id": "{{first-answer-id}}",
"answer": "{{first-answer-text-input}}"
},
{
"id": "{{second-answer-id}}",
"answer": "{{second-answer-text-input}}"
},
...
]
}
Need to show thank you page after successful survey submission
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.