diff --git a/app/sampledata/features.json b/app/sampledata/features.json new file mode 100644 index 0000000000000000000000000000000000000000..febda7e543d6b005f70192558a0b65b0fc2e12cf --- /dev/null +++ b/app/sampledata/features.json @@ -0,0 +1,62 @@ +[ + { + "name": "SynchronizedMarkerLine", + "description": "Required for synchronizing the last position in channels" + }, + { + "name": "SaslAuthentication", + "description": "Required for SASL" + }, + { + "name": "SaslExternal", + "description": "Required for SASL with certificates" + }, + { + "name": "HideInactiveNetworks", + "description": "Required for hiding inactive networks from chat lists" + }, + { + "name": "PasswordChange", + "description": "Required for changing passwords from the client" + }, + { + "name": "CapNegotiation", + "description": "Required for IRCv3 capabilities" + }, + { + "name": "VerifyServerSSL", + "description": "Required for verifying the SSL certificate of IRC networks you connect to" + }, + { + "name": "CustomRateLimits", + "description": "Required for custom rate limits for IRC networks" + }, + { + "name": "AwayFormatTimestamp", + "description": "Required for custom formatted timestamps in away messages" + }, + { + "name": "BufferActivitySync", + "description": "Required for seeing activity of chats in the chat list" + }, + { + "name": "CoreSideHighlights", + "description": "Required for highlights" + }, + { + "name": "SenderPrefixes", + "description": "Required for seeing prefix modes (+, @) of users in channels" + }, + { + "name": "RemoteDisconnect", + "description": "Required for remote disconnects of your own clients" + }, + { + "name": "RichMessages", + "description": "Required for seeing real names or IRCv3 or Gravatar avatars in messages" + }, + { + "name": "BacklogFilterType", + "description": "Required for receiving past notifications after connecting" + } +] diff --git a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt index 7bed5e754fad77ac8436b25a51cee9954c319fc2..9d4d5fc6089127fcc13ef4abb87ff2f44101af4c 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt +++ b/app/src/main/java/de/kuschku/quasseldroid/ui/chat/ChatActivity.kt @@ -47,6 +47,7 @@ import de.kuschku.libquassel.protocol.Buffer_Type import de.kuschku.libquassel.protocol.Message import de.kuschku.libquassel.protocol.Message_Type import de.kuschku.libquassel.protocol.message.HandshakeMessage +import de.kuschku.libquassel.quassel.ExtendedFeature import de.kuschku.libquassel.session.Error import de.kuschku.libquassel.util.Optional import de.kuschku.libquassel.util.flag.and @@ -68,6 +69,8 @@ import de.kuschku.quasseldroid.ui.setup.accounts.selection.AccountSelectionActiv import de.kuschku.quasseldroid.ui.setup.user.UserSetupActivity import de.kuschku.quasseldroid.util.helper.* import de.kuschku.quasseldroid.util.irc.format.IrcFormatDeserializer +import de.kuschku.quasseldroid.util.missingfeatures.MissingFeature +import de.kuschku.quasseldroid.util.missingfeatures.MissingFeaturesDialog import de.kuschku.quasseldroid.util.service.ServiceBoundActivity import de.kuschku.quasseldroid.util.ui.DragInterceptBottomSheetBehavior import de.kuschku.quasseldroid.util.ui.MaterialContentLoadingProgressBar @@ -464,6 +467,52 @@ class ChatActivity : ServiceBoundActivity(), SharedPreferences.OnSharedPreferenc if (it.identities.isEmpty()) { UserSetupActivity.launch(this) } + val missingFeatures = listOf( + ExtendedFeature.SynchronizedMarkerLine, + ExtendedFeature.SaslAuthentication, + ExtendedFeature.SaslExternal, + ExtendedFeature.HideInactiveNetworks, + ExtendedFeature.PasswordChange, + ExtendedFeature.CapNegotiation, + ExtendedFeature.VerifyServerSSL, + ExtendedFeature.CustomRateLimits, + ExtendedFeature.AwayFormatTimestamp, + ExtendedFeature.BufferActivitySync, + ExtendedFeature.CoreSideHighlights, + ExtendedFeature.SenderPrefixes, + ExtendedFeature.RemoteDisconnect, + ExtendedFeature.RichMessages, + ExtendedFeature.BacklogFilterType + ) - it.features.core.enabledFeatures + if (missingFeatures.isNotEmpty()) { + MissingFeaturesDialog.Builder(this) + .missingFeatures(missingFeatures.mapNotNull { feature -> + when (feature) { + ExtendedFeature.SynchronizedMarkerLine -> R.string.label_feature_synchronizedmarkerline + ExtendedFeature.SaslAuthentication -> R.string.label_feature_saslauthentication + ExtendedFeature.SaslExternal -> R.string.label_feature_saslexternal + ExtendedFeature.HideInactiveNetworks -> R.string.label_feature_hideinactivenetworks + ExtendedFeature.PasswordChange -> R.string.label_feature_passwordchange + ExtendedFeature.CapNegotiation -> R.string.label_feature_capnegotiation + ExtendedFeature.VerifyServerSSL -> R.string.label_feature_verifyserverssl + ExtendedFeature.CustomRateLimits -> R.string.label_feature_customratelimits + ExtendedFeature.AwayFormatTimestamp -> R.string.label_feature_awayformattimestamp + ExtendedFeature.BufferActivitySync -> R.string.label_feature_bufferactivitysync + ExtendedFeature.CoreSideHighlights -> R.string.label_feature_coresidehighlights + ExtendedFeature.SenderPrefixes -> R.string.label_feature_senderprefixes + ExtendedFeature.RemoteDisconnect -> R.string.label_feature_remotedisconnect + ExtendedFeature.RichMessages -> R.string.label_feature_richmessages + ExtendedFeature.BacklogFilterType -> R.string.label_feature_backlogfiltertype + else -> null + }?.let { + MissingFeature( + feature = feature, + description = it + ) + } + }) + .show() + } } } }) diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java index e1af161f21d72c0b21a196954bb389d8eadbf0d2..03c127e7fb9ad8d286f3cd265c56765708725065 100644 --- a/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java +++ b/app/src/main/java/de/kuschku/quasseldroid/util/ui/ColorChooserDialog.java @@ -94,16 +94,6 @@ public class ColorChooserDialog extends DialogFragment public ColorChooserDialog() { } - @Nullable - public static ColorChooserDialog findVisible( - @NonNull FragmentManager fragmentManager, @ColorChooserTag String tag) { - Fragment frag = fragmentManager.findFragmentByTag(tag); - if (frag != null && frag instanceof ColorChooserDialog) { - return (ColorChooserDialog) frag; - } - return null; - } - private void generateColors() { Builder builder = getBuilder(); colorsTop = builder.colorsTop; diff --git a/app/src/main/res/layout/dialog_missing_features.xml b/app/src/main/res/layout/dialog_missing_features.xml new file mode 100644 index 0000000000000000000000000000000000000000..09017390d0cba50effe1f1f916f26cd20af1edc1 --- /dev/null +++ b/app/src/main/res/layout/dialog_missing_features.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Quasseldroid - Quassel client for Android + + Copyright (c) 2018 Janne Koschinski + Copyright (c) 2018 The Quassel Project + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License version 3 as published + by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see <http://www.gnu.org/licenses/>. + --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + android:paddingBottom="8dp" + android:paddingTop="8dp"> + + <TextView + style="@style/Widget.RtlConformTextView" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingBottom="8dp" + android:paddingEnd="?listPreferredItemPaddingRight" + android:paddingLeft="?listPreferredItemPaddingLeft" + android:paddingRight="?listPreferredItemPaddingRight" + android:paddingStart="?listPreferredItemPaddingLeft" + android:paddingTop="8dp" + android:text="@string/info_missing_features" + android:textColor="?colorTextPrimary" + android:textSize="16sp" /> + + <android.support.v7.widget.RecyclerView + android:id="@+id/list" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:nestedScrollingEnabled="false" + tools:ignore="UnusedAttribute" + tools:itemCount="3" + tools:listitem="@layout/widget_missing_feature" /> +</LinearLayout> diff --git a/app/src/main/res/layout/widget_missing_feature.xml b/app/src/main/res/layout/widget_missing_feature.xml new file mode 100644 index 0000000000000000000000000000000000000000..c7eae4a51320e0e08b3f608f651d25764425ddbf --- /dev/null +++ b/app/src/main/res/layout/widget_missing_feature.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?><!-- + Quasseldroid - Quassel client for Android + + Copyright (c) 2018 Janne Koschinski + Copyright (c) 2018 The Quassel Project + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License version 3 as published + by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program. If not, see <http://www.gnu.org/licenses/>. + --> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?android:attr/selectableItemBackground" + android:focusable="true" + android:gravity="center_vertical" + android:minHeight="?android:attr/listPreferredItemHeightSmall" + android:paddingEnd="?android:attr/listPreferredItemPaddingRight" + android:paddingLeft="?android:attr/listPreferredItemPaddingLeft" + android:paddingRight="?android:attr/listPreferredItemPaddingRight" + android:paddingStart="?android:attr/listPreferredItemPaddingLeft" + tools:showIn="@layout/dialog_missing_features"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingBottom="16dp" + android:paddingTop="16dp"> + + <TextView + android:id="@+id/name" + style="@style/Widget.RtlConformTextView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?colorTextPrimary" + android:textSize="16sp" + tools:text="@sample/features.json/name" /> + + <TextView + android:id="@+id/description" + style="@style/Widget.RtlConformTextView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textColor="?colorTextSecondary" + tools:text="@sample/features.json/description" /> + </LinearLayout> +</LinearLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f4736bc615f064beda7fc97184b110cee8c58bcc..823a191ec9b29d7e201e88e017ab2cb1a42e0e77 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,6 +28,7 @@ <string name="connection_service_description">Keeps a connection to your core to allow for notifications, and to transmit messages.</string> <string name="label_about">About</string> + <string name="label_accept">Accept</string> <string name="label_avatar">Avatar</string> <string name="label_back">Back</string> <string name="label_buffer_name">Buffer Name</string> @@ -109,11 +110,30 @@ <string name="label_whois_long">Update user information</string> <string name="label_yes">Yes</string> + <string name="label_feature_synchronizedmarkerline">Required for synchronizing the last position in channels</string> + <string name="label_feature_saslauthentication">Required for SASL</string> + <string name="label_feature_saslexternal">Required for SASL with certificates</string> + <string name="label_feature_hideinactivenetworks">Required for hiding inactive networks from chat lists</string> + <string name="label_feature_passwordchange">Required for changing passwords from the client</string> + <string name="label_feature_capnegotiation">Required for IRCv3 capabilities</string> + <string name="label_feature_verifyserverssl">Required for verifying the SSL certificate of IRC networks you connect to</string> + <string name="label_feature_customratelimits">Required for custom rate limits for IRC networks</string> + <string name="label_feature_awayformattimestamp">Required for custom formatted timestamps in away messages</string> + <string name="label_feature_bufferactivitysync">Required for seeing activity of chats in the chat list</string> + <string name="label_feature_coresidehighlights">Required for highlights</string> + <string name="label_feature_senderprefixes">Required for seeing prefix modes (+, @) of users in channels</string> + <string name="label_feature_remotedisconnect">Required for remote disconnects of your own clients</string> + <string name="label_feature_richmessages">Required for seeing real names or IRCv3 or Gravatar avatars in messages</string> + <string name="label_feature_backlogfiltertype">Required for receiving past notifications after connecting</string> + <string name="notification_channel_background" translatable="false">background</string> <string name="notification_channel_connection_title">Connection</string> <string name="notification_channel_highlight" translatable="false">highlight</string> <string name="notification_channel_highlight_title">Highlight</string> + <string name="label_missing_features">Missing Features</string> + <string name="info_missing_features">Your core is missing features that are required for Quasseldroid to work correctly.</string> + <string name="buffer_delete_confirmation">Do you want to delete this buffer permanently?</string> <string name="delete_confirmation">Are you sure you want to delete this permanently? This can not be undone.</string>