From a1ca48960cb45839850757cf47aeb7af8e8c96f0 Mon Sep 17 00:00:00 2001 From: Taras Smakula <tarassmakula@gmail.com> Date: Mon, 17 Jul 2023 14:55:35 +0300 Subject: [PATCH] System notices to core, remove settings --- app/build.gradle | 1 - .../following/RemoveFollowingDialog.kt | 2 +- .../futo/circles/feature/home/HomeFragment.kt | 2 +- .../feature/settings}/SettingsDataSource.kt | 2 +- .../feature/settings}/SettingsFragment.kt | 13 ++- .../feature/settings}/SettingsNavigator.kt | 4 +- .../feature/settings}/SettingsViewModel.kt | 2 +- .../edit_profile/EditProfileDialogFragment.kt | 6 +- .../edit_profile/EditProfileViewModel.kt | 2 +- .../timeline/TimelineDialogFragment.kt | 2 +- .../futo/circles/model/ConfirmationType.kt | 10 +- .../layout/dialog_fragment_edit_profile.xml | 0 .../src/main/res/layout/fragment_settings.xml | 0 .../res/navigation/settings_nav_graph.xml | 55 +++-------- app/src/main/res/values/strings.xml | 10 +- app/src/main/res/values/styles.xml | 20 ++++ .../navigation/log_in_sessions_nav_graph.xml | 44 +++++++++ auth/src/main/res/values/strings.xml | 3 + .../SystemNoticesCountSharedViewModel.kt | 2 +- settings.gradle | 3 +- settings/.gitignore | 1 - settings/build.gradle | 91 ------------------- settings/consumer-rules.pro | 0 settings/proguard-rules.pro | 21 ----- .../settings/ExampleInstrumentedTest.kt | 24 ----- settings/src/main/AndroidManifest.xml | 4 - .../settings/model/ConfirmationType.kt | 13 --- settings/src/main/res/values-night/colors.xml | 4 - settings/src/main/res/values/colors.xml | 4 - settings/src/main/res/values/strings.xml | 15 --- settings/src/main/res/values/styles.xml | 24 ----- .../futo/circles/settings/ExampleUnitTest.kt | 17 ---- 32 files changed, 113 insertions(+), 288 deletions(-) rename {settings/src/main/java/org/futo/circles/settings/feature => app/src/main/java/org/futo/circles/feature/settings}/SettingsDataSource.kt (98%) rename {settings/src/main/java/org/futo/circles/settings/feature => app/src/main/java/org/futo/circles/feature/settings}/SettingsFragment.kt (92%) rename {settings/src/main/java/org/futo/circles/settings/feature => app/src/main/java/org/futo/circles/feature/settings}/SettingsNavigator.kt (96%) rename {settings/src/main/java/org/futo/circles/settings/feature => app/src/main/java/org/futo/circles/feature/settings}/SettingsViewModel.kt (98%) rename {settings/src/main/java/org/futo/circles/settings/feature => app/src/main/java/org/futo/circles/feature/settings}/edit_profile/EditProfileDialogFragment.kt (95%) rename {settings/src/main/java/org/futo/circles/settings/feature => app/src/main/java/org/futo/circles/feature/settings}/edit_profile/EditProfileViewModel.kt (96%) rename {settings => app}/src/main/res/layout/dialog_fragment_edit_profile.xml (100%) rename {settings => app}/src/main/res/layout/fragment_settings.xml (100%) create mode 100644 auth/src/main/res/navigation/log_in_sessions_nav_graph.xml rename {settings/src/main/java/org/futo/circles/settings/feature/system_notices => core/src/main/java/org/futo/circles/core/notices}/SystemNoticesCountSharedViewModel.kt (96%) delete mode 100644 settings/.gitignore delete mode 100644 settings/build.gradle delete mode 100644 settings/consumer-rules.pro delete mode 100644 settings/proguard-rules.pro delete mode 100644 settings/src/androidTest/java/org/futo/circles/settings/ExampleInstrumentedTest.kt delete mode 100644 settings/src/main/AndroidManifest.xml delete mode 100644 settings/src/main/java/org/futo/circles/settings/model/ConfirmationType.kt delete mode 100644 settings/src/main/res/values-night/colors.xml delete mode 100644 settings/src/main/res/values/colors.xml delete mode 100644 settings/src/main/res/values/strings.xml delete mode 100644 settings/src/main/res/values/styles.xml delete mode 100644 settings/src/test/java/org/futo/circles/settings/ExampleUnitTest.kt diff --git a/app/build.gradle b/app/build.gradle index a75fde634..1f307f8cc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,7 +60,6 @@ dependencies { implementation project(path: ':core') implementation project(path: ':auth') implementation project(path: ':gallery') - implementation project(path: ':settings') //Firebase gplayImplementation platform('com.google.firebase:firebase-bom:32.1.1') diff --git a/app/src/main/java/org/futo/circles/feature/circles/following/RemoveFollowingDialog.kt b/app/src/main/java/org/futo/circles/feature/circles/following/RemoveFollowingDialog.kt index 9e28cf883..3f3915145 100644 --- a/app/src/main/java/org/futo/circles/feature/circles/following/RemoveFollowingDialog.kt +++ b/app/src/main/java/org/futo/circles/feature/circles/following/RemoveFollowingDialog.kt @@ -28,7 +28,7 @@ class RemoveFollowingDialog( setContentView(binding.root) with(binding) { - val title = "${context.getString(R.string.remove)} $roomName" + val title = "${context.getString(org.futo.circles.core.R.string.remove)} $roomName" tvTitle.text = title btnClose.setOnClickListener { dismiss() } btnCancel.setOnClickListener { dismiss() } diff --git a/app/src/main/java/org/futo/circles/feature/home/HomeFragment.kt b/app/src/main/java/org/futo/circles/feature/home/HomeFragment.kt index 84c39c43f..6421a55f5 100644 --- a/app/src/main/java/org/futo/circles/feature/home/HomeFragment.kt +++ b/app/src/main/java/org/futo/circles/feature/home/HomeFragment.kt @@ -30,7 +30,7 @@ import org.futo.circles.core.picker.RuntimePermissionHelper import org.futo.circles.core.provider.MatrixSessionProvider import org.futo.circles.databinding.FragmentBottomNavigationBinding import org.futo.circles.gallery.feature.backup.service.MediaBackupServiceManager -import org.futo.circles.settings.feature.system_notices.SystemNoticesCountSharedViewModel +import org.futo.circles.core.notices.SystemNoticesCountSharedViewModel import org.matrix.android.sdk.api.session.getRoomSummary import javax.inject.Inject diff --git a/settings/src/main/java/org/futo/circles/settings/feature/SettingsDataSource.kt b/app/src/main/java/org/futo/circles/feature/settings/SettingsDataSource.kt similarity index 98% rename from settings/src/main/java/org/futo/circles/settings/feature/SettingsDataSource.kt rename to app/src/main/java/org/futo/circles/feature/settings/SettingsDataSource.kt index dc1fe57b7..acdf3f0f2 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/SettingsDataSource.kt +++ b/app/src/main/java/org/futo/circles/feature/settings/SettingsDataSource.kt @@ -1,4 +1,4 @@ -package org.futo.circles.settings.feature +package org.futo.circles.feature.settings import android.content.Context import com.bumptech.glide.Glide diff --git a/settings/src/main/java/org/futo/circles/settings/feature/SettingsFragment.kt b/app/src/main/java/org/futo/circles/feature/settings/SettingsFragment.kt similarity index 92% rename from settings/src/main/java/org/futo/circles/settings/feature/SettingsFragment.kt rename to app/src/main/java/org/futo/circles/feature/settings/SettingsFragment.kt index a4c7f60ab..2dfd0ec06 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/SettingsFragment.kt +++ b/app/src/main/java/org/futo/circles/feature/settings/SettingsFragment.kt @@ -1,4 +1,4 @@ -package org.futo.circles.settings.feature +package org.futo.circles.feature.settings import android.os.Bundle import android.view.View @@ -9,6 +9,7 @@ import androidx.fragment.app.viewModels import by.kirich1409.viewbindingdelegate.viewBinding import dagger.hilt.android.AndroidEntryPoint import org.futo.circles.MainActivity +import org.futo.circles.R import org.futo.circles.auth.model.LogOut import org.futo.circles.auth.model.SwitchUser import org.futo.circles.core.CirclesAppConfig @@ -19,13 +20,11 @@ import org.futo.circles.core.extensions.observeResponse import org.futo.circles.core.extensions.showError import org.futo.circles.core.extensions.showSuccess import org.futo.circles.core.extensions.withConfirmation +import org.futo.circles.core.notices.SystemNoticesCountSharedViewModel import org.futo.circles.core.provider.PreferencesProvider import org.futo.circles.core.view.LoadingDialog -import org.futo.circles.settings.R -import org.futo.circles.settings.databinding.FragmentSettingsBinding -import org.futo.circles.settings.feature.system_notices.SystemNoticesCountSharedViewModel -import org.futo.circles.settings.model.DeactivateAccount -import org.futo.circles.settings.model.LogOut +import org.futo.circles.databinding.FragmentSettingsBinding +import org.futo.circles.model.DeactivateAccount import org.matrix.android.sdk.api.session.user.model.User @AndroidEntryPoint @@ -73,7 +72,7 @@ class SettingsFragment : Fragment(R.layout.fragment_settings) { } viewModel.deactivateLiveData.observeResponse(this, success = { clearSessionAndRestart() }, - error = { showError(getString(R.string.invalid_auth)) } + error = { showError(getString(org.futo.circles.auth.R.string.invalid_auth)) } ) systemNoticesCountViewModel.systemNoticesCountLiveData?.observeData(this) { binding.ivNoticesCount.setCount(it ?: 0) diff --git a/settings/src/main/java/org/futo/circles/settings/feature/SettingsNavigator.kt b/app/src/main/java/org/futo/circles/feature/settings/SettingsNavigator.kt similarity index 96% rename from settings/src/main/java/org/futo/circles/settings/feature/SettingsNavigator.kt rename to app/src/main/java/org/futo/circles/feature/settings/SettingsNavigator.kt index 532a19240..6578d2340 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/SettingsNavigator.kt +++ b/app/src/main/java/org/futo/circles/feature/settings/SettingsNavigator.kt @@ -1,11 +1,11 @@ -package org.futo.circles.settings.feature +package org.futo.circles.feature.settings import androidx.navigation.fragment.findNavController +import org.futo.circles.R import org.futo.circles.core.extensions.navigateSafe import org.futo.circles.core.extensions.showError import org.futo.circles.core.utils.getSharedCirclesSpaceId import org.futo.circles.core.utils.getSystemNoticesRoomId -import org.futo.circles.settings.R class SettingsNavigator(private val fragment: SettingsFragment) { diff --git a/settings/src/main/java/org/futo/circles/settings/feature/SettingsViewModel.kt b/app/src/main/java/org/futo/circles/feature/settings/SettingsViewModel.kt similarity index 98% rename from settings/src/main/java/org/futo/circles/settings/feature/SettingsViewModel.kt rename to app/src/main/java/org/futo/circles/feature/settings/SettingsViewModel.kt index d21a1fead..30b1cecbf 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/SettingsViewModel.kt +++ b/app/src/main/java/org/futo/circles/feature/settings/SettingsViewModel.kt @@ -1,4 +1,4 @@ -package org.futo.circles.settings.feature +package org.futo.circles.feature.settings import androidx.lifecycle.ViewModel import dagger.hilt.android.lifecycle.HiltViewModel diff --git a/settings/src/main/java/org/futo/circles/settings/feature/edit_profile/EditProfileDialogFragment.kt b/app/src/main/java/org/futo/circles/feature/settings/edit_profile/EditProfileDialogFragment.kt similarity index 95% rename from settings/src/main/java/org/futo/circles/settings/feature/edit_profile/EditProfileDialogFragment.kt rename to app/src/main/java/org/futo/circles/feature/settings/edit_profile/EditProfileDialogFragment.kt index a7002891a..6569c5653 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/edit_profile/EditProfileDialogFragment.kt +++ b/app/src/main/java/org/futo/circles/feature/settings/edit_profile/EditProfileDialogFragment.kt @@ -1,4 +1,4 @@ -package org.futo.circles.settings.feature.edit_profile +package org.futo.circles.feature.settings.edit_profile import android.os.Bundle import android.view.View @@ -6,6 +6,7 @@ import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels import dagger.hilt.android.AndroidEntryPoint +import org.futo.circles.R import org.futo.circles.core.extensions.getText import org.futo.circles.core.extensions.loadProfileIcon import org.futo.circles.core.extensions.notEmptyDisplayName @@ -15,9 +16,8 @@ import org.futo.circles.core.extensions.onBackPressed import org.futo.circles.core.extensions.showSuccess import org.futo.circles.core.fragment.BaseFullscreenDialogFragment import org.futo.circles.core.fragment.HasLoadingState +import org.futo.circles.databinding.DialogFragmentEditProfileBinding import org.futo.circles.gallery.feature.pick.AllMediaPickerHelper -import org.futo.circles.settings.R -import org.futo.circles.settings.databinding.DialogFragmentEditProfileBinding import org.matrix.android.sdk.api.session.user.model.User @AndroidEntryPoint diff --git a/settings/src/main/java/org/futo/circles/settings/feature/edit_profile/EditProfileViewModel.kt b/app/src/main/java/org/futo/circles/feature/settings/edit_profile/EditProfileViewModel.kt similarity index 96% rename from settings/src/main/java/org/futo/circles/settings/feature/edit_profile/EditProfileViewModel.kt rename to app/src/main/java/org/futo/circles/feature/settings/edit_profile/EditProfileViewModel.kt index a93e75143..b1eec4aaa 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/edit_profile/EditProfileViewModel.kt +++ b/app/src/main/java/org/futo/circles/feature/settings/edit_profile/EditProfileViewModel.kt @@ -1,4 +1,4 @@ -package org.futo.circles.settings.feature.edit_profile +package org.futo.circles.feature.settings.edit_profile import android.net.Uri import androidx.lifecycle.MutableLiveData diff --git a/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt b/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt index 1f29495cc..808ee5590 100644 --- a/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt +++ b/app/src/main/java/org/futo/circles/feature/timeline/TimelineDialogFragment.kt @@ -56,7 +56,7 @@ class TimelineDialogFragment : BaseFullscreenDialogFragment(DialogFragmentTimeli private val timelineId by lazy { if (isGroupMode) args.roomId else getTimelineRoomFor(args.roomId)?.roomId ?: throw IllegalArgumentException( - requireContext().getString(R.string.timeline_not_found) + "Timeline not found" ) } private val binding by lazy { diff --git a/app/src/main/java/org/futo/circles/model/ConfirmationType.kt b/app/src/main/java/org/futo/circles/model/ConfirmationType.kt index 33d59c050..d65775b3a 100644 --- a/app/src/main/java/org/futo/circles/model/ConfirmationType.kt +++ b/app/src/main/java/org/futo/circles/model/ConfirmationType.kt @@ -26,7 +26,7 @@ data class UnfollowTimeline( data class RemovePost( override val titleRes: Int = R.string.remove_post, override val messageRes: Int = R.string.remove_post_message, - override val positiveButtonRes: Int = R.string.remove + override val positiveButtonRes: Int = org.futo.circles.core.R.string.remove ) : ConfirmationType(titleRes, messageRes, positiveButtonRes) data class IgnoreSender( @@ -62,7 +62,7 @@ data class DeleteCircle( data class RemoveRoomUser( override val titleRes: Int = R.string.remove_user, override val messageRes: Int = R.string.remove_user_in_room_message, - override val positiveButtonRes: Int = R.string.remove + override val positiveButtonRes: Int = org.futo.circles.core.R.string.remove ) : ConfirmationType(titleRes, messageRes, positiveButtonRes) data class BanUser( @@ -87,4 +87,10 @@ data class ResendInvite( override val titleRes: Int = R.string.resend_invite, override val messageRes: Int = R.string.resend_invite_message, override val positiveButtonRes: Int = android.R.string.ok +) : ConfirmationType(titleRes, messageRes, positiveButtonRes) + +data class DeactivateAccount( + override val titleRes: Int = R.string.deactivate_my_account, + override val messageRes: Int = R.string.deactivate_message, + override val positiveButtonRes: Int = R.string.deactivate ) : ConfirmationType(titleRes, messageRes, positiveButtonRes) \ No newline at end of file diff --git a/settings/src/main/res/layout/dialog_fragment_edit_profile.xml b/app/src/main/res/layout/dialog_fragment_edit_profile.xml similarity index 100% rename from settings/src/main/res/layout/dialog_fragment_edit_profile.xml rename to app/src/main/res/layout/dialog_fragment_edit_profile.xml diff --git a/settings/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml similarity index 100% rename from settings/src/main/res/layout/fragment_settings.xml rename to app/src/main/res/layout/fragment_settings.xml diff --git a/app/src/main/res/navigation/settings_nav_graph.xml b/app/src/main/res/navigation/settings_nav_graph.xml index 856462439..f0cea5e28 100644 --- a/app/src/main/res/navigation/settings_nav_graph.xml +++ b/app/src/main/res/navigation/settings_nav_graph.xml @@ -7,7 +7,7 @@ <fragment android:id="@+id/settingsFragment" - android:name="org.futo.circles.settings.feature.SettingsFragment" + android:name="org.futo.circles.feature.settings.SettingsFragment" android:label="@string/settings" tools:layout="@layout/fragment_settings"> <action @@ -18,7 +18,7 @@ app:destination="@id/changePasswordDialogFragment" /> <action android:id="@+id/to_activeSessionsDialogFragment" - app:destination="@id/activeSessionsDialogFragment" /> + app:destination="@id/log_in_sessions_nav_graph" /> <action android:id="@+id/to_systemNoticesDialogFragment" app:destination="@id/systemNoticesDialogFragment"> @@ -35,9 +35,6 @@ app:nullable="false" /> </action> - <action - android:id="@+id/action_settingsFragment_to_activeSessionsDialogFragment" - app:destination="@id/activeSessionsDialogFragment" /> <action android:id="@+id/to_reAuthStagesDialogFragment" app:destination="@id/reAuthStagesDialogFragment" /> @@ -63,35 +60,14 @@ <dialog android:id="@+id/editProfileDialogFragment" - android:name="org.futo.circles.settings.edit_profile.EditProfileDialogFragment" + android:name="org.futo.circles.feature.settings.edit_profile.EditProfileDialogFragment" android:label="ProfileDialogFragment" tools:layout="@layout/dialog_fragment_edit_profile" /> <dialog android:id="@+id/changePasswordDialogFragment" - android:name="org.futo.circles.settings.change_password.ChangePasswordDialogFragment" + android:name="org.futo.circles.auth.feature.change_password.ChangePasswordDialogFragment" android:label="ChangePasswordDialogFragment" tools:layout="@layout/dialog_fragment_change_password" /> - <dialog - android:id="@+id/activeSessionsDialogFragment" - android:name="org.futo.circles.settings.active_sessions.ActiveSessionsDialogFragment" - android:label="ActiveSessionsDialogFragment" - tools:layout="@layout/dialog_fragment_active_sessions"> - <action - android:id="@+id/to_reAuthStagesDialogFragment" - app:destination="@id/reAuthStagesDialogFragment" /> - - <action - android:id="@+id/to_verifySessionDialogFragment" - app:destination="@id/verifySessionDialogFragment"> - - <argument - android:name="deviceId" - app:argType="string" - app:nullable="false" /> - - </action> - - </dialog> <dialog android:id="@+id/systemNoticesDialogFragment" android:name="org.futo.circles.feature.notices.SystemNoticesDialogFragment" @@ -108,22 +84,6 @@ app:nullable="false" /> </dialog> - <dialog - android:id="@+id/verifySessionDialogFragment" - android:name="org.futo.circles.settings.active_sessions.verify.VerifySessionDialogFragment" - tools:layout="@layout/dialog_fragment_verify_session"> - - <argument - android:name="deviceId" - app:argType="string" - app:nullable="false" /> - - </dialog> - - <dialog - android:id="@+id/reAuthStagesDialogFragment" - android:name="org.futo.circles.auth.feature.reauth.ReAuthStagesDialogFragment" - tools:layout="@layout/fragment_login_stages" /> <dialog android:id="@+id/shareRoomDialogFragment" @@ -155,4 +115,11 @@ android:name="org.futo.circles.feature.notifications.test.NotificationTestDialogFragment" tools:layout="@layout/dialog_fragment_notifications_test" /> + <include app:graph="@navigation/log_in_sessions_nav_graph" /> + + <dialog + android:id="@+id/reAuthStagesDialogFragment" + android:name="org.futo.circles.auth.feature.reauth.ReAuthStagesDialogFragment" + tools:layout="@layout/fragment_login_stages" /> + </navigation> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6044d1f4a..e04d79f95 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -166,8 +166,6 @@ <string name="end_poll_message">This will stop people from being able to vote and will display the final results of the poll.</string> <string name="system_notices_room_not_found">System notices room not found.</string> <string name="you_are_signed_out">You’re signed out</string> - <string name="verify_session">Verify session</string> - <string name="scan_qr_code">Scan QR code</string> <string name="create_your_first_circle_to_be_able_to_accept_invite">Create your first Circle to be able to accept invite</string> <string name="show_more">Show more</string> <string name="edit">Edit</string> @@ -284,6 +282,14 @@ <string name="send_request_to_follow_user">Send request to follow this user</string> <string name="resend">Resend</string> <string name="unable_to_parse_url">Unable to parse url</string> + <string name="profile_updated">Profile updated</string> + <string name="version_format">Version %s</string> + <string name="developer_mode_enabled">Developer mode is enabled</string> + <string name="developer_mode_disabled">Developer mode is disabled</string> + <string name="deactivate_my_account">Deactivate my account</string> + <string name="deactivate_message">This will make your account permanently unusable. You will not be able to log in, and no one will be able to re-register the same user lD. This will cause your account to leave all rooms it is participating in, and it will remove your account details from your identity server. This action is irreversible.</string> + <string name="deactivate">Deactivate</string> + <string name="room_not_found">Room is not found</string> <string-array name="report_categories"> <item>@string/crude_language</item> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 441eb39bc..dde7b2409 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -15,6 +15,26 @@ <item name="cornerFamilyTopRight">rounded</item> </style> + <style name="settingMenuItem" parent="body"> + <item name="android:background">?attr/selectableItemBackground</item> + <item name="android:clickable">true</item> + <item name="android:focusable">true</item> + <item name="android:drawablePadding">8dp</item> + <item name="android:paddingBottom">10dp</item> + <item name="android:paddingStart">16dp</item> + <item name="android:paddingEnd">16dp</item> + <item name="android:paddingTop">10dp</item> + <item name="android:drawableTint">@color/list_item_icon_color</item> + </style> + + <style name="settingMenuHeader" parent="subheadline"> + <item name="android:textColor">@color/blue</item> + <item name="android:paddingBottom">8dp</item> + <item name="android:paddingStart">16dp</item> + <item name="android:paddingEnd">16dp</item> + <item name="android:paddingTop">16dp</item> + </style> + <style name="AuthLogoStyle"> <item name="android:src">@drawable/ic_logo</item> </style> diff --git a/auth/src/main/res/navigation/log_in_sessions_nav_graph.xml b/auth/src/main/res/navigation/log_in_sessions_nav_graph.xml new file mode 100644 index 000000000..bee1fe4e5 --- /dev/null +++ b/auth/src/main/res/navigation/log_in_sessions_nav_graph.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<navigation xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:id="@+id/log_in_sessions_nav_graph" + app:startDestination="@id/activeSessionsDialogFragment"> + + <dialog + android:id="@+id/activeSessionsDialogFragment" + android:name="org.futo.circles.auth.feature.active_sessions.ActiveSessionsDialogFragment" + android:label="ActiveSessionsDialogFragment" + tools:layout="@layout/dialog_fragment_active_sessions"> + <action + android:id="@+id/to_reAuthStagesDialogFragment" + app:destination="@id/reAuthStagesDialogFragment" /> + + <action + android:id="@+id/to_verifySessionDialogFragment" + app:destination="@id/verifySessionDialogFragment"> + + <argument + android:name="deviceId" + app:argType="string" + app:nullable="false" /> + + </action> + + </dialog> + <dialog + android:id="@+id/verifySessionDialogFragment" + android:name="org.futo.circles.auth.feature.active_sessions.verify.VerifySessionDialogFragment" + tools:layout="@layout/dialog_fragment_verify_session"> + + <argument + android:name="deviceId" + app:argType="string" + app:nullable="false" /> + + </dialog> + <dialog + android:id="@+id/reAuthStagesDialogFragment" + android:name="org.futo.circles.auth.feature.reauth.ReAuthStagesDialogFragment" + tools:layout="@layout/fragment_login_stages" /> +</navigation> diff --git a/auth/src/main/res/values/strings.xml b/auth/src/main/res/values/strings.xml index 76b7988d2..fa168e1ee 100644 --- a/auth/src/main/res/values/strings.xml +++ b/auth/src/main/res/values/strings.xml @@ -117,6 +117,9 @@ <string name="cross_signed">cross signed</string> <string name="waiting_for_verification_format">Waiting for %s to start verification</string> <string name="session_verified">Session verified</string> + <string name="active_login_sessions">Active login sessions</string> + <string name="verify_session">Verify session</string> + <string name="scan_qr_code">Scan QR code</string> <plurals name="days"> <item quantity="one">%1$d day</item> diff --git a/settings/src/main/java/org/futo/circles/settings/feature/system_notices/SystemNoticesCountSharedViewModel.kt b/core/src/main/java/org/futo/circles/core/notices/SystemNoticesCountSharedViewModel.kt similarity index 96% rename from settings/src/main/java/org/futo/circles/settings/feature/system_notices/SystemNoticesCountSharedViewModel.kt rename to core/src/main/java/org/futo/circles/core/notices/SystemNoticesCountSharedViewModel.kt index 8e30a27df..62a4db05c 100644 --- a/settings/src/main/java/org/futo/circles/settings/feature/system_notices/SystemNoticesCountSharedViewModel.kt +++ b/core/src/main/java/org/futo/circles/core/notices/SystemNoticesCountSharedViewModel.kt @@ -1,4 +1,4 @@ -package org.futo.circles.settings.feature.system_notices +package org.futo.circles.core.notices import androidx.lifecycle.ViewModel import androidx.lifecycle.map diff --git a/settings.gradle b/settings.gradle index 81772c613..6b8c7c174 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,5 +2,4 @@ rootProject.name = "Circles" include ':app' include ':auth' include ':core' -include ':gallery' -include ':settings' +include ':gallery' \ No newline at end of file diff --git a/settings/.gitignore b/settings/.gitignore deleted file mode 100644 index 42afabfd2..000000000 --- a/settings/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/settings/build.gradle b/settings/build.gradle deleted file mode 100644 index 49b500ab0..000000000 --- a/settings/build.gradle +++ /dev/null @@ -1,91 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' -apply plugin: 'androidx.navigation.safeargs.kotlin' -apply plugin: 'kotlin-kapt' -apply plugin: 'dagger.hilt.android.plugin' -apply plugin: 'maven-publish' - -android { - namespace 'org.futo.circles.settings' - compileSdk 33 - - defaultConfig { - minSdk 24 - targetSdk 33 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - } - - buildFeatures { - viewBinding true - } - - buildTypes { - debug { - minifyEnabled false - } - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_17.toString() - } -} - -dependencies { - implementation project(path: ':core') - - //Hilt - def hilt = '2.46.1' - implementation "com.google.dagger:hilt-android:$hilt" - kapt "com.google.dagger:hilt-compiler:$hilt" - - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' -} - -kapt { - correctErrorTypes = true -} - -def groupIdString = "org.futo.circles" -def artifactIdString = "settings" - -afterEvaluate { - Properties properties = new Properties() - if (rootProject.file("local.properties").exists()) { - properties.load(rootProject.file("local.properties").newDataInputStream()) - } - publishing { - publications { - release(MavenPublication) { - from components.release - groupId groupIdString - artifactId artifactIdString - version rootProject.ext.modules_version - } - } - repositories { - maven { - url "https://gitlab.futo.org/api/v4/projects/$rootProject.ext.modules_gitlab_projectId/packages/maven" - name "GitLab" - credentials(HttpHeaderCredentials) { - name = "Private-Token" - value = properties.getProperty("PUBLISH_TOKEN") - } - authentication { - header(HttpHeaderAuthentication) - } - } - } - } -} \ No newline at end of file diff --git a/settings/consumer-rules.pro b/settings/consumer-rules.pro deleted file mode 100644 index e69de29bb..000000000 diff --git a/settings/proguard-rules.pro b/settings/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/settings/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/settings/src/androidTest/java/org/futo/circles/settings/ExampleInstrumentedTest.kt b/settings/src/androidTest/java/org/futo/circles/settings/ExampleInstrumentedTest.kt deleted file mode 100644 index f6f076b14..000000000 --- a/settings/src/androidTest/java/org/futo/circles/settings/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package org.futo.circles.settings - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("org.futo.circles.settings.test", appContext.packageName) - } -} \ No newline at end of file diff --git a/settings/src/main/AndroidManifest.xml b/settings/src/main/AndroidManifest.xml deleted file mode 100644 index a5918e68a..000000000 --- a/settings/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android"> - -</manifest> \ No newline at end of file diff --git a/settings/src/main/java/org/futo/circles/settings/model/ConfirmationType.kt b/settings/src/main/java/org/futo/circles/settings/model/ConfirmationType.kt deleted file mode 100644 index 5237b48c3..000000000 --- a/settings/src/main/java/org/futo/circles/settings/model/ConfirmationType.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.futo.circles.settings.model - -import org.futo.circles.core.model.ConfirmationType -import org.futo.circles.settings.R - -data class DeactivateAccount( - override val titleRes: Int = R.string.deactivate_my_account, - override val messageRes: Int = R.string.deactivate_message, - override val positiveButtonRes: Int = R.string.deactivate -) : ConfirmationType(titleRes, messageRes, positiveButtonRes) - - - diff --git a/settings/src/main/res/values-night/colors.xml b/settings/src/main/res/values-night/colors.xml deleted file mode 100644 index 0d2c4cc40..000000000 --- a/settings/src/main/res/values-night/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - -</resources> \ No newline at end of file diff --git a/settings/src/main/res/values/colors.xml b/settings/src/main/res/values/colors.xml deleted file mode 100644 index 0d2c4cc40..000000000 --- a/settings/src/main/res/values/colors.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - -</resources> \ No newline at end of file diff --git a/settings/src/main/res/values/strings.xml b/settings/src/main/res/values/strings.xml deleted file mode 100644 index 2bea33ecf..000000000 --- a/settings/src/main/res/values/strings.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - - <string name="profile_updated">Profile updated</string> - <string name="version_format">Version %s</string> - <string name="developer_mode_enabled">Developer mode is enabled</string> - <string name="developer_mode_disabled">Developer mode is disabled</string> - <string name="deactivate_my_account">Deactivate my account</string> - <string name="deactivate_message">This will make your account permanently unusable. You will not be able to log in, and no one will be able to re-register the same user lD. This will cause your account to leave all rooms it is participating in, and it will remove your account details from your identity server. This action is irreversible.</string> - <string name="deactivate">Deactivate</string> - - <string name="active_login_sessions">Active login sessions</string> - -</resources> \ No newline at end of file diff --git a/settings/src/main/res/values/styles.xml b/settings/src/main/res/values/styles.xml deleted file mode 100644 index 523cb6286..000000000 --- a/settings/src/main/res/values/styles.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - - <style name="settingMenuItem" parent="body"> - <item name="android:background">?attr/selectableItemBackground</item> - <item name="android:clickable">true</item> - <item name="android:focusable">true</item> - <item name="android:drawablePadding">8dp</item> - <item name="android:paddingBottom">10dp</item> - <item name="android:paddingStart">16dp</item> - <item name="android:paddingEnd">16dp</item> - <item name="android:paddingTop">10dp</item> - <item name="android:drawableTint">@color/list_item_icon_color</item> - </style> - - <style name="settingMenuHeader" parent="subheadline"> - <item name="android:textColor">@color/blue</item> - <item name="android:paddingBottom">8dp</item> - <item name="android:paddingStart">16dp</item> - <item name="android:paddingEnd">16dp</item> - <item name="android:paddingTop">16dp</item> - </style> - -</resources> \ No newline at end of file diff --git a/settings/src/test/java/org/futo/circles/settings/ExampleUnitTest.kt b/settings/src/test/java/org/futo/circles/settings/ExampleUnitTest.kt deleted file mode 100644 index 2155453fd..000000000 --- a/settings/src/test/java/org/futo/circles/settings/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.futo.circles.settings - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file -- GitLab