Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update lib #8

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,15 @@ dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'org.mockito:mockito-android:2.7.19'

configurations.all {
exclude group: 'com.facebook.fresco', module: 'animated-gif'
exclude group: 'com.facebook.yoga', module: 'yoga'
exclude group: 'com.facebook.infer.annotation', module: 'infer-annotation'
resolutionStrategy.force 'com.google.code.findbugs:jsr305:2.0.1'

}


Expand Down
5 changes: 0 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@

<activity
android:name=".ui.login.view.LoginActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Translucent.Overlap.Login" />

<activity
android:name=".ui.login.view.FacebookActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Translucent" />

<activity
android:name=".ui.login.view.TwitterActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Translucent" />

<activity
Expand Down Expand Up @@ -109,7 +106,6 @@

<activity
android:name=".ui.productdetail.view.ProductDetailActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Translucent.Overlap" />

<activity
Expand Down Expand Up @@ -174,7 +170,6 @@

<activity
android:name=".ui.noti.view.NotificationActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />

<activity
Expand Down
1,983 changes: 1,000 additions & 983 deletions app/src/main/assets/react/ask/index.android.bundle

Large diffs are not rendered by default.

1,773 changes: 889 additions & 884 deletions app/src/main/assets/react/jobs/index.android.bundle

Large diffs are not rendered by default.

1,769 changes: 887 additions & 882 deletions app/src/main/assets/react/live/index.android.bundle

Large diffs are not rendered by default.

1,809 changes: 907 additions & 902 deletions app/src/main/assets/react/meetups/index.android.bundle

Large diffs are not rendered by default.

1,979 changes: 998 additions & 981 deletions app/src/main/assets/react/newsletter/index.android.bundle

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions app/src/main/java/com/ctech/eaty/annotation/ConnectionType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package com.ctech.eaty.annotation
import android.net.ConnectivityManager
import android.support.annotation.IntDef

const val WIFI = ConnectivityManager.TYPE_WIFI.toLong()
const val MOBILE = ConnectivityManager.TYPE_MOBILE.toLong()
const val NONE = -1L
const val WIFI = ConnectivityManager.TYPE_WIFI
const val MOBILE = ConnectivityManager.TYPE_MOBILE
const val NONE = -1

@Retention(AnnotationRetention.SOURCE)
@IntDef(WIFI, MOBILE, NONE)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/ctech/eaty/annotation/Lightness.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.ctech.eaty.annotation

import android.support.annotation.IntDef

const val IS_LIGHT = 0L
const val IS_DARK = 1L
const val LIGHTNESS_UNKNOWN = 2L
const val IS_LIGHT = 0
const val IS_DARK = 1
const val LIGHTNESS_UNKNOWN = 2

