Skip to content

Commit

Permalink
challeng to be only in october
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 committed Oct 30, 2024
1 parent f31b982 commit 54b70c6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ import org.ole.planet.myplanet.utilities.MarkdownDialog
import org.ole.planet.myplanet.utilities.TimeUtils.formatDate
import org.ole.planet.myplanet.utilities.Utilities
import org.ole.planet.myplanet.utilities.Utilities.toast
import java.time.LocalDate
import java.time.temporal.ChronoUnit
import java.util.Calendar
import java.util.Date
import java.util.UUID
import kotlin.math.ceil
Expand Down Expand Up @@ -233,20 +236,29 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
}
})

if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_LEARNING_URL}") {
challengeDialog()
val calendar = Calendar.getInstance()
val currentMonth = calendar.get(Calendar.MONTH)

if (currentMonth == Calendar.OCTOBER) {
if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_LEARNING_URL}") {
val today = LocalDate.now()
val endOfMonth = today.withDayOfMonth(today.lengthOfMonth())
val remainingDays = ChronoUnit.DAYS.between(today, endOfMonth).toInt()

challengeDialog(remainingDays)
}
}
}

private fun challengeDialog() {
private fun challengeDialog(remainingDays: Int) {
val markdownContent = """
## myPlanet issues challenge
![issues challenge](file:///android_asset/images/github-filter-issues.png)
get ready for virtual intern github issues challenge!
**duration:** 30 days
**duration:** $remainingDays days remaining
## steps to participate:
- Find an issue on myPlanet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ import org.ole.planet.myplanet.utilities.MarkdownDialog
import org.ole.planet.myplanet.utilities.TimeUtils.formatDate
import org.ole.planet.myplanet.utilities.Utilities
import org.ole.planet.myplanet.utilities.Utilities.toast
import java.time.LocalDate
import java.time.temporal.ChronoUnit
import java.util.Calendar
import java.util.Date
import java.util.UUID
import kotlin.math.ceil
Expand Down Expand Up @@ -233,20 +236,29 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
}
})

if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_LEARNING_URL}") {
challengeDialog()
val calendar = Calendar.getInstance()
val currentMonth = calendar.get(Calendar.MONTH)

if (currentMonth == Calendar.OCTOBER) {
if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_LEARNING_URL}") {
val today = LocalDate.now()
val endOfMonth = today.withDayOfMonth(today.lengthOfMonth())
val remainingDays = ChronoUnit.DAYS.between(today, endOfMonth).toInt()

challengeDialog(remainingDays)
}
}
}

private fun challengeDialog() {
private fun challengeDialog(remainingDays: Int) {
val markdownContent = """
## myPlanet issues challenge

![issues challenge](file:///android_asset/images/github-filter-issues.png)

get ready for virtual intern github issues challenge!

**duration:** 30 days
**duration:** $remainingDays days remaining

## steps to participate:
- Find an issue on myPlanet
Expand Down

0 comments on commit 54b70c6

Please sign in to comment.