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

Support offline mode for Sponsors #529

Closed

Conversation

youta1119
Copy link
Contributor

Issue

Overview (Required)

  • Support offline mode for Sponsors

Links

  • None

droidKaigiApi: DroidKaigiApi,
sponsorDatabase: SponsorDatabase,
schedulerProvider: SchedulerProvider
): SponsorPlanRepository = SponsorPlanDataRepository(droidKaigiApi, sponsorDatabase, schedulerProvider)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Exceeded max line length (100)


@Singleton @Provides
fun provideSponsorDao(db: AppDatabase): SponsorDao = db.sponsorDao()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Unexpected blank line(s) before “}”

@takahirom
Copy link
Member

Sorry, We should prepare release, I will see this pull request tomorrow 🙏

@takahirom
Copy link
Member

Please fix lint errors 🙏

(SessionFeedbackEntity::class),
(SponsorPlanEntity::class),
(SponsorGroupEntity::class),
(SponsorEntity::class)
],
version = 6
Copy link
Member

@takahirom takahirom Jan 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge from master and revert 6.json and upgrade version to 8 and rebuild for creating 8.json 🙇

@takahirom
Copy link
Member

takahirom commented Jan 30, 2018

This is a very hard work implementation, but I would like to change from three tables to one table. 🙇

You do not have to change the model class. I think that it is only necessary to have id, link, base64Img, imgUrl, groupIndex in that table.

I think that it is possible to smoothly implement the table conversion by mapper.

What do you think?


これはとてもhard workな実装になるのですが、3つのテーブルから1テーブルに変更したいです。

モデルクラスは変えなくていいです。私はそのテーブルにはid,link, base64Img, imgUrl,groupIndexがあるだけで良いと思います。

テーブルの変換はmapperで行えば多分スムーズに実装できる気がしています。

どう思いますか?

@youta1119
Copy link
Contributor Author

@takahirom
I think that good. I'll try it

@youta1119 youta1119 changed the title Support offline mode for Sponsors [WIP]Support offline mode for Sponsors Jan 30, 2018
@youta1119 youta1119 changed the title [WIP]Support offline mode for Sponsors Support offline mode for Sponsors Jan 30, 2018
@youta1119
Copy link
Contributor Author

@takahirom
I was deleteed SponsorGruopEntity and SponsorGroupWithSponsor.
And I fixed SponsorEntity and mapper.
Please review again:pray:

imgUrl != null -> Sponsor.ImageUri.NetworkImageUri(imgUrl)
else -> throw IllegalStateException("a json file is broken.")
fun List<SponsorGroup>.toSponsorGroupEntities(planId: Int): List<SponsorEntity> =
mapIndexed { index, group ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

}
}.flatten()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆒

import android.arch.persistence.room.PrimaryKey

@Entity(tableName = "sponsor_plan")
data class SponsorPlanEntity(
Copy link
Member

@takahirom takahirom Jan 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. I don't know how to delete SponsorPlanEntity using @Embedded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for lack of explanation. I think that it is possible to delete the DB table and not delete the class. 🙇🏻

@@ -2,7 +2,7 @@
"formatVersion": 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takahirom
Copy link
Member

takahirom commented Feb 1, 2018

I refactored this. Please cherry-pick 🙏
aa186e6

@takahirom
Copy link
Member

Sorry for taking long time 🙇

@takahirom
Copy link
Member

We don't have the time
Please let me merge selfly.
Of course, your commit goes into master.

@takahirom takahirom closed this Feb 1, 2018
@youta1119 youta1119 deleted the support_offline_sponsor_list branch February 1, 2018 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Assigned] Support offline mode for Sponsors
3 participants