mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-22 07:57:30 +00:00
Merge branch 'dev' into firebase
This commit is contained in:
commit
5db952d676
@ -6,7 +6,7 @@
|
||||
<uses-sdk tools:overrideLibrary="com.amulyakhare.textdrawable,com.astuetz.pagerslidingtabstrip,pl.tajchert.waitingdots,com.h6ah4i.android.multiselectlistpreferencecompat,android.support.v13,com.davemorrissey.labs.subscaleview,com.tomergoldst.tooltips,com.klinker.android.send_message,com.takisoft.colorpicker,android.support.v14.preference" />
|
||||
|
||||
<permission
|
||||
android:name="network.loki.messenger.ACCESS_SECRETS"
|
||||
android:name="network.loki.messenger.ACCESS_SESSION_SECRETS"
|
||||
android:label="Access to TextSecure Secrets"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
||||
<uses-permission android:name="network.loki.messenger.ACCESS_SECRETS" />
|
||||
<uses-permission android:name="network.loki.messenger.ACCESS_SESSION_SECRETS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
@ -676,11 +676,6 @@
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver android:name="org.thoughtcrime.securesms.loki.api.BackgroundOpenGroupPollWorker">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<!-- Session -->
|
||||
<service
|
||||
android:name="org.thoughtcrime.securesms.jobmanager.JobSchedulerScheduler$SystemService"
|
||||
|
@ -73,6 +73,7 @@ configurations.all {
|
||||
exclude group: "org.whispersystems", module: "signal-protocol-android"
|
||||
exclude group: "org.signal", module: "signal-metadata-java"
|
||||
exclude group: "org.signal", module: "signal-metadata-android"
|
||||
exclude module: "commons-logging"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -196,8 +197,8 @@ dependencies {
|
||||
implementation "com.opencsv:opencsv:$opencsv_version"
|
||||
}
|
||||
|
||||
def canonicalVersionCode = 53
|
||||
def canonicalVersionName = "1.2.1"
|
||||
def canonicalVersionCode = 55
|
||||
def canonicalVersionName = "1.2.2"
|
||||
|
||||
def postFixSize = 10
|
||||
def abiPostFix = ['armeabi-v7a' : 1,
|
||||
|
@ -1,116 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/default_session_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="@dimen/very_large_font_size"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_explanation" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fcmOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
android:background="@drawable/default_session_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/very_large_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="@dimen/very_large_font_size"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_fcm_option_title" />
|
||||
android:text="@string/activity_pn_mode_explanation" />
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:id="@+id/fcmOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_fcm_option_explanation" />
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
|
||||
<TextView
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_fcm_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_fcm_option_explanation" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/accent"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_recommended_option_tag" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/backgroundPollingOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/accent"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_recommended_option_tag" />
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/small_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_explanation" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
style="@style/MediumProminentFilledButton"
|
||||
android:id="@+id/registerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/medium_button_height"
|
||||
android:layout_marginLeft="@dimen/massive_spacing"
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:layout_marginRight="@dimen/massive_spacing"
|
||||
android:layout_marginBottom="@dimen/medium_spacing"
|
||||
android:text="@string/continue_2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/backgroundPollingOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/small_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_explanation" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
style="@style/MediumProminentFilledButton"
|
||||
android:id="@+id/registerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/medium_button_height"
|
||||
android:layout_marginLeft="@dimen/massive_spacing"
|
||||
android:layout_marginRight="@dimen/massive_spacing"
|
||||
android:layout_marginBottom="@dimen/medium_spacing"
|
||||
android:text="Continue" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -1,116 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/default_session_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="13sp"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_explanation" />
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fcmOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
android:background="@drawable/default_session_background"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/very_large_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="@dimen/large_font_size"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_fcm_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_fcm_option_explanation" />
|
||||
android:text="@string/activity_pn_mode_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/accent"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_recommended_option_tag" />
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/small_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_explanation" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/fcmOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/medium_spacing"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_fcm_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_fcm_option_explanation" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/accent"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_recommended_option_tag" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/backgroundPollingOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="@dimen/small_spacing"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="12dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/medium_spacing"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_explanation" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
style="@style/MediumProminentFilledButton"
|
||||
android:id="@+id/registerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/medium_button_height"
|
||||
android:layout_marginLeft="@dimen/massive_spacing"
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:layout_marginRight="@dimen/massive_spacing"
|
||||
android:layout_marginBottom="@dimen/medium_spacing"
|
||||
android:text="@string/continue_2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/backgroundPollingOptionView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginRight="@dimen/very_large_spacing"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/pn_option_background">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/text"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_title" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:textSize="@dimen/very_small_font_size"
|
||||
android:textColor="@color/text"
|
||||
android:text="@string/activity_pn_mode_background_polling_option_explanation" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
style="@style/MediumProminentFilledButton"
|
||||
android:id="@+id/registerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/medium_button_height"
|
||||
android:layout_marginLeft="@dimen/massive_spacing"
|
||||
android:layout_marginRight="@dimen/massive_spacing"
|
||||
android:layout_marginBottom="@dimen/medium_spacing"
|
||||
android:text="@string/continue_2" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
@ -59,7 +59,6 @@ import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.logging.PersistentLogger;
|
||||
import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger;
|
||||
import org.thoughtcrime.securesms.loki.activities.HomeActivity;
|
||||
import org.thoughtcrime.securesms.loki.api.BackgroundOpenGroupPollWorker;
|
||||
import org.thoughtcrime.securesms.loki.api.BackgroundPollWorker;
|
||||
import org.thoughtcrime.securesms.loki.api.LokiPublicChatManager;
|
||||
import org.thoughtcrime.securesms.loki.api.LokiPushNotificationManager;
|
||||
@ -366,7 +365,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
LocalBackupListener.schedule(this);
|
||||
RotateSenderCertificateListener.schedule(this);
|
||||
BackgroundPollWorker.schedule(this); // Loki
|
||||
BackgroundOpenGroupPollWorker.schedule(this); // Loki
|
||||
|
||||
if (BuildConfig.PLAY_STORE_DISABLED) {
|
||||
UpdateApkRefreshListener.schedule(this);
|
||||
|
@ -2066,7 +2066,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
} else if (!isSecureText && !isDefaultSms) {
|
||||
unblockButton.setVisibility(View.GONE);
|
||||
inputPanel.setVisibility(View.GONE);
|
||||
makeDefaultSmsButton.setVisibility(View.VISIBLE);
|
||||
makeDefaultSmsButton.setVisibility(View.GONE);
|
||||
registerButton.setVisibility(View.GONE);
|
||||
} else {
|
||||
inputPanel.setVisibility(View.VISIBLE);
|
||||
|
@ -1,38 +0,0 @@
|
||||
package org.thoughtcrime.securesms.loki.api
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||
import org.thoughtcrime.securesms.service.PersistentAlarmManagerListener
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class BackgroundOpenGroupPollWorker : PersistentAlarmManagerListener() {
|
||||
|
||||
companion object {
|
||||
private val pollInterval = TimeUnit.MINUTES.toMillis(4)
|
||||
|
||||
@JvmStatic
|
||||
fun schedule(context: Context) {
|
||||
BackgroundOpenGroupPollWorker().onReceive(context, Intent())
|
||||
}
|
||||
}
|
||||
|
||||
override fun getNextScheduledExecutionTime(context: Context): Long {
|
||||
return TextSecurePreferences.getOpenGroupBackgroundPollTime(context)
|
||||
}
|
||||
|
||||
override fun onAlarm(context: Context, scheduledTime: Long): Long {
|
||||
if (scheduledTime != 0L) {
|
||||
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
|
||||
for (openGroup in openGroups) {
|
||||
val poller = LokiPublicChatPoller(context, openGroup)
|
||||
poller.stop()
|
||||
poller.pollForNewMessages()
|
||||
}
|
||||
}
|
||||
val nextTime = System.currentTimeMillis() + pollInterval
|
||||
TextSecurePreferences.setOpenGroupBackgroundPollTime(context, nextTime)
|
||||
return nextTime
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ import java.util.concurrent.TimeUnit
|
||||
class BackgroundPollWorker : PersistentAlarmManagerListener() {
|
||||
|
||||
companion object {
|
||||
private val pollInterval = TimeUnit.MINUTES.toMillis(2)
|
||||
private val pollInterval = TimeUnit.MINUTES.toMillis(10)
|
||||
|
||||
@JvmStatic
|
||||
fun schedule(context: Context) {
|
||||
@ -28,21 +28,28 @@ class BackgroundPollWorker : PersistentAlarmManagerListener() {
|
||||
}
|
||||
|
||||
override fun onAlarm(context: Context, scheduledTime: Long): Long {
|
||||
if (TextSecurePreferences.isUsingFCM(context)) { return 0L }
|
||||
if (scheduledTime != 0L) {
|
||||
val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
|
||||
try {
|
||||
val applicationContext = context.applicationContext as ApplicationContext
|
||||
val broadcaster = applicationContext.broadcaster
|
||||
LokiAPI.configureIfNeeded(userHexEncodedPublicKey, lokiAPIDatabase, broadcaster)
|
||||
LokiAPI.shared.getMessages().map { messages ->
|
||||
messages.forEach {
|
||||
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false)
|
||||
if (TextSecurePreferences.isUsingFCM(context)) {
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context)
|
||||
val lokiAPIDatabase = DatabaseFactory.getLokiAPIDatabase(context)
|
||||
try {
|
||||
val applicationContext = context.applicationContext as ApplicationContext
|
||||
val broadcaster = applicationContext.broadcaster
|
||||
LokiAPI.configureIfNeeded(userPublicKey, lokiAPIDatabase, broadcaster)
|
||||
LokiAPI.shared.getMessages().map { messages ->
|
||||
messages.forEach {
|
||||
PushContentReceiveJob(context).processEnvelope(SignalServiceEnvelope(it), false)
|
||||
}
|
||||
}
|
||||
} catch (exception: Throwable) {
|
||||
// Do nothing
|
||||
}
|
||||
} catch (exception: Throwable) {
|
||||
// Do nothing
|
||||
}
|
||||
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().map { it.value }
|
||||
for (openGroup in openGroups) {
|
||||
val poller = LokiPublicChatPoller(context, openGroup)
|
||||
poller.stop()
|
||||
poller.pollForNewMessages()
|
||||
}
|
||||
}
|
||||
val nextTime = System.currentTimeMillis() + pollInterval
|
||||
|
@ -26,8 +26,8 @@ class LokiSessionResetImplementation(private val context: Context) : LokiSession
|
||||
}
|
||||
|
||||
override fun validatePreKeySignalMessage(sender: String, message: PreKeySignalMessage) {
|
||||
val preKeyRecord = DatabaseFactory.getLokiPreKeyRecordDatabase(context).getPreKeyRecord(sender)
|
||||
check(preKeyRecord != null) { "Received a background message from a user without an associated pre key record." }
|
||||
val preKeyRecord = DatabaseFactory.getLokiPreKeyRecordDatabase(context).getPreKeyRecord(sender) ?: return
|
||||
// TODO: Checking that the pre key record isn't null is causing issues when it shouldn't
|
||||
check(preKeyRecord.id == (message.preKeyId ?: -1)) { "Received a background message from an unknown source." }
|
||||
}
|
||||
}
|
@ -14,7 +14,6 @@ import android.os.VibrationEffect
|
||||
import android.os.VibrationEffect.DEFAULT_AMPLITUDE
|
||||
import android.os.Vibrator
|
||||
import android.support.annotation.ColorRes
|
||||
import android.support.annotation.DimenRes
|
||||
import android.support.annotation.DrawableRes
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
@ -198,12 +197,9 @@ class NewConversationButtonSetView : RelativeLayout {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
if (isExpanded) {
|
||||
if (sessionButton.contains(touch)) { delegate?.createNewPrivateChat(); collapse() }
|
||||
else if (closedGroupButton.contains(touch)) { delegate?.createNewClosedGroup(); collapse() }
|
||||
else if (openGroupButton.contains(touch)) { delegate?.joinOpenGroup(); collapse() }
|
||||
else if (mainButton.contains(touch)) { collapse() }
|
||||
if (mainButton.contains(touch)) { collapse() }
|
||||
} else {
|
||||
isExpanded = !isExpanded
|
||||
isExpanded = true
|
||||
expand()
|
||||
}
|
||||
val vibrator = context.getSystemService(VIBRATOR_SERVICE) as Vibrator
|
||||
@ -235,15 +231,17 @@ class NewConversationButtonSetView : RelativeLayout {
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
|
||||
val distanceFromRestPosition = touch.distanceTo(buttonRestPosition)
|
||||
if (distanceFromRestPosition > (minDragDistance + mainButton.collapsedSize / 2)) {
|
||||
val mainButtonCenter = PointF(width.toFloat() / 2, height.toFloat() - bottomMargin - mainButton.expandedSize / 2)
|
||||
val distanceFromMainButtonCenter = touch.distanceTo(mainButtonCenter)
|
||||
fun collapse() {
|
||||
isExpanded = false
|
||||
this.collapse()
|
||||
}
|
||||
if (distanceFromMainButtonCenter > (minDragDistance + mainButton.collapsedSize / 2)) {
|
||||
if (sessionButton.contains(touch) || touch.isAbove(sessionButton, dragMargin)) { delegate?.createNewPrivateChat(); collapse() }
|
||||
else if (closedGroupButton.contains(touch) || touch.isRightOf(closedGroupButton, dragMargin)) { delegate?.createNewClosedGroup(); collapse() }
|
||||
else if (openGroupButton.contains(touch) || touch.isLeftOf(openGroupButton, dragMargin)) { delegate?.joinOpenGroup(); collapse() }
|
||||
else {
|
||||
isExpanded = !isExpanded
|
||||
if (!isExpanded) { collapse() }
|
||||
}
|
||||
else { collapse() }
|
||||
} else {
|
||||
val currentPosition = PointF(mainButton.x, mainButton.y)
|
||||
mainButton.animatePositionChange(currentPosition, buttonRestPosition)
|
||||
|
@ -61,7 +61,7 @@ public class KeyCachingService extends Service {
|
||||
|
||||
public static final int SERVICE_RUNNING_ID = 4141;
|
||||
|
||||
public static final String KEY_PERMISSION = "network.loki.messenger.ACCESS_SECRETS";
|
||||
public static final String KEY_PERMISSION = "network.loki.messenger.ACCESS_SESSION_SECRETS";
|
||||
public static final String NEW_KEY_EVENT = "org.thoughtcrime.securesms.service.action.NEW_KEY_EVENT";
|
||||
public static final String CLEAR_KEY_EVENT = "org.thoughtcrime.securesms.service.action.CLEAR_KEY_EVENT";
|
||||
public static final String LOCK_TOGGLED_EVENT = "org.thoughtcrime.securesms.service.action.LOCK_ENABLED_EVENT";
|
||||
|
@ -40,7 +40,7 @@ public class BitmapUtil {
|
||||
|
||||
private static final String TAG = BitmapUtil.class.getSimpleName();
|
||||
|
||||
private static final int MAX_COMPRESSION_QUALITY = 90;
|
||||
private static final int MAX_COMPRESSION_QUALITY = 95;
|
||||
private static final int MIN_COMPRESSION_QUALITY = 45;
|
||||
private static final int MAX_COMPRESSION_ATTEMPTS = 5;
|
||||
private static final int MIN_COMPRESSION_QUALITY_DECREASE = 5;
|
||||
@ -255,7 +255,7 @@ public class BitmapUtil {
|
||||
|
||||
public static InputStream toCompressedJpeg(Bitmap bitmap) {
|
||||
ByteArrayOutputStream thumbnailBytes = new ByteArrayOutputStream();
|
||||
bitmap.compress(CompressFormat.JPEG, 85, thumbnailBytes);
|
||||
bitmap.compress(CompressFormat.JPEG, 95, thumbnailBytes);
|
||||
return new ByteArrayInputStream(thumbnailBytes.toByteArray());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user