Skip to content

Commit

Permalink
Improve computation of the work name to limit its length
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime NATUREL committed May 25, 2022
1 parent 8864a3c commit 791d4fb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.content.Context
import androidx.work.WorkerParameters
import com.squareup.moshi.JsonClass
import io.realm.RealmConfiguration
import org.matrix.android.sdk.api.util.md5
import org.matrix.android.sdk.internal.SessionManager
import org.matrix.android.sdk.internal.database.awaitTransaction
import org.matrix.android.sdk.internal.database.model.livelocation.LiveLocationShareAggregatedSummaryEntity
Expand Down Expand Up @@ -88,8 +89,9 @@ internal class DeactivateLiveLocationShareWorker(context: Context, params: Worke
}

companion object {
private const val WORK_NAME_PREFIX = "DeactivateLiveLocationWork-"

fun getWorkName(eventId: String, roomId: String) = "${WORK_NAME_PREFIX}$eventId-$roomId"
fun getWorkName(eventId: String, roomId: String): String {
val hash = "$eventId$roomId".md5()
return "DeactivateLiveLocationWork-$hash"
}
}
}

0 comments on commit 791d4fb

Please sign in to comment.