Skip to content

Commit

Permalink
Merge pull request #14 from joaomanaia/math-quiz
Browse files Browse the repository at this point in the history
Maze
Guess number (wordle)
Guess math formula (wordle)
Maze
Guess math solution (multi choice)
Login bug fixed
  • Loading branch information
joaomanaia authored Dec 25, 2022
2 parents 30bafa1 + 99da2d7 commit 792b819
Show file tree
Hide file tree
Showing 133 changed files with 4,636 additions and 200 deletions.
16 changes: 16 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 46 additions & 11 deletions LOGGING_ANALYTICS.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,53 @@
# Logging analytics

## Core logging analytics

| Event name | Triggered when... | Parameters |
|-------------|------------------------------------|-----------------------------------|
| screen_view | This event signifies a screen view | screen_name |
| create_maze | User generates a new maze | seed<br/>item_size<br/>game_modes |

### Parameters

| Parameter name | Description | Type |
|----------------|-----------------------------|--------|
| screen_name | Current screen name | String |
| seed | The seed of the maze | Number |
| item_size | The count of maze questions | Number |
| game_modes | All maze game modes enabled | String |

## Multi choice logging analytics

| Event name | Triggered when... | Parameters |
|-------------------------|------------------------|----------------------------------------------------------------------------------------------------|
| multi_choice_game_start | user starts a new game | multi_choice_questions_size<br/>multi_choice_category<br/>multi_choice_difficulty<br/>maze_item_id |
| multi_choice_game_end | user starts a new game | multi_choice_questions_size<br/>multi_choice_correct_answers<br/>maze_item_id |

### Parameters

| Parameter name | Description | Type |
|------------------------------|------------------------------|--------|
| multi_choice_questions_size | Questions size | Number |
| multi_choice_correct_answers | Correct answers size | Number |
| multi_choice_category | Category for all questions | String |
| multi_choice_difficulty | Difficulty for all questions | String |
| maze_item_id | Item id from maze game mode | String |

## Wordle logging analytics

| Event name | Triggered when... | Parameters |
|-------------------|------------------------|------------------------------------------------------------------------------------------------------------------|
| wordle_game_start | user starts a new game | wordle_word_length<br/>wordle_max_rows<br/>wordle_day (optional) |
| wordle_row_end | user ends the game | wordle_word_length<br/>wordle_max_rows<br/>wordle_last_row<br/>wordle_last_row_correct<br/>wordle_day (optional) |
| Event name | Triggered when... | Parameters |
|-------------------|------------------------|------------------------------------------------------------------------------------------------------------------------|
| wordle_game_start | user starts a new game | wordle_word_length<br/>wordle_max_rows<br/>wordle_day<br/>maze_item_id |
| wordle_row_end | user ends the game | wordle_word_length<br/>wordle_max_rows<br/>wordle_last_row<br/>wordle_last_row_correct<br/>wordle_day<br/>maze_item_id |

### Parameters

| Parameter name | Description | Type |
|-------------------------|----------------------------|--------|
| wordle_word_length | Word length | Number |
| wordle_max_rows | Quiz max rows | Number |
| wordle_day | Wordle day mode: word date | String |
| wordle_last_row | Quiz last row position | Number |
| wordle_last_row_correct | is quiz last row correct | String |
| Parameter name | Description | Type |
|-------------------------|-----------------------------|--------|
| wordle_word_length | Word length | Number |
| wordle_max_rows | Quiz max rows | Number |
| wordle_day | Wordle day mode: word date | String |
| wordle_last_row | Quiz last row position | Number |
| wordle_last_row_correct | Is quiz last row correct | String |
| wordle_quiz_type | Type of wordle quiz | String |
| maze_item_id | Item id from maze game mode | String |
20 changes: 11 additions & 9 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,15 @@ android {
baseline = file("lint-baseline.xml")
}
namespace = "com.infinitepower.newquiz"
}

