Update website build to use PackageInstaller.

This commit is contained in:
Greyson Parrelli
2023-10-23 11:30:37 -07:00
committed by GitHub
parent d468d4c21b
commit 4b004f70ec
24 changed files with 759 additions and 458 deletions

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.keyvalue
internal class ApkUpdateValues(store: KeyValueStore) : SignalStoreValues(store) {
companion object {
private const val DOWNLOAD_ID = "apk_update.download_id"
private const val DIGEST = "apk_update.digest"
private const val AUTO_UPDATE = "apk_update.auto_update"
}
override fun onFirstEverAppLaunch() = Unit
override fun getKeysToIncludeInBackup(): List<String> = emptyList()
val downloadId: Long by longValue(DOWNLOAD_ID, -2)
val digest: ByteArray? get() = store.getBlob(DIGEST, null)
val autoUpdate: Boolean by booleanValue(AUTO_UPDATE, true)
fun setDownloadAttributes(id: Long, digest: ByteArray?) {
store
.beginWrite()
.putLong(DOWNLOAD_ID, id)
.putBlob(DIGEST, digest)
.commit()
}
fun clearDownloadAttributes() {
store
.beginWrite()
.putLong(DOWNLOAD_ID, -1)
.putBlob(DIGEST, null)
.commit()
}
}

View File

@@ -43,6 +43,7 @@ public final class SignalStore {
private final NotificationProfileValues notificationProfileValues;
private final ReleaseChannelValues releaseChannelValues;
private final StoryValues storyValues;
private final ApkUpdateValues apkUpdate;
private final PlainTextSharedPrefsDataStore plainTextValues;
@@ -87,6 +88,7 @@ public final class SignalStore {
this.notificationProfileValues = new NotificationProfileValues(store);
this.releaseChannelValues = new ReleaseChannelValues(store);
this.storyValues = new StoryValues(store);
this.apkUpdate = new ApkUpdateValues(store);
this.plainTextValues = new PlainTextSharedPrefsDataStore(ApplicationDependencies.getApplication());
}
@@ -264,6 +266,10 @@ public final class SignalStore {
return getInstance().storyValues;
}
public static @NonNull ApkUpdateValues apkUpdate() {
return getInstance().apkUpdate;
}
public static @NonNull GroupsV2AuthorizationSignalStoreCache groupsV2AciAuthorizationCache() {
return GroupsV2AuthorizationSignalStoreCache.createAciCache(getStore());
}