@Retention(AnnotationRetention.SOURCE)
@IntDef(IS_LIGHT, IS_DARK, LIGHTNESS_UNKNOWN)
Expand Down
14 changes: 8 additions & 6 deletions app/src/main/java/com/ctech/eaty/di/StoreModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ import okio.BufferedSource
@Module
class StoreModule {

private val PRODUCT_LIMIT = 10
private val COMMENT_LIMIT = 10
private val COLLECTION_LIMIT = 10
private val TOPIC_LIMIT = 10
private val VOTE_LIMIT = 10
private val SEARCH_LIMIT = 10
companion object {
private const val PRODUCT_LIMIT = 10
private const val COMMENT_LIMIT = 10
private const val COLLECTION_LIMIT = 10
private const val TOPIC_LIMIT = 10
private const val VOTE_LIMIT = 10
private const val SEARCH_LIMIT = 10
}

@Provides
fun providerRealmPersister(): Persister<ProductResponse, BarCode> {
Expand Down
18 changes: 8 additions & 10 deletions app/src/main/java/com/ctech/eaty/linking/UniversalLinkActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.support.v7.app.AppCompatActivity
import com.ctech.eaty.R
import com.ctech.eaty.di.Injectable
import com.uber.autodispose.android.lifecycle.AndroidLifecycleScopeProvider
import com.uber.autodispose.kotlin.autoDisposeWith
import com.uber.autodispose.kotlin.autoDisposable
import timber.log.Timber
import javax.inject.Inject

Expand All @@ -31,15 +31,13 @@ class UniversalLinkActivity : AppCompatActivity(), Injectable {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_loading)
universalLinkDispatcher.dispatch(intent.dataString)
.autoDisposeWith(AndroidLifecycleScopeProvider.from(this))
.subscribe(
{
finish()
},
{
Timber.e(it)
finish()
})
.autoDisposable(AndroidLifecycleScopeProvider.from(this))
.subscribe({
finish()
}, {
Timber.e(it)
finish()
})
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import com.google.firebase.messaging.RemoteMessage

class AppFirebaseMessagingService : FirebaseMessagingService() {

companion object {
private const val KEY_URL = "url"

private val KEY_URL = "url"
}

override fun onMessageReceived(remoteMessage: RemoteMessage?) {

Expand All @@ -33,8 +35,8 @@ class AppFirebaseMessagingService : FirebaseMessagingService() {
val defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
val notificationBuilder = NotificationCompat.Builder(this, channelId)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(message.notification.title)
.setContentText(message.notification.body)
.setContentTitle(message.notification?.title)
.setContentText(message.notification?.body)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setContentIntent(pendingIntent)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
package com.ctech.eaty.network.adapter

import com.apollographql.apollo.CustomTypeAdapter
import com.apollographql.apollo.response.CustomTypeAdapter
import com.apollographql.apollo.response.CustomTypeValue
import org.joda.time.DateTime
import org.joda.time.format.ISODateTimeFormat


object ApolloTypedAdapterFactory {


val TYPED_JSON: CustomTypeAdapter<String> = object : CustomTypeAdapter<String> {
override fun decode(value: String): String {
return value
override fun decode(value: CustomTypeValue<*>): String {
return value.value as String
}

override fun encode(value: String): String {
return value

override fun encode(value: String): CustomTypeValue<*> {
return CustomTypeValue.GraphQLString(value)
}
}


val TYPED_DATE_TIME: CustomTypeAdapter<DateTime> = object : CustomTypeAdapter<DateTime> {
override fun decode(value: String): DateTime {
override fun decode(value: CustomTypeValue<*>): DateTime {
val fmt = ISODateTimeFormat.dateTimeParser()
return fmt.parseDateTime(value)
return fmt.parseDateTime(value.value as String)
}

override fun encode(value: DateTime): String {

override fun encode(value: DateTime): CustomTypeValue<*> {
val fmt = ISODateTimeFormat.dateTime()
return fmt.print(value)
return CustomTypeValue.GraphQLString(fmt.print(value))
}
}

Expand Down
45 changes: 24 additions & 21 deletions app/src/main/java/com/ctech/eaty/player/ExoMediaController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ package com.ctech.eaty.player
import android.app.Activity
import android.net.Uri
import android.os.Handler
import android.util.Log
import android.view.View
import com.ctech.eaty.R
import com.ctech.eaty.util.EventLogger
import com.google.android.exoplayer2.C
import com.google.android.exoplayer2.ExoPlayerFactory
import com.google.android.exoplayer2.SimpleExoPlayer
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory
import com.google.android.exoplayer2.source.ExtractorMediaSource
import com.google.android.exoplayer2.source.MediaSource
import com.google.android.exoplayer2.source.dash.DashMediaSource
Expand All @@ -19,26 +17,33 @@ import com.google.android.exoplayer2.source.smoothstreaming.DefaultSsChunkSource
import com.google.android.exoplayer2.source.smoothstreaming.SsMediaSource
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector
import com.google.android.exoplayer2.ui.SimpleExoPlayerView
import com.google.android.exoplayer2.upstream.*
import com.google.android.exoplayer2.ui.PlayerView
import com.google.android.exoplayer2.upstream.DataSource
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory
import com.google.android.exoplayer2.upstream.HttpDataSource
import com.google.android.exoplayer2.util.Util
import io.reactivex.Completable

class ExoMediaController(private val context: Activity) : MediaController<SimpleExoPlayerView> {
class ExoMediaController(private val context: Activity) : MediaController<PlayerView> {

private var player: SimpleExoPlayer
private val bandwidthMeter = DefaultBandwidthMeter()
private val mediaDataSourceFactory: DataSource.Factory = buildDataSourceFactory(bandwidthMeter)
private val mainHandler: Handler
private val eventLogger: EventLogger
private var currentTrackUri = Uri.EMPTY
private var manifestDataSourceFactory: DataSource.Factory? = null

init {
val trackSelectionFactory = AdaptiveTrackSelection.Factory(bandwidthMeter)
val trackSelector = DefaultTrackSelector(trackSelectionFactory)
player = ExoPlayerFactory.newSimpleInstance(context, trackSelector)
mainHandler = Handler()
eventLogger = EventLogger(trackSelector)
manifestDataSourceFactory = DefaultDataSourceFactory(
context, Util.getUserAgent(context, context.getString(R.string.app_name)))
}

override fun play(uri: Uri): Completable {
Expand Down Expand Up @@ -73,29 +78,27 @@ class ExoMediaController(private val context: Activity) : MediaController<Simple
player.release()
}

override fun takeView(view: SimpleExoPlayerView) {
override fun takeView(view: PlayerView) {

}

private fun buildMediaSource(uri: Uri): MediaSource {
val type = Util.inferContentType(uri)
@C.ContentType val type = Util.inferContentType(uri)
return when (type) {
C.TYPE_SS -> SsMediaSource(uri, buildDataSourceFactory(bandwidthMeter),
DefaultSsChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger)

C.TYPE_DASH -> DashMediaSource(uri, buildDataSourceFactory(bandwidthMeter),
DefaultDashChunkSource.Factory(mediaDataSourceFactory), mainHandler, eventLogger)

C.TYPE_HLS -> HlsMediaSource(uri, mediaDataSourceFactory, mainHandler, eventLogger)

C.TYPE_OTHER -> ExtractorMediaSource(uri, mediaDataSourceFactory, DefaultExtractorsFactory(), mainHandler, eventLogger)

else -> {
throw IllegalStateException("Unsupported type: " + type)
}
C.TYPE_DASH -> DashMediaSource.Factory(
DefaultDashChunkSource.Factory(mediaDataSourceFactory),
manifestDataSourceFactory)
.createMediaSource(uri)
C.TYPE_SS -> SsMediaSource.Factory(
DefaultSsChunkSource.Factory(mediaDataSourceFactory), manifestDataSourceFactory)
.createMediaSource(uri)
C.TYPE_HLS -> HlsMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri)
C.TYPE_OTHER -> ExtractorMediaSource.Factory(mediaDataSourceFactory).createMediaSource(uri)
else -> throw IllegalStateException("Unsupported type: $type")
}
}


private fun buildDataSourceFactory(bandwidthMeter: DefaultBandwidthMeter): DataSource.Factory {
return DefaultDataSourceFactory(context, bandwidthMeter,
buildHttpDataSourceFactory(bandwidthMeter))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class TabbedViewPagerManager : ViewGroupManager<TabbedViewPager>() {

companion object {
const val REACT_CLASS = "TabbedViewPager"
private const val COMMAND_SET_PAGE = 1
private const val COMMAND_SET_PAGE_WITHOUT_ANIMATION = 2
}

private val COMMAND_SET_PAGE = 1
private val COMMAND_SET_PAGE_WITHOUT_ANIMATION = 2

override fun getName(): String {
return REACT_CLASS
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/ctech/eaty/ui/app/AppState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.ctech.eaty.ui.app

import com.ctech.eaty.annotation.ConnectionType

data class AppState(@ConnectionType val connectionType: Long)
data class AppState(@ConnectionType val connectionType: Int)
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.ctech.eaty.ui.app.result

import com.ctech.eaty.base.redux.Result

data class NetworkChangeResult(val connectionType: Long) : Result
data class NetworkChangeResult(val connectionType: Int) : Result
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.ctech.eaty.ui.home.state.HomeState
import com.facebook.litho.Border
import com.facebook.litho.ClickEvent
import com.facebook.litho.Column
import com.facebook.litho.Component
import com.facebook.litho.ComponentContext
import com.facebook.litho.ComponentLayout
import com.facebook.litho.annotations.LayoutSpec
Expand All @@ -27,7 +28,7 @@ import com.facebook.yoga.YogaJustify
object DataSaverComponentSpec {

@OnCreateLayout
fun onCreateLayout(c: ComponentContext): ComponentLayout {
fun onCreateLayout(c: ComponentContext): Component {

return Column.create(c)
.child(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.ctech.eaty.ui.home.component

import com.ctech.eaty.R
import com.facebook.litho.Column
import com.facebook.litho.Component
import com.facebook.litho.ComponentContext
import com.facebook.litho.ComponentLayout
import com.facebook.litho.Row
Expand All @@ -17,7 +18,7 @@ import com.facebook.yoga.YogaJustify
object ErrorFooterComponentSpec {

@OnCreateLayout
fun onCreateLayout(c: ComponentContext): ComponentLayout =
fun onCreateLayout(c: ComponentContext): Component =
Column.create(c)
.justifyContent(YogaJustify.CENTER)
.alignItems(YogaAlign.CENTER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import com.facebook.litho.sections.common.SingleComponentSection
@GroupSectionSpec
object HomeFeedSectionSpec {

private val KEY_FOOTER_LOADING = "loading"
private val KEY_FOOTER_ERROR = "error"
private const val KEY_FOOTER_LOADING = "loading"
private const val KEY_FOOTER_ERROR = "error"

@OnCreateChildren
fun onCreateChildren(c: SectionContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.ctech.eaty.R
import com.ctech.eaty.base.redux.Store
import com.ctech.eaty.ui.home.model.HomeFeed
import com.ctech.eaty.ui.home.state.HomeState
import com.facebook.litho.Component
import com.facebook.litho.ComponentContext
import com.facebook.litho.ComponentLayout
import com.facebook.litho.annotations.LayoutSpec
Expand All @@ -23,7 +24,7 @@ object HomeListComponentSpec {
fun onCreateLayout(c: ComponentContext,
@Prop dataSource: List<HomeFeed>,
@Prop store: Store<HomeState>,
@Prop eventsController: RecyclerCollectionEventsController): ComponentLayout {
@Prop eventsController: RecyclerCollectionEventsController): Component {
return RecyclerCollectionComponent.create(c)
.section(
HomeFeedSection.create(SectionContext(c))
Expand All @@ -34,7 +35,7 @@ object HomeListComponentSpec {
.refreshProgressBarColorRes(R.color.colorAccent)
.disablePTR(false)
.testKey(MAIN_SCREEN)
.buildWithLayout()
.build()
}

}
Loading