diff --git a/res/drawable/default_bottom_sheet_background.xml b/res/drawable/default_bottom_sheet_background.xml
new file mode 100644
index 0000000000..127fdb9645
--- /dev/null
+++ b/res/drawable/default_bottom_sheet_background.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/default_bottom_sheet_background_inset.xml b/res/drawable/default_bottom_sheet_background_inset.xml
new file mode 100644
index 0000000000..6806f7b96c
--- /dev/null
+++ b/res/drawable/default_bottom_sheet_background_inset.xml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ic_chat_bubbles.xml b/res/drawable/ic_chat_bubbles.xml
new file mode 100644
index 0000000000..6af5f35f47
--- /dev/null
+++ b/res/drawable/ic_chat_bubbles.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
diff --git a/res/layout/fragment_open_group_suggestion_bottom_sheet.xml b/res/layout/fragment_open_group_suggestion_bottom_sheet.xml
new file mode 100644
index 0000000000..b26d9f86dc
--- /dev/null
+++ b/res/layout/fragment_open_group_suggestion_bottom_sheet.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/res/values/styles.xml b/res/values/styles.xml
index fe6bab3fc9..7ceeb76dff 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -49,6 +49,14 @@
- @style/Session.AlertDialog.PositiveButtonStyle
+
+
+
+
diff --git a/src/org/thoughtcrime/securesms/DeviceListFragment.java b/src/org/thoughtcrime/securesms/DeviceListFragment.java
index 61328af624..91381c4835 100644
--- a/src/org/thoughtcrime/securesms/DeviceListFragment.java
+++ b/src/org/thoughtcrime/securesms/DeviceListFragment.java
@@ -25,7 +25,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory;
import org.thoughtcrime.securesms.database.loaders.DeviceListLoader;
import org.thoughtcrime.securesms.dependencies.InjectableType;
import org.thoughtcrime.securesms.devicelist.Device;
-import org.thoughtcrime.securesms.loki.redesign.views.DeviceEditingOptionsBottomSheet;
+import org.thoughtcrime.securesms.loki.redesign.dialogs.DeviceEditingOptionsBottomSheet;
import org.thoughtcrime.securesms.loki.redesign.utilities.MnemonicUtilities;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.ViewUtil;
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/HomeActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/HomeActivity.kt
index 514363f404..78cb11d8a2 100644
--- a/src/org/thoughtcrime/securesms/loki/redesign/activities/HomeActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/HomeActivity.kt
@@ -22,13 +22,16 @@ import android.text.style.ForegroundColorSpan
import android.view.View
import kotlinx.android.synthetic.main.activity_home.*
import network.loki.messenger.R
+import nl.komponents.kovenant.ui.successUi
import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.conversation.ConversationActivity
+import org.thoughtcrime.securesms.crypto.ProfileKeyUtil
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.database.ThreadDatabase
import org.thoughtcrime.securesms.database.model.ThreadRecord
import org.thoughtcrime.securesms.loki.getColorWithID
+import org.thoughtcrime.securesms.loki.redesign.dialogs.OpenGroupSuggestionBottomSheet
import org.thoughtcrime.securesms.loki.redesign.utilities.push
import org.thoughtcrime.securesms.loki.redesign.utilities.show
import org.thoughtcrime.securesms.loki.redesign.views.ConversationView
@@ -147,6 +150,32 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe
if (hasViewedSeed || !isMasterDevice) {
seedReminderView.visibility = View.GONE
}
+ if (!TextSecurePreferences.getHasSeenOpenGroupSuggestionSheet(this)) {
+ val bottomSheet = OpenGroupSuggestionBottomSheet()
+ bottomSheet.onJoinTapped = {
+ TextSecurePreferences.setHasSeenOpenGroupSuggestionSheet(this)
+ bottomSheet.dismiss()
+ // TODO: Duplication of the code in JoinPublicChatActivity
+ val application = ApplicationContext.getInstance(this)
+ val channel: Long = 1
+ val displayName = TextSecurePreferences.getProfileName(this)
+ val lokiPublicChatAPI = application.lokiPublicChatAPI!!
+ val url = "https://chat.getsession.org"
+ application.lokiPublicChatManager.addChat(url, channel).successUi {
+ lokiPublicChatAPI.getMessages(channel, url)
+ lokiPublicChatAPI.setDisplayName(displayName, url)
+ lokiPublicChatAPI.join(channel, url)
+ val profileKey: ByteArray = ProfileKeyUtil.getProfileKey(this)
+ val profileUrl: String? = TextSecurePreferences.getProfileAvatarUrl(this)
+ lokiPublicChatAPI.setProfilePicture(url, profileKey, profileUrl)
+ }
+ }
+ bottomSheet.onDismissTapped = {
+ TextSecurePreferences.setHasSeenOpenGroupSuggestionSheet(this)
+ bottomSheet.dismiss()
+ }
+ bottomSheet.show(supportFragmentManager, bottomSheet.tag)
+ }
}
// endregion
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt b/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt
index 669f575ac5..ba659cfa21 100644
--- a/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt
+++ b/src/org/thoughtcrime/securesms/loki/redesign/activities/LinkedDevicesActivity.kt
@@ -15,11 +15,7 @@ import network.loki.messenger.R
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.devicelist.Device
-import org.thoughtcrime.securesms.loki.redesign.views.DeviceEditingOptionsBottomSheet
-import org.thoughtcrime.securesms.loki.redesign.dialogs.EditDeviceNameDialog
-import org.thoughtcrime.securesms.loki.redesign.dialogs.EditDeviceNameDialogDelegate
-import org.thoughtcrime.securesms.loki.redesign.dialogs.LinkDeviceMasterModeDialog
-import org.thoughtcrime.securesms.loki.redesign.dialogs.LinkDeviceMasterModeDialogDelegate
+import org.thoughtcrime.securesms.loki.redesign.dialogs.*
import org.thoughtcrime.securesms.loki.signAndSendPairingAuthorisationMessage
import org.thoughtcrime.securesms.sms.MessageSender
import org.thoughtcrime.securesms.util.TextSecurePreferences
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/views/DeviceEditingOptionsBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/DeviceEditingOptionsBottomSheet.kt
similarity index 94%
rename from src/org/thoughtcrime/securesms/loki/redesign/views/DeviceEditingOptionsBottomSheet.kt
rename to src/org/thoughtcrime/securesms/loki/redesign/dialogs/DeviceEditingOptionsBottomSheet.kt
index 78904471e4..d8bb4967f4 100644
--- a/src/org/thoughtcrime/securesms/loki/redesign/views/DeviceEditingOptionsBottomSheet.kt
+++ b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/DeviceEditingOptionsBottomSheet.kt
@@ -1,4 +1,4 @@
-package org.thoughtcrime.securesms.loki.redesign.views
+package org.thoughtcrime.securesms.loki.redesign.dialogs
import android.os.Bundle
import android.support.design.widget.BottomSheetDialogFragment
diff --git a/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt
new file mode 100644
index 0000000000..274b36af74
--- /dev/null
+++ b/src/org/thoughtcrime/securesms/loki/redesign/dialogs/OpenGroupSuggestionBottomSheet.kt
@@ -0,0 +1,29 @@
+package org.thoughtcrime.securesms.loki.redesign.dialogs
+
+import android.os.Bundle
+import android.support.design.widget.BottomSheetDialogFragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import kotlinx.android.synthetic.main.fragment_open_group_suggestion_bottom_sheet.*
+import network.loki.messenger.R
+
+public class OpenGroupSuggestionBottomSheet : BottomSheetDialogFragment() {
+ var onJoinTapped: (() -> Unit)? = null
+ var onDismissTapped: (() -> 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_open_group_suggestion_bottom_sheet, container, false)
+ }
+
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+ joinButton.setOnClickListener { onJoinTapped?.invoke() }
+ dismissButton.setOnClickListener { onDismissTapped?.invoke() }
+ }
+}
\ No newline at end of file
diff --git a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java
index d7fece32d1..052997e3ac 100644
--- a/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java
+++ b/src/org/thoughtcrime/securesms/util/TextSecurePreferences.java
@@ -1250,6 +1250,14 @@ public class TextSecurePreferences {
public static long getRestorationTime(Context context) {
return getLongPreference(context, "restoration_time", 0);
}
+
+ public static boolean getHasSeenOpenGroupSuggestionSheet(Context context) {
+ return getBooleanPreference(context, "has_seen_open_group_suggestion_sheet", false);
+ }
+
+ public static void setHasSeenOpenGroupSuggestionSheet(Context context) {
+ setBooleanPreference(context, "has_seen_open_group_suggestion_sheet", true);
+ }
// endregion
public static void clearAll(Context context) {