Get apk from here
.
└── instastories
├── Data.kt
├── MainActivity.kt
├── data
│ ├── remote
│ │ ├── StoriesService.kt
│ │ └── injector
│ │ ├── OkHttpClientProvider.kt
│ │ └── RemoteServiceProvider.kt
│ └── repositories
│ └── StoryRepository.kt
├── domain
│ ├── injector
│ │ ├── RepositoryProvider.kt
│ │ └── UseCasesProvider.kt
│ ├── models
│ │ └── Story.kt
│ └── usecases
│ └── GetStoriesRemoteUseCase.kt
├── server
│ └── EmbeddedServer.kt
├── ui
│ ├── features
│ │ ├── AppNavigation.kt
│ │ ├── storiesHome
│ │ │ ├── StoriesScreen.kt
│ │ │ ├── StoryViewModel.kt
│ │ │ └── components
│ │ │ └── CircularUserIcon.kt
│ │ └── storiesPreview
│ │ ├── StoriesPreviewScreen.kt
│ │ ├── StoryPreviewViewModel.kt
│ │ └── component
│ │ ├── AutoScrollIndicator.kt
│ │ ├── AutoScrollingPager.kt
│ │ └── CrossIcon.kt
│ ├── injector
│ │ └── AppInjector.kt
│ └── theme
│ ├── Color.kt
│ ├── Theme.kt
│ └── Type.kt
└── utils
├── Extensions.kt
└── TestTags.kt
The instastories
application follows a structured architecture to ensure modularity and maintainability:
- Data Layer: Manages remote data access via
StoriesService
and repositories likeStoryRepository
, with dependency injection provided byOkHttpClientProvider
andRemoteServiceProvider
. - Domain Layer: Contains core business logic, including use cases such as
GetStoriesRemoteUseCase
, and domain models likeStory
. Dependency injection is handled byRepositoryProvider
andUseCasesProvider
. - Server: Includes
EmbeddedServer
for backend operations. - UI Layer: Composed of feature-specific screens and view models, such as
StoriesScreen
andStoryViewModel
, with UI components and themes. - Utils: Provides extension functions and test tags for enhanced functionality.
Application is small level therefore isnt require complex solutions such as koin or Dagger/hilt,
Implemented manual DI I explain more about it here
In this application, I have embedded a Ktor server within the app itself. It automatically starts in MainActivity
's onCreate
method and stops in onDestroy
. To test it, simply install the application and visit http://localhost:8080/chetan/api/stories from your mobile chrome browser.
You can learn more about Ktor here.
Implement the following features:
- A list of stories should be visible in a smaller view in a horizontally scrollable list.
- The data for stories should be served by a backend API.
- User should be able to start viewing one of the available stories from list.
- Stories should automatically advance to the next one after a set duration (say 5 seconds).
- The user should be able to manually navigate between stories using UI controls. Tapping on the left side of an open story should take
- the user to the previous story. Tapping on the right side of an open story should take the suer to the next story.
- Use animations or transitions for smoother story transitions and UI interactions.
- Performance - stories should load smoothly without any delay from the backend or observable delay in loading of images.
- Tests - Write Integration tests for this feature.
- Caching - Write a service to cache the API response.
- Language: Kotlin
- Framework: Native Android
- Testing Framework: Feel free to use any testing framework of your choice.
- CI/CD Pipelines: use any service of your choice to run tests on every push.