Skip to content

Commit 54b9b2d

Browse files
author
Patrick Jackson
committed
before removing external package.
1 parent 620f672 commit 54b9b2d

File tree

17 files changed

+8
-270
lines changed

17 files changed

+8
-270
lines changed

android/build.gradle

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ dependencies {
8181
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
8282

8383
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
84-
implementation 'com.google.firebase:firebase-core:16.0.8'
85-
implementation 'com.google.firebase:firebase-auth:16.2.1'
86-
implementation 'com.firebaseui:firebase-ui-auth:4.3.2'
8784
debugImplementation 'com.willowtreeapps.hyperion:hyperion-core:0.9.27'
8885
releaseImplementation 'com.willowtreeapps.hyperion:hyperion-core-no-op:0.9.27'
8986
debugImplementation 'com.willowtreeapps.hyperion:hyperion-measurement:0.9.27'

android/src/main/java/com/willowtreeapps/namegame/NameGameApp.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.willowtreeapps.namegame
33
import android.app.Activity
44
import android.app.Application
55
import android.os.Bundle
6-
import com.google.firebase.FirebaseApp
76
import com.willowtreeapps.common.GameEngine
87
import com.willowtreeapps.common.Logger
98
import kotlinx.coroutines.Dispatchers
@@ -17,7 +16,6 @@ class NameGameApp : Application() {
1716

1817
override fun onCreate() {
1918
super.onCreate()
20-
FirebaseApp.initializeApp(this)
2119
instance = this
2220
val navigator = AndroidNavigator()
2321
gameEngine = GameEngine(navigator, this, Dispatchers.IO, Dispatchers.Main)

android/src/main/java/com/willowtreeapps/namegame/store/SettingsDialogFragment.kt

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
package com.willowtreeapps.namegame.store
22

33
import android.Manifest
4-
import android.content.Intent
54
import android.content.pm.PackageManager
65
import android.os.Bundle
76
import android.view.LayoutInflater
87
import android.view.View
98
import android.view.ViewGroup
109
import androidx.core.content.ContextCompat
1110
import androidx.fragment.app.DialogFragment
12-
import com.firebase.ui.auth.AuthUI
13-
import com.google.firebase.auth.FirebaseAuth
1411
import com.willowtreeapps.common.*
1512
import com.willowtreeapps.common.middleware.UiActions
1613
//import com.google.firebase.auth.FirebaseAuth
@@ -53,7 +50,6 @@ class SettingsDialogFragment : DialogFragment(), SettingsView {
5350
dispatch(UiActions.CategoryPicked(newCategory))
5451
}
5552
btn_ok.setOnClickListener { dismiss() }
56-
btn_sign_in.setOnClickListener { launchSignIn() }
5753
switch_mic.setOnCheckedChangeListener { buttonView, isChecked ->
5854
//TODO consider moving this logic somewhere else
5955
if (isChecked) {
@@ -71,16 +67,6 @@ class SettingsDialogFragment : DialogFragment(), SettingsView {
7167
numberPicker.value = viewState.numQuestions
7268
categoryPicker.value = viewState.categoryDisplayValues.indexOf(viewState.categoryId.displayName)
7369
switch_mic.isChecked = viewState.isMicModeEnabled
74-
btn_sign_in.setOnClickListener {
75-
if (viewState.isWillowTree) {
76-
signOut()
77-
} else {
78-
launchSignIn()
79-
}
80-
}
81-
// btn_sign_in.visibility = if (viewState.showSignIn) View.VISIBLE else View.GONE
82-
83-
btn_sign_in.text = viewState.signInBtnText
8470
}
8571

8672
override fun askForMicPermissions() {
@@ -113,30 +99,4 @@ class SettingsDialogFragment : DialogFragment(), SettingsView {
11399
}
114100
}
115101
}
116-
117-
118-
private fun launchSignIn() {
119-
startActivityForResult(
120-
AuthUI.getInstance().createSignInIntentBuilder()
121-
.setAvailableProviders(listOf(AuthUI.IdpConfig.GoogleBuilder().build()))
122-
.build(), 0)
123-
}
124-
125-
private fun signOut() {
126-
AuthUI.getInstance()
127-
.signOut(activity?.applicationContext!!)
128-
.addOnCompleteListener {
129-
dispatch(Actions.WillowTreeSignInSuccessAction())
130-
}
131-
}
132-
133-
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
134-
super.onActivityResult(requestCode, resultCode, data)
135-
if (requestCode == 0) {
136-
val auth = FirebaseAuth.getInstance()
137-
val email = auth.currentUser?.email!!
138-
dispatch(Actions.WillowTreeSignOutSuccessAction())
139-
}
140-
141-
}
142102
}

android/src/main/res/layout/fragment_settings.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
app:layout_constraintTop_toBottomOf="@+id/txt_num_questions"
2121
app:layout_constraintVertical_bias="0.86" />
2222

23-
<Button
24-
android:id="@+id/btn_sign_in"
25-
android:layout_width="wrap_content"
26-
android:layout_height="wrap_content"
27-
android:text="Sign in"
28-
app:layout_constraintBottom_toTopOf="@+id/btn_ok"
29-
app:layout_constraintEnd_toEndOf="parent"
30-
app:layout_constraintStart_toStartOf="parent"
31-
app:layout_constraintTop_toBottomOf="@+id/switch_mic" />
32-
3323
<NumberPicker
3424
android:id="@+id/numberPicker"
3525
android:layout_width="wrap_content"

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ ext {
4747
multiplatformSettingsVersion = '0.3.2'
4848
reduxVersion = '0.2.6'
4949
reduxThunkVersion = '0.2.8'
50-
reduxPresenterMiddlewareVersion = '0.2.7'
50+
reduxPresenterMiddlewareVersion = '0.2.8'
5151
reduxReselectVersion = '0.2.8'
5252
}

common/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ kotlin {
3030
implementation "org.reduxkotlin:redux-kotlin:$reduxVersion"
3131
implementation "org.reduxkotlin:redux-kotlin-thunk:$reduxThunkVersion"
3232
implementation "org.reduxkotlin:redux-kotlin-reselect:$reduxReselectVersion"
33+
implementation "org.reduxkotlin:presenter-middleware:$reduxPresenterMiddlewareVersion"
3334
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
3435

3536

common/src/commonMain/kotlin/com/willowtreeapps/common/Actions.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ sealed class Actions {
2828
data class ChangeCategorySettingsAction(val categoryId: QuestionCategoryId)
2929
data class ChangeMicrophoneModeSettingsAction(val enabled: Boolean)
3030

31-
class WillowTreeSignInSuccessAction
32-
class WillowTreeSignOutSuccessAction
3331
open class ThrottledAction(val waitTimeMs: Long, val thunk: Thunk<AppState>)
3432

3533
}

common/src/commonMain/kotlin/com/willowtreeapps/common/AppState.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,12 @@ data class Item(val id: ItemId,
6868
}
6969

7070
enum class QuestionCategoryId(val displayName: String) {
71-
WILLOW_TREE("WillowTree"),
7271
DOGS("Dogs"),
7372
CATS("Cats");
7473

7574
companion object {
76-
val displayNameListWithWT by lazy {
77-
values().map { it.displayName }
78-
}
7975
val displayNameListWithoutWT by lazy {
80-
values().filter { it != WILLOW_TREE }.map { it.displayName }
76+
values().map { it.displayName }
8177
}
8278

8379
fun fromOrdinal(ordinal: Int) = values()[ordinal]
@@ -88,7 +84,6 @@ enum class QuestionCategoryId(val displayName: String) {
8884

8985
data class UserSettings(val numQuestions: Int,
9086
val categoryId: QuestionCategoryId,
91-
val isWillowTree: Boolean = false,
9287
val microphoneMode: Boolean) {
9388
companion object {
9489
fun defaults() = UserSettings(3,

common/src/commonMain/kotlin/com/willowtreeapps/common/NetworkThunks.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ class NetworkThunks(private val networkContext: CoroutineContext) : CoroutineSco
1919

2020
//TODO cache the repositories
2121
private fun repoForCategory(categoryId: QuestionCategoryId) = when (categoryId) {
22-
QuestionCategoryId.WILLOW_TREE -> ProfileItemRepository()
2322
QuestionCategoryId.CATS -> CatItemRepository()
2423
QuestionCategoryId.DOGS -> DogItemRepository()
2524
}

common/src/commonMain/kotlin/com/willowtreeapps/common/Reducers.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ val reducer: Reducer<AppState> = { state: AppState, action ->
7070
is ChangeMicrophoneModeSettingsAction -> state.copy(settings = state.settings.copy(microphoneMode = action.enabled))
7171
is SettingsLoadedAction -> state.copy(settings = action.settings)
7272

73-
is WillowTreeSignInSuccessAction -> state.copy(settings = state.settings.copy(isWillowTree = true))
74-
is WillowTreeSignOutSuccessAction -> state.copy(settings = state.settings.copy(isWillowTree = false))
7573
is LoadAllSettingsAction -> {
7674
state
7775
}

0 commit comments

Comments
 (0)