Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
153e026a8d | |||
8731c2e1f2 | |||
0977282a4b | |||
667c4b6af7 | |||
1f5088cfc9 | |||
bf6b857a3e | |||
80cb94c434 | |||
0cb4eda32b | |||
d169f964f2 | |||
103ab95c80 |
@ -11,10 +11,10 @@ cache:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- 0.7.x
|
||||
#branches:
|
||||
# only:
|
||||
# - master
|
||||
# - 0.8.x
|
||||
|
||||
android:
|
||||
licenses:
|
||||
|
@ -16,8 +16,8 @@ android {
|
||||
testApplicationId "io.github.tests.wulkanowy"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 34
|
||||
versionName "0.8.1"
|
||||
versionCode 36
|
||||
versionName "0.8.3"
|
||||
multiDexEnabled true
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
@ -80,12 +80,12 @@ androidExtensions {
|
||||
play {
|
||||
serviceAccountEmail = System.getenv("PLAY_SERVICE_ACCOUNT_EMAIL") ?: "jan@fakelog.cf"
|
||||
serviceAccountCredentials = file('key.p12')
|
||||
defaultToAppBundles = true
|
||||
defaultToAppBundles = false
|
||||
track = 'alpha'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'io.github.wulkanowy:api:0.8.1'
|
||||
implementation 'io.github.wulkanowy:api:0.8.3'
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||
|
@ -7,7 +7,7 @@ import org.threeten.bp.LocalDateTime.now
|
||||
import io.github.wulkanowy.api.timetable.Timetable as TimetableRemote
|
||||
import io.github.wulkanowy.data.db.entities.Timetable as TimetableLocal
|
||||
|
||||
fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", subject: String = ""): TimetableLocal {
|
||||
fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", subject: String = "", teacher: String = ""): TimetableLocal {
|
||||
return TimetableLocal(
|
||||
studentId = 1,
|
||||
diaryId = 2,
|
||||
@ -20,7 +20,7 @@ fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", s
|
||||
group = "",
|
||||
room = room,
|
||||
roomOld = "",
|
||||
teacher = "",
|
||||
teacher = teacher,
|
||||
teacherOld = "",
|
||||
info = "",
|
||||
changes = false,
|
||||
@ -28,7 +28,7 @@ fun createTimetableLocal(number: Int, start: LocalDateTime, room: String = "", s
|
||||
)
|
||||
}
|
||||
|
||||
fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subject: String = ""): TimetableRemote {
|
||||
fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subject: String = "", teacher: String = ""): TimetableRemote {
|
||||
return TimetableRemote(
|
||||
number = number,
|
||||
start = start.toDate(),
|
||||
@ -37,7 +37,7 @@ fun createTimetableRemote(number: Int, start: LocalDateTime, room: String, subje
|
||||
subject = subject,
|
||||
group = "",
|
||||
room = room,
|
||||
teacher = "",
|
||||
teacher = teacher,
|
||||
info = "",
|
||||
changes = false,
|
||||
canceled = false
|
||||
|
@ -63,23 +63,27 @@ class TimetableRepositoryTest {
|
||||
fun copyDetailsToCompletedFromPrevious() {
|
||||
timetableLocal.saveTimetable(listOf(
|
||||
createTimetableLocal(1, of(2019, 3, 5, 8, 0), "123", "Przyroda"),
|
||||
createTimetableLocal(1, of(2019, 3, 5, 8, 50), "321", "Religia"),
|
||||
createTimetableLocal(1, of(2019, 3, 5, 9, 40), "213", "W-F")
|
||||
createTimetableLocal(2, of(2019, 3, 5, 8, 50), "321", "Religia"),
|
||||
createTimetableLocal(3, of(2019, 3, 5, 9, 40), "213", "W-F"),
|
||||
createTimetableLocal(4, of(2019, 3, 5, 10, 30), "213", "W-F", "Jan Kowalski")
|
||||
))
|
||||
|
||||
every { mockApi.getTimetable(any(), any()) } returns Single.just(listOf(
|
||||
createTimetableRemote(1, of(2019, 3, 5, 8, 0), "", "Przyroda"),
|
||||
createTimetableRemote(1, of(2019, 3, 5, 8, 50), "", "Religia"),
|
||||
createTimetableRemote(1, of(2019, 3, 5, 9, 40), "", "W-F")
|
||||
createTimetableRemote(2, of(2019, 3, 5, 8, 50), "", "Religia"),
|
||||
createTimetableRemote(3, of(2019, 3, 5, 9, 40), "", "W-F"),
|
||||
createTimetableRemote(4, of(2019, 3, 5, 10, 30), "", "W-F")
|
||||
))
|
||||
|
||||
val lessons = TimetableRepository(settings, timetableLocal, timetableRemote)
|
||||
.getTimetable(semesterMock, LocalDate.of(2019, 3, 5), LocalDate.of(2019, 3, 5), true)
|
||||
.blockingGet()
|
||||
|
||||
assertEquals(3, lessons.size)
|
||||
assertEquals(4, lessons.size)
|
||||
assertEquals("123", lessons[0].room)
|
||||
assertEquals("321", lessons[1].room)
|
||||
assertEquals("213", lessons[2].room)
|
||||
|
||||
assertEquals("", lessons[3].teacher)
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ interface MessagesDao {
|
||||
@Query("SELECT * FROM Messages WHERE student_id = :studentId AND folder_id = :folder AND removed = 0 ORDER BY date DESC")
|
||||
fun loadAll(studentId: Int, folder: Int): Maybe<List<Message>>
|
||||
|
||||
@Query("SELECT * FROM Messages WHERE student_id = :studentId AND real_id = :id")
|
||||
fun load(studentId: Int, id: Int): Maybe<Message>
|
||||
@Query("SELECT * FROM Messages WHERE id = :id")
|
||||
fun load(id: Long): Maybe<Message>
|
||||
|
||||
@Query("SELECT * FROM Messages WHERE student_id = :studentId AND removed = 1 ORDER BY date DESC")
|
||||
fun loadDeleted(studentId: Int): Maybe<List<Message>>
|
||||
|
@ -23,8 +23,8 @@ class MessageLocal @Inject constructor(private val messagesDb: MessagesDao) {
|
||||
messagesDb.deleteAll(messages)
|
||||
}
|
||||
|
||||
fun getMessage(student: Student, id: Int): Maybe<Message> {
|
||||
return messagesDb.load(student.id.toInt(), id)
|
||||
fun getMessage(id: Long): Maybe<Message> {
|
||||
return messagesDb.load(id)
|
||||
}
|
||||
|
||||
fun getMessages(student: Student, folder: MessageFolder): Maybe<List<Message>> {
|
||||
|
@ -46,14 +46,14 @@ class MessageRepository @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun getMessage(student: Student, messageId: Int, markAsRead: Boolean = false): Single<Message> {
|
||||
fun getMessage(student: Student, messageDbId: Long, markAsRead: Boolean = false): Single<Message> {
|
||||
return Single.just(apiHelper.initApi(student))
|
||||
.flatMap { _ ->
|
||||
local.getMessage(student, messageId)
|
||||
local.getMessage(messageDbId)
|
||||
.filter { !it.content.isNullOrEmpty() }
|
||||
.switchIfEmpty(ReactiveNetwork.checkInternetConnectivity(settings)
|
||||
.flatMap {
|
||||
if (it) local.getMessage(student, messageId).toSingle()
|
||||
if (it) local.getMessage(messageDbId).toSingle()
|
||||
else Single.error(UnknownHostException())
|
||||
}
|
||||
.flatMap { dbMessage ->
|
||||
@ -64,7 +64,7 @@ class MessageRepository @Inject constructor(
|
||||
}))
|
||||
}
|
||||
}.flatMap {
|
||||
local.getMessage(student, messageId).toSingle()
|
||||
local.getMessage(messageDbId).toSingle()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ class StudentRepository @Inject constructor(
|
||||
|
||||
fun isStudentSaved(): Single<Boolean> = local.getStudents(false).isEmpty.map { !it }
|
||||
|
||||
fun isCurrentStudentSet(): Single<Boolean> = local.getCurrentStudent(false).isEmpty.map { !it }
|
||||
|
||||
fun getStudents(email: String, password: String, endpoint: String, symbol: String = ""): Single<List<Student>> {
|
||||
return ReactiveNetwork.checkInternetConnectivity(settings)
|
||||
.flatMap {
|
||||
|
@ -35,8 +35,7 @@ class TimetableRepository @Inject constructor(
|
||||
item.apply {
|
||||
old.singleOrNull { this.start == it.start }?.let {
|
||||
return@map copy(
|
||||
room = if (room.isEmpty()) it.room else room,
|
||||
teacher = if (teacher.isEmpty()) it.teacher else teacher
|
||||
room = if (room.isEmpty()) it.room else room
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class SyncWorker @AssistedInject constructor(
|
||||
|
||||
override fun createWork(): Single<Result> {
|
||||
Timber.i("SyncWorker is starting")
|
||||
return studentRepository.isStudentSaved()
|
||||
return studentRepository.isCurrentStudentSet()
|
||||
.filter { true }
|
||||
.flatMap { studentRepository.getCurrentStudent().toMaybe() }
|
||||
.flatMapCompletable { student ->
|
||||
|
@ -2,6 +2,7 @@ package io.github.wulkanowy.ui.base
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.fragment.app.Fragment
|
||||
@ -25,7 +26,7 @@ abstract class BaseActivity : AppCompatActivity(), BaseView, HasSupportFragmentI
|
||||
@Inject
|
||||
lateinit var themeManager: ThemeManager
|
||||
|
||||
protected lateinit var messageContainer: View
|
||||
protected var messageContainer: View? = null
|
||||
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
AndroidInjection.inject(this)
|
||||
@ -36,13 +37,18 @@ abstract class BaseActivity : AppCompatActivity(), BaseView, HasSupportFragmentI
|
||||
}
|
||||
|
||||
override fun showError(text: String, error: Throwable) {
|
||||
Snackbar.make(messageContainer, text, LENGTH_LONG).setAction(R.string.all_details) {
|
||||
ErrorDialog.newInstance(error).show(supportFragmentManager, error.toString())
|
||||
}.show()
|
||||
if (messageContainer != null) {
|
||||
Snackbar.make(messageContainer!!, text, LENGTH_LONG)
|
||||
.setAction(R.string.all_details) {
|
||||
ErrorDialog.newInstance(error).show(supportFragmentManager, error.toString())
|
||||
}
|
||||
.show()
|
||||
} else showMessage(text)
|
||||
}
|
||||
|
||||
override fun showMessage(text: String) {
|
||||
Snackbar.make(messageContainer, text, LENGTH_LONG).show()
|
||||
if (messageContainer != null) Snackbar.make(messageContainer!!, text, LENGTH_LONG).show()
|
||||
else Toast.makeText(this, text, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
@ -2,6 +2,7 @@ package io.github.wulkanowy.ui.base
|
||||
|
||||
import android.view.View
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.android.material.snackbar.Snackbar.LENGTH_LONG
|
||||
import dagger.android.support.DaggerFragment
|
||||
import io.github.wulkanowy.R
|
||||
|
||||
@ -10,16 +11,22 @@ abstract class BaseFragment : DaggerFragment(), BaseView {
|
||||
protected var messageContainer: View? = null
|
||||
|
||||
override fun showError(text: String, error: Throwable) {
|
||||
if (messageContainer == null) (activity as? BaseActivity)?.showError(text, error)
|
||||
else messageContainer?.also {
|
||||
Snackbar.make(it, text, Snackbar.LENGTH_LONG).setAction(R.string.all_details) {
|
||||
ErrorDialog.newInstance(error).show(childFragmentManager, error.toString())
|
||||
}.show()
|
||||
if (messageContainer != null) {
|
||||
Snackbar.make(messageContainer!!, text, LENGTH_LONG)
|
||||
.setAction(R.string.all_details) {
|
||||
if (isAdded) ErrorDialog.newInstance(error).show(childFragmentManager, error.toString())
|
||||
}
|
||||
.show()
|
||||
} else {
|
||||
(activity as? BaseActivity)?.showError(text, error)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showMessage(text: String) {
|
||||
if (messageContainer == null) (activity as? BaseActivity)?.showMessage(text)
|
||||
else messageContainer?.also { Snackbar.make(it, text, Snackbar.LENGTH_LONG).show() }
|
||||
if (messageContainer != null) {
|
||||
Snackbar.make(messageContainer!!, text, LENGTH_LONG).show()
|
||||
} else {
|
||||
(activity as? BaseActivity)?.showMessage(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import io.github.wulkanowy.BuildConfig
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.main.MainView
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import io.github.wulkanowy.utils.withOnExtraListener
|
||||
import javax.inject.Inject
|
||||
|
||||
@ -57,11 +58,11 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
|
||||
}
|
||||
|
||||
override fun openDiscordInviteView() {
|
||||
startActivity(Intent.parseUri("https://discord.gg/vccAQBr", 0))
|
||||
context?.openInternetBrowser("https://discord.gg/vccAQBr", ::showMessage)
|
||||
}
|
||||
|
||||
override fun openHomepageWebView() {
|
||||
startActivity(Intent.parseUri("https://wulkanowy.github.io/", 0))
|
||||
context?.openInternetBrowser("https://wulkanowy.github.io/", ::showMessage)
|
||||
}
|
||||
|
||||
override fun openEmailClientView() {
|
||||
@ -80,7 +81,7 @@ class AboutFragment : BaseFragment(), AboutView, MainView.TitledView {
|
||||
if (intent.resolveActivity(it.packageManager) != null) {
|
||||
startActivity(Intent.createChooser(intent, getString(R.string.about_feedback)))
|
||||
} else {
|
||||
startActivity(Intent.parseUri("https://github.com/wulkanowy/wulkanowy/issues", 0))
|
||||
it.openInternetBrowser("https://github.com/wulkanowy/wulkanowy/issues", ::showMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ class AttendanceFragment : BaseSessionFragment(), AttendanceView, MainView.MainC
|
||||
}
|
||||
|
||||
override fun onFragmentReselected() {
|
||||
presenter.onViewReselected()
|
||||
if (::presenter.isInitialized) presenter.onViewReselected()
|
||||
}
|
||||
|
||||
override fun popView() {
|
||||
|
@ -88,7 +88,7 @@ class ExamFragment : BaseSessionFragment(), ExamView, MainView.MainChildView, Ma
|
||||
}
|
||||
|
||||
override fun onFragmentReselected() {
|
||||
presenter.onViewReselected()
|
||||
if (::presenter.isInitialized) presenter.onViewReselected()
|
||||
}
|
||||
|
||||
override fun showEmpty(show: Boolean) {
|
||||
|
@ -88,7 +88,7 @@ class GradeFragment : BaseSessionFragment(), GradeView, MainView.MainChildView,
|
||||
}
|
||||
|
||||
override fun onFragmentReselected() {
|
||||
presenter.onViewReselected()
|
||||
if (::presenter.isInitialized) presenter.onViewReselected()
|
||||
}
|
||||
|
||||
override fun showContent(show: Boolean) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package io.github.wulkanowy.ui.modules.login.form
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -17,6 +16,7 @@ import io.github.wulkanowy.data.db.entities.Student
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
import io.github.wulkanowy.utils.hideSoftInput
|
||||
import io.github.wulkanowy.utils.openInternetBrowser
|
||||
import io.github.wulkanowy.utils.setOnItemSelectedListener
|
||||
import io.github.wulkanowy.utils.setOnTextChangedListener
|
||||
import io.github.wulkanowy.utils.showSoftInput
|
||||
@ -145,7 +145,7 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
||||
}
|
||||
|
||||
override fun openPrivacyPolicyPage() {
|
||||
startActivity(Intent.parseUri("https://wulkanowy.github.io/polityka-prywatnosci.html", 0))
|
||||
context?.openInternetBrowser("https://wulkanowy.github.io/polityka-prywatnosci.html", ::showMessage)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -68,7 +68,7 @@ class LuckyNumberWidgetProvider : BroadcastReceiver() {
|
||||
}
|
||||
|
||||
private fun onUpdate(context: Context, intent: Intent) {
|
||||
intent.getIntArrayExtra(EXTRA_APPWIDGET_IDS).forEach { appWidgetId ->
|
||||
intent.getIntArrayExtra(EXTRA_APPWIDGET_IDS)?.forEach { appWidgetId ->
|
||||
RemoteViews(context.packageName, R.layout.widget_luckynumber).apply {
|
||||
setTextViewText(R.id.luckyNumberWidgetNumber,
|
||||
getLuckyNumber(sharedPref.getLong(getStudentWidgetKey(appWidgetId), 0), appWidgetId)?.luckyNumber?.toString() ?: "#"
|
||||
@ -100,11 +100,12 @@ class LuckyNumberWidgetProvider : BroadcastReceiver() {
|
||||
when {
|
||||
student != null -> Maybe.just(student)
|
||||
studentId != 0L -> {
|
||||
studentRepository.getCurrentStudent(false)
|
||||
.toMaybe()
|
||||
studentRepository.isCurrentStudentSet()
|
||||
.filter { true }
|
||||
.flatMap { studentRepository.getCurrentStudent(false).toMaybe() }
|
||||
.doOnSuccess { sharedPref.putLong(getStudentWidgetKey(appWidgetId), it.id) }
|
||||
}
|
||||
else -> null
|
||||
else -> Maybe.empty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import android.content.Intent
|
||||
import android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
@ -165,9 +164,7 @@ class MainActivity : BaseActivity(), MainView {
|
||||
}
|
||||
|
||||
override fun notifyMenuViewReselected() {
|
||||
Handler().postDelayed({
|
||||
(navController.currentStack?.get(0) as? MainView.MainChildView)?.onFragmentReselected()
|
||||
}, 250)
|
||||
(navController.currentStack?.getOrNull(0) as? MainView.MainChildView)?.onFragmentReselected()
|
||||
}
|
||||
|
||||
fun showDialogFragment(dialog: DialogFragment) {
|
||||
|
@ -27,7 +27,9 @@ class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainVi
|
||||
lateinit var presenter: MessagePreviewPresenter
|
||||
|
||||
private var menuReplyButton: MenuItem? = null
|
||||
|
||||
private var menuForwardButton: MenuItem? = null
|
||||
|
||||
private var menuDeleteButton: MenuItem? = null
|
||||
|
||||
override val titleStringId: Int
|
||||
@ -42,9 +44,9 @@ class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainVi
|
||||
companion object {
|
||||
const val MESSAGE_ID_KEY = "message_id"
|
||||
|
||||
fun newInstance(messageId: Int?): MessagePreviewFragment {
|
||||
fun newInstance(messageId: Long): MessagePreviewFragment {
|
||||
return MessagePreviewFragment().apply {
|
||||
arguments = Bundle().apply { putInt(MESSAGE_ID_KEY, messageId ?: 0) }
|
||||
arguments = Bundle().apply { putLong(MESSAGE_ID_KEY, messageId) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -61,7 +63,7 @@ class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainVi
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
messageContainer = messagePreviewContainer
|
||||
presenter.onAttachView(this, (savedInstanceState ?: arguments)?.getInt(MESSAGE_ID_KEY) ?: 0)
|
||||
presenter.onAttachView(this, (savedInstanceState ?: arguments)?.getLong(MESSAGE_ID_KEY) ?: 0L)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
@ -145,7 +147,7 @@ class MessagePreviewFragment : BaseSessionFragment(), MessagePreviewView, MainVi
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
outState.putInt(MESSAGE_ID_KEY, presenter.messageId)
|
||||
outState.putLong(MESSAGE_ID_KEY, presenter.messageId)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -20,16 +20,16 @@ class MessagePreviewPresenter @Inject constructor(
|
||||
private val analytics: FirebaseAnalyticsHelper
|
||||
) : BaseSessionPresenter<MessagePreviewView>(errorHandler) {
|
||||
|
||||
var messageId: Int = 0
|
||||
var messageId = 0L
|
||||
|
||||
private var message: Message? = null
|
||||
|
||||
fun onAttachView(view: MessagePreviewView, id: Int) {
|
||||
fun onAttachView(view: MessagePreviewView, id: Long) {
|
||||
super.onAttachView(view)
|
||||
loadData(id)
|
||||
}
|
||||
|
||||
private fun loadData(id: Int) {
|
||||
private fun loadData(id: Long) {
|
||||
Timber.i("Loading message $id preview started")
|
||||
messageId = id
|
||||
disposable.apply {
|
||||
|
@ -56,7 +56,7 @@ class MessageTabFragment : BaseSessionFragment(), MessageTabView {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
messageContainer = messageTabRecycler
|
||||
presenter.onAttachView(this, MessageFolder.valueOf(
|
||||
(savedInstanceState ?: arguments)?.getString(MessageTabFragment.MESSAGE_TAB_FOLDER_ID).orEmpty()
|
||||
(savedInstanceState ?: arguments)?.getString(MESSAGE_TAB_FOLDER_ID).orEmpty()
|
||||
))
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class MessageTabFragment : BaseSessionFragment(), MessageTabView {
|
||||
messageTabSwipe.isRefreshing = show
|
||||
}
|
||||
|
||||
override fun openMessage(messageId: Int?) {
|
||||
override fun openMessage(messageId: Long) {
|
||||
(activity as? MainActivity)?.pushView(MessagePreviewFragment.newInstance(messageId))
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class MessageTabFragment : BaseSessionFragment(), MessageTabView {
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
outState.putString(MessageTabFragment.MESSAGE_TAB_FOLDER_ID, presenter.folder.name)
|
||||
outState.putString(MESSAGE_TAB_FOLDER_ID, presenter.folder.name)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
|
@ -44,9 +44,9 @@ class MessageTabPresenter @Inject constructor(
|
||||
|
||||
fun onMessageItemSelected(item: AbstractFlexibleItem<*>) {
|
||||
if (item is MessageItem) {
|
||||
Timber.i("Select message ${item.message.realId} item")
|
||||
Timber.i("Select message ${item.message.id} item")
|
||||
view?.run {
|
||||
openMessage(item.message.realId)
|
||||
openMessage(item.message.id)
|
||||
if (item.message.unread) {
|
||||
item.message.unread = false
|
||||
updateItem(item)
|
||||
@ -90,13 +90,13 @@ class MessageTabPresenter @Inject constructor(
|
||||
}
|
||||
|
||||
private fun updateMessage(message: Message) {
|
||||
Timber.i("Attempt to update message ${message.realId}")
|
||||
Timber.i("Attempt to update message ${message.id}")
|
||||
disposable.add(messageRepository.updateMessage(message)
|
||||
.subscribeOn(schedulers.backgroundThread)
|
||||
.observeOn(schedulers.mainThread)
|
||||
.subscribe({ Timber.d("Update message ${message.realId} result: Success") })
|
||||
.subscribe({ Timber.d("Update message ${message.id} result: Success") })
|
||||
{ error ->
|
||||
Timber.i("Update message ${message.realId} result: An exception occurred")
|
||||
Timber.i("Update message ${message.id} result: An exception occurred")
|
||||
errorHandler.dispatch(error)
|
||||
})
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ interface MessageTabView : BaseSessionView {
|
||||
|
||||
fun showRefresh(show: Boolean)
|
||||
|
||||
fun openMessage(messageId: Int?)
|
||||
fun openMessage(messageId: Long)
|
||||
|
||||
fun notifyParentDataLoaded()
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ class MoreFragment : BaseFragment(), MoreView, MainView.TitledView, MainView.Mai
|
||||
}
|
||||
|
||||
override fun onFragmentReselected() {
|
||||
presenter.onViewReselected()
|
||||
if (::presenter.isInitialized) presenter.onViewReselected()
|
||||
}
|
||||
|
||||
override fun updateData(data: List<MoreItem>) {
|
||||
|
@ -14,7 +14,7 @@ class SplashPresenter @Inject constructor(
|
||||
|
||||
override fun onAttachView(view: SplashView) {
|
||||
super.onAttachView(view)
|
||||
disposable.add(studentRepository.isStudentSaved()
|
||||
disposable.add(studentRepository.isCurrentStudentSet()
|
||||
.subscribeOn(schedulers.backgroundThread)
|
||||
.observeOn(schedulers.mainThread)
|
||||
.subscribe({
|
||||
|
@ -110,7 +110,7 @@ class TimetableFragment : BaseSessionFragment(), TimetableView, MainView.MainChi
|
||||
}
|
||||
|
||||
override fun onFragmentReselected() {
|
||||
presenter.onViewReselected()
|
||||
if (::presenter.isInitialized) presenter.onViewReselected()
|
||||
}
|
||||
|
||||
override fun popView() {
|
||||
|
@ -161,11 +161,12 @@ class TimetableWidgetProvider : BroadcastReceiver() {
|
||||
when {
|
||||
student != null -> Maybe.just(student)
|
||||
studentId != 0L -> {
|
||||
studentRepository.getCurrentStudent(false)
|
||||
.toMaybe()
|
||||
studentRepository.isCurrentStudentSet()
|
||||
.filter { true }
|
||||
.flatMap { studentRepository.getCurrentStudent(false).toMaybe() }
|
||||
.doOnSuccess { sharedPref.putLong(getStudentWidgetKey(appWidgetId), it.id) }
|
||||
}
|
||||
else -> null
|
||||
else -> Maybe.empty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import android.app.Activity
|
||||
import android.content.Context.INPUT_METHOD_SERVICE
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
|
||||
|
||||
fun Activity.showSoftInput() {
|
||||
(getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager?)?.run {
|
||||
if (currentFocus != null) showSoftInput(currentFocus, 0)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.github.wulkanowy.utils
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.ColorRes
|
||||
@ -18,3 +19,10 @@ fun Context.getThemeAttrColor(@AttrRes colorAttr: Int): Int {
|
||||
|
||||
@ColorInt
|
||||
fun Context.getCompatColor(@ColorRes colorRes: Int) = ContextCompat.getColor(this, colorRes)
|
||||
|
||||
fun Context.openInternetBrowser(uri: String, onActivityNotFound: (uri: String) -> Unit) {
|
||||
Intent.parseUri(uri, 0).let {
|
||||
if (it.resolveActivity(packageManager) != null) startActivity(it)
|
||||
else onActivityNotFound(uri)
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,10 @@
|
||||
Wersja 0.8.1
|
||||
|
||||
Uwaga! Po tej aktualizacji wymagane jest ponowne przypięcie widżetu planu lekcji!
|
||||
|
||||
Dodaliśmy:
|
||||
- przesyłanie dalej i usuwanie wiadomości
|
||||
- opcję zmiany ucznia w widżecie
|
||||
- opcję liczenia średniej ocen z całego roku
|
||||
- tryb AMOLED
|
||||
- logowanie wielu uczniów jednocześnie
|
||||
- widżet szczęśliwego numerka
|
||||
|
||||
Zoptymalizowaliśmy:
|
||||
- przełączanie kont
|
||||
Wersja 0.8.3
|
||||
|
||||
Naprawiliśmy:
|
||||
- synchronizację zdublowanych ocen
|
||||
- rzadkie problemy z wczytywaniem treści wiadomości
|
||||
- rzadkie problemy z wyświetlaniem poprawnego nauczyciela przy zastępstwach
|
||||
|
||||
Zmieniliśmy:
|
||||
- tekst wskazówki przy wprowadzaniu symbolu w formularzu logowania
|
||||
|
||||
Pełna lista zmian: https://github.com/wulkanowy/wulkanowy/releases
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
<!--Login-->
|
||||
<string name="login_header_default">Zaloguj się za pomocą konta ucznia lub rodzica</string>
|
||||
<string name="login_header_symbol">Podaj symbol dziennika VULCAN</string>
|
||||
<string name="login_header_symbol">Podaj symbol</string>
|
||||
<string name="login_nickname_hint">Email lub nick</string>
|
||||
<string name="login_password_hint">Hasło</string>
|
||||
<string name="login_host_hint">Dziennik</string>
|
||||
@ -32,7 +32,7 @@
|
||||
<string name="login_incorrect_symbol">Nie znaleziono ucznia. Sprawdź symbol</string>
|
||||
<string name="login_field_required">To pole jest wymagane</string>
|
||||
<string name="login_duplicate_student">Wybrany uczeń jest już zalogowany</string>
|
||||
<string name="login_symbol_helper">Symbol znajduje się na stronie dziennika w zakładce Dostęp Mobilny</string>
|
||||
<string name="login_symbol_helper">Symbol znajdziesz na stronie dziennika w Uczeń -> Dostęp Mobilny -> Zarejestruj urządzenie mobilne</string>
|
||||
<string name="login_select_student">Wybierz uczniów do zalogowania w aplikacji</string>
|
||||
<string name="login_privacy_policy">Polityka prywatności</string>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
<!--Login-->
|
||||
<string name="login_header_default">Sign in with the student or parent account</string>
|
||||
<string name="login_header_symbol">Enter the VULCAN diary symbol</string>
|
||||
<string name="login_header_symbol">Enter the symbol</string>
|
||||
<string name="login_nickname_hint">Email or nick</string>
|
||||
<string name="login_password_hint">Password</string>
|
||||
<string name="login_host_hint">Register</string>
|
||||
@ -32,7 +32,7 @@
|
||||
<string name="login_incorrect_symbol">Student not found. Check the symbol</string>
|
||||
<string name="login_field_required">This field is required</string>
|
||||
<string name="login_duplicate_student">The selected student is already logged in</string>
|
||||
<string name="login_symbol_helper">The symbol is located on the register page in the Mobile Access tab</string>
|
||||
<string name="login_symbol_helper">The symbol can be found on the register page in Uczeń -> Dostęp Mobilny -> Zarejestruj urządzenie mobilne</string>
|
||||
<string name="login_select_student">Select students to log in to the application</string>
|
||||
<string name="login_privacy_policy">Privacy policy</string>
|
||||
|
||||
|
@ -32,14 +32,14 @@ class SplashPresenterTest {
|
||||
|
||||
@Test
|
||||
fun testOpenLoginView() {
|
||||
doReturn(Single.just(false)).`when`(studentRepository).isStudentSaved()
|
||||
doReturn(Single.just(false)).`when`(studentRepository).isCurrentStudentSet()
|
||||
presenter.onAttachView(splashView)
|
||||
verify(splashView).openLoginView()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testMainMainView() {
|
||||
doReturn(Single.just(true)).`when`(studentRepository).isStudentSaved()
|
||||
doReturn(Single.just(true)).`when`(studentRepository).isCurrentStudentSet()
|
||||
presenter.onAttachView(splashView)
|
||||
verify(splashView).openMainView()
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.android.tools.build:gradle:3.4.0'
|
||||
classpath 'com.android.tools.build:gradle:3.4.1'
|
||||
classpath 'com.google.gms:google-services:4.2.0'
|
||||
classpath "io.fabric.tools:gradle:1.28.1"
|
||||
classpath "com.github.triplet.gradle:play-publisher:2.2.0"
|
||||
|
Reference in New Issue
Block a user