Please enable JavaScript.
Coggle requires JavaScript to display documents.
Pipipek - Feature's Follow - Coggle Diagram
Pipipek - Feature's Follow
Login
Step1:
User input phone number and touch LogIn Button,
The app call API requestAuthOtp, the server will send Otp to user phone number if phone number already registered or throw error
The present will handle result. If success, it will show success msg on UI and show Otp form. Otherwise, if the error is DriverNotFound, it will show Download App Driver form or return UnknownError
Step2:
User input Otp code in the expire time, touch Confirm Button.
The app call API validateAuthOtp, the server will return validate Auth Otp info or error
If success, present save info driver, device into memento, save authentication info into ApiProvider and navigate to ad screen
If error, show error dialog
Show Ad
Download ad info from server in RepositoryProvider
In the class, it has 2 subject of list campaigns and list ads.
When init variable, it will get data cache in Memento to 2 subject
It runs init function when start it's an instance in the module class
In the init function, if GeoProvider trigger location area, it will call API to download campaigns & ads
When UI ready, the service manager starts running and it start download list campaigns and list ads.
The app called to the server to download ads, it will put longitude, the latitude of location, and radius = 100
The result from server: If success, the app will convert data to list campaigns and list ads and save them into Memento. Otherwise, app will report an error to Sentry
Ad Display
Live Ad Display
It used in AdMvpPresent class
It has LiveAdView reference, and must find ad. After find ad, it call view stop current ad and show next ad.
In the LiveAdDisplayImpl, it get view show Ad from present class. When all permissions accepted and view is ready, this class will get LiveAdView
In the init function, it get LiveAdConfig or trigger has trip, or has schedule Ad, it will find ad to show
Find an ad to show:
If ScheduleAdProvider has schedule ad or (has a trip active or not require has trip), it will pop ad from the queue in ScheduleAdProvide. Otherwise, it will get list idle ads image to show
After it get an ad, it will call view to show the ad and start observable delay time (time to show ad). If delay time, it will call view stop ad, and continue get ad available to show.
Show Ad in Activity
The view has an ad to show
In layout, we has 2 views to show image/video/HTML ad, called it is BgView and LiveView. And LiveView will show ad to user.
When get ad to show, it will wrap 2 view LiveView and BgView to BgView show current ad to user and LiveAd free. After, LiveAd will get new ad to show. The app use fade animation, to old ad fade out and new add fade in and show to user.
In activity, it capture StopPreviousAd, StopCurrentAd.
When the layout get a next ad, it will stop the current ad. The StopPreviousAd is CurrentAd, StopCurentAd = next ad.
The view will stop the ad in StopPreviousAd, after it call to show next Ad
ScheduleAdProvider
Download list ads and provide ad to LiveAdDisplay to show into view
Download Ads
All ads download success, it will be added to adQueue
List ads get from Memento and from server
If list ads from server, it will updated into Memento
Process list new ads:
Create list change set of list old ads and new ads
Update list new ads into memento
If list change set doesn't has any changes, it won't do any thing
If list change set has changes, it has more process below
Process has changes between list new ads and old ads:
Clear download failed queue
Pause observable list ads and scheduler config
Process ads by type ad:
Create change set base on type ad and convert to list schedule Ad
If change set has removed list, it will remove list removed ads out adQueue, scheduleQueue, downloadQueue, cacheManager
If change set has update list, it will remove updated list out adQueue, scheduleAdQueue, downloadQueue and add it to downloadQueue to download new update ad
If change set has list added ads, it will add ads into downloadQueue
Download Ads:
Get ad from downloadQueue and download it
If download ad success, the ad will be added into adQueue and emit item to action filter schedule Ad
If download fail, it will remove ad out cacheManage and add it into downloadFailQueue
Filter Schedule Ad
The result will be got to show in view
Get list campaigns from Memento
Get all items in AdQueue
Check every ad in AdQueue, if ad in area, in time running, demo graphic (gender), target age of campaign, it will be added to ScheduleAdQueue
If ad is not match with condition of campaign, remove it out ScheduleAdQueue
Finally, notify has schedule Ad to LiveAdDisplay to show Ad into view
Analytic
When ad displayed in LiveAdDisplay, it will notify to analyticService.
The ad displayed will be added to list Ads in service. Check if number of ads >= 100, it will report stats to server
When trip end, it will send stats to server
Convert list ads to stats
Foreach list ads a to get location data, time start and end ad display
Foreach list passengers, create passengerDto info and stats object by passenger