Skip to content

Commit

Permalink
Merge branch 'release/1.64'
Browse files Browse the repository at this point in the history
  • Loading branch information
eadm committed Jul 25, 2018
2 parents 1808463 + 67d6df6 commit 256a900
Show file tree
Hide file tree
Showing 439 changed files with 3,834 additions and 4,896 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ kapt {

dependencies {
implementation project(':androidsvg')
implementation project(':model')
implementation libraries.kotlinStd

//<DI>
Expand Down Expand Up @@ -138,6 +139,8 @@ dependencies {

implementation libraries.amplitude
implementation libraries.appMetrica
implementation libraries.appsflyer
implementation libraries.installreferrer

implementation libraries.calligraphy
implementation libraries.lottie
Expand Down
10 changes: 10 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@
-keep class com.yandex.metrica.* { *; }
-dontwarn com.yandex.metrica.*

#Install Referrer
-dontwarn com.android.installreferrer
-keep class com.appsflyer.** { *; }
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**

#Keep POJO
-keep class org.stepic.droid.model.** { *; }
-keep interface org.stepic.droid.model.** { *; }
Expand All @@ -89,6 +95,10 @@
-dontwarn org.stepic.droid.web.**
-dontwarn org.stepic.droid.model.**

-keep class org.stepik.android.model.** { *; }
-keep interface org.stepik.android.model.** { *; }
-keep public enum org.stepik.android.**{ *;}

#Keep all enums
-keep public enum org.stepic.droid.**{
*;
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,12 @@
</intent-filter>
</receiver>

<receiver android:name="com.appsflyer.SingleInstallBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<receiver
android:name=".receivers.BootCompletedReceiver"
android:enabled="true"
Expand Down
Binary file modified app/src/main/assets/configs/config.json
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.stepic.droid.adaptive.listeners

import org.stepic.droid.adaptive.model.Reaction
import org.stepik.android.model.adaptive.Reaction

interface AdaptiveReactionListener {
fun createReaction(lessonId: Long, reaction: Reaction)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/org/stepic/droid/adaptive/model/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import io.reactivex.disposables.Disposable
import org.stepic.droid.base.App
import org.stepic.droid.di.qualifiers.BackgroundScheduler
import org.stepic.droid.di.qualifiers.MainScheduler
import org.stepic.droid.model.Attempt
import org.stepic.droid.model.Lesson
import org.stepic.droid.model.Step
import org.stepik.android.model.attempts.Attempt
import org.stepik.android.model.Lesson
import org.stepik.android.model.Step
import org.stepic.droid.web.Api
import javax.inject.Inject

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import android.widget.ImageView
import android.widget.TextView
import kotlinx.android.synthetic.main.adaptive_rating_item.view.*
import org.stepic.droid.R
import org.stepic.droid.adaptive.model.RatingItem
import org.stepik.android.model.adaptive.RatingItem
import org.stepic.droid.preferences.SharedPreferenceHelper

class AdaptiveRatingAdapter (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import android.webkit.WebViewClient
import android.widget.Button
import kotlinx.android.synthetic.main.adaptive_quiz_card_view.view.*
import org.stepic.droid.R
import org.stepic.droid.adaptive.model.Reaction
import org.stepik.android.model.adaptive.Reaction
import org.stepic.droid.adaptive.ui.animations.CardAnimations
import org.stepic.droid.adaptive.ui.custom.CardScrollView
import org.stepic.droid.adaptive.ui.custom.SwipeableLayout
Expand All @@ -19,8 +19,8 @@ import org.stepic.droid.base.App
import org.stepic.droid.core.ScreenManager
import org.stepic.droid.core.presenters.CardPresenter
import org.stepic.droid.core.presenters.contracts.CardView
import org.stepic.droid.model.Step
import org.stepic.droid.model.Submission
import org.stepik.android.model.Step
import org.stepik.android.model.Submission
import org.stepic.droid.ui.custom.LatexSupportableWebView
import org.stepic.droid.ui.quiz.QuizDelegate
import org.stepic.droid.util.compatibilityModeForSDK15
Expand Down Expand Up @@ -155,7 +155,7 @@ class QuizCardViewHolder(
nextButton.visibility = View.VISIBLE
container.isEnabled = true

if (submission.hint.isNotBlank()) {
if (submission.hint?.isNotBlank() == true) {
hint.text = submission.hint
hint.visibility = View.VISIBLE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import org.stepic.droid.R
import org.stepic.droid.adaptive.model.Card
import org.stepic.droid.adaptive.ui.adapters.OnboardingQuizCardsAdapter
import org.stepic.droid.base.FragmentBase
import org.stepic.droid.model.Attempt
import org.stepic.droid.model.Block
import org.stepic.droid.model.Lesson
import org.stepic.droid.model.Step
import org.stepik.android.model.Block
import org.stepik.android.model.Lesson
import org.stepik.android.model.Step
import org.stepic.droid.ui.util.initCenteredToolbar
import org.stepik.android.model.attempts.Attempt

class AdaptiveOnboardingFragment: FragmentBase() {
private val adapter = OnboardingQuizCardsAdapter {
Expand Down Expand Up @@ -42,14 +42,11 @@ class AdaptiveOnboardingFragment: FragmentBase() {
adapter.add(createMockCard(-4, R.string.adaptive_onboarding_card_title_4, R.string.adaptive_onboarding_card_question_4))
}

private fun createMockCard(id: Long, @StringRes title_id: Int, @StringRes question_id: Int) : Card {
val lesson = Lesson()
lesson.title = getString(title_id)
private fun createMockCard(id: Long, @StringRes titleId: Int, @StringRes questionId: Int) : Card {
val lesson = Lesson(title = getString(titleId))

val step = Step()
val block = Block()
block.text = getString(question_id)
step.block = block
val block = Block(text = getString(questionId))
val step = Step(block = block)

return Card(id, 0, lesson, step, Attempt())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import org.stepic.droid.base.App
import org.stepic.droid.base.FragmentBase
import org.stepic.droid.core.presenters.RecommendationsPresenter
import org.stepic.droid.core.presenters.contracts.RecommendationsView
import org.stepic.droid.model.Course
import org.stepik.android.model.Course
import org.stepic.droid.ui.util.PopupHelper
import org.stepic.droid.util.AppConstants
import org.stepic.droid.util.MathUtli
Expand Down Expand Up @@ -59,7 +59,7 @@ class RecommendationsFragment : FragmentBase(), RecommendationsView {

override fun injectComponent() {
App.componentManager()
.adaptiveCourseComponent(course?.courseId ?: 0)
.adaptiveCourseComponent(course?.id ?: 0)
.inject(this)
}

Expand All @@ -81,7 +81,7 @@ class RecommendationsFragment : FragmentBase(), RecommendationsView {
}

toolbar.setOnClickListener {
screenManager.showAdaptiveStats(context, course?.courseId ?: 0)
screenManager.showAdaptiveStats(context, course?.id ?: 0)

expPopupWindow?.let {
if (it.isShowing) {
Expand Down Expand Up @@ -193,7 +193,7 @@ class RecommendationsFragment : FragmentBase(), RecommendationsView {

override fun onReleaseComponent() {
App.componentManager()
.releaseAdaptiveCourseComponent(course?.courseId ?: 0)
.releaseAdaptiveCourseComponent(course?.id ?: 0)
}

override fun onDestroy() {
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/org/stepic/droid/analytic/AnalyticImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import android.os.Bundle
import android.support.v4.app.NotificationManagerCompat
import com.amplitude.api.Amplitude
import com.amplitude.api.Identify
import com.appsflyer.AppsFlyerConversionListener
import com.appsflyer.AppsFlyerLib
import com.crashlytics.android.Crashlytics
import com.google.firebase.analytics.FirebaseAnalytics
import com.yandex.metrica.YandexMetrica
Expand All @@ -33,6 +35,9 @@ class AnalyticImpl
.set(AmplitudeAnalytic.Properties.APPLICATION_ID, context.packageName)
.set(AmplitudeAnalytic.Properties.PUSH_PERMISSION, if (NotificationManagerCompat.from(context).areNotificationsEnabled()) "granted" else "not_granted")
)

AppsFlyerLib.getInstance().init(config.appsFlyerApiKey, null, context.applicationContext)
AppsFlyerLib.getInstance().startTracking(App.application)
}

// Amplitude properties
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/stepic/droid/base/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.stepic.droid.base
import android.app.Application
import android.content.Context
import android.os.StrictMode
import com.appsflyer.AppsFlyerLib
import com.facebook.FacebookSdk
import com.facebook.appevents.AppEventsLogger
import com.squareup.leakcanary.LeakCanary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.stepic.droid.analytic.Analytic;
import org.stepic.droid.core.dropping.contract.DroppingListener;
import org.stepic.droid.core.presenters.PersistentCourseListPresenter;
import org.stepic.droid.model.Course;
import org.stepik.android.model.Course;
import org.stepic.droid.storage.operations.Table;
import org.stepic.droid.ui.fragments.CourseListFragmentBase;
import org.stepic.droid.ui.util.ContextMenuRecyclerView;
Expand Down Expand Up @@ -177,14 +177,14 @@ public void onRefresh() {

@Override
public void onFailDropCourse(@NotNull Course droppedCourse) {
long courseId = droppedCourse.getCourseId();
long courseId = droppedCourse.getId();
getAnalytic().reportEvent(Analytic.Course.DROP_COURSE_FAIL, courseId + "");
Toast.makeText(getContext(), R.string.internet_problem, Toast.LENGTH_LONG).show();
}

@Override
public void onSuccessDropCourse(@NotNull Course droppedCourse) {
long courseId = droppedCourse.getCourseId();
long courseId = droppedCourse.getId();
getAnalytic().reportEvent(Analytic.Course.DROP_COURSE_SUCCESSFUL, courseId + "");
analytic.reportAmplitudeEvent(AmplitudeAnalytic.Course.UNSUBSCRIBED,
MapsKt.mapOf(new Pair<String, Object>(AmplitudeAnalytic.Course.Params.COURSE, courseId)));
Expand All @@ -197,7 +197,7 @@ public void onSuccessDropCourse(@NotNull Course droppedCourse) {
int position = -1;
for (int i = 0; i < courses.size(); i++) {
Course courseItem = courses.get(i);
if (courseItem.getCourseId() == droppedCourse.getCourseId()) {
if (courseItem.getId() == droppedCourse.getId()) {
courseItem.setEnrollment(0);
position = i;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.stepic.droid.core.ScreenManager;
import org.stepic.droid.core.ShareHelper;
import org.stepic.droid.fonts.FontsProvider;
import org.stepic.droid.model.Course;
import org.stepik.android.model.Course;
import org.stepic.droid.notifications.StepikNotificationManager;
import org.stepic.droid.preferences.SharedPreferenceHelper;
import org.stepic.droid.preferences.UserPreferences;
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/org/stepic/droid/base/StepBaseFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import org.stepic.droid.core.presenters.RouteStepPresenter;
import org.stepic.droid.core.presenters.contracts.AnonymousView;
import org.stepic.droid.core.presenters.contracts.RouteStepView;
import org.stepic.droid.model.Lesson;
import org.stepic.droid.model.Section;
import org.stepic.droid.model.Step;
import org.stepic.droid.model.Unit;
import org.stepik.android.model.Lesson;
import org.stepik.android.model.Section;
import org.stepik.android.model.Step;
import org.stepik.android.model.Unit;
import org.stepic.droid.storage.operations.DatabaseFacade;
import org.stepic.droid.ui.custom.LatexSupportableEnhancedFrameLayout;
import org.stepic.droid.ui.dialogs.LoadingProgressDialogFragment;
Expand Down Expand Up @@ -177,7 +177,7 @@ public void onClick(View v) {
}

private void updateCommentState() {
if (step != null && step.getDiscussion_proxy() != null) {
if (step != null && step.getDiscussionProxy() != null) {
showComment();
} else {
textForComment.setVisibility(View.GONE);
Expand All @@ -189,18 +189,18 @@ private void showComment() {
textForComment.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int discussionCount = step.getDiscussions_count();
int discussionCount = step.getDiscussionsCount();
getAnalytic().reportEvent(Analytic.Comments.OPEN_FROM_STEP_UI);

if (discussionCount == 0) {
getScreenManager().openComments(getActivity(), step.getDiscussion_proxy(), step.getId(), true); //show new form, but in back stack comment oldList is exist.
getScreenManager().openComments(getActivity(), step.getDiscussionProxy(), step.getId(), true); //show new form, but in back stack comment oldList is exist.
} else {
getScreenManager().openComments(getActivity(), step.getDiscussion_proxy(), step.getId());
getScreenManager().openComments(getActivity(), step.getDiscussionProxy(), step.getId());
}
}
});

int discussionCount = step.getDiscussions_count();
int discussionCount = step.getDiscussionsCount();
if (discussionCount > 0) {
textForComment.setText(App.Companion.getAppContext().getResources().getQuantityString(R.plurals.open_comments, discussionCount, discussionCount));
} else {
Expand Down Expand Up @@ -243,8 +243,8 @@ public void onDestroyView() {

public void onDiscussionWasUpdatedFromInternet(Step updatedStep) {
if (updatedStep.getId() == step.getId()) {
step.setDiscussion_proxy(updatedStep.getDiscussion_proxy()); //fixme do it in immutable way
step.setDiscussions_count(updatedStep.getDiscussions_count());
step.setDiscussionProxy(updatedStep.getDiscussionProxy()); //fixme do it in immutable way
step.setDiscussionsCount(updatedStep.getDiscussionsCount());
updateCommentState();
}
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/org/stepic/droid/configuration/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ public interface Config {

String getAmplitudeApiKey();

String getAppsFlyerApiKey();

boolean isAppInStore();
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private constructor() : Config {
private val csrfCookieName: String? = null
private val sessionCookieName: String? = null
private val amplitudeApiKey: String? = null
private val appsflyerApiKey: String? = null
private val isAppInStore: Boolean = false

override fun getOAuthClientId(type: Api.TokenType) = when (type) {
Expand Down Expand Up @@ -93,4 +94,6 @@ private constructor() : Config {
override fun isAppInStore() = isAppInStore

override fun getAmplitudeApiKey() = amplitudeApiKey

override fun getAppsFlyerApiKey() = appsflyerApiKey
}
Loading

0 comments on commit 256a900

Please sign in to comment.