diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index bfa2c456dc..ea4e449167 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -112,6 +112,9 @@
android:name="org.thoughtcrime.securesms.loki.redesign.activities.DisplayNameActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/pn_option_background_deselect_transition.xml b/res/drawable/pn_option_background_deselect_transition.xml
new file mode 100644
index 0000000000..7fcb8e1160
--- /dev/null
+++ b/res/drawable/pn_option_background_deselect_transition.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/pn_option_background_select_transition.xml b/res/drawable/pn_option_background_select_transition.xml
new file mode 100644
index 0000000000..21c58cf71d
--- /dev/null
+++ b/res/drawable/pn_option_background_select_transition.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/pn_option_background_selected.xml b/res/drawable/pn_option_background_selected.xml
new file mode 100644
index 0000000000..56d1ed983a
--- /dev/null
+++ b/res/drawable/pn_option_background_selected.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout-sw400dp/activity_pn_mode.xml b/res/layout-sw400dp/activity_pn_mode.xml
new file mode 100644
index 0000000000..8edc9267df
--- /dev/null
+++ b/res/layout-sw400dp/activity_pn_mode.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout-sw400dp/fragment_pn_mode_bottom_sheet.xml b/res/layout-sw400dp/fragment_pn_mode_bottom_sheet.xml
new file mode 100644
index 0000000000..0b01b12fdc
--- /dev/null
+++ b/res/layout-sw400dp/fragment_pn_mode_bottom_sheet.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/layout/activity_pn_mode.xml b/res/layout/activity_pn_mode.xml
new file mode 100644
index 0000000000..25f868d1f8
--- /dev/null
+++ b/res/layout/activity_pn_mode.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/fragment_pn_mode_bottom_sheet.xml b/res/layout/fragment_pn_mode_bottom_sheet.xml
new file mode 100644
index 0000000000..48fc5f3a31
--- /dev/null
+++ b/res/layout/fragment_pn_mode_bottom_sheet.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 958e2a8bd1..374020fd95 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -26,6 +26,8 @@
#3F4146
#99FFFFFF
#1F1F1F
+ #1B1B1B
+ #212121
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 3ed8a9a187..16ed23c8fe 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -32,6 +32,7 @@
56dp
8dp
4dp
+ 8dp
8dp
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c32f241721..8745cd043b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1670,5 +1670,26 @@
Are you sure you want to leave this group?
Are you sure you want to delete this conversation?
Conversation deleted
+ Push Notifications
+ There are two ways Session can handle push notifications. Make sure to read the descriptions carefully before you choose.
+ Firebase Cloud Messaging
+ Session will use the Firebase Cloud Messaging service to receive push notifications. You’ll be notified of new messages reliably and immediately. Using FCM means that this device will communicate directly with Google’s servers to retrieve push notifications, which will expose your IP address to Google. Your messages will still be onion-routed and end-to-end encrypted, so the contents of your messages will remain completely private.
+ Background Polling
+ Session will occasionally check for new messages in the background. This guarantees full privacy protection, but message notifications may be significantly delayed.
+ Recommended
+ Please Pick an Option
+ Push Notifications
+ Session now features two ways to handle push notifications. Make sure to read the descriptions carefully before you choose.
+ Firebase Cloud Messaging
+ Session will use the Firebase Cloud Messaging service to receive push notifications. You’ll be notified of new messages reliably and immediately. Using FCM means that this device will communicate directly with Google’s servers to retrieve push notifications, which will expose your IP address to Google. Your messages will still be onion-routed and end-to-end encrypted, so the contents of your messages will remain completely private.
+ Background Polling
+ Session will occasionally check for new messages in the background. This guarantees full privacy protection, but message notifications may be significantly delayed.
+ Recommended
+ Please Pick an Option
+ Confirm
+ Skip
+ Notification Strategy
+ Use FCM
+ Using Firebase Cloud Messaging allows for more reliable push notifications, but exposes your IP to Google.
diff --git a/res/xml/preferences_notifications.xml b/res/xml/preferences_notifications.xml
index 12dafb675a..9a9c918179 100644
--- a/res/xml/preferences_notifications.xml
+++ b/res/xml/preferences_notifications.xml
@@ -21,6 +21,19 @@
+
+
+
+
+
+
+
+
{
+ performTransition(R.drawable.pn_option_background_select_transition, fcmOptionView)
+ selectedOptionView = fcmOptionView
+ }
+ fcmOptionView -> {
+ performTransition(R.drawable.pn_option_background_deselect_transition, fcmOptionView)
+ selectedOptionView = null
+ }
+ backgroundPollingOptionView -> {
+ performTransition(R.drawable.pn_option_background_select_transition, fcmOptionView)
+ performTransition(R.drawable.pn_option_background_deselect_transition, backgroundPollingOptionView)
+ selectedOptionView = fcmOptionView
+ }
+ }
+ }
+
+ private fun toggleBackgroundPolling() {
+ when (selectedOptionView) {
+ null -> {
+ performTransition(R.drawable.pn_option_background_select_transition, backgroundPollingOptionView)
+ selectedOptionView = backgroundPollingOptionView
+ }
+ backgroundPollingOptionView -> {
+ performTransition(R.drawable.pn_option_background_deselect_transition, backgroundPollingOptionView)
+ selectedOptionView = null
+ }
+ fcmOptionView -> {
+ performTransition(R.drawable.pn_option_background_select_transition, backgroundPollingOptionView)
+ performTransition(R.drawable.pn_option_background_deselect_transition, fcmOptionView)
+ selectedOptionView = backgroundPollingOptionView
+ }
+ }
+ }
+
+ private fun register() {
+ // TODO: Implement
+ }
+ // endregion
+}
\ No newline at end of file
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt
index 274b36af74..18802dee97 100644
--- a/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt
+++ b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt
@@ -8,7 +8,7 @@ import android.view.ViewGroup
import kotlinx.android.synthetic.main.fragment_open_group_suggestion_bottom_sheet.*
import network.loki.messenger.R
-public class OpenGroupSuggestionBottomSheet : BottomSheetDialogFragment() {
+class OpenGroupSuggestionBottomSheet : BottomSheetDialogFragment() {
var onJoinTapped: (() -> Unit)? = null
var onDismissTapped: (() -> Unit)? = null
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt
new file mode 100644
index 0000000000..32ccbd4b0b
--- /dev/null
+++ b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/PNModeBottomSheet.kt
@@ -0,0 +1,80 @@
+package org.thoughtcrime.securesms.loki.redesign.dialogs
+
+import android.graphics.drawable.TransitionDrawable
+import android.os.Bundle
+import android.support.annotation.DrawableRes
+import android.support.design.widget.BottomSheetDialogFragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.LinearLayout
+import kotlinx.android.synthetic.main.fragment_pn_mode_bottom_sheet.*
+import network.loki.messenger.R
+
+class PNModeBottomSheet : BottomSheetDialogFragment() {
+ private var selectedOptionView: LinearLayout? = null
+ var onConfirmTapped: ((Boolean) -> Unit)? = null
+ var onSkipTapped: (() -> Unit)? = null
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setStyle(STYLE_NORMAL, R.style.SessionBottomSheetDialogTheme)
+ }
+
+ override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
+ return inflater.inflate(R.layout.fragment_pn_mode_bottom_sheet, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ fcmOptionView.setOnClickListener { toggleFCM() }
+ backgroundPollingOptionView.setOnClickListener { toggleBackgroundPolling() }
+ confirmButton.setOnClickListener { onConfirmTapped?.invoke(selectedOptionView == fcmOptionView) }
+ skipButton.setOnClickListener { onSkipTapped?.invoke() }
+ }
+
+ // region Animation
+ private fun performTransition(@DrawableRes transitionID: Int, subject: View) {
+ val drawable = resources.getDrawable(transitionID, context!!.theme) as TransitionDrawable
+ subject.background = drawable
+ drawable.startTransition(250)
+ }
+ // endregion
+
+ // region Interaction
+ private fun toggleFCM() {
+ when (selectedOptionView) {
+ null -> {
+ performTransition(R.drawable.pn_option_background_select_transition, fcmOptionView)
+ selectedOptionView = fcmOptionView
+ }
+ fcmOptionView -> {
+ performTransition(R.drawable.pn_option_background_deselect_transition, fcmOptionView)
+ selectedOptionView = null
+ }
+ backgroundPollingOptionView -> {
+ performTransition(R.drawable.pn_option_background_select_transition, fcmOptionView)
+ performTransition(R.drawable.pn_option_background_deselect_transition, backgroundPollingOptionView)
+ selectedOptionView = fcmOptionView
+ }
+ }
+ }
+
+ private fun toggleBackgroundPolling() {
+ when (selectedOptionView) {
+ null -> {
+ performTransition(R.drawable.pn_option_background_select_transition, backgroundPollingOptionView)
+ selectedOptionView = backgroundPollingOptionView
+ }
+ backgroundPollingOptionView -> {
+ performTransition(R.drawable.pn_option_background_deselect_transition, backgroundPollingOptionView)
+ selectedOptionView = null
+ }
+ fcmOptionView -> {
+ performTransition(R.drawable.pn_option_background_select_transition, backgroundPollingOptionView)
+ performTransition(R.drawable.pn_option_background_deselect_transition, fcmOptionView)
+ selectedOptionView = backgroundPollingOptionView
+ }
+ }
+ }
+}
\ No newline at end of file