Skip to content

Commit f14c043

Browse files
Merge pull request #966 from StepicOrg/release/1.217
Release/1.217
2 parents 8a60892 + fa40c1e commit f14c043

File tree

12 files changed

+89
-38
lines changed

12 files changed

+89
-38
lines changed

app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ dependencies {
215215
implementation libraries.firebaseAppindexing
216216
implementation libraries.googleauth
217217
implementation libraries.firebaseConfig
218-
implementation libraries.firebasePerf
219218

220219
// implementation libraries.facebookSdk
221220
implementation libraries.vkSdk
@@ -256,6 +255,8 @@ dependencies {
256255
androidTestImplementation libraries.espressoCore
257256
androidTestImplementation libraries.espressoContrib
258257
androidTestImplementation libraries.espressoIntents
258+
androidTestImplementation libraries.kaspresso
259+
androidTestImplementation libraries.kaspressoAllure
259260

260261
debugImplementation libraries.soloader
261262
debugImplementation libraries.flipperCore
@@ -277,5 +278,4 @@ afterEvaluate {
277278
apply plugin: 'com.google.gms.google-services'
278279
if (getGradle().getStartParameter().getTaskRequests().toString().contains("Release")) {
279280
apply plugin: 'com.getkeepsafe.dexcount'
280-
}
281-
apply plugin: 'com.google.firebase.firebase-perf'
281+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.stepik.android.view.auth.ui.activity
2+
3+
import androidx.test.ext.junit.rules.ActivityScenarioRule
4+
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
5+
import org.junit.Rule
6+
import org.junit.Test
7+
8+
class AuthSampleTest : TestCase() {
9+
@get:Rule
10+
val activityTestRule = ActivityScenarioRule(SocialAuthActivity::class.java)
11+
12+
@Test
13+
fun test() =
14+
run {
15+
step("Open Social Auth Screen") {
16+
testLogger.d("I am testLogger")
17+
SocialAuthScreen {
18+
signInWithEmailButton {
19+
isVisible()
20+
click()
21+
}
22+
}
23+
}
24+
25+
step("Open Credential Auth Screen") {
26+
CredentialAuthScreen {
27+
loginField.isVisible()
28+
loginField.typeText("test@stepik.org")
29+
passwordField.typeText("stepikthebest")
30+
loginField.hasText("test@stepik.org")
31+
}
32+
}
33+
}
34+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.stepik.android.view.auth.ui.activity
2+
3+
import org.stepic.droid.R
4+
import com.kaspersky.kaspresso.screens.KScreen
5+
import io.github.kakaocup.kakao.edit.KEditText
6+
7+
object CredentialAuthScreen : KScreen<CredentialAuthScreen>() {
8+
override val layoutId: Int = R.layout.activity_auth_credential
9+
override val viewClass: Class<*> = CredentialAuthActivity::class.java
10+
11+
val loginField = KEditText { withId(R.id.loginField) }
12+
val passwordField = KEditText { withId(R.id.passwordField) }
13+
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.stepik.android.view.auth.ui.activity
2+
3+
import com.kaspersky.kaspresso.screens.KScreen
4+
import io.github.kakaocup.kakao.text.KButton
5+
import org.stepic.droid.R
6+
7+
object SocialAuthScreen : KScreen<SocialAuthScreen>() {
8+
9+
override val layoutId: Int = R.layout.activity_auth_social
10+
override val viewClass: Class<*> = SocialAuthActivity::class.java
11+
12+
val signInWithEmailButton = KButton { withId(R.id.signInWithEmail) }
13+
}

app/src/main/java/org/stepic/droid/analytic/AmplitudeAnalytic.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ interface AmplitudeAnalytic {
1313
const val IS_NIGHT_MODE_ENABLED = "is_night_mode_enabled"
1414
const val IS_AR_SUPPORTED = "is_ar_supported"
1515
const val IS_GOOGLE_SERVICES_AVAILABLE = "is_google_services_available"
16+
const val ACCESSIBILITY_FONT_SCALE = "accessibility_font_scale"
17+
const val ACCESSIBILITY_SCREEN_READER_ENABLED = "accessibility_screen_reader_enabled"
1618
}
1719

1820
object Launch {

app/src/main/java/org/stepic/droid/analytic/Analytic.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,6 @@ interface Params {
337337
}
338338
}
339339

340-
interface Traces {
341-
String COURSE_CONTENT_LOADING = "course_content_loading";
342-
String SPLASH_LOADING = "splash_loading";
343-
}
344-
345340
void reportEvent(String eventName, Bundle bundle);
346341

347342
void reportEvent(String eventName, String id);

app/src/main/java/org/stepic/droid/analytic/AnalyticImpl.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import com.yandex.metrica.profile.UserProfile
1818
import org.json.JSONObject
1919
import org.stepic.droid.base.App
2020
import org.stepic.droid.configuration.Config
21-
import org.stepic.droid.configuration.RemoteConfig
2221
import org.stepic.droid.di.AppSingleton
2322
import org.stepic.droid.util.isARSupported
23+
import org.stepic.droid.util.isScreenReaderOn
2424
import org.stepik.android.domain.base.analytic.AnalyticEvent
2525
import org.stepik.android.domain.base.analytic.AnalyticSource
2626
import org.stepik.android.domain.base.analytic.UserProperty
@@ -66,17 +66,23 @@ constructor(
6666
.set(AmplitudeAnalytic.Properties.PUSH_PERMISSION, if (isNotificationsEnabled) "granted" else "not_granted")
6767
.set(AmplitudeAnalytic.Properties.IS_NIGHT_MODE_ENABLED, context.isNightModeEnabled().toString())
6868
.set(AmplitudeAnalytic.Properties.IS_AR_SUPPORTED, context.isARSupported().toString())
69+
.set(AmplitudeAnalytic.Properties.ACCESSIBILITY_FONT_SCALE, context.resources.configuration.fontScale.toString())
70+
.set(AmplitudeAnalytic.Properties.ACCESSIBILITY_SCREEN_READER_ENABLED, context.isScreenReaderOn().toString())
6971
)
7072

7173
updateYandexUserProfile {
7274
apply(Attribute.notificationsEnabled().withValue(isNotificationsEnabled))
7375
apply(Attribute.customBoolean(AmplitudeAnalytic.Properties.IS_NIGHT_MODE_ENABLED).withValue(context.isNightModeEnabled()))
7476
apply(Attribute.customBoolean(AmplitudeAnalytic.Properties.IS_AR_SUPPORTED).withValue(context.isARSupported()))
77+
apply(Attribute.customNumber(AmplitudeAnalytic.Properties.ACCESSIBILITY_FONT_SCALE).withValue(context.resources.configuration.fontScale.toDouble()))
78+
apply(Attribute.customBoolean(AmplitudeAnalytic.Properties.ACCESSIBILITY_SCREEN_READER_ENABLED).withValue(context.isScreenReaderOn()))
7579
}
7680

7781
setFirebaseUserProperty(AmplitudeAnalytic.Properties.PUSH_PERMISSION, if (isNotificationsEnabled) "granted" else "not_granted")
7882
setFirebaseUserProperty(AmplitudeAnalytic.Properties.IS_NIGHT_MODE_ENABLED, context.isNightModeEnabled().toString())
7983
setFirebaseUserProperty(AmplitudeAnalytic.Properties.IS_AR_SUPPORTED, context.isARSupported().toString())
84+
setFirebaseUserProperty(AmplitudeAnalytic.Properties.ACCESSIBILITY_FONT_SCALE, context.resources.configuration.fontScale.toString())
85+
setFirebaseUserProperty(AmplitudeAnalytic.Properties.ACCESSIBILITY_SCREEN_READER_ENABLED, context.isScreenReaderOn().toString())
8086
}
8187

8288
// Amplitude properties

app/src/main/java/org/stepic/droid/core/presenters/SplashPresenter.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package org.stepic.droid.core.presenters
22

33
import android.content.res.Resources
44
import com.google.android.gms.tasks.Tasks
5-
import com.google.firebase.perf.FirebasePerformance
65
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
76
import com.google.firebase.remoteconfig.ktx.get
87
import io.reactivex.Completable
@@ -32,7 +31,6 @@ import org.stepik.android.view.routing.deeplink.BranchDeepLinkParser
3231
import org.stepik.android.view.routing.deeplink.BranchRoute
3332
import org.stepik.android.view.splash.notification.RemindRegistrationNotificationDelegate
3433
import org.stepik.android.view.splash.notification.RetentionNotificationDelegate
35-
import java.util.concurrent.TimeUnit
3634
import javax.inject.Inject
3735

3836
@SplashScope
@@ -73,7 +71,6 @@ constructor(
7371
private var disposable: Disposable? = null
7472

7573
fun onSplashCreated(referringParams: JSONObject? = null) {
76-
val splashLoadingTrace = FirebasePerformance.startTrace(Analytic.Traces.SPLASH_LOADING)
7774
disposable = Completable
7875
.fromCallable {
7976
countNumberOfLaunches()
@@ -94,9 +91,6 @@ constructor(
9491
.andThen(resolveSplashRoute(referringParams))
9592
.subscribeOn(backgroundScheduler)
9693
.observeOn(mainScheduler)
97-
.doFinally {
98-
splashLoadingTrace.stop()
99-
}
10094
.subscribeBy(
10195
onError = emptyOnErrorStub,
10296
onSuccess = {

app/src/main/java/org/stepic/droid/util/ContextExtensions.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
package org.stepic.droid.util
22

3+
import android.accessibilityservice.AccessibilityServiceInfo
34
import android.content.ClipData
45
import android.content.ClipboardManager
56
import android.content.Context
67
import android.content.pm.PackageManager
7-
import android.content.res.Configuration
8-
import android.content.res.Resources
9-
import android.graphics.drawable.Drawable
108
import android.os.Build
119
import android.util.TypedValue
10+
import android.view.accessibility.AccessibilityManager
1211
import android.widget.Toast
1312
import androidx.annotation.AttrRes
1413
import androidx.annotation.ColorInt
15-
import androidx.annotation.DrawableRes
16-
import androidx.appcompat.content.res.AppCompatResources
1714

1815
fun Context.copyTextToClipboard(label: String? = null, textToCopy: String, toastMessage: String) {
1916
val clipboardManager = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
@@ -61,4 +58,9 @@ fun Context.isARSupported(): Boolean =
6158
true
6259
} catch (e : PackageManager.NameNotFoundException) {
6360
false
64-
}
61+
}
62+
63+
fun Context.isScreenReaderOn(): Boolean {
64+
val am = getSystemService(Context.ACCESSIBILITY_SERVICE) as AccessibilityManager
65+
return am.isEnabled && am.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_SPOKEN).isNotEmpty()
66+
}

app/src/main/java/org/stepik/android/domain/course_content/interactor/CourseContentInteractor.kt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package org.stepik.android.domain.course_content.interactor
22

3-
import com.google.firebase.perf.FirebasePerformance
43
import io.reactivex.Observable
54
import io.reactivex.Single
65
import io.reactivex.rxkotlin.Observables
76
import io.reactivex.rxkotlin.Singles.zip
87
import io.reactivex.rxkotlin.toObservable
98
import io.reactivex.schedulers.Schedulers
109
import io.reactivex.subjects.PublishSubject
11-
import org.stepic.droid.analytic.AmplitudeAnalytic
12-
import org.stepic.droid.analytic.Analytic
1310
import ru.nobird.app.core.model.mapToLongArray
1411
import org.stepic.droid.util.plus
1512
import org.stepik.android.domain.base.DataSourceType
@@ -74,21 +71,12 @@ constructor(
7471
private fun getEmptySections(course: Course): Observable<Pair<Course, List<CourseContentItem>>> =
7572
Observable.just(course to emptyList())
7673

77-
private fun getContent(course: Course, items: List<CourseContentItem>, dataSourceType: DataSourceType): Observable<Pair<Course, List<CourseContentItem>>> {
78-
val courseContentLoadingTrace = FirebasePerformance.getInstance().newTrace(Analytic.Traces.COURSE_CONTENT_LOADING)
79-
courseContentLoadingTrace.putAttribute(AmplitudeAnalytic.Course.Params.COURSE, course.id.toString())
80-
courseContentLoadingTrace.putAttribute(AmplitudeAnalytic.Course.Params.SOURCE, dataSourceType.name)
81-
courseContentLoadingTrace.start()
82-
83-
return getSectionsOfCourse(course, dataSourceType)
74+
private fun getContent(course: Course, items: List<CourseContentItem>, dataSourceType: DataSourceType): Observable<Pair<Course, List<CourseContentItem>>> =
75+
getSectionsOfCourse(course, dataSourceType)
8476
.flatMap { populateSections(course, it, items, dataSourceType) }
8577
.flatMapObservable { populatedItems ->
8678
Observable.just(course to populatedItems) + loadUnits(course, populatedItems, dataSourceType)
8779
}
88-
.doOnComplete {
89-
courseContentLoadingTrace.stop()
90-
}
91-
}
9280

9381
private fun getSectionsOfCourse(course: Course, dataSourceType: DataSourceType): Single<List<Section>> =
9482
sectionRepository

0 commit comments

Comments
 (0)