@startuml
skinparam activityFontSize 10
skinparam activityFontName Helvetica
title NOTIFICATION MODE

(*) --> "Application start"
if "Pending reports ?" then
	-->[false] "Start Main Activity"
else
	-->[true] === S1 ===
	--> "Send silent or \napproved reports"
	=== S1 === if "Delete Unapproved ?" then
		-->[true] "Delete unapproved \nreports"
		note right
			We have to keep the latest report
			because it may be related to a
			previously sent and still existing
			notification.
		end note
		"Delete unapproved \nreports" --> "Start Main Activity" 
	else
		-->[false] === S3 ===
		--> "Send Notification"
		=== S3 === --> "Start Main Activity"
		
	endif
	
endif
--> "Activities running"
"Activities running" -left->[Exception] "Display Crash Toast"
--> === S4 ===
--> "Send Notification"
=== S4 === -up-> "Kill Application"
--> "Application start"
"Application start" -->[User activates \nnotification] "Display report \ndialog"
"Activities running" -right->[User activates \nnotification] "Display report \ndialog"
if "User accepts?" then
	-->[true] === S2 ===
	--> "Attach comment \nto report"
	--> "Send reports"
	=== S2 === --> "Display thanks Toast"
	=== S2 === --> "Activities running"
else
	-->[false] "Delete pending reports"
	--> "Activities running"
endif
@enduml

@startuml
title TOAST MODE

(*) --> "Application start"
if "Pending reports ?" then
	-->[false] (*)
else
	-->[true] "Send all reports"
	--> (*) 
endif
@enduml

