Skip to content

Commit

Permalink
[22321] Updated with files from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sg-jsonjuliane committed Oct 21, 2024
2 parents 9ca0d0b + 19d6659 commit 11800da
Show file tree
Hide file tree
Showing 173 changed files with 4,955 additions and 5,613 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* Represents a mutable property that can be observed via {@link Observable}.
* <p>
* Use {@link BehaviorSubject} instead.
*
* Update 10-04-24 - Updated the classes that uses this to use BehaviorSubject instead.
* This can now be removed on the future updates
*/
@Deprecated
public abstract class Var<T> implements Consumer<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class TripSegment : IRealTimeElement, ITimeRange {
override fun getServiceTripId(): String? = mServiceTripId

override fun getOperator(): String {
return serviceOperator!!
return serviceOperator.orEmpty()
}

val wheelchairFriendliness: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class CursorToRegionConverter implements Function<Cursor, Region> {

@Override
public Region apply(Cursor cursor) {
final String json = cursor.getString(cursor.getColumnIndex(Tables.FIELD_JSON.getName()));
final String json = cursor.getString(cursor.getColumnIndex(Tables.FIELD_JSON.name));
return gson.fromJson(json, Region.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class CursorToTransportModeConverter implements Function<Cursor, Transport

@Override
public TransportMode apply(Cursor cursor) {
final String json = cursor.getString(cursor.getColumnIndex(Tables.FIELD_JSON.getName()));
final String json = cursor.getString(cursor.getColumnIndex(Tables.FIELD_JSON.name));
return gson.fromJson(json, TransportMode.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ public void subscribe(ObservableEmitter<Void> emitter) throws Exception {

ContentValues toRegionValues(Region region) {
final ContentValues values = new ContentValues(1);
values.put(Tables.FIELD_JSON.getName(), gson.toJson(region));
values.put(Tables.FIELD_JSON.name, gson.toJson(region));
return values;
}

ContentValues toTransportModeValues(TransportMode mode) {
final ContentValues values = new ContentValues(1);
values.put(Tables.FIELD_JSON.getName(), gson.toJson(mode));
values.put(Tables.FIELD_JSON.name, gson.toJson(mode));
return values;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.skedgo.tripkit.data.database.booking.ticket.TicketDao
import com.skedgo.tripkit.data.database.booking.ticket.TicketEntity
import com.skedgo.tripkit.data.database.locations.bikepods.BikePodDao
Expand Down Expand Up @@ -50,7 +52,7 @@ import skedgo.tripgo.data.timetables.ParentStopEntity
ServiceAlertsEntity::class,
TicketEntity::class,
FacilityLocationEntity::class,
], version = 7
], version = 8
)
abstract class TripKitDatabase : RoomDatabase() {
abstract fun carParkDao(): CarParkDao
Expand All @@ -70,10 +72,17 @@ abstract class TripKitDatabase : RoomDatabase() {
return Room.databaseBuilder(
context.applicationContext,
TripKitDatabase::class.java, "tripkit.db"
)
).addMigrations(MIGRATION_7_8)
.fallbackToDestructiveMigration()
.build()
}

val MIGRATION_7_8 = object : Migration(7, 8) {
override fun migrate(database: SupportSQLiteDatabase) {
// Add the new column with a default value
database.execSQL("ALTER TABLE tickets ADD COLUMN userId TEXT DEFAULT NULL")
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ interface TicketDao {

@Query("SELECT * FROM tickets")
fun getAllTicketsRx(): Single<List<TicketEntity>>

@Query("SELECT * FROM tickets WHERE userId = :userId")
fun getTicketsByUserIdRx(userId: String?): Maybe<List<TicketEntity>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ data class TicketEntity(
val status: String?,
val qrCode: String? = null,
val ticketActionsJson: String?, // Serialized TicketAction
val userId: String? = null
)

This file was deleted.

Loading

0 comments on commit 11800da

Please sign in to comment.