mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
feat: initial creation sets flag, rename to match libsession implementation value
This commit is contained in:
parent
92b4e9d913
commit
3269cfa4de
6 changed files with 29 additions and 15 deletions
|
@ -436,7 +436,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isCheckingCommunityRequests(): Boolean {
|
override fun isCheckingCommunityRequests(): Boolean {
|
||||||
return configFactory.user?.getBlocksCommunityMessageRequests() != true
|
return configFactory.user?.getCommunityMessageRequests() != true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun notifyUpdates(forConfigObject: ConfigBase) {
|
fun notifyUpdates(forConfigObject: ConfigBase) {
|
||||||
|
|
|
@ -71,8 +71,8 @@ import org.thoughtcrime.securesms.onboarding.SeedActivity
|
||||||
import org.thoughtcrime.securesms.onboarding.SeedReminderViewDelegate
|
import org.thoughtcrime.securesms.onboarding.SeedReminderViewDelegate
|
||||||
import org.thoughtcrime.securesms.permissions.Permissions
|
import org.thoughtcrime.securesms.permissions.Permissions
|
||||||
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
import org.thoughtcrime.securesms.preferences.SettingsActivity
|
||||||
import org.thoughtcrime.securesms.showSessionDialog
|
|
||||||
import org.thoughtcrime.securesms.showMuteDialog
|
import org.thoughtcrime.securesms.showMuteDialog
|
||||||
|
import org.thoughtcrime.securesms.showSessionDialog
|
||||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||||
import org.thoughtcrime.securesms.util.DateUtils
|
import org.thoughtcrime.securesms.util.DateUtils
|
||||||
import org.thoughtcrime.securesms.util.IP2Country
|
import org.thoughtcrime.securesms.util.IP2Country
|
||||||
|
@ -298,13 +298,18 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
||||||
}
|
}
|
||||||
EventBus.getDefault().register(this@HomeActivity)
|
EventBus.getDefault().register(this@HomeActivity)
|
||||||
if (intent.hasExtra(FROM_ONBOARDING)
|
if (intent.hasExtra(FROM_ONBOARDING)
|
||||||
&& intent.getBooleanExtra(FROM_ONBOARDING, false)
|
&& intent.getBooleanExtra(FROM_ONBOARDING, false)) {
|
||||||
&& !(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).areNotificationsEnabled()
|
if (!(getSystemService(NOTIFICATION_SERVICE) as NotificationManager).areNotificationsEnabled()) {
|
||||||
) {
|
|
||||||
Permissions.with(this)
|
Permissions.with(this)
|
||||||
.request(Manifest.permission.POST_NOTIFICATIONS)
|
.request(Manifest.permission.POST_NOTIFICATIONS)
|
||||||
.execute()
|
.execute()
|
||||||
}
|
}
|
||||||
|
configFactory.user?.let { user ->
|
||||||
|
if (!user.isBlockCommunityMessageRequestsSet()) {
|
||||||
|
user.setCommunityMessageRequests(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInputFocusChanged(hasFocus: Boolean) {
|
override fun onInputFocusChanged(hasFocus: Boolean) {
|
||||||
|
|
|
@ -47,14 +47,14 @@ class PrivacySettingsPreferenceFragment : ListSummaryPreferenceFragment() {
|
||||||
|
|
||||||
override fun getBoolean(key: String?, defValue: Boolean): Boolean {
|
override fun getBoolean(key: String?, defValue: Boolean): Boolean {
|
||||||
if (key == TextSecurePreferences.ALLOW_MESSAGE_REQUESTS) {
|
if (key == TextSecurePreferences.ALLOW_MESSAGE_REQUESTS) {
|
||||||
return !user.getBlocksCommunityMessageRequests()
|
return user.getCommunityMessageRequests()
|
||||||
}
|
}
|
||||||
return super.getBoolean(key, defValue)
|
return super.getBoolean(key, defValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun putBoolean(key: String?, value: Boolean) {
|
override fun putBoolean(key: String?, value: Boolean) {
|
||||||
if (key == TextSecurePreferences.ALLOW_MESSAGE_REQUESTS) {
|
if (key == TextSecurePreferences.ALLOW_MESSAGE_REQUESTS) {
|
||||||
user.setBlocksCommunityMessageRequests(!value)
|
user.setCommunityMessageRequests(value)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
super.putBoolean(key, value)
|
super.putBoolean(key, value)
|
||||||
|
|
|
@ -98,7 +98,7 @@ Java_network_loki_messenger_libsession_1util_UserProfile_getNtsPriority(JNIEnv *
|
||||||
}
|
}
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_network_loki_messenger_libsession_1util_UserProfile_getBlocksCommunityMessageRequests(
|
Java_network_loki_messenger_libsession_1util_UserProfile_getCommunityMessageRequests(
|
||||||
JNIEnv *env, jobject thiz) {
|
JNIEnv *env, jobject thiz) {
|
||||||
std::lock_guard lock{util::util_mutex_};
|
std::lock_guard lock{util::util_mutex_};
|
||||||
auto profile = ptrToProfile(env, thiz);
|
auto profile = ptrToProfile(env, thiz);
|
||||||
|
@ -111,9 +111,17 @@ Java_network_loki_messenger_libsession_1util_UserProfile_getBlocksCommunityMessa
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_network_loki_messenger_libsession_1util_UserProfile_setBlocksCommunityMessageRequests(
|
Java_network_loki_messenger_libsession_1util_UserProfile_setCommunityMessageRequests(
|
||||||
JNIEnv *env, jobject thiz, jboolean blocks) {
|
JNIEnv *env, jobject thiz, jboolean blocks) {
|
||||||
std::lock_guard lock{util::util_mutex_};
|
std::lock_guard lock{util::util_mutex_};
|
||||||
auto profile = ptrToProfile(env, thiz);
|
auto profile = ptrToProfile(env, thiz);
|
||||||
profile->set_blinded_msgreqs(std::optional{(bool)blocks});
|
profile->set_blinded_msgreqs(std::optional{(bool)blocks});
|
||||||
}
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT jboolean JNICALL
|
||||||
|
Java_network_loki_messenger_libsession_1util_UserProfile_isBlockCommunityMessageRequestsSet(
|
||||||
|
JNIEnv *env, jobject thiz) {
|
||||||
|
std::lock_guard lock{util::util_mutex_};
|
||||||
|
auto profile = ptrToProfile(env, thiz);
|
||||||
|
return profile->get_blinded_msgreqs().has_value();
|
||||||
|
}
|
|
@ -126,8 +126,9 @@ class UserProfile(pointer: Long) : ConfigBase(pointer) {
|
||||||
external fun setPic(userPic: UserPic)
|
external fun setPic(userPic: UserPic)
|
||||||
external fun setNtsPriority(priority: Int)
|
external fun setNtsPriority(priority: Int)
|
||||||
external fun getNtsPriority(): Int
|
external fun getNtsPriority(): Int
|
||||||
external fun getBlocksCommunityMessageRequests(): Boolean
|
external fun getCommunityMessageRequests(): Boolean
|
||||||
external fun setBlocksCommunityMessageRequests(blocks: Boolean)
|
external fun setCommunityMessageRequests(blocks: Boolean)
|
||||||
|
external fun isBlockCommunityMessageRequestsSet(): Boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConversationVolatileConfig(pointer: Long): ConfigBase(pointer) {
|
class ConversationVolatileConfig(pointer: Long): ConfigBase(pointer) {
|
||||||
|
|
|
@ -247,7 +247,7 @@ object MessageSender {
|
||||||
}
|
}
|
||||||
configFactory.user?.let { user ->
|
configFactory.user?.let { user ->
|
||||||
if (message is VisibleMessage) {
|
if (message is VisibleMessage) {
|
||||||
message.blocksMessageRequests = user.getBlocksCommunityMessageRequests()
|
message.blocksMessageRequests = user.getCommunityMessageRequests()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val userEdKeyPair = MessagingModuleConfiguration.shared.getUserED25519KeyPair()!!
|
val userEdKeyPair = MessagingModuleConfiguration.shared.getUserED25519KeyPair()!!
|
||||||
|
|
Loading…
Reference in a new issue