kotlin {
sourceSets {
debug {
kotlin.srcDir("build/generated/ksp/debug/kotlin")
}
release {
kotlin.srcDir("build/generated/ksp/release/kotlin")
applicationVariants.all {
kotlin.sourceSets {
getByName(name) {
kotlin.srcDir("build/generated/ksp/$name/kotlin")
}
}

addJavaSourceFoldersToModel(File(buildDir, "generated/ksp/${name}/kotlin"))
}
}

Expand Down Expand Up @@ -139,13 +138,14 @@ dependencies {
implementation(Google.firebase.remoteConfigKtx.withVersionPlaceholder())
implementation(Google.firebase.crashlyticsKtx.withVersionPlaceholder())
implementation(Google.firebase.performanceMonitoringKtx.withVersionPlaceholder())
implementation(libs.firebase.appcheck.safetynet)

implementation(KotlinX.datetime)

implementation(libs.play.services.ads)
implementation(libs.user.messaging.platform)

implementation("org.slf4j:slf4j-simple:2.0.4")
implementation(libs.slf4j.simple)

implementation(project(Modules.core))
implementation(project(Modules.model))
Expand All @@ -156,6 +156,8 @@ dependencies {
implementation(project(Modules.data))
implementation(project(Modules.domain))
implementation(project(Modules.onlineServices))
implementation(project(Modules.mathQuiz))
implementation(project(Modules.mazeQuiz))
}

tasks.withType<Test> {
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/java/com/infinitepower/newquiz/NewQuizApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import androidx.core.app.NotificationManagerCompat
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.*
import com.google.android.gms.ads.MobileAds
import com.google.firebase.FirebaseApp
import com.google.firebase.appcheck.FirebaseAppCheck
import com.google.firebase.appcheck.safetynet.SafetyNetAppCheckProviderFactory
import com.google.firebase.ktx.Firebase
import com.google.firebase.remoteconfig.ktx.remoteConfig
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
Expand Down Expand Up @@ -39,6 +42,12 @@ class NewQuizApp : Application(), Configuration.Provider {
//createNotificationChannels()
//createDailyWordleWork()
checkUserDBWork()

FirebaseApp.initializeApp(this)
val firebaseAppCheck = FirebaseAppCheck.getInstance()
firebaseAppCheck.installAppCheckProviderFactory(
SafetyNetAppCheckProviderFactory.getInstance()
)
}

private fun initializeMobileAds() {
Expand All @@ -48,7 +57,7 @@ class NewQuizApp : Application(), Configuration.Provider {
private fun initializeRemoteConfig() {
val remoteConfig = Firebase.remoteConfig

val remoteConfigMinFetchInterval = if (BuildConfig.DEBUG) 0L else TWELVE_HOUR_IN_SECONDS
val remoteConfigMinFetchInterval = 0L //if (BuildConfig.DEBUG) 0L else TWELVE_HOUR_IN_SECONDS
val remoteConfigSettings = remoteConfigSettings {
minimumFetchIntervalInSeconds = remoteConfigMinFetchInterval
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,23 @@ import androidx.navigation.NavHostController
import com.google.android.ump.ConsentInformation
import com.infinitepower.newquiz.core.util.ui.nav_drawer.NavDrawerUtil
import com.infinitepower.newquiz.core.util.ui.nav_drawer.NavDrawerUtilImpl
import com.infinitepower.newquiz.home_presentation.HomeScreen
import com.infinitepower.newquiz.home_presentation.destinations.HomeScreenDestination
import com.infinitepower.newquiz.home_presentation.destinations.LoginScreenDestination
import com.infinitepower.newquiz.math_quiz.list.destinations.MathQuizListScreenDestination
import com.infinitepower.newquiz.maze_quiz.destinations.MazeScreenDestination
import com.infinitepower.newquiz.multi_choice_quiz.destinations.*
import com.infinitepower.newquiz.online_services.ui.profile.destinations.ProfileScreenDestination
import com.infinitepower.newquiz.settings_presentation.destinations.SettingsScreenDestination
import com.infinitepower.newquiz.wordle.destinations.DailyWordSelectorScreenDestination
import com.infinitepower.newquiz.wordle.destinations.WordleListScreenDestination
import com.infinitepower.newquiz.wordle.destinations.WordleScreenDestination
import com.ramcosta.composedestinations.DestinationsNavHost
import com.ramcosta.composedestinations.manualcomposablecalls.composable
import com.ramcosta.composedestinations.navigation.dependency
import com.ramcosta.composedestinations.navigation.navigate
import com.ramcosta.composedestinations.scope.DestinationScope
import com.ramcosta.composedestinations.spec.DestinationSpec
import com.ramcosta.composedestinations.spec.NavGraphSpec
import com.ramcosta.composedestinations.spec.Route
import kotlinx.coroutines.launch

internal data class NavGraph(
override val route: String,
Expand All @@ -52,12 +51,13 @@ internal object AppNavGraphs {
WordleScreenDestination,
WordleListScreenDestination,
DailyWordSelectorScreenDestination,
MultiChoiceQuizScreenDestination,
LoginScreenDestination,
MultiChoiceQuizResultsScreenDestination,
MultiChoiceQuizListScreenDestination,
MultiChoiceCategoriesScreenDestination,
ProfileScreenDestination
ProfileScreenDestination,
MathQuizListScreenDestination,
MazeScreenDestination
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import com.google.firebase.remoteconfig.ktx.remoteConfig
import com.infinitepower.newquiz.core.multi_choice_quiz.MultiChoiceQuizType
import com.infinitepower.newquiz.multi_choice_quiz.destinations.MultiChoiceQuizScreenDestination
import com.infinitepower.newquiz.home_presentation.HomeScreenNavigator
import com.infinitepower.newquiz.maze_quiz.MazeScreenNavigator
import com.infinitepower.newquiz.maze_quiz.destinations.MazeScreenDestination
import com.infinitepower.newquiz.model.maze.MazeQuiz
import com.infinitepower.newquiz.model.multi_choice_quiz.MultiChoiceQuestion
import com.infinitepower.newquiz.multi_choice_quiz.destinations.SavedMultiChoiceQuestionsScreenDestination
import com.infinitepower.newquiz.multi_choice_quiz.saved_questions.SavedQuestionsScreenNavigator
Expand All @@ -15,7 +18,7 @@ import com.ramcosta.composedestinations.navigation.navigate

class CommonNavGraphNavigator(
private val navController: NavController
) : HomeScreenNavigator, SavedQuestionsScreenNavigator {
) : HomeScreenNavigator, SavedQuestionsScreenNavigator, MazeScreenNavigator {
private val remoteConfig by lazy { Firebase.remoteConfig }

override fun navigateToQuickQuiz(initialQuestions: ArrayList<MultiChoiceQuestion>) {
Expand Down Expand Up @@ -50,4 +53,28 @@ class CommonNavGraphNavigator(
override fun navigateToWordle() {
navController.navigate(WordleScreenDestination())
}

override fun navigateToMaze() {
navController.navigate(MazeScreenDestination)
}

override fun navigateToGame(item: MazeQuiz.MazeItem) {
val destination = when (item) {
is MazeQuiz.MazeItem.Wordle -> {
WordleScreenDestination(
word = item.word,
quizType = item.wordleQuizType,
mazeItemId = item.id.toString()
)
}
is MazeQuiz.MazeItem.MultiChoice -> {
MultiChoiceQuizScreenDestination(
initialQuestions = arrayListOf(item.question),
mazeItemId = item.id.toString()
)
}
}

navController.navigate(destination)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.semantics.semantics
import androidx.navigation.NavController
import com.infinitepower.newquiz.core.theme.spacing
import com.infinitepower.newquiz.home_presentation.destinations.HomeScreenDestination
import com.infinitepower.newquiz.math_quiz.list.destinations.MathQuizListScreenDestination
import com.infinitepower.newquiz.multi_choice_quiz.destinations.MultiChoiceQuizListScreenDestination
import com.infinitepower.newquiz.online_services.ui.profile.destinations.ProfileScreenDestination
import com.infinitepower.newquiz.settings_presentation.destinations.SettingsScreenDestination
Expand All @@ -37,14 +38,19 @@ private val navDrawerItems = listOf(
),
NavDrawerItem.Item(
text = CoreR.string.multi_choice_quiz,
icon = Icons.Rounded.Quiz,
icon = Icons.Rounded.ListAlt,
direction = MultiChoiceQuizListScreenDestination
),
NavDrawerItem.Item(
text = CoreR.string.wordle,
icon = Icons.Rounded.Quiz,
icon = Icons.Rounded.Password,
direction = WordleListScreenDestination
),
NavDrawerItem.Item(
text = CoreR.string.math_quiz,
icon = Icons.Rounded.Numbers,
direction = MathQuizListScreenDestination
),
NavDrawerItem.Label(
text = CoreR.string.online,
group = NavDrawerItemGroup("online")
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/round_play_circle_24.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10s10,-4.48 10,-10S17.52,2 12,2zM9.5,14.67V9.33c0,-0.79 0.88,-1.27 1.54,-0.84l4.15,2.67c0.61,0.39 0.61,1.29 0,1.68l-4.15,2.67C10.38,15.94 9.5,15.46 9.5,14.67z"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/xml-v25/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="quick_quiz"
android:enabled="true"
android:icon="@drawable/round_play_circle_24"
android:shortcutShortLabel="@string/maze"
android:shortcutLongLabel="@string/maze">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="com.infinitepower.newquiz"
android:targetClass="com.infinitepower.newquiz.MainActivity"
android:data="newquiz://maze"/>
</shortcut>

<shortcut
android:shortcutId="quick_quiz"
android:enabled="true"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/xml/remote_config_defaults.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,12 @@
<key>user_initial_diamonds</key>
<value>10</value>
</entry>
<entry>
<key>math_quiz_difficulty</key>
<value>easy</value>
</entry>
<entry>
<key>math_quiz_operator_size</key>
<value>1</value>
</entry>
</defaultsMap>
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ buildscript {
}

plugins {
id("com.android.application") version "7.4.0-beta02" apply false
id("com.android.library") version "7.4.0-beta02" apply false
id("org.jetbrains.kotlin.android") apply false
id("com.android.application") version "8.0.0-alpha10" apply false
id("com.android.library") version "8.0.0-alpha10" apply false
id("org.jetbrains.kotlin.android") apply false version "1.7.21"
id("org.jetbrains.kotlin.plugin.serialization") apply false
id("com.google.dagger.hilt.android") apply false
id("com.google.gms.google-services") apply false
id("com.android.dynamic-feature") version "7.4.0-beta02" apply false
id("com.android.dynamic-feature") version "8.0.0-alpha10" apply false
}

tasks.register("clean", Delete::class) {
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/java/Modules.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ object Modules {
const val wordle = ":wordle"
const val translationDynamicFeature = ":translation_dynamic_feature"
const val onlineServices = ":online_services"
const val mathQuiz = ":math-quiz"
const val mazeQuiz = ":maze-quiz"
}
4 changes: 2 additions & 2 deletions buildSrc/src/main/java/ProjectConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ object ProjectConfig {

const val targetSdk = 33

const val versionCode = 4
const val versionCode = 5

const val versionName = "1.2.1"
const val versionName = "1.3.0"
}
Loading

0 comments on commit 792b819

Please sign in to comment.