From bc9f3b69cc1b109f6bd7a5f17e5c82578ff0a077 Mon Sep 17 00:00:00 2001 From: ganfra Date: Wed, 8 Mar 2023 16:13:45 +0100 Subject: [PATCH] [Architecture] split all feature modules to api/impl --- app/build.gradle.kts | 2 +- .../android/x/initializer/CrashInitializer.kt | 2 +- .../x/initializer/TimberInitializer.kt | 2 +- appnav/build.gradle.kts | 14 +-- .../io/element/android/appnav/RootFlowNode.kt | 5 +- .../android/appnav/root/RootPresenter.kt | 4 +- .../element/android/appnav/root/RootState.kt | 9 +- .../android/appnav/root/RootStateProvider.kt | 4 +- .../element/android/appnav/root/RootView.kt | 8 +- .../element/android/appnav/FakeBugReporter.kt | 70 --------------- .../android/appnav/FakeCrashDataStore.kt | 50 ----------- .../element/android/appnav/FakeRageShake.kt | 44 --------- .../android/appnav/FakeRageshakeDataStore.kt | 46 ---------- .../android/appnav/RootPresenterTest.kt | 16 ++-- features/login/.gitignore | 1 - features/login/api/build.gradle.kts | 27 ++++++ .../features/login/api/LoginEntryPoint.kt | 0 features/login/consumer-rules.pro | 0 features/login/{ => impl}/build.gradle.kts | 3 +- .../login/impl/DefaultLoginEntryPoint.kt | 0 .../features/login/impl/LoginFlowNode.kt | 0 .../impl/changeserver/ChangeServerEvents.kt | 0 .../impl/changeserver/ChangeServerNode.kt | 2 +- .../changeserver/ChangeServerPresenter.kt | 2 +- .../impl/changeserver/ChangeServerState.kt | 0 .../changeserver/ChangeServerStateProvider.kt | 0 .../impl/changeserver/ChangeServerView.kt | 2 +- .../login/impl/error/ErrorFormatter.kt | 0 .../login/impl/root/LoginRootEvents.kt | 0 .../features/login/impl/root/LoginRootNode.kt | 0 .../login/impl/root/LoginRootPresenter.kt | 5 +- .../login/impl/root/LoginRootScreen.kt | 0 .../login/impl/root/LoginRootState.kt | 0 .../login/impl/root/LoginRootStateProvider.kt | 0 .../login/impl}/util/LoginConstants.kt | 2 +- .../src/main/res/drawable/ic_homeserver.xml | 0 .../changeserver/ChangeServerPresenterTest.kt | 2 +- .../impl}/root/LoginRootPresenterTest.kt | 2 +- features/login/proguard-rules.pro | 21 ----- .../features/login/ExampleInstrumentedTest.kt | 38 -------- features/login/src/main/AndroidManifest.xml | 20 ----- .../android/features/login/ExampleUnitTest.kt | 32 ------- features/logout/.gitignore | 1 - features/logout/api/build.gradle.kts | 29 ++++++ .../logout/api}/LogoutPreferenceEvents.kt | 2 +- .../logout/api/LogoutPreferencePresenter.kt | 21 +++++ .../logout/api}/LogoutPreferenceScreen.kt | 2 +- .../logout/api}/LogoutPreferenceState.kt | 2 +- .../api}/LogoutPreferenceStateProvider.kt | 2 +- features/logout/consumer-rules.pro | 0 features/logout/{ => impl}/build.gradle.kts | 6 +- .../impl}/src/main/AndroidManifest.xml | 4 +- .../impl/DefaultLogoutPreferencePresenter.kt} | 13 ++- .../impl}/LogoutPreferencePresenterTest.kt | 10 ++- features/logout/proguard-rules.pro | 21 ----- .../logout/ExampleInstrumentedTest.kt | 38 -------- features/logout/src/main/AndroidManifest.xml | 20 ----- .../features/logout/ExampleUnitTest.kt | 32 ------- features/messages/api/build.gradle.kts | 2 +- features/onboarding/.gitignore | 1 - features/onboarding/api/build.gradle.kts | 27 ++++++ .../onboarding/api/OnBoardingEntryPoint.kt | 0 features/onboarding/build.gradle.kts | 48 ---------- features/onboarding/consumer-rules.pro | 0 .../impl}/build.gradle.kts | 16 ++-- .../impl/DefaultOnBoardingEntryPoint.kt | 0 .../onboarding/impl/OnBoardingNode.kt | 0 .../onboarding/impl/OnBoardingScreen.kt | 0 .../onboarding/impl/SplashCarouselData.kt | 0 .../impl/SplashCarouselDataFactory.kt | 1 - .../ic_splash_collaboration.webp | Bin .../ic_splash_collaboration_dark.webp | Bin .../res/drawable-hdpi/ic_splash_control.webp | Bin .../drawable-hdpi/ic_splash_control_dark.webp | Bin .../ic_splash_conversations.webp | Bin .../ic_splash_conversations_dark.webp | Bin .../res/drawable-hdpi/ic_splash_secure.webp | Bin .../drawable-hdpi/ic_splash_secure_dark.webp | Bin .../ic_splash_collaboration.webp | Bin .../ic_splash_collaboration_dark.webp | Bin .../res/drawable-xhdpi/ic_splash_control.webp | Bin .../ic_splash_control_dark.webp | Bin .../ic_splash_conversations.webp | Bin .../ic_splash_conversations_dark.webp | Bin .../res/drawable-xhdpi/ic_splash_secure.webp | Bin .../drawable-xhdpi/ic_splash_secure_dark.webp | Bin .../ic_splash_collaboration.webp | Bin .../ic_splash_collaboration_dark.webp | Bin .../drawable-xxhdpi/ic_splash_control.webp | Bin .../ic_splash_control_dark.webp | Bin .../ic_splash_conversations.webp | Bin .../ic_splash_conversations_dark.webp | Bin .../res/drawable-xxhdpi/ic_splash_secure.webp | Bin .../ic_splash_secure_dark.webp | Bin .../ic_splash_collaboration.webp | Bin .../ic_splash_collaboration_dark.webp | Bin .../drawable-xxxhdpi/ic_splash_control.webp | Bin .../ic_splash_control_dark.webp | Bin .../ic_splash_conversations.webp | Bin .../ic_splash_conversations_dark.webp | Bin .../drawable-xxxhdpi/ic_splash_secure.webp | Bin .../ic_splash_secure_dark.webp | Bin .../main/res/drawable/bg_carousel_page_1.xml | 0 .../main/res/drawable/bg_carousel_page_2.xml | 0 .../main/res/drawable/bg_carousel_page_3.xml | 0 .../main/res/drawable/bg_carousel_page_4.xml | 0 .../main/res/drawable/bg_color_background.xml | 0 .../res/drawable/bg_gradient_ftue_breaker.xml | 0 .../src/main/res/values/strings.xml | 0 features/onboarding/proguard-rules.pro | 21 ----- .../features/login/ExampleInstrumentedTest.kt | 38 -------- .../onboarding/src/main/AndroidManifest.xml | 20 ----- .../android/features/login/ExampleUnitTest.kt | 32 ------- features/preferences/.gitignore | 1 - features/preferences/api/build.gradle.kts | 27 ++++++ .../preferences/api/PreferencesEntryPoint.kt | 0 features/preferences/consumer-rules.pro | 0 features/preferences/impl/build.gradle.kts | 63 +++++++++++++ .../impl/DefaultPreferencesEntryPoint.kt | 3 +- .../preferences/impl/PreferencesFlowNode.kt | 0 .../impl/root/PreferencesRootNode.kt | 0 .../impl/root/PreferencesRootPresenter.kt | 4 +- .../impl/root/PreferencesRootState.kt | 4 +- .../impl/root/PreferencesRootStateProvider.kt | 4 +- .../impl/root/PreferencesRootView.kt | 4 +- .../preferences/impl/user/UserPreferences.kt | 0 .../root/PreferencesRootPresenterTest.kt | 13 +-- features/preferences/proguard-rules.pro | 21 ----- .../preferences/ExampleInstrumentedTest.kt | 38 -------- .../preferences/root/FakeRageShake.kt | 44 --------- features/rageshake/.gitignore | 1 - features/rageshake/api/build.gradle.kts | 30 +++++++ .../api}/bugreport/BugReportEntryPoint.kt | 2 +- .../rageshake/api}/crash/CrashDataStore.kt | 2 +- .../api/crash}/CrashDetectionEvents.kt | 2 +- .../api/crash/CrashDetectionPresenter.kt | 21 +++++ .../api/crash}/CrashDetectionState.kt | 5 +- .../api/crash}/CrashDetectionStateProvider.kt | 2 +- .../api/crash/CrashDetectionView.kt} | 2 +- .../detection/RageshakeDetectionEvents.kt | 4 +- .../detection/RageshakeDetectionPresenter.kt | 21 +++++ .../api}/detection/RageshakeDetectionState.kt | 7 +- .../RageshakeDetectionStateProvider.kt | 4 +- .../api}/detection/RageshakeDetectionView.kt | 6 +- .../preferences/RageshakePreferencesEvents.kt | 2 +- .../RageshakePreferencesPresenter.kt | 21 +++++ .../preferences/RageshakePreferencesState.kt | 2 +- .../RageshakePreferencesStateProvider.kt | 2 +- .../preferences/RageshakePreferencesView.kt | 2 +- .../rageshake/api}/rageshake/RageShake.kt | 2 +- .../api}/rageshake/RageshakeDataStore.kt | 2 +- .../rageshake/api}/reporter/BugReporter.kt | 4 +- .../api}/reporter/BugReporterListener.kt | 2 +- .../rageshake/api}/reporter/ReportType.kt | 2 +- .../rageshake/api}/screenshot/Screenshot.kt | 2 +- .../api}/screenshot/ScreenshotHolder.kt | 2 +- features/rageshake/consumer-rules.pro | 0 .../rageshake/{ => impl}/build.gradle.kts | 8 +- .../reporter/BugReporterMultipartBody.java | 2 +- .../impl}/bugreport/BugReportEvents.kt | 2 +- .../impl}/bugreport/BugReportNode.kt | 4 +- .../impl}/bugreport/BugReportPresenter.kt | 14 +-- .../impl}/bugreport/BugReportState.kt | 2 +- .../impl}/bugreport/BugReportStateProvider.kt | 2 +- .../impl}/bugreport/BugReportView.kt | 2 +- .../bugreport/DefaultBugReportEntryPoint.kt | 3 +- .../crash/DefaultCrashDetectionPresenter.kt} | 15 ++-- .../impl}/crash/PreferencesCrashDataStore.kt | 3 +- .../crash/VectorUncaughtExceptionHandler.kt | 2 +- .../DefaultRageshakeDetectionPresenter.kt} | 23 +++-- .../rageshake/impl}/logs/LogFormatter.kt | 2 +- .../rageshake/impl}/logs/VectorFileLogger.kt | 2 +- .../DefaultRageshakePreferencesPresenter.kt} | 17 ++-- .../impl}/rageshake/DefaultRageShake.kt | 5 +- .../PreferencesRageshakeDataStore.kt | 3 +- .../impl}/reporter/DefaultBugReporter.kt | 15 ++-- .../screenshot/DefaultScreenshotHolder.kt | 5 +- .../src/main/res/values/strings.xml | 0 .../impl}/bugreport/BugReportPresenterTest.kt | 6 +- .../impl}/bugreport/FakeBugReporter.kt | 8 +- .../impl}/bugreport/FakeScreenshotHolder.kt | 4 +- .../crash/ui/CrashDetectionPresenterTest.kt | 14 +-- .../RageshakeDetectionPresenterTest.kt | 33 +++---- .../RageshakePreferencesPresenterTest.kt | 14 +-- features/rageshake/proguard-rules.pro | 21 ----- .../rageshake/src/main/AndroidManifest.xml | 20 ----- .../preferences/FakeRageshakeDataStore.kt | 43 --------- features/rageshake/test/build.gradle.kts | 28 ++++++ .../test/crash}/FakeCrashDataStore.kt | 4 +- .../test/rageshake}/FakeRageShake.kt | 6 +- .../test/rageshake}/FakeRageshakeDataStore.kt | 4 +- .../test/screenshot}/FakeScreenshotHolder.kt | 4 +- features/roomlist/.gitignore | 1 - features/roomlist/api/build.gradle.kts | 28 ++++++ .../roomlist/api/RoomListEntryPoint.kt | 0 features/roomlist/consumer-rules.pro | 0 features/roomlist/{ => impl}/build.gradle.kts | 13 +-- .../impl/DefaultRoomListEntryPoint.kt | 0 .../features/roomlist/impl/RoomListEvents.kt | 0 .../features/roomlist/impl/RoomListNode.kt | 0 .../roomlist/impl/RoomListPresenter.kt | 0 .../features/roomlist/impl/RoomListState.kt | 0 .../roomlist/impl/RoomListStateProvider.kt | 0 .../features/roomlist/impl/RoomListView.kt | 0 .../impl/components/RoomListTopBar.kt | 0 .../impl/components/RoomSummaryRow.kt | 0 .../impl/model/RoomListRoomSummary.kt | 0 .../model/RoomListRoomSummaryPlaceholders.kt | 0 .../impl/model/RoomListRoomSummaryProvider.kt | 0 .../roomlist/impl}/RoomListPresenterTests.kt | 85 +++++++++--------- features/roomlist/proguard-rules.pro | 21 ----- .../roomlist/ExampleInstrumentedTest.kt | 38 -------- .../roomlist/src/main/AndroidManifest.xml | 20 ----- libraries/dateformatter/test/build.gradle.kts | 2 +- .../test}/FakeLastMessageFormatter.kt | 2 +- .../kotlin/extension/DependencyHandleScope.kt | 12 +-- settings.gradle.kts | 26 ++++-- 217 files changed, 674 insertions(+), 1138 deletions(-) delete mode 100644 appnav/src/test/kotlin/io/element/android/appnav/FakeBugReporter.kt delete mode 100644 appnav/src/test/kotlin/io/element/android/appnav/FakeCrashDataStore.kt delete mode 100644 appnav/src/test/kotlin/io/element/android/appnav/FakeRageShake.kt delete mode 100644 appnav/src/test/kotlin/io/element/android/appnav/FakeRageshakeDataStore.kt delete mode 100644 features/login/.gitignore create mode 100644 features/login/api/build.gradle.kts rename features/login/{ => api}/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt (100%) delete mode 100644 features/login/consumer-rules.pro rename features/login/{ => impl}/build.gradle.kts (94%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPoint.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerEvents.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt (97%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt (97%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt (99%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/error/ErrorFormatter.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootEvents.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootNode.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt (96%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootScreen.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootState.kt (100%) rename features/login/{ => impl}/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootStateProvider.kt (100%) rename features/login/{src/main/kotlin/io/element/android/features/login => impl/src/main/kotlin/io/element/android/features/login/impl}/util/LoginConstants.kt (93%) rename features/login/{ => impl}/src/main/res/drawable/ic_homeserver.xml (100%) rename features/login/{src/test/kotlin/io/element/android/features/login => impl/src/test/kotlin/io/element/android/features/login/impl}/changeserver/ChangeServerPresenterTest.kt (99%) rename features/login/{src/test/kotlin/io/element/android/features/login => impl/src/test/kotlin/io/element/android/features/login/impl}/root/LoginRootPresenterTest.kt (99%) delete mode 100644 features/login/proguard-rules.pro delete mode 100644 features/login/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt delete mode 100644 features/login/src/main/AndroidManifest.xml delete mode 100644 features/login/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt delete mode 100644 features/logout/.gitignore create mode 100644 features/logout/api/build.gradle.kts rename features/logout/{src/main/kotlin/io/element/android/features/logout => api/src/main/kotlin/io/element/android/features/logout/api}/LogoutPreferenceEvents.kt (93%) create mode 100644 features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferencePresenter.kt rename features/logout/{src/main/kotlin/io/element/android/features/logout => api/src/main/kotlin/io/element/android/features/logout/api}/LogoutPreferenceScreen.kt (98%) rename features/logout/{src/main/kotlin/io/element/android/features/logout => api/src/main/kotlin/io/element/android/features/logout/api}/LogoutPreferenceState.kt (94%) rename features/logout/{src/main/kotlin/io/element/android/features/logout => api/src/main/kotlin/io/element/android/features/logout/api}/LogoutPreferenceStateProvider.kt (94%) delete mode 100644 features/logout/consumer-rules.pro rename features/logout/{ => impl}/build.gradle.kts (91%) rename features/{preferences => logout/impl}/src/main/AndroidManifest.xml (85%) rename features/logout/{src/main/kotlin/io/element/android/features/logout/LogoutPreferencePresenter.kt => impl/src/main/kotlin/io/element/android/features/logout/impl/DefaultLogoutPreferencePresenter.kt} (77%) rename features/logout/{src/test/kotlin/io/element/android/features/logout => impl/src/test/kotlin/io/element/android/features/logout/impl}/LogoutPreferencePresenterTest.kt (88%) delete mode 100644 features/logout/proguard-rules.pro delete mode 100644 features/logout/src/androidTest/kotlin/io/element/android/features/logout/ExampleInstrumentedTest.kt delete mode 100644 features/logout/src/main/AndroidManifest.xml delete mode 100644 features/logout/src/test/kotlin/io/element/android/features/logout/ExampleUnitTest.kt delete mode 100644 features/onboarding/.gitignore create mode 100644 features/onboarding/api/build.gradle.kts rename features/onboarding/{ => api}/src/main/kotlin/io/element/android/features/onboarding/api/OnBoardingEntryPoint.kt (100%) delete mode 100644 features/onboarding/build.gradle.kts delete mode 100644 features/onboarding/consumer-rules.pro rename features/{preferences => onboarding/impl}/build.gradle.kts (84%) rename features/onboarding/{ => impl}/src/main/kotlin/io/element/android/features/onboarding/impl/DefaultOnBoardingEntryPoint.kt (100%) rename features/onboarding/{ => impl}/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingNode.kt (100%) rename features/onboarding/{ => impl}/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingScreen.kt (100%) rename features/onboarding/{ => impl}/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselData.kt (100%) rename features/onboarding/{ => impl}/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt (98%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_collaboration.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_collaboration_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_control.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_control_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_conversations.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_conversations_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_secure.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-hdpi/ic_splash_secure_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_collaboration.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_collaboration_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_control.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_control_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_conversations.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_conversations_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_secure.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xhdpi/ic_splash_secure_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_collaboration.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_collaboration_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_control.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_control_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_conversations.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_conversations_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_secure.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxhdpi/ic_splash_secure_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_collaboration.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_collaboration_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_control.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_control_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_conversations.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_conversations_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_secure.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable-xxxhdpi/ic_splash_secure_dark.webp (100%) rename features/onboarding/{ => impl}/src/main/res/drawable/bg_carousel_page_1.xml (100%) rename features/onboarding/{ => impl}/src/main/res/drawable/bg_carousel_page_2.xml (100%) rename features/onboarding/{ => impl}/src/main/res/drawable/bg_carousel_page_3.xml (100%) rename features/onboarding/{ => impl}/src/main/res/drawable/bg_carousel_page_4.xml (100%) rename features/onboarding/{ => impl}/src/main/res/drawable/bg_color_background.xml (100%) rename features/onboarding/{ => impl}/src/main/res/drawable/bg_gradient_ftue_breaker.xml (100%) rename features/onboarding/{ => impl}/src/main/res/values/strings.xml (100%) delete mode 100644 features/onboarding/proguard-rules.pro delete mode 100644 features/onboarding/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt delete mode 100644 features/onboarding/src/main/AndroidManifest.xml delete mode 100644 features/onboarding/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt delete mode 100644 features/preferences/.gitignore create mode 100644 features/preferences/api/build.gradle.kts rename features/preferences/{ => api}/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt (100%) delete mode 100644 features/preferences/consumer-rules.pro create mode 100644 features/preferences/impl/build.gradle.kts rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt (98%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt (100%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt (100%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt (89%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt (85%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt (85%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt (94%) rename features/preferences/{ => impl}/src/main/kotlin/io/element/android/features/preferences/impl/user/UserPreferences.kt (100%) rename features/preferences/{src/test/kotlin/io/element/android/features/preferences => impl/src/test/kotlin/io/element/android/features/preferences/impl}/root/PreferencesRootPresenterTest.kt (75%) delete mode 100644 features/preferences/proguard-rules.pro delete mode 100644 features/preferences/src/androidTest/kotlin/io/element/android/features/preferences/ExampleInstrumentedTest.kt delete mode 100644 features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageShake.kt delete mode 100644 features/rageshake/.gitignore create mode 100644 features/rageshake/api/build.gradle.kts rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/bugreport/BugReportEntryPoint.kt (94%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/crash/CrashDataStore.kt (93%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/crash/ui => api/src/main/kotlin/io/element/android/features/rageshake/api/crash}/CrashDetectionEvents.kt (93%) create mode 100644 features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionPresenter.kt rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/crash/ui => api/src/main/kotlin/io/element/android/features/rageshake/api/crash}/CrashDetectionState.kt (86%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/crash/ui => api/src/main/kotlin/io/element/android/features/rageshake/api/crash}/CrashDetectionStateProvider.kt (92%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionScreen.kt => api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt} (97%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/detection/RageshakeDetectionEvents.kt (87%) create mode 100644 features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionPresenter.kt rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/detection/RageshakeDetectionState.kt (81%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/detection/RageshakeDetectionStateProvider.kt (84%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/detection/RageshakeDetectionView.kt (94%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/preferences/RageshakePreferencesEvents.kt (92%) create mode 100644 features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesPresenter.kt rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/preferences/RageshakePreferencesState.kt (92%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/preferences/RageshakePreferencesStateProvider.kt (95%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/preferences/RageshakePreferencesView.kt (98%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/rageshake/RageShake.kt (94%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/rageshake/RageshakeDataStore.kt (93%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/reporter/BugReporter.kt (89%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/reporter/BugReporterListener.kt (95%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/reporter/ReportType.kt (92%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/screenshot/Screenshot.kt (97%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => api/src/main/kotlin/io/element/android/features/rageshake/api}/screenshot/ScreenshotHolder.kt (92%) delete mode 100644 features/rageshake/consumer-rules.pro rename features/rageshake/{ => impl}/build.gradle.kts (92%) rename features/rageshake/{src/main/java/io/element/android/features/rageshake => impl/src/main/java/io/element/android/features/rageshake/impl}/reporter/BugReporterMultipartBody.java (99%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportEvents.kt (94%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportNode.kt (88%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportPresenter.kt (91%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportState.kt (96%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportStateProvider.kt (96%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportView.kt (99%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/bugreport/DefaultBugReportEntryPoint.kt (91%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenter.kt => impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt} (73%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/crash/PreferencesCrashDataStore.kt (95%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/crash/VectorUncaughtExceptionHandler.kt (98%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenter.kt => impl/src/main/kotlin/io/element/android/features/rageshake/impl/detection/DefaultRageshakeDetectionPresenter.kt} (81%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/logs/LogFormatter.kt (97%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/logs/VectorFileLogger.kt (98%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenter.kt => impl/src/main/kotlin/io/element/android/features/rageshake/impl/preferences/DefaultRageshakePreferencesPresenter.kt} (77%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/rageshake/DefaultRageShake.kt (92%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/rageshake/PreferencesRageshakeDataStore.kt (94%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/reporter/DefaultBugReporter.kt (97%) rename features/rageshake/{src/main/kotlin/io/element/android/features/rageshake => impl/src/main/kotlin/io/element/android/features/rageshake/impl}/screenshot/DefaultScreenshotHolder.kt (90%) rename features/rageshake/{ => impl}/src/main/res/values/strings.xml (100%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake => impl/src/test/kotlin/io/element/android/features/rageshake/impl}/bugreport/BugReportPresenterTest.kt (97%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake => impl/src/test/kotlin/io/element/android/features/rageshake/impl}/bugreport/FakeBugReporter.kt (88%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake => impl/src/test/kotlin/io/element/android/features/rageshake/impl}/bugreport/FakeScreenshotHolder.kt (86%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake => impl/src/test/kotlin/io/element/android/features/rageshake/impl}/crash/ui/CrashDetectionPresenterTest.kt (82%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake => impl/src/test/kotlin/io/element/android/features/rageshake/impl}/detection/RageshakeDetectionPresenterTest.kt (85%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake => impl/src/test/kotlin/io/element/android/features/rageshake/impl}/preferences/RageshakePreferencesPresenterTest.kt (83%) delete mode 100644 features/rageshake/proguard-rules.pro delete mode 100644 features/rageshake/src/main/AndroidManifest.xml delete mode 100644 features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageshakeDataStore.kt create mode 100644 features/rageshake/test/build.gradle.kts rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake/crash/ui => test/src/main/kotlin/io/element/android/features/rageshake/test/crash}/FakeCrashDataStore.kt (91%) rename features/rageshake/{src/test/kotlin/io/element/android/features/rageshake/preferences => test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake}/FakeRageShake.kt (87%) rename features/{preferences/src/test/kotlin/io/element/android/features/preferences/root => rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake}/FakeRageshakeDataStore.kt (91%) rename {appnav/src/test/kotlin/io/element/android/appnav => features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/screenshot}/FakeScreenshotHolder.kt (87%) delete mode 100644 features/roomlist/.gitignore create mode 100644 features/roomlist/api/build.gradle.kts rename features/roomlist/{ => api}/src/main/kotlin/io/element/android/features/roomlist/api/RoomListEntryPoint.kt (100%) delete mode 100644 features/roomlist/consumer-rules.pro rename features/roomlist/{ => impl}/build.gradle.kts (88%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/DefaultRoomListEntryPoint.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListEvents.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListNode.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListState.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomListTopBar.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt (100%) rename features/roomlist/{ => impl}/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt (100%) rename features/roomlist/{src/test/kotlin/io/element/android/features/roomlist => impl/src/test/kotlin/io/element/android/features/roomlist/impl}/RoomListPresenterTests.kt (68%) delete mode 100644 features/roomlist/proguard-rules.pro delete mode 100644 features/roomlist/src/androidTest/kotlin/io/element/android/features/roomlist/ExampleInstrumentedTest.kt delete mode 100644 features/roomlist/src/main/AndroidManifest.xml rename {features/roomlist/src/test/kotlin/io/element/android/features/roomlist => libraries/dateformatter/test/src/main/kotlin/io/element/android/libraries/dateformatter/test}/FakeLastMessageFormatter.kt (94%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b667b5d0a4..de5119181d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -26,8 +26,8 @@ plugins { id("io.element.android-compose-application") alias(libs.plugins.stem) alias(libs.plugins.kotlin.android) - alias(libs.plugins.ksp) alias(libs.plugins.anvil) + alias(libs.plugins.ksp) alias(libs.plugins.kapt) id("com.google.firebase.appdistribution") version "3.0.2" id("org.jetbrains.kotlinx.knit") version "0.4.0" diff --git a/app/src/main/kotlin/io/element/android/x/initializer/CrashInitializer.kt b/app/src/main/kotlin/io/element/android/x/initializer/CrashInitializer.kt index fa7e904e72..c947bc20e3 100644 --- a/app/src/main/kotlin/io/element/android/x/initializer/CrashInitializer.kt +++ b/app/src/main/kotlin/io/element/android/x/initializer/CrashInitializer.kt @@ -18,7 +18,7 @@ package io.element.android.x.initializer import android.content.Context import androidx.startup.Initializer -import io.element.android.features.rageshake.crash.VectorUncaughtExceptionHandler +import io.element.android.features.rageshake.impl.crash.VectorUncaughtExceptionHandler class CrashInitializer : Initializer { diff --git a/app/src/main/kotlin/io/element/android/x/initializer/TimberInitializer.kt b/app/src/main/kotlin/io/element/android/x/initializer/TimberInitializer.kt index 23286c683d..5a641d75c6 100644 --- a/app/src/main/kotlin/io/element/android/x/initializer/TimberInitializer.kt +++ b/app/src/main/kotlin/io/element/android/x/initializer/TimberInitializer.kt @@ -18,7 +18,7 @@ package io.element.android.x.initializer import android.content.Context import androidx.startup.Initializer -import io.element.android.features.rageshake.logs.VectorFileLogger +import io.element.android.features.rageshake.impl.logs.VectorFileLogger import io.element.android.x.BuildConfig import timber.log.Timber diff --git a/appnav/build.gradle.kts b/appnav/build.gradle.kts index 4b36c75055..7a82a27f54 100644 --- a/appnav/build.gradle.kts +++ b/appnav/build.gradle.kts @@ -37,12 +37,12 @@ dependencies { kapt(libs.dagger.compiler) implementation(projects.features.messages.api) - implementation(projects.features.roomlist) - implementation(projects.features.rageshake) - implementation(projects.features.login) - implementation(projects.features.preferences) - implementation(projects.features.logout) - implementation(projects.features.onboarding) + implementation(projects.features.roomlist.api) + implementation(projects.features.rageshake.api) + implementation(projects.features.login.api) + implementation(projects.features.preferences.api) + implementation(projects.features.logout.api) + implementation(projects.features.onboarding.api) implementation(projects.libraries.core) implementation(projects.libraries.architecture) @@ -58,4 +58,6 @@ dependencies { testImplementation(libs.test.truth) testImplementation(libs.test.turbine) testImplementation(projects.libraries.matrix.test) + testImplementation(projects.features.rageshake.test) + testImplementation(projects.features.rageshake.impl) } diff --git a/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt b/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt index 77f53e2498..87263b86f4 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/RootFlowNode.kt @@ -17,7 +17,6 @@ package io.element.android.appnav import android.app.Activity -import android.content.Context import android.os.Parcelable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize @@ -42,13 +41,12 @@ import io.element.android.anvilannotations.ContributesNode import io.element.android.appnav.di.MatrixClientsHolder import io.element.android.appnav.root.RootPresenter import io.element.android.appnav.root.RootView -import io.element.android.features.rageshake.bugreport.BugReportEntryPoint +import io.element.android.features.rageshake.api.bugreport.BugReportEntryPoint import io.element.android.libraries.architecture.BackstackNode import io.element.android.libraries.architecture.animation.rememberDefaultTransitionHandler import io.element.android.libraries.architecture.createNode import io.element.android.libraries.designsystem.theme.components.CircularProgressIndicator import io.element.android.libraries.di.AppScope -import io.element.android.libraries.di.ApplicationContext import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService import io.element.android.libraries.matrix.api.core.SessionId import io.element.android.libraries.matrix.api.core.UserId @@ -63,7 +61,6 @@ import timber.log.Timber class RootFlowNode @AssistedInject constructor( @Assisted val buildContext: BuildContext, @Assisted plugins: List, - @ApplicationContext private val appContext: Context, private val authenticationService: MatrixAuthenticationService, private val matrixClientsHolder: MatrixClientsHolder, private val presenter: RootPresenter, diff --git a/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt b/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt index 5797eca221..a3b73bc4d9 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/root/RootPresenter.kt @@ -19,8 +19,8 @@ package io.element.android.appnav.root import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable -import io.element.android.features.rageshake.crash.ui.CrashDetectionPresenter -import io.element.android.features.rageshake.detection.RageshakeDetectionPresenter +import io.element.android.features.rageshake.api.crash.CrashDetectionPresenter +import io.element.android.features.rageshake.api.detection.RageshakeDetectionPresenter import io.element.android.libraries.architecture.Presenter import javax.inject.Inject diff --git a/appnav/src/main/kotlin/io/element/android/appnav/root/RootState.kt b/appnav/src/main/kotlin/io/element/android/appnav/root/RootState.kt index e96229d675..ab3be17746 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/root/RootState.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/root/RootState.kt @@ -16,12 +16,11 @@ package io.element.android.appnav.root -import androidx.compose.runtime.Stable -import io.element.android.appnav.root.RootEvents -import io.element.android.features.rageshake.crash.ui.CrashDetectionState -import io.element.android.features.rageshake.detection.RageshakeDetectionState +import androidx.compose.runtime.Immutable +import io.element.android.features.rageshake.api.crash.CrashDetectionState +import io.element.android.features.rageshake.api.detection.RageshakeDetectionState -@Stable +@Immutable data class RootState( val isShowkaseButtonVisible: Boolean, val rageshakeDetectionState: RageshakeDetectionState, diff --git a/appnav/src/main/kotlin/io/element/android/appnav/root/RootStateProvider.kt b/appnav/src/main/kotlin/io/element/android/appnav/root/RootStateProvider.kt index ac8142fb9c..9ed9d365f2 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/root/RootStateProvider.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/root/RootStateProvider.kt @@ -17,8 +17,8 @@ package io.element.android.appnav.root import androidx.compose.ui.tooling.preview.PreviewParameterProvider -import io.element.android.features.rageshake.crash.ui.aCrashDetectionState -import io.element.android.features.rageshake.detection.aRageshakeDetectionState +import io.element.android.features.rageshake.api.crash.aCrashDetectionState +import io.element.android.features.rageshake.api.detection.aRageshakeDetectionState open class RootStateProvider : PreviewParameterProvider { override val values: Sequence diff --git a/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt b/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt index b93a925b12..e5eb25704d 100644 --- a/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt +++ b/appnav/src/main/kotlin/io/element/android/appnav/root/RootView.kt @@ -24,10 +24,10 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter -import io.element.android.features.rageshake.crash.ui.CrashDetectionEvents -import io.element.android.features.rageshake.crash.ui.CrashDetectionView -import io.element.android.features.rageshake.detection.RageshakeDetectionEvents -import io.element.android.features.rageshake.detection.RageshakeDetectionView +import io.element.android.features.rageshake.api.crash.CrashDetectionEvents +import io.element.android.features.rageshake.api.crash.CrashDetectionView +import io.element.android.features.rageshake.api.detection.RageshakeDetectionEvents +import io.element.android.features.rageshake.api.detection.RageshakeDetectionView import io.element.android.libraries.designsystem.preview.ElementPreviewDark import io.element.android.libraries.designsystem.preview.ElementPreviewLight import io.element.android.libraries.designsystem.theme.components.Text diff --git a/appnav/src/test/kotlin/io/element/android/appnav/FakeBugReporter.kt b/appnav/src/test/kotlin/io/element/android/appnav/FakeBugReporter.kt deleted file mode 100644 index d0caa6d838..0000000000 --- a/appnav/src/test/kotlin/io/element/android/appnav/FakeBugReporter.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.appnav - -import io.element.android.features.rageshake.reporter.BugReporter -import io.element.android.features.rageshake.reporter.BugReporterListener -import io.element.android.features.rageshake.reporter.ReportType -import io.element.android.libraries.matrix.test.A_FAILURE_REASON -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch - -// TODO Remove this duplicated class when we will rework modules. -class FakeBugReporter(val mode: FakeBugReporterMode = FakeBugReporterMode.Success) : BugReporter { - override fun sendBugReport( - coroutineScope: CoroutineScope, - reportType: ReportType, - withDevicesLogs: Boolean, - withCrashLogs: Boolean, - withKeyRequestHistory: Boolean, - withScreenshot: Boolean, - theBugDescription: String, - serverVersion: String, - canContact: Boolean, - customFields: Map?, - listener: BugReporterListener?, - ) { - coroutineScope.launch { - delay(100) - listener?.onProgress(0) - delay(100) - listener?.onProgress(50) - delay(100) - when (mode) { - FakeBugReporterMode.Success -> Unit - FakeBugReporterMode.Failure -> { - listener?.onUploadFailed(A_FAILURE_REASON) - return@launch - } - FakeBugReporterMode.Cancel -> { - listener?.onUploadCancelled() - return@launch - } - } - listener?.onProgress(100) - delay(100) - listener?.onUploadSucceed(null) - } - } -} - -enum class FakeBugReporterMode { - Success, - Failure, - Cancel -} diff --git a/appnav/src/test/kotlin/io/element/android/appnav/FakeCrashDataStore.kt b/appnav/src/test/kotlin/io/element/android/appnav/FakeCrashDataStore.kt deleted file mode 100644 index 65d9e39a39..0000000000 --- a/appnav/src/test/kotlin/io/element/android/appnav/FakeCrashDataStore.kt +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.appnav - -import io.element.android.features.rageshake.crash.CrashDataStore -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow - -const val A_CRASH_DATA = "Some crash data" - -// TODO Remove this duplicated class when we will rework modules. - -class FakeCrashDataStore( - crashData: String = "", - appHasCrashed: Boolean = false, -) : CrashDataStore { - private val appHasCrashedFlow = MutableStateFlow(appHasCrashed) - private val crashDataFlow = MutableStateFlow(crashData) - - override fun setCrashData(crashData: String) { - crashDataFlow.value = crashData - } - - override suspend fun resetAppHasCrashed() { - appHasCrashedFlow.value = false - } - - override fun appHasCrashed(): Flow = appHasCrashedFlow - - override fun crashInfo(): Flow = crashDataFlow - - override suspend fun reset() { - appHasCrashedFlow.value = false - crashDataFlow.value = "" - } -} diff --git a/appnav/src/test/kotlin/io/element/android/appnav/FakeRageShake.kt b/appnav/src/test/kotlin/io/element/android/appnav/FakeRageShake.kt deleted file mode 100644 index 949b9f0b7b..0000000000 --- a/appnav/src/test/kotlin/io/element/android/appnav/FakeRageShake.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.appnav - -import io.element.android.features.rageshake.rageshake.RageShake - -// TODO Remove this duplicated class when we will rework modules. -class FakeRageShake( - private var isAvailableValue: Boolean = true -) : RageShake { - - private var interceptor: (() -> Unit)? = null - - override fun isAvailable() = isAvailableValue - - override fun start(sensitivity: Float) { - } - - override fun stop() { - } - - override fun setSensitivity(sensitivity: Float) { - } - - override fun setInterceptor(interceptor: (() -> Unit)?) { - this.interceptor = interceptor - } - - fun triggerPhoneRageshake() = interceptor?.invoke() -} diff --git a/appnav/src/test/kotlin/io/element/android/appnav/FakeRageshakeDataStore.kt b/appnav/src/test/kotlin/io/element/android/appnav/FakeRageshakeDataStore.kt deleted file mode 100644 index 5dac61db66..0000000000 --- a/appnav/src/test/kotlin/io/element/android/appnav/FakeRageshakeDataStore.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.appnav - -import io.element.android.features.rageshake.rageshake.RageshakeDataStore -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow - -const val A_SENSITIVITY = 1f - -// TODO Remove this duplicated class when we will rework modules. -class FakeRageshakeDataStore( - isEnabled: Boolean = true, - sensitivity: Float = A_SENSITIVITY, -) : RageshakeDataStore { - - private val isEnabledFlow = MutableStateFlow(isEnabled) - override fun isEnabled(): Flow = isEnabledFlow - - override suspend fun setIsEnabled(isEnabled: Boolean) { - isEnabledFlow.value = isEnabled - } - - private val sensitivityFlow = MutableStateFlow(sensitivity) - override fun sensitivity(): Flow = sensitivityFlow - - override suspend fun setSensitivity(sensitivity: Float) { - sensitivityFlow.value = sensitivity - } - - override suspend fun reset() = Unit -} diff --git a/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt index d912f5dffd..d0ad2adb2e 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt +++ b/appnav/src/test/kotlin/io/element/android/appnav/RootPresenterTest.kt @@ -24,9 +24,13 @@ import app.cash.turbine.test import com.google.common.truth.Truth.assertThat import io.element.android.appnav.root.RootEvents import io.element.android.appnav.root.RootPresenter -import io.element.android.features.rageshake.crash.ui.CrashDetectionPresenter -import io.element.android.features.rageshake.detection.RageshakeDetectionPresenter -import io.element.android.features.rageshake.preferences.RageshakePreferencesPresenter +import io.element.android.features.rageshake.impl.crash.DefaultCrashDetectionPresenter +import io.element.android.features.rageshake.impl.detection.DefaultRageshakeDetectionPresenter +import io.element.android.features.rageshake.impl.preferences.DefaultRageshakePreferencesPresenter +import io.element.android.features.rageshake.test.crash.FakeCrashDataStore +import io.element.android.features.rageshake.test.rageshake.FakeRageShake +import io.element.android.features.rageshake.test.rageshake.FakeRageshakeDataStore +import io.element.android.features.rageshake.test.screenshot.FakeScreenshotHolder import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test @@ -63,13 +67,13 @@ class RootPresenterTest { val rageshakeDataStore = FakeRageshakeDataStore() val rageshake = FakeRageShake() val screenshotHolder = FakeScreenshotHolder() - val crashDetectionPresenter = CrashDetectionPresenter( + val crashDetectionPresenter = DefaultCrashDetectionPresenter( crashDataStore = crashDataStore ) - val rageshakeDetectionPresenter = RageshakeDetectionPresenter( + val rageshakeDetectionPresenter = DefaultRageshakeDetectionPresenter( screenshotHolder = screenshotHolder, rageShake = rageshake, - preferencesPresenter = RageshakePreferencesPresenter( + preferencesPresenter = DefaultRageshakePreferencesPresenter( rageshake = rageshake, rageshakeDataStore = rageshakeDataStore, ) diff --git a/features/login/.gitignore b/features/login/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/features/login/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/features/login/api/build.gradle.kts b/features/login/api/build.gradle.kts new file mode 100644 index 0000000000..18164ac9a0 --- /dev/null +++ b/features/login/api/build.gradle.kts @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-library") +} + +android { + namespace = "io.element.android.features.login.api" +} + +dependencies { + implementation(projects.libraries.architecture) +} diff --git a/features/login/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt b/features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt rename to features/login/api/src/main/kotlin/io/element/android/features/login/api/LoginEntryPoint.kt diff --git a/features/login/consumer-rules.pro b/features/login/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/features/login/build.gradle.kts b/features/login/impl/build.gradle.kts similarity index 94% rename from features/login/build.gradle.kts rename to features/login/impl/build.gradle.kts index 4b5504ec34..a2713cba34 100644 --- a/features/login/build.gradle.kts +++ b/features/login/impl/build.gradle.kts @@ -24,7 +24,7 @@ plugins { } android { - namespace = "io.element.android.features.login" + namespace = "io.element.android.features.login.impl" } anvil { @@ -41,6 +41,7 @@ dependencies { implementation(projects.libraries.elementresources) implementation(projects.libraries.testtags) implementation(projects.libraries.uiStrings) + api(projects.features.login.api) ksp(libs.showkase.processor) testImplementation(libs.test.junit) diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPoint.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPoint.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPoint.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/DefaultLoginEntryPoint.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/LoginFlowNode.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerEvents.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerEvents.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerEvents.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt similarity index 97% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt index 39a4732b6d..11952ce5a8 100644 --- a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerNode.kt @@ -28,7 +28,7 @@ import com.bumble.appyx.core.plugin.Plugin import dagger.assisted.Assisted import dagger.assisted.AssistedInject import io.element.android.anvilannotations.ContributesNode -import io.element.android.features.login.util.LoginConstants +import io.element.android.features.login.impl.util.LoginConstants import io.element.android.libraries.core.data.tryOrNull import io.element.android.libraries.di.AppScope diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt similarity index 97% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt index e97a47387a..19a95db3bf 100644 --- a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenter.kt @@ -22,7 +22,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable -import io.element.android.features.login.util.LoginConstants +import io.element.android.features.login.impl.util.LoginConstants import io.element.android.libraries.architecture.Async import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.architecture.execute diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerState.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerStateProvider.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt similarity index 99% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt index f8e136f011..647bab4e9f 100644 --- a/features/login/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerView.kt @@ -50,7 +50,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp -import io.element.android.features.login.R +import io.element.android.features.login.impl.R import io.element.android.libraries.architecture.Async import io.element.android.libraries.designsystem.ElementTextStyles import io.element.android.libraries.designsystem.components.dialogs.ConfirmationDialog diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/error/ErrorFormatter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/error/ErrorFormatter.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/error/ErrorFormatter.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/error/ErrorFormatter.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootEvents.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootEvents.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootEvents.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootEvents.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootNode.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootNode.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootNode.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootNode.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt similarity index 96% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt index d2117956c1..a76f197b4a 100644 --- a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootPresenter.kt @@ -23,14 +23,12 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable -import io.element.android.features.login.util.LoginConstants +import io.element.android.features.login.impl.util.LoginConstants import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.core.data.tryOrNull import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService import io.element.android.libraries.matrix.api.auth.MatrixHomeServerDetails import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.filterNotNull -import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import javax.inject.Inject @@ -87,5 +85,4 @@ class LoginRootPresenter @Inject constructor(private val authenticationService: private fun updateFormState(formState: MutableState, updateLambda: LoginFormState.() -> LoginFormState) { formState.value = updateLambda(formState.value) } - } diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootScreen.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootScreen.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootScreen.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootScreen.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootState.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootState.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootState.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootState.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootStateProvider.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootStateProvider.kt similarity index 100% rename from features/login/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootStateProvider.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/root/LoginRootStateProvider.kt diff --git a/features/login/src/main/kotlin/io/element/android/features/login/util/LoginConstants.kt b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/util/LoginConstants.kt similarity index 93% rename from features/login/src/main/kotlin/io/element/android/features/login/util/LoginConstants.kt rename to features/login/impl/src/main/kotlin/io/element/android/features/login/impl/util/LoginConstants.kt index 61bd6455f9..8e2c37904f 100644 --- a/features/login/src/main/kotlin/io/element/android/features/login/util/LoginConstants.kt +++ b/features/login/impl/src/main/kotlin/io/element/android/features/login/impl/util/LoginConstants.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.login.util +package io.element.android.features.login.impl.util object LoginConstants { diff --git a/features/login/src/main/res/drawable/ic_homeserver.xml b/features/login/impl/src/main/res/drawable/ic_homeserver.xml similarity index 100% rename from features/login/src/main/res/drawable/ic_homeserver.xml rename to features/login/impl/src/main/res/drawable/ic_homeserver.xml diff --git a/features/login/src/test/kotlin/io/element/android/features/login/changeserver/ChangeServerPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt similarity index 99% rename from features/login/src/test/kotlin/io/element/android/features/login/changeserver/ChangeServerPresenterTest.kt rename to features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt index fa12718bb3..da717f85cd 100644 --- a/features/login/src/test/kotlin/io/element/android/features/login/changeserver/ChangeServerPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt @@ -16,7 +16,7 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.login.changeserver +package io.element.android.features.login.impl.changeserver import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow diff --git a/features/login/src/test/kotlin/io/element/android/features/login/root/LoginRootPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/root/LoginRootPresenterTest.kt similarity index 99% rename from features/login/src/test/kotlin/io/element/android/features/login/root/LoginRootPresenterTest.kt rename to features/login/impl/src/test/kotlin/io/element/android/features/login/impl/root/LoginRootPresenterTest.kt index ff1aac115a..6c825d0edd 100644 --- a/features/login/src/test/kotlin/io/element/android/features/login/root/LoginRootPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/root/LoginRootPresenterTest.kt @@ -16,7 +16,7 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.login.root +package io.element.android.features.login.impl.root import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow diff --git a/features/login/proguard-rules.pro b/features/login/proguard-rules.pro deleted file mode 100644 index ff59496d81..0000000000 --- a/features/login/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.kts. -# -# 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/features/login/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt b/features/login/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt deleted file mode 100644 index 4ad31d222f..0000000000 --- a/features/login/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.login - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -/** - * 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("io.element.android.features.login.test", appContext.packageName) - } -} diff --git a/features/login/src/main/AndroidManifest.xml b/features/login/src/main/AndroidManifest.xml deleted file mode 100644 index 19db0c3d57..0000000000 --- a/features/login/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/features/login/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt b/features/login/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt deleted file mode 100644 index ee6363e624..0000000000 --- a/features/login/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.login - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * 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) - } -} diff --git a/features/logout/.gitignore b/features/logout/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/features/logout/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/features/logout/api/build.gradle.kts b/features/logout/api/build.gradle.kts new file mode 100644 index 0000000000..ebf25933b8 --- /dev/null +++ b/features/logout/api/build.gradle.kts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-compose-library") +} + +android { + namespace = "io.element.android.features.logout.api" +} + +dependencies { + implementation(projects.libraries.architecture) + implementation(projects.libraries.designsystem) + implementation(projects.libraries.uiStrings) +} diff --git a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceEvents.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceEvents.kt similarity index 93% rename from features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceEvents.kt rename to features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceEvents.kt index b381668974..2dad1623ab 100644 --- a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceEvents.kt +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceEvents.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.logout +package io.element.android.features.logout.api sealed interface LogoutPreferenceEvents { object Logout : LogoutPreferenceEvents diff --git a/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferencePresenter.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferencePresenter.kt new file mode 100644 index 0000000000..b42744f912 --- /dev/null +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferencePresenter.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.element.android.features.logout.api + +import io.element.android.libraries.architecture.Presenter + +interface LogoutPreferencePresenter : Presenter diff --git a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceScreen.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceScreen.kt similarity index 98% rename from features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceScreen.kt rename to features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceScreen.kt index 050b66f660..8fdd2692cd 100644 --- a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceScreen.kt +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceScreen.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.logout +package io.element.android.features.logout.api import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Logout diff --git a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceState.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceState.kt similarity index 94% rename from features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceState.kt rename to features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceState.kt index ee90d64e0b..e5fd05ba8e 100644 --- a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceState.kt +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceState.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.logout +package io.element.android.features.logout.api import io.element.android.libraries.architecture.Async diff --git a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceStateProvider.kt b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceStateProvider.kt similarity index 94% rename from features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceStateProvider.kt rename to features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceStateProvider.kt index f6bed308c4..3e729298b0 100644 --- a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferenceStateProvider.kt +++ b/features/logout/api/src/main/kotlin/io/element/android/features/logout/api/LogoutPreferenceStateProvider.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.logout +package io.element.android.features.logout.api import io.element.android.libraries.architecture.Async diff --git a/features/logout/consumer-rules.pro b/features/logout/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/features/logout/build.gradle.kts b/features/logout/impl/build.gradle.kts similarity index 91% rename from features/logout/build.gradle.kts rename to features/logout/impl/build.gradle.kts index e7be5fc95c..86c5ed7bac 100644 --- a/features/logout/build.gradle.kts +++ b/features/logout/impl/build.gradle.kts @@ -23,7 +23,7 @@ plugins { } android { - namespace = "io.element.android.features.logout" + namespace = "io.element.android.features.logout.impl" } anvil { @@ -33,12 +33,14 @@ anvil { dependencies { implementation(projects.anvilannotations) anvil(projects.anvilcodegen) - implementation(projects.libraries.architecture) implementation(projects.libraries.core) + implementation(projects.libraries.architecture) implementation(projects.libraries.matrix.api) implementation(projects.libraries.designsystem) implementation(projects.libraries.elementresources) + implementation(projects.libraries.testtags) implementation(projects.libraries.uiStrings) + api(projects.features.logout.api) ksp(libs.showkase.processor) testImplementation(libs.test.junit) diff --git a/features/preferences/src/main/AndroidManifest.xml b/features/logout/impl/src/main/AndroidManifest.xml similarity index 85% rename from features/preferences/src/main/AndroidManifest.xml rename to features/logout/impl/src/main/AndroidManifest.xml index 19db0c3d57..e9c0841b6b 100644 --- a/features/preferences/src/main/AndroidManifest.xml +++ b/features/logout/impl/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ - + diff --git a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferencePresenter.kt b/features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/DefaultLogoutPreferencePresenter.kt similarity index 77% rename from features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferencePresenter.kt rename to features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/DefaultLogoutPreferencePresenter.kt index 441e603791..baad764025 100644 --- a/features/logout/src/main/kotlin/io/element/android/features/logout/LogoutPreferencePresenter.kt +++ b/features/logout/impl/src/main/kotlin/io/element/android/features/logout/impl/DefaultLogoutPreferencePresenter.kt @@ -14,23 +14,28 @@ * limitations under the License. */ -package io.element.android.features.logout +package io.element.android.features.logout.impl import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope +import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.logout.api.LogoutPreferenceEvents +import io.element.android.features.logout.api.LogoutPreferencePresenter +import io.element.android.features.logout.api.LogoutPreferenceState import io.element.android.libraries.architecture.Async -import io.element.android.libraries.architecture.Presenter import io.element.android.libraries.architecture.execute +import io.element.android.libraries.di.SessionScope import io.element.android.libraries.matrix.api.MatrixClient import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import javax.inject.Inject -class LogoutPreferencePresenter @Inject constructor(private val matrixClient: MatrixClient) : - Presenter { +@ContributesBinding(SessionScope::class) +class DefaultLogoutPreferencePresenter @Inject constructor(private val matrixClient: MatrixClient) : + LogoutPreferencePresenter { @Composable override fun present(): LogoutPreferenceState { diff --git a/features/logout/src/test/kotlin/io/element/android/features/logout/LogoutPreferencePresenterTest.kt b/features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/LogoutPreferencePresenterTest.kt similarity index 88% rename from features/logout/src/test/kotlin/io/element/android/features/logout/LogoutPreferencePresenterTest.kt rename to features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/LogoutPreferencePresenterTest.kt index 8e8f45e4de..6429ff1938 100644 --- a/features/logout/src/test/kotlin/io/element/android/features/logout/LogoutPreferencePresenterTest.kt +++ b/features/logout/impl/src/test/kotlin/io/element/android/features/logout/impl/LogoutPreferencePresenterTest.kt @@ -16,12 +16,14 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.logout +package io.element.android.features.logout.impl import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat +import io.element.android.features.logout.api.LogoutPreferenceEvents +import io.element.android.features.logout.api.LogoutPreferenceState import io.element.android.libraries.architecture.Async import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.A_THROWABLE @@ -33,7 +35,7 @@ import org.junit.Test class LogoutPreferencePresenterTest { @Test fun `present - initial state`() = runTest { - val presenter = LogoutPreferencePresenter( + val presenter = DefaultLogoutPreferencePresenter( FakeMatrixClient(A_SESSION_ID), ) moleculeFlow(RecompositionClock.Immediate) { @@ -46,7 +48,7 @@ class LogoutPreferencePresenterTest { @Test fun `present - logout`() = runTest { - val presenter = LogoutPreferencePresenter( + val presenter = DefaultLogoutPreferencePresenter( FakeMatrixClient(A_SESSION_ID), ) moleculeFlow(RecompositionClock.Immediate) { @@ -64,7 +66,7 @@ class LogoutPreferencePresenterTest { @Test fun `present - logout with error`() = runTest { val matrixClient = FakeMatrixClient(A_SESSION_ID) - val presenter = LogoutPreferencePresenter( + val presenter = DefaultLogoutPreferencePresenter( matrixClient, ) moleculeFlow(RecompositionClock.Immediate) { diff --git a/features/logout/proguard-rules.pro b/features/logout/proguard-rules.pro deleted file mode 100644 index ff59496d81..0000000000 --- a/features/logout/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.kts. -# -# 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/features/logout/src/androidTest/kotlin/io/element/android/features/logout/ExampleInstrumentedTest.kt b/features/logout/src/androidTest/kotlin/io/element/android/features/logout/ExampleInstrumentedTest.kt deleted file mode 100644 index 1316448d00..0000000000 --- a/features/logout/src/androidTest/kotlin/io/element/android/features/logout/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.logout - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -/** - * 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("io.element.android.features.login.test", appContext.packageName) - } -} diff --git a/features/logout/src/main/AndroidManifest.xml b/features/logout/src/main/AndroidManifest.xml deleted file mode 100644 index 19db0c3d57..0000000000 --- a/features/logout/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/features/logout/src/test/kotlin/io/element/android/features/logout/ExampleUnitTest.kt b/features/logout/src/test/kotlin/io/element/android/features/logout/ExampleUnitTest.kt deleted file mode 100644 index 065f4e917d..0000000000 --- a/features/logout/src/test/kotlin/io/element/android/features/logout/ExampleUnitTest.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.logout - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * 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) - } -} diff --git a/features/messages/api/build.gradle.kts b/features/messages/api/build.gradle.kts index 45b8f50fc3..555e631a4d 100644 --- a/features/messages/api/build.gradle.kts +++ b/features/messages/api/build.gradle.kts @@ -17,7 +17,7 @@ // TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed @Suppress("DSL_SCOPE_VIOLATION") plugins { - id("io.element.android-compose-library") + id("io.element.android-library") } android { diff --git a/features/onboarding/.gitignore b/features/onboarding/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/features/onboarding/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/features/onboarding/api/build.gradle.kts b/features/onboarding/api/build.gradle.kts new file mode 100644 index 0000000000..95000c3a60 --- /dev/null +++ b/features/onboarding/api/build.gradle.kts @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-library") +} + +android { + namespace = "io.element.android.features.onboarding.api" +} + +dependencies { + implementation(projects.libraries.architecture) +} diff --git a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/api/OnBoardingEntryPoint.kt b/features/onboarding/api/src/main/kotlin/io/element/android/features/onboarding/api/OnBoardingEntryPoint.kt similarity index 100% rename from features/onboarding/src/main/kotlin/io/element/android/features/onboarding/api/OnBoardingEntryPoint.kt rename to features/onboarding/api/src/main/kotlin/io/element/android/features/onboarding/api/OnBoardingEntryPoint.kt diff --git a/features/onboarding/build.gradle.kts b/features/onboarding/build.gradle.kts deleted file mode 100644 index 85016fd90e..0000000000 --- a/features/onboarding/build.gradle.kts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed -@Suppress("DSL_SCOPE_VIOLATION") -plugins { - id("io.element.android-compose-library") - alias(libs.plugins.anvil) - alias(libs.plugins.ksp) -} - -android { - namespace = "io.element.android.features.onboarding" -} - -anvil { - generateDaggerFactories.set(true) -} - -dependencies { - implementation(projects.libraries.core) - implementation(projects.libraries.elementresources) - implementation(projects.anvilannotations) - anvil(projects.anvilcodegen) - implementation(projects.libraries.uiStrings) - implementation(projects.libraries.designsystem) - implementation(projects.libraries.architecture) - implementation(projects.libraries.testtags) - implementation(projects.libraries.androidutils) - implementation(libs.accompanist.pager) - implementation(libs.accompanist.pagerindicator) - testImplementation(libs.test.junit) - androidTestImplementation(libs.test.junitext) - ksp(libs.showkase.processor) -} diff --git a/features/onboarding/consumer-rules.pro b/features/onboarding/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/features/preferences/build.gradle.kts b/features/onboarding/impl/build.gradle.kts similarity index 84% rename from features/preferences/build.gradle.kts rename to features/onboarding/impl/build.gradle.kts index 4cface7d76..8dc0b1b0fa 100644 --- a/features/preferences/build.gradle.kts +++ b/features/onboarding/impl/build.gradle.kts @@ -24,7 +24,7 @@ plugins { } android { - namespace = "io.element.android.features.preferences" + namespace = "io.element.android.features.onboarding.impl" } anvil { @@ -34,16 +34,17 @@ anvil { dependencies { implementation(projects.anvilannotations) anvil(projects.anvilcodegen) - implementation(projects.libraries.architecture) implementation(projects.libraries.core) - implementation(projects.libraries.matrixui) - implementation(projects.features.rageshake) - implementation(projects.features.logout) + implementation(projects.libraries.architecture) + implementation(projects.libraries.matrix.api) implementation(projects.libraries.designsystem) implementation(projects.libraries.elementresources) + implementation(projects.libraries.testtags) implementation(projects.libraries.uiStrings) - implementation(libs.datetime) - implementation(libs.accompanist.placeholder) + implementation(libs.accompanist.pager) + implementation(libs.accompanist.pagerindicator) + api(projects.features.onboarding.api) + ksp(libs.showkase.processor) testImplementation(libs.test.junit) testImplementation(libs.coroutines.test) @@ -53,5 +54,4 @@ dependencies { testImplementation(projects.libraries.matrix.test) androidTestImplementation(libs.test.junitext) - ksp(libs.showkase.processor) } diff --git a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/DefaultOnBoardingEntryPoint.kt b/features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/DefaultOnBoardingEntryPoint.kt similarity index 100% rename from features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/DefaultOnBoardingEntryPoint.kt rename to features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/DefaultOnBoardingEntryPoint.kt diff --git a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingNode.kt b/features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingNode.kt similarity index 100% rename from features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingNode.kt rename to features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingNode.kt diff --git a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingScreen.kt b/features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingScreen.kt similarity index 100% rename from features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingScreen.kt rename to features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/OnBoardingScreen.kt diff --git a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselData.kt b/features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselData.kt similarity index 100% rename from features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselData.kt rename to features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselData.kt diff --git a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt b/features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt similarity index 98% rename from features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt rename to features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt index 0ae33d70b4..80e86213b2 100644 --- a/features/onboarding/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt +++ b/features/onboarding/impl/src/main/kotlin/io/element/android/features/onboarding/impl/SplashCarouselDataFactory.kt @@ -17,7 +17,6 @@ package io.element.android.features.onboarding.impl import androidx.annotation.DrawableRes -import io.element.android.features.onboarding.R import io.element.android.libraries.ui.strings.R as StringR class SplashCarouselDataFactory { diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_collaboration.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_collaboration.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_collaboration.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_collaboration.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_collaboration_dark.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_collaboration_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_collaboration_dark.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_collaboration_dark.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_control.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_control.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_control.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_control.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_control_dark.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_control_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_control_dark.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_control_dark.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_conversations.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_conversations.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_conversations.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_conversations.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_conversations_dark.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_conversations_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_conversations_dark.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_conversations_dark.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_secure.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_secure.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_secure.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_secure.webp diff --git a/features/onboarding/src/main/res/drawable-hdpi/ic_splash_secure_dark.webp b/features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_secure_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-hdpi/ic_splash_secure_dark.webp rename to features/onboarding/impl/src/main/res/drawable-hdpi/ic_splash_secure_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_collaboration.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_collaboration.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_collaboration.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_collaboration.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_collaboration_dark.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_collaboration_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_collaboration_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_collaboration_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_control.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_control.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_control.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_control.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_control_dark.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_control_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_control_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_control_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_conversations.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_conversations.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_conversations.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_conversations.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_conversations_dark.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_conversations_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_conversations_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_conversations_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_secure.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_secure.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_secure.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_secure.webp diff --git a/features/onboarding/src/main/res/drawable-xhdpi/ic_splash_secure_dark.webp b/features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_secure_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xhdpi/ic_splash_secure_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xhdpi/ic_splash_secure_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_collaboration.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_collaboration.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_collaboration.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_collaboration.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_collaboration_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_collaboration_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_collaboration_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_collaboration_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_control.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_control.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_control.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_control.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_control_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_control_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_control_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_control_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_conversations.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_conversations.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_conversations.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_conversations.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_conversations_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_conversations_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_conversations_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_conversations_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_secure.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_secure.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_secure.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_secure.webp diff --git a/features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_secure_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_secure_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxhdpi/ic_splash_secure_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxhdpi/ic_splash_secure_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_collaboration.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_collaboration.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_collaboration.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_collaboration.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_collaboration_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_collaboration_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_collaboration_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_collaboration_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_control.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_control.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_control.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_control.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_control_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_control_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_control_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_control_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_conversations.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_conversations.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_conversations.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_conversations.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_conversations_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_conversations_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_conversations_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_conversations_dark.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_secure.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_secure.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_secure.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_secure.webp diff --git a/features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_secure_dark.webp b/features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_secure_dark.webp similarity index 100% rename from features/onboarding/src/main/res/drawable-xxxhdpi/ic_splash_secure_dark.webp rename to features/onboarding/impl/src/main/res/drawable-xxxhdpi/ic_splash_secure_dark.webp diff --git a/features/onboarding/src/main/res/drawable/bg_carousel_page_1.xml b/features/onboarding/impl/src/main/res/drawable/bg_carousel_page_1.xml similarity index 100% rename from features/onboarding/src/main/res/drawable/bg_carousel_page_1.xml rename to features/onboarding/impl/src/main/res/drawable/bg_carousel_page_1.xml diff --git a/features/onboarding/src/main/res/drawable/bg_carousel_page_2.xml b/features/onboarding/impl/src/main/res/drawable/bg_carousel_page_2.xml similarity index 100% rename from features/onboarding/src/main/res/drawable/bg_carousel_page_2.xml rename to features/onboarding/impl/src/main/res/drawable/bg_carousel_page_2.xml diff --git a/features/onboarding/src/main/res/drawable/bg_carousel_page_3.xml b/features/onboarding/impl/src/main/res/drawable/bg_carousel_page_3.xml similarity index 100% rename from features/onboarding/src/main/res/drawable/bg_carousel_page_3.xml rename to features/onboarding/impl/src/main/res/drawable/bg_carousel_page_3.xml diff --git a/features/onboarding/src/main/res/drawable/bg_carousel_page_4.xml b/features/onboarding/impl/src/main/res/drawable/bg_carousel_page_4.xml similarity index 100% rename from features/onboarding/src/main/res/drawable/bg_carousel_page_4.xml rename to features/onboarding/impl/src/main/res/drawable/bg_carousel_page_4.xml diff --git a/features/onboarding/src/main/res/drawable/bg_color_background.xml b/features/onboarding/impl/src/main/res/drawable/bg_color_background.xml similarity index 100% rename from features/onboarding/src/main/res/drawable/bg_color_background.xml rename to features/onboarding/impl/src/main/res/drawable/bg_color_background.xml diff --git a/features/onboarding/src/main/res/drawable/bg_gradient_ftue_breaker.xml b/features/onboarding/impl/src/main/res/drawable/bg_gradient_ftue_breaker.xml similarity index 100% rename from features/onboarding/src/main/res/drawable/bg_gradient_ftue_breaker.xml rename to features/onboarding/impl/src/main/res/drawable/bg_gradient_ftue_breaker.xml diff --git a/features/onboarding/src/main/res/values/strings.xml b/features/onboarding/impl/src/main/res/values/strings.xml similarity index 100% rename from features/onboarding/src/main/res/values/strings.xml rename to features/onboarding/impl/src/main/res/values/strings.xml diff --git a/features/onboarding/proguard-rules.pro b/features/onboarding/proguard-rules.pro deleted file mode 100644 index ff59496d81..0000000000 --- a/features/onboarding/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.kts. -# -# 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/features/onboarding/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt b/features/onboarding/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt deleted file mode 100644 index 4ad31d222f..0000000000 --- a/features/onboarding/src/androidTest/kotlin/io/element/android/features/login/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.login - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -/** - * 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("io.element.android.features.login.test", appContext.packageName) - } -} diff --git a/features/onboarding/src/main/AndroidManifest.xml b/features/onboarding/src/main/AndroidManifest.xml deleted file mode 100644 index 19db0c3d57..0000000000 --- a/features/onboarding/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/features/onboarding/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt b/features/onboarding/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt deleted file mode 100644 index ee6363e624..0000000000 --- a/features/onboarding/src/test/kotlin/io/element/android/features/login/ExampleUnitTest.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.login - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * 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) - } -} diff --git a/features/preferences/.gitignore b/features/preferences/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/features/preferences/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/features/preferences/api/build.gradle.kts b/features/preferences/api/build.gradle.kts new file mode 100644 index 0000000000..43ab960c56 --- /dev/null +++ b/features/preferences/api/build.gradle.kts @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-library") +} + +android { + namespace = "io.element.android.features.preferences.api" +} + +dependencies { + implementation(projects.libraries.architecture) +} diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt b/features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt similarity index 100% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt rename to features/preferences/api/src/main/kotlin/io/element/android/features/preferences/api/PreferencesEntryPoint.kt diff --git a/features/preferences/consumer-rules.pro b/features/preferences/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/features/preferences/impl/build.gradle.kts b/features/preferences/impl/build.gradle.kts new file mode 100644 index 0000000000..c181cfa74c --- /dev/null +++ b/features/preferences/impl/build.gradle.kts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed +@Suppress("DSL_SCOPE_VIOLATION") +plugins { + id("io.element.android-compose-library") + alias(libs.plugins.anvil) + alias(libs.plugins.ksp) + id("kotlin-parcelize") +} + +android { + namespace = "io.element.android.features.preferences.impl" +} + +anvil { + generateDaggerFactories.set(true) +} + +dependencies { + implementation(projects.anvilannotations) + anvil(projects.anvilcodegen) + implementation(projects.libraries.core) + implementation(projects.libraries.architecture) + implementation(projects.libraries.matrix.api) + implementation(projects.libraries.designsystem) + implementation(projects.libraries.elementresources) + implementation(projects.libraries.testtags) + implementation(projects.libraries.uiStrings) + implementation(projects.features.rageshake.api) + implementation(projects.libraries.matrixui) + implementation(projects.features.logout.api) + implementation(libs.datetime) + implementation(libs.accompanist.placeholder) + api(projects.features.preferences.api) + ksp(libs.showkase.processor) + + testImplementation(libs.test.junit) + testImplementation(libs.coroutines.test) + testImplementation(libs.molecule.runtime) + testImplementation(libs.test.truth) + testImplementation(libs.test.turbine) + testImplementation(projects.libraries.matrix.test) + testImplementation(projects.features.rageshake.test) + testImplementation(projects.features.rageshake.impl) + testImplementation(projects.features.logout.impl) + + androidTestImplementation(libs.test.junitext) +} diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt similarity index 98% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt index ac26d05255..aa286394dc 100644 --- a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/DefaultPreferencesEntryPoint.kt @@ -30,13 +30,14 @@ class DefaultPreferencesEntryPoint @Inject constructor() : PreferencesEntryPoint override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): PreferencesEntryPoint.NodeBuilder { return object : PreferencesEntryPoint.NodeBuilder { val plugins = ArrayList() + override fun callback(callback: PreferencesEntryPoint.Callback): PreferencesEntryPoint.NodeBuilder { plugins += callback return this } override fun build(): Node { - return parentNode.createNode(buildContext) + return parentNode.createNode(buildContext, plugins) } } } diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt similarity index 100% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/PreferencesFlowNode.kt diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt similarity index 100% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt similarity index 89% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt index eebc52ab36..68036cfa9b 100644 --- a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenter.kt @@ -17,8 +17,8 @@ package io.element.android.features.preferences.impl.root import androidx.compose.runtime.Composable -import io.element.android.features.logout.LogoutPreferencePresenter -import io.element.android.features.rageshake.preferences.RageshakePreferencesPresenter +import io.element.android.features.logout.api.LogoutPreferencePresenter +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesPresenter import io.element.android.libraries.architecture.Async import io.element.android.libraries.architecture.Presenter import javax.inject.Inject diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt similarity index 85% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt index 38704b3674..fbf307f7e8 100644 --- a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootState.kt @@ -16,8 +16,8 @@ package io.element.android.features.preferences.impl.root -import io.element.android.features.logout.LogoutPreferenceState -import io.element.android.features.rageshake.preferences.RageshakePreferencesState +import io.element.android.features.logout.api.LogoutPreferenceState +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesState import io.element.android.libraries.architecture.Async import io.element.android.libraries.matrix.ui.model.MatrixUser diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt similarity index 85% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt index 619c20a047..a12b16a54b 100644 --- a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootStateProvider.kt @@ -16,8 +16,8 @@ package io.element.android.features.preferences.impl.root -import io.element.android.features.logout.aLogoutPreferenceState -import io.element.android.features.rageshake.preferences.aRageshakePreferencesState +import io.element.android.features.logout.api.aLogoutPreferenceState +import io.element.android.features.rageshake.api.preferences.aRageshakePreferencesState import io.element.android.libraries.architecture.Async fun aPreferencesRootState() = PreferencesRootState( diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt similarity index 94% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt index 39827dcd7e..22ca852fc6 100644 --- a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt +++ b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootView.kt @@ -21,9 +21,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewParameter -import io.element.android.features.logout.LogoutPreferenceView +import io.element.android.features.logout.api.LogoutPreferenceView import io.element.android.features.preferences.impl.user.UserPreferences -import io.element.android.features.rageshake.preferences.RageshakePreferencesView +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesView import io.element.android.libraries.architecture.Async import io.element.android.libraries.designsystem.components.preferences.PreferenceView import io.element.android.libraries.designsystem.preview.ElementPreviewDark diff --git a/features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/user/UserPreferences.kt b/features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/user/UserPreferences.kt similarity index 100% rename from features/preferences/src/main/kotlin/io/element/android/features/preferences/impl/user/UserPreferences.kt rename to features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/user/UserPreferences.kt diff --git a/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/PreferencesRootPresenterTest.kt b/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenterTest.kt similarity index 75% rename from features/preferences/src/test/kotlin/io/element/android/features/preferences/root/PreferencesRootPresenterTest.kt rename to features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenterTest.kt index 9ca0f591a5..83d1163e9e 100644 --- a/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/PreferencesRootPresenterTest.kt +++ b/features/preferences/impl/src/test/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootPresenterTest.kt @@ -16,15 +16,16 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.preferences.root +package io.element.android.features.preferences.impl.root import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat -import io.element.android.features.logout.LogoutPreferencePresenter -import io.element.android.features.preferences.impl.root.PreferencesRootPresenter -import io.element.android.features.rageshake.preferences.RageshakePreferencesPresenter +import io.element.android.features.logout.impl.DefaultLogoutPreferencePresenter +import io.element.android.features.rageshake.impl.preferences.DefaultRageshakePreferencesPresenter +import io.element.android.features.rageshake.test.rageshake.FakeRageShake +import io.element.android.features.rageshake.test.rageshake.FakeRageshakeDataStore import io.element.android.libraries.architecture.Async import io.element.android.libraries.matrix.test.FakeMatrixClient import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -34,8 +35,8 @@ import org.junit.Test class PreferencesRootPresenterTest { @Test fun `present - initial state`() = runTest { - val logoutPresenter = LogoutPreferencePresenter(FakeMatrixClient()) - val rageshakePresenter = RageshakePreferencesPresenter(FakeRageShake(), FakeRageshakeDataStore()) + val logoutPresenter = DefaultLogoutPreferencePresenter(FakeMatrixClient()) + val rageshakePresenter = DefaultRageshakePreferencesPresenter(FakeRageShake(), FakeRageshakeDataStore()) val presenter = PreferencesRootPresenter( logoutPresenter, rageshakePresenter ) diff --git a/features/preferences/proguard-rules.pro b/features/preferences/proguard-rules.pro deleted file mode 100644 index 481bb43481..0000000000 --- a/features/preferences/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/features/preferences/src/androidTest/kotlin/io/element/android/features/preferences/ExampleInstrumentedTest.kt b/features/preferences/src/androidTest/kotlin/io/element/android/features/preferences/ExampleInstrumentedTest.kt deleted file mode 100644 index 3b0a6ee9ae..0000000000 --- a/features/preferences/src/androidTest/kotlin/io/element/android/features/preferences/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.preferences - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -/** - * 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("io.element.android.features.preferences.test", appContext.packageName) - } -} diff --git a/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageShake.kt b/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageShake.kt deleted file mode 100644 index 9c1d69828d..0000000000 --- a/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageShake.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.preferences.root - -import io.element.android.features.rageshake.rageshake.RageShake - -// TODO Remove this duplicated class when we will rework modules. -class FakeRageShake( - private var isAvailableValue: Boolean = true -) : RageShake { - - private var interceptor: (() -> Unit)? = null - - override fun isAvailable() = isAvailableValue - - override fun start(sensitivity: Float) { - } - - override fun stop() { - } - - override fun setSensitivity(sensitivity: Float) { - } - - override fun setInterceptor(interceptor: (() -> Unit)?) { - this.interceptor = interceptor - } - - fun triggerPhoneRageshake() = interceptor?.invoke() -} diff --git a/features/rageshake/.gitignore b/features/rageshake/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/features/rageshake/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/features/rageshake/api/build.gradle.kts b/features/rageshake/api/build.gradle.kts new file mode 100644 index 0000000000..a3c54c8ec3 --- /dev/null +++ b/features/rageshake/api/build.gradle.kts @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-compose-library") +} + +android { + namespace = "io.element.android.features.rageshake.api" +} + +dependencies { + implementation(projects.libraries.architecture) + implementation(projects.libraries.designsystem) + implementation(projects.libraries.androidutils) + implementation(projects.libraries.uiStrings) +} diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportEntryPoint.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/bugreport/BugReportEntryPoint.kt similarity index 94% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportEntryPoint.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/bugreport/BugReportEntryPoint.kt index 955763b3cc..5a59cb0622 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportEntryPoint.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/bugreport/BugReportEntryPoint.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.api.bugreport import com.bumble.appyx.core.modality.BuildContext import com.bumble.appyx.core.node.Node diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/CrashDataStore.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDataStore.kt similarity index 93% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/CrashDataStore.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDataStore.kt index d9326841d8..1336c825ba 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/CrashDataStore.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDataStore.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash +package io.element.android.features.rageshake.api.crash import kotlinx.coroutines.flow.Flow diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionEvents.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvents.kt similarity index 93% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionEvents.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvents.kt index 0175e1fde2..055a8339f6 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionEvents.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionEvents.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.api.crash sealed interface CrashDetectionEvents { object ResetAllCrashData : CrashDetectionEvents diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionPresenter.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionPresenter.kt new file mode 100644 index 0000000000..9ec87b9ee3 --- /dev/null +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionPresenter.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.element.android.features.rageshake.api.crash + +import io.element.android.libraries.architecture.Presenter + +interface CrashDetectionPresenter : Presenter diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionState.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt similarity index 86% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionState.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt index 851b6789df..96fb558de6 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionState.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionState.kt @@ -14,8 +14,11 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.api.crash +import androidx.compose.runtime.Immutable + +@Immutable data class CrashDetectionState( val crashDetected: Boolean, val eventSink: (CrashDetectionEvents) -> Unit diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionStateProvider.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionStateProvider.kt similarity index 92% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionStateProvider.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionStateProvider.kt index 0ffc9f22a1..184d0ecbbc 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionStateProvider.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionStateProvider.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.api.crash fun aCrashDetectionState() = CrashDetectionState( crashDetected = false, diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionScreen.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt similarity index 97% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionScreen.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt index 50d6488697..927b372820 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionScreen.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/crash/CrashDetectionView.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.api.crash import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionEvents.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionEvents.kt similarity index 87% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionEvents.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionEvents.kt index 9bc787d4ac..bfba87a01a 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionEvents.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionEvents.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.element.android.features.rageshake.detection +package io.element.android.features.rageshake.api.detection -import io.element.android.features.rageshake.screenshot.ImageResult +import io.element.android.features.rageshake.api.screenshot.ImageResult sealed interface RageshakeDetectionEvents { object Dismiss : RageshakeDetectionEvents diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionPresenter.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionPresenter.kt new file mode 100644 index 0000000000..87d833db63 --- /dev/null +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionPresenter.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.element.android.features.rageshake.api.detection + +import io.element.android.libraries.architecture.Presenter + +interface RageshakeDetectionPresenter : Presenter diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionState.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionState.kt similarity index 81% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionState.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionState.kt index aa8990c82b..5d6df8bac9 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionState.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionState.kt @@ -14,12 +14,13 @@ * limitations under the License. */ -package io.element.android.features.rageshake.detection +package io.element.android.features.rageshake.api.detection +import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable -import io.element.android.features.rageshake.preferences.RageshakePreferencesState +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesState -@Stable +@Immutable data class RageshakeDetectionState( val takeScreenshot: Boolean, val showDialog: Boolean, diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionStateProvider.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionStateProvider.kt similarity index 84% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionStateProvider.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionStateProvider.kt index 806d0c6df9..83d2bcd758 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionStateProvider.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionStateProvider.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.element.android.features.rageshake.detection +package io.element.android.features.rageshake.api.detection -import io.element.android.features.rageshake.preferences.aRageshakePreferencesState +import io.element.android.features.rageshake.api.preferences.aRageshakePreferencesState fun aRageshakeDetectionState() = RageshakeDetectionState( takeScreenshot = false, diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionView.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionView.kt similarity index 94% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionView.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionView.kt index c54281c606..d93c82dc7c 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionView.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/detection/RageshakeDetectionView.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.detection +package io.element.android.features.rageshake.api.detection import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -23,8 +23,8 @@ import androidx.compose.ui.platform.LocalView import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.lifecycle.Lifecycle -import io.element.android.features.rageshake.screenshot.ImageResult -import io.element.android.features.rageshake.screenshot.screenshot +import io.element.android.features.rageshake.api.screenshot.ImageResult +import io.element.android.features.rageshake.api.screenshot.screenshot import io.element.android.libraries.androidutils.hardware.vibrate import io.element.android.libraries.designsystem.components.dialogs.ConfirmationDialog import io.element.android.libraries.designsystem.preview.ElementPreviewDark diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesEvents.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesEvents.kt similarity index 92% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesEvents.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesEvents.kt index 39b788e003..365bfd7397 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesEvents.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesEvents.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.api.preferences sealed interface RageshakePreferencesEvents { data class SetSensitivity(val sensitivity: Float) : RageshakePreferencesEvents diff --git a/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesPresenter.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesPresenter.kt new file mode 100644 index 0000000000..dff0afa96e --- /dev/null +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesPresenter.kt @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.element.android.features.rageshake.api.preferences + +import io.element.android.libraries.architecture.Presenter + +interface RageshakePreferencesPresenter : Presenter diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesState.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesState.kt similarity index 92% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesState.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesState.kt index acb560ef49..20a88d5494 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesState.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesState.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.api.preferences data class RageshakePreferencesState( val isEnabled: Boolean, diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesStateProvider.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesStateProvider.kt similarity index 95% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesStateProvider.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesStateProvider.kt index 6ecd59a713..0af9639242 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesStateProvider.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesStateProvider.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.api.preferences import androidx.compose.ui.tooling.preview.PreviewParameterProvider diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesView.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesView.kt similarity index 98% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesView.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesView.kt index dd716bd4ad..d3541a22b6 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesView.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/preferences/RageshakePreferencesView.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.api.preferences import androidx.compose.foundation.layout.Column import androidx.compose.material.icons.Icons diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/RageShake.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/rageshake/RageShake.kt similarity index 94% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/RageShake.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/rageshake/RageShake.kt index d9150b5ecd..02661e658f 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/RageShake.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/rageshake/RageShake.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.rageshake +package io.element.android.features.rageshake.api.rageshake interface RageShake { /** diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/RageshakeDataStore.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/rageshake/RageshakeDataStore.kt similarity index 93% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/RageshakeDataStore.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/rageshake/RageshakeDataStore.kt index 25a7080354..0c45d24e31 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/RageshakeDataStore.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/rageshake/RageshakeDataStore.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.rageshake +package io.element.android.features.rageshake.api.rageshake import kotlinx.coroutines.flow.Flow diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/BugReporter.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt similarity index 89% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/BugReporter.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt index 3acd22107d..deddbd4faa 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/BugReporter.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporter.kt @@ -14,8 +14,10 @@ * limitations under the License. */ -package io.element.android.features.rageshake.reporter +package io.element.android.features.rageshake.api.reporter +import io.element.android.features.rageshake.api.reporter.BugReporterListener +import io.element.android.features.rageshake.api.reporter.ReportType import kotlinx.coroutines.CoroutineScope interface BugReporter { diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/BugReporterListener.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporterListener.kt similarity index 95% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/BugReporterListener.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporterListener.kt index 3259034ad7..8f2ae90d1c 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/BugReporterListener.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/BugReporterListener.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.reporter +package io.element.android.features.rageshake.api.reporter /** * Bug report upload listener. diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/ReportType.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/ReportType.kt similarity index 92% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/ReportType.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/ReportType.kt index a29d29e702..17b75ea1a7 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/ReportType.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/reporter/ReportType.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.reporter +package io.element.android.features.rageshake.api.reporter enum class ReportType { BUG_REPORT, diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/Screenshot.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/screenshot/Screenshot.kt similarity index 97% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/Screenshot.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/screenshot/Screenshot.kt index 803c51f2da..13041b24ac 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/Screenshot.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/screenshot/Screenshot.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.screenshot +package io.element.android.features.rageshake.api.screenshot import android.app.Activity import android.graphics.Bitmap diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/ScreenshotHolder.kt b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/screenshot/ScreenshotHolder.kt similarity index 92% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/ScreenshotHolder.kt rename to features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/screenshot/ScreenshotHolder.kt index dfe31ae2fe..abd79bd77b 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/ScreenshotHolder.kt +++ b/features/rageshake/api/src/main/kotlin/io/element/android/features/rageshake/api/screenshot/ScreenshotHolder.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.screenshot +package io.element.android.features.rageshake.api.screenshot import android.graphics.Bitmap diff --git a/features/rageshake/consumer-rules.pro b/features/rageshake/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/features/rageshake/build.gradle.kts b/features/rageshake/impl/build.gradle.kts similarity index 92% rename from features/rageshake/build.gradle.kts rename to features/rageshake/impl/build.gradle.kts index cf16ccf1be..c23bbe74cc 100644 --- a/features/rageshake/build.gradle.kts +++ b/features/rageshake/impl/build.gradle.kts @@ -24,7 +24,7 @@ plugins { } android { - namespace = "io.element.android.features.rageshake" + namespace = "io.element.android.features.rageshake.impl" } anvil { @@ -32,8 +32,8 @@ anvil { } dependencies { - anvil(projects.anvilcodegen) implementation(projects.anvilannotations) + anvil(projects.anvilcodegen) implementation(projects.libraries.androidutils) implementation(projects.libraries.core) implementation(projects.libraries.architecture) @@ -41,6 +41,7 @@ dependencies { implementation(projects.libraries.elementresources) implementation(projects.libraries.uiStrings) api(libs.squareup.seismic) + api(projects.features.rageshake.api) implementation(libs.androidx.datastore.preferences) implementation(libs.coil) implementation(libs.coil.compose) @@ -51,8 +52,9 @@ dependencies { testImplementation(libs.molecule.runtime) testImplementation(libs.test.truth) testImplementation(libs.test.turbine) - testImplementation(projects.libraries.matrix.test) testImplementation(libs.test.mockk) + testImplementation(projects.libraries.matrix.test) + testImplementation(projects.features.rageshake.test) androidTestImplementation(libs.test.junitext) } diff --git a/features/rageshake/src/main/java/io/element/android/features/rageshake/reporter/BugReporterMultipartBody.java b/features/rageshake/impl/src/main/java/io/element/android/features/rageshake/impl/reporter/BugReporterMultipartBody.java similarity index 99% rename from features/rageshake/src/main/java/io/element/android/features/rageshake/reporter/BugReporterMultipartBody.java rename to features/rageshake/impl/src/main/java/io/element/android/features/rageshake/impl/reporter/BugReporterMultipartBody.java index aa499c3f86..e114cb3901 100755 --- a/features/rageshake/src/main/java/io/element/android/features/rageshake/reporter/BugReporterMultipartBody.java +++ b/features/rageshake/impl/src/main/java/io/element/android/features/rageshake/impl/reporter/BugReporterMultipartBody.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.reporter; +package io.element.android.features.rageshake.impl.reporter; import java.io.IOException; import java.util.ArrayList; diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportEvents.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportEvents.kt similarity index 94% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportEvents.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportEvents.kt index 0045f29a2c..9ab6c46a9a 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportEvents.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportEvents.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport sealed interface BugReportEvents { object SendBugReport : BugReportEvents diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportNode.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt similarity index 88% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportNode.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt index 79c1beec0f..b5c20c1ab2 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportNode.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportNode.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -25,6 +25,8 @@ import com.bumble.appyx.core.plugin.plugins import dagger.assisted.Assisted import dagger.assisted.AssistedInject import io.element.android.anvilannotations.ContributesNode +import io.element.android.features.rageshake.api.bugreport.BugReportEntryPoint +import io.element.android.features.rageshake.impl.bugreport.BugReportPresenter import io.element.android.libraries.di.AppScope @ContributesNode(AppScope::class) diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportPresenter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportPresenter.kt similarity index 91% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportPresenter.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportPresenter.kt index a2e17d737b..bce4e96709 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportPresenter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportPresenter.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState @@ -23,12 +23,12 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable -import io.element.android.features.rageshake.crash.CrashDataStore -import io.element.android.features.rageshake.logs.VectorFileLogger -import io.element.android.features.rageshake.reporter.BugReporter -import io.element.android.features.rageshake.reporter.BugReporterListener -import io.element.android.features.rageshake.reporter.ReportType -import io.element.android.features.rageshake.screenshot.ScreenshotHolder +import io.element.android.features.rageshake.api.reporter.BugReporter +import io.element.android.features.rageshake.api.reporter.BugReporterListener +import io.element.android.features.rageshake.api.reporter.ReportType +import io.element.android.features.rageshake.api.crash.CrashDataStore +import io.element.android.features.rageshake.impl.logs.VectorFileLogger +import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder import io.element.android.libraries.architecture.Async import io.element.android.libraries.architecture.Presenter import kotlinx.coroutines.CoroutineScope diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportState.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportState.kt similarity index 96% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportState.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportState.kt index ea62ea1ef3..3300693973 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportState.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportState.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import android.os.Parcelable import io.element.android.libraries.architecture.Async diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportStateProvider.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportStateProvider.kt similarity index 96% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportStateProvider.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportStateProvider.kt index a5dd2ad947..3601c2a259 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportStateProvider.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportStateProvider.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import androidx.compose.ui.tooling.preview.PreviewParameterProvider import io.element.android.libraries.architecture.Async diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportView.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportView.kt similarity index 99% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportView.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportView.kt index 024d6beab9..46a4f7b5c3 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/BugReportView.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportView.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/DefaultBugReportEntryPoint.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/DefaultBugReportEntryPoint.kt similarity index 91% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/DefaultBugReportEntryPoint.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/DefaultBugReportEntryPoint.kt index e71f8a9511..19f4e532e9 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/bugreport/DefaultBugReportEntryPoint.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/bugreport/DefaultBugReportEntryPoint.kt @@ -14,12 +14,13 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import com.bumble.appyx.core.modality.BuildContext import com.bumble.appyx.core.node.Node import com.bumble.appyx.core.plugin.Plugin import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.bugreport.BugReportEntryPoint import io.element.android.libraries.architecture.createNode import io.element.android.libraries.di.AppScope import javax.inject.Inject diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt similarity index 73% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenter.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt index 1f6300a5ac..6a15553bdb 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/DefaultCrashDetectionPresenter.kt @@ -14,19 +14,24 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.impl.crash import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.rememberCoroutineScope -import io.element.android.features.rageshake.crash.CrashDataStore -import io.element.android.libraries.architecture.Presenter +import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.crash.CrashDetectionEvents +import io.element.android.features.rageshake.api.crash.CrashDetectionPresenter +import io.element.android.features.rageshake.api.crash.CrashDetectionState +import io.element.android.features.rageshake.api.crash.CrashDataStore +import io.element.android.libraries.di.AppScope import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import javax.inject.Inject -class CrashDetectionPresenter @Inject constructor(private val crashDataStore: CrashDataStore) : - Presenter { +@ContributesBinding(AppScope::class) +class DefaultCrashDetectionPresenter @Inject constructor(private val crashDataStore: CrashDataStore) : + CrashDetectionPresenter { @Composable override fun present(): CrashDetectionState { diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/PreferencesCrashDataStore.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/PreferencesCrashDataStore.kt similarity index 95% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/PreferencesCrashDataStore.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/PreferencesCrashDataStore.kt index 70f258fd02..018b30d4c5 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/PreferencesCrashDataStore.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/PreferencesCrashDataStore.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash +package io.element.android.features.rageshake.impl.crash import android.content.Context import androidx.datastore.core.DataStore @@ -24,6 +24,7 @@ import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.stringPreferencesKey import androidx.datastore.preferences.preferencesDataStore import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.crash.CrashDataStore import io.element.android.libraries.core.bool.orFalse import io.element.android.libraries.di.AppScope import io.element.android.libraries.di.ApplicationContext diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/VectorUncaughtExceptionHandler.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/VectorUncaughtExceptionHandler.kt similarity index 98% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/VectorUncaughtExceptionHandler.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/VectorUncaughtExceptionHandler.kt index 942d49d531..a5e7edf405 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/crash/VectorUncaughtExceptionHandler.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/crash/VectorUncaughtExceptionHandler.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash +package io.element.android.features.rageshake.impl.crash import android.content.Context import android.os.Build diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/detection/DefaultRageshakeDetectionPresenter.kt similarity index 81% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenter.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/detection/DefaultRageshakeDetectionPresenter.kt index dc0155877e..58a49611be 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/detection/DefaultRageshakeDetectionPresenter.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.detection +package io.element.android.features.rageshake.impl.detection import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -23,22 +23,27 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable -import io.element.android.features.rageshake.preferences.RageshakePreferencesEvents -import io.element.android.features.rageshake.preferences.RageshakePreferencesPresenter -import io.element.android.features.rageshake.rageshake.RageShake -import io.element.android.features.rageshake.screenshot.ImageResult -import io.element.android.features.rageshake.screenshot.ScreenshotHolder -import io.element.android.libraries.architecture.Presenter +import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.detection.RageshakeDetectionEvents +import io.element.android.features.rageshake.api.detection.RageshakeDetectionPresenter +import io.element.android.features.rageshake.api.detection.RageshakeDetectionState +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesEvents +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesPresenter +import io.element.android.features.rageshake.api.rageshake.RageShake +import io.element.android.features.rageshake.api.screenshot.ImageResult +import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder +import io.element.android.libraries.di.AppScope import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import timber.log.Timber import javax.inject.Inject -class RageshakeDetectionPresenter @Inject constructor( +@ContributesBinding(AppScope::class) +class DefaultRageshakeDetectionPresenter @Inject constructor( private val screenshotHolder: ScreenshotHolder, private val rageShake: RageShake, private val preferencesPresenter: RageshakePreferencesPresenter, -) : Presenter { +) : RageshakeDetectionPresenter { @Composable override fun present(): RageshakeDetectionState { diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/logs/LogFormatter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/logs/LogFormatter.kt similarity index 97% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/logs/LogFormatter.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/logs/LogFormatter.kt index 2f6a50c077..e0dc1a5fbb 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/logs/LogFormatter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/logs/LogFormatter.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.logs +package io.element.android.features.rageshake.impl.logs import java.io.PrintWriter import java.io.StringWriter diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/logs/VectorFileLogger.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/logs/VectorFileLogger.kt similarity index 98% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/logs/VectorFileLogger.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/logs/VectorFileLogger.kt index 5df72e29f7..eea6c1dbbf 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/logs/VectorFileLogger.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/logs/VectorFileLogger.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.logs +package io.element.android.features.rageshake.impl.logs import android.content.Context import android.util.Log diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/preferences/DefaultRageshakePreferencesPresenter.kt similarity index 77% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenter.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/preferences/DefaultRageshakePreferencesPresenter.kt index 119e37d5e5..82a411ec95 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/preferences/DefaultRageshakePreferencesPresenter.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.impl.preferences import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState @@ -22,17 +22,22 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable -import io.element.android.features.rageshake.rageshake.RageShake -import io.element.android.features.rageshake.rageshake.RageshakeDataStore -import io.element.android.libraries.architecture.Presenter +import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesEvents +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesPresenter +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesState +import io.element.android.features.rageshake.api.rageshake.RageShake +import io.element.android.features.rageshake.api.rageshake.RageshakeDataStore +import io.element.android.libraries.di.AppScope import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import javax.inject.Inject -class RageshakePreferencesPresenter @Inject constructor( +@ContributesBinding(AppScope::class) +class DefaultRageshakePreferencesPresenter @Inject constructor( private val rageshake: RageShake, private val rageshakeDataStore: RageshakeDataStore, -) : Presenter { +) : RageshakePreferencesPresenter { @Composable override fun present(): RageshakePreferencesState { diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/DefaultRageShake.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/rageshake/DefaultRageShake.kt similarity index 92% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/DefaultRageShake.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/rageshake/DefaultRageShake.kt index a0963000d8..1d9ff6ee5a 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/DefaultRageShake.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/rageshake/DefaultRageShake.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.rageshake +package io.element.android.features.rageshake.impl.rageshake import android.content.Context import android.hardware.Sensor @@ -22,13 +22,14 @@ import android.hardware.SensorManager import androidx.core.content.getSystemService import com.squareup.anvil.annotations.ContributesBinding import com.squareup.seismic.ShakeDetector +import io.element.android.features.rageshake.api.rageshake.RageShake import io.element.android.libraries.di.AppScope import io.element.android.libraries.di.ApplicationContext import io.element.android.libraries.di.SingleIn import javax.inject.Inject @SingleIn(AppScope::class) -@ContributesBinding(AppScope::class, RageShake::class) +@ContributesBinding(scope = AppScope::class, boundType = RageShake::class) class DefaultRageShake @Inject constructor( @ApplicationContext context: Context, ) : ShakeDetector.Listener, RageShake { diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/PreferencesRageshakeDataStore.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/rageshake/PreferencesRageshakeDataStore.kt similarity index 94% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/PreferencesRageshakeDataStore.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/rageshake/PreferencesRageshakeDataStore.kt index 4643038536..2dc3f3e517 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/rageshake/PreferencesRageshakeDataStore.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/rageshake/PreferencesRageshakeDataStore.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.rageshake.rageshake +package io.element.android.features.rageshake.impl.rageshake import android.content.Context import androidx.datastore.core.DataStore @@ -24,6 +24,7 @@ import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.floatPreferencesKey import androidx.datastore.preferences.preferencesDataStore import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.rageshake.RageshakeDataStore import io.element.android.libraries.core.bool.orTrue import io.element.android.libraries.di.AppScope import io.element.android.libraries.di.ApplicationContext diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/DefaultBugReporter.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt similarity index 97% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/DefaultBugReporter.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt index 7fd40fc786..27bae6ee72 100755 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/reporter/DefaultBugReporter.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 New Vector Ltd + * Copyright (c) 2023 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,17 +14,20 @@ * limitations under the License. */ -package io.element.android.features.rageshake.reporter +package io.element.android.features.rageshake.impl.reporter import android.content.Context import android.os.Build import androidx.core.net.toFile import androidx.core.net.toUri import com.squareup.anvil.annotations.ContributesBinding -import io.element.android.features.rageshake.R -import io.element.android.features.rageshake.crash.CrashDataStore -import io.element.android.features.rageshake.logs.VectorFileLogger -import io.element.android.features.rageshake.screenshot.ScreenshotHolder +import io.element.android.features.rageshake.api.reporter.BugReporter +import io.element.android.features.rageshake.api.reporter.BugReporterListener +import io.element.android.features.rageshake.api.reporter.ReportType +import io.element.android.features.rageshake.impl.R +import io.element.android.features.rageshake.api.crash.CrashDataStore +import io.element.android.features.rageshake.impl.logs.VectorFileLogger +import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder import io.element.android.libraries.androidutils.file.compressFile import io.element.android.libraries.androidutils.file.safeDelete import io.element.android.libraries.core.coroutine.CoroutineDispatchers diff --git a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/DefaultScreenshotHolder.kt b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/screenshot/DefaultScreenshotHolder.kt similarity index 90% rename from features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/DefaultScreenshotHolder.kt rename to features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/screenshot/DefaultScreenshotHolder.kt index 31eeac39a6..d61c7c8c01 100644 --- a/features/rageshake/src/main/kotlin/io/element/android/features/rageshake/screenshot/DefaultScreenshotHolder.kt +++ b/features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/screenshot/DefaultScreenshotHolder.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 New Vector Ltd + * Copyright (c) 2023 New Vector Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,12 +14,13 @@ * limitations under the License. */ -package io.element.android.features.rageshake.screenshot +package io.element.android.features.rageshake.impl.screenshot import android.content.Context import android.graphics.Bitmap import androidx.core.net.toUri import com.squareup.anvil.annotations.ContributesBinding +import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder import io.element.android.libraries.androidutils.bitmap.writeBitmap import io.element.android.libraries.androidutils.file.safeDelete import io.element.android.libraries.di.AppScope diff --git a/features/rageshake/src/main/res/values/strings.xml b/features/rageshake/impl/src/main/res/values/strings.xml similarity index 100% rename from features/rageshake/src/main/res/values/strings.xml rename to features/rageshake/impl/src/main/res/values/strings.xml diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/BugReportPresenterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportPresenterTest.kt similarity index 97% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/BugReportPresenterTest.kt rename to features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportPresenterTest.kt index 93252c8891..1d87eb6306 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/BugReportPresenterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/BugReportPresenterTest.kt @@ -16,14 +16,14 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat -import io.element.android.features.rageshake.crash.ui.A_CRASH_DATA -import io.element.android.features.rageshake.crash.ui.FakeCrashDataStore +import io.element.android.features.rageshake.impl.crash.ui.A_CRASH_DATA +import io.element.android.features.rageshake.impl.crash.ui.FakeCrashDataStore import io.element.android.libraries.architecture.Async import io.element.android.libraries.matrix.test.A_FAILURE_REASON import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/FakeBugReporter.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/FakeBugReporter.kt similarity index 88% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/FakeBugReporter.kt rename to features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/FakeBugReporter.kt index 558edf0b15..dd5d3e76c7 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/FakeBugReporter.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/FakeBugReporter.kt @@ -14,11 +14,11 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport -import io.element.android.features.rageshake.reporter.BugReporter -import io.element.android.features.rageshake.reporter.BugReporterListener -import io.element.android.features.rageshake.reporter.ReportType +import io.element.android.features.rageshake.api.reporter.BugReporter +import io.element.android.features.rageshake.api.reporter.BugReporterListener +import io.element.android.features.rageshake.api.reporter.ReportType import io.element.android.libraries.matrix.test.A_FAILURE_REASON import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.delay diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/FakeScreenshotHolder.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/FakeScreenshotHolder.kt similarity index 86% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/FakeScreenshotHolder.kt rename to features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/FakeScreenshotHolder.kt index 14ece36a14..0ed7714287 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/bugreport/FakeScreenshotHolder.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/bugreport/FakeScreenshotHolder.kt @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.element.android.features.rageshake.bugreport +package io.element.android.features.rageshake.impl.bugreport import android.graphics.Bitmap -import io.element.android.features.rageshake.screenshot.ScreenshotHolder +import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder const val A_SCREENSHOT_URI = "file://content/uri" diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt similarity index 82% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenterTest.kt rename to features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt index 16a03eca86..3a47ab7797 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/crash/ui/CrashDetectionPresenterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/crash/ui/CrashDetectionPresenterTest.kt @@ -16,12 +16,16 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.impl.crash.ui import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat +import io.element.android.features.rageshake.api.crash.CrashDetectionEvents +import io.element.android.features.rageshake.impl.crash.DefaultCrashDetectionPresenter +import io.element.android.features.rageshake.test.crash.A_CRASH_DATA +import io.element.android.features.rageshake.test.crash.FakeCrashDataStore import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test @@ -29,7 +33,7 @@ import org.junit.Test class CrashDetectionPresenterTest { @Test fun `present - initial state no crash`() = runTest { - val presenter = CrashDetectionPresenter( + val presenter = DefaultCrashDetectionPresenter( FakeCrashDataStore() ) moleculeFlow(RecompositionClock.Immediate) { @@ -42,7 +46,7 @@ class CrashDetectionPresenterTest { @Test fun `present - initial state crash`() = runTest { - val presenter = CrashDetectionPresenter( + val presenter = DefaultCrashDetectionPresenter( FakeCrashDataStore(appHasCrashed = true) ) moleculeFlow(RecompositionClock.Immediate) { @@ -57,7 +61,7 @@ class CrashDetectionPresenterTest { @Test fun `present - reset app has crashed`() = runTest { - val presenter = CrashDetectionPresenter( + val presenter = DefaultCrashDetectionPresenter( FakeCrashDataStore(appHasCrashed = true) ) moleculeFlow(RecompositionClock.Immediate) { @@ -73,7 +77,7 @@ class CrashDetectionPresenterTest { @Test fun `present - reset all crash data`() = runTest { - val presenter = CrashDetectionPresenter( + val presenter = DefaultCrashDetectionPresenter( FakeCrashDataStore(appHasCrashed = true, crashData = A_CRASH_DATA) ) moleculeFlow(RecompositionClock.Immediate) { diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/detection/RageshakeDetectionPresenterTest.kt similarity index 85% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenterTest.kt rename to features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/detection/RageshakeDetectionPresenterTest.kt index 2993ab41f1..312671ccbe 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/detection/RageshakeDetectionPresenterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/detection/RageshakeDetectionPresenterTest.kt @@ -16,18 +16,19 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.rageshake.detection +package io.element.android.features.rageshake.impl.detection import android.graphics.Bitmap import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat -import io.element.android.features.rageshake.bugreport.FakeScreenshotHolder -import io.element.android.features.rageshake.preferences.FakeRageShake -import io.element.android.features.rageshake.preferences.FakeRageshakeDataStore -import io.element.android.features.rageshake.preferences.RageshakePreferencesPresenter -import io.element.android.features.rageshake.screenshot.ImageResult +import io.element.android.features.rageshake.api.detection.RageshakeDetectionEvents +import io.element.android.features.rageshake.api.screenshot.ImageResult +import io.element.android.features.rageshake.impl.bugreport.FakeScreenshotHolder +import io.element.android.features.rageshake.impl.preferences.DefaultRageshakePreferencesPresenter +import io.element.android.features.rageshake.test.rageshake.FakeRageShake +import io.element.android.features.rageshake.test.rageshake.FakeRageshakeDataStore import io.element.android.libraries.matrix.test.AN_EXCEPTION import io.mockk.mockk import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -41,10 +42,10 @@ class RageshakeDetectionPresenterTest { val screenshotHolder = FakeScreenshotHolder(screenshotUri = null) val rageshake = FakeRageShake(isAvailableValue = true) val rageshakeDataStore = FakeRageshakeDataStore(isEnabled = true) - val presenter = RageshakeDetectionPresenter( + val presenter = DefaultRageshakeDetectionPresenter( screenshotHolder = screenshotHolder, rageShake = rageshake, - preferencesPresenter = RageshakePreferencesPresenter( + preferencesPresenter = DefaultRageshakePreferencesPresenter( rageshake = rageshake, rageshakeDataStore = rageshakeDataStore, ) @@ -65,10 +66,10 @@ class RageshakeDetectionPresenterTest { val screenshotHolder = FakeScreenshotHolder(screenshotUri = null) val rageshake = FakeRageShake(isAvailableValue = true) val rageshakeDataStore = FakeRageshakeDataStore(isEnabled = true) - val presenter = RageshakeDetectionPresenter( + val presenter = DefaultRageshakeDetectionPresenter( screenshotHolder = screenshotHolder, rageShake = rageshake, - preferencesPresenter = RageshakePreferencesPresenter( + preferencesPresenter = DefaultRageshakePreferencesPresenter( rageshake = rageshake, rageshakeDataStore = rageshakeDataStore, ) @@ -90,10 +91,10 @@ class RageshakeDetectionPresenterTest { val screenshotHolder = FakeScreenshotHolder(screenshotUri = null) val rageshake = FakeRageShake(isAvailableValue = true) val rageshakeDataStore = FakeRageshakeDataStore(isEnabled = true) - val presenter = RageshakeDetectionPresenter( + val presenter = DefaultRageshakeDetectionPresenter( screenshotHolder = screenshotHolder, rageShake = rageshake, - preferencesPresenter = RageshakePreferencesPresenter( + preferencesPresenter = DefaultRageshakePreferencesPresenter( rageshake = rageshake, rageshakeDataStore = rageshakeDataStore, ) @@ -124,10 +125,10 @@ class RageshakeDetectionPresenterTest { val screenshotHolder = FakeScreenshotHolder(screenshotUri = null) val rageshake = FakeRageShake(isAvailableValue = true) val rageshakeDataStore = FakeRageshakeDataStore(isEnabled = true) - val presenter = RageshakeDetectionPresenter( + val presenter = DefaultRageshakeDetectionPresenter( screenshotHolder = screenshotHolder, rageShake = rageshake, - preferencesPresenter = RageshakePreferencesPresenter( + preferencesPresenter = DefaultRageshakePreferencesPresenter( rageshake = rageshake, rageshakeDataStore = rageshakeDataStore, ) @@ -158,10 +159,10 @@ class RageshakeDetectionPresenterTest { val screenshotHolder = FakeScreenshotHolder(screenshotUri = null) val rageshake = FakeRageShake(isAvailableValue = true) val rageshakeDataStore = FakeRageshakeDataStore(isEnabled = true) - val presenter = RageshakeDetectionPresenter( + val presenter = DefaultRageshakeDetectionPresenter( screenshotHolder = screenshotHolder, rageShake = rageshake, - preferencesPresenter = RageshakePreferencesPresenter( + preferencesPresenter = DefaultRageshakePreferencesPresenter( rageshake = rageshake, rageshakeDataStore = rageshakeDataStore, ) diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenterTest.kt b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/preferences/RageshakePreferencesPresenterTest.kt similarity index 83% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenterTest.kt rename to features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/preferences/RageshakePreferencesPresenterTest.kt index 17a46e8da6..e10e485d79 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/RageshakePreferencesPresenterTest.kt +++ b/features/rageshake/impl/src/test/kotlin/io/element/android/features/rageshake/impl/preferences/RageshakePreferencesPresenterTest.kt @@ -16,12 +16,16 @@ @file:OptIn(ExperimentalCoroutinesApi::class) -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.impl.preferences import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test import com.google.common.truth.Truth.assertThat +import io.element.android.features.rageshake.api.preferences.RageshakePreferencesEvents +import io.element.android.features.rageshake.test.rageshake.A_SENSITIVITY +import io.element.android.features.rageshake.test.rageshake.FakeRageShake +import io.element.android.features.rageshake.test.rageshake.FakeRageshakeDataStore import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test @@ -29,7 +33,7 @@ import org.junit.Test class RageshakePreferencesPresenterTest { @Test fun `present - initial state available`() = runTest { - val presenter = RageshakePreferencesPresenter( + val presenter = DefaultRageshakePreferencesPresenter( FakeRageShake(isAvailableValue = true), FakeRageshakeDataStore(isEnabled = true) ) @@ -45,7 +49,7 @@ class RageshakePreferencesPresenterTest { @Test fun `present - initial state not available`() = runTest { - val presenter = RageshakePreferencesPresenter( + val presenter = DefaultRageshakePreferencesPresenter( FakeRageShake(isAvailableValue = false), FakeRageshakeDataStore(isEnabled = true) ) @@ -61,7 +65,7 @@ class RageshakePreferencesPresenterTest { @Test fun `present - enable and disable`() = runTest { - val presenter = RageshakePreferencesPresenter( + val presenter = DefaultRageshakePreferencesPresenter( FakeRageShake(isAvailableValue = true), FakeRageshakeDataStore(isEnabled = true) ) @@ -80,7 +84,7 @@ class RageshakePreferencesPresenterTest { @Test fun `present - set sensitivity`() = runTest { - val presenter = RageshakePreferencesPresenter( + val presenter = DefaultRageshakePreferencesPresenter( FakeRageShake(isAvailableValue = true), FakeRageshakeDataStore(isEnabled = true) ) diff --git a/features/rageshake/proguard-rules.pro b/features/rageshake/proguard-rules.pro deleted file mode 100644 index ff59496d81..0000000000 --- a/features/rageshake/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.kts. -# -# 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/features/rageshake/src/main/AndroidManifest.xml b/features/rageshake/src/main/AndroidManifest.xml deleted file mode 100644 index 19db0c3d57..0000000000 --- a/features/rageshake/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageshakeDataStore.kt b/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageshakeDataStore.kt deleted file mode 100644 index 22c4ae4d4d..0000000000 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageshakeDataStore.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2023 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.rageshake.preferences - -import io.element.android.features.rageshake.rageshake.RageshakeDataStore -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.MutableStateFlow - -class FakeRageshakeDataStore( - isEnabled: Boolean = true, - sensitivity: Float = A_SENSITIVITY, -) : RageshakeDataStore { - - private val isEnabledFlow = MutableStateFlow(isEnabled) - override fun isEnabled(): Flow = isEnabledFlow - - override suspend fun setIsEnabled(isEnabled: Boolean) { - isEnabledFlow.value = isEnabled - } - - private val sensitivityFlow = MutableStateFlow(sensitivity) - override fun sensitivity(): Flow = sensitivityFlow - - override suspend fun setSensitivity(sensitivity: Float) { - sensitivityFlow.value = sensitivity - } - - override suspend fun reset() = Unit -} diff --git a/features/rageshake/test/build.gradle.kts b/features/rageshake/test/build.gradle.kts new file mode 100644 index 0000000000..9317935797 --- /dev/null +++ b/features/rageshake/test/build.gradle.kts @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-library") +} + +android { + namespace = "io.element.android.features.rageshake.test" +} + +dependencies { + implementation(projects.features.rageshake.api) + implementation(libs.coroutines.core) +} diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/crash/ui/FakeCrashDataStore.kt b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/crash/FakeCrashDataStore.kt similarity index 91% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/crash/ui/FakeCrashDataStore.kt rename to features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/crash/FakeCrashDataStore.kt index a757931d53..e12db31763 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/crash/ui/FakeCrashDataStore.kt +++ b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/crash/FakeCrashDataStore.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.element.android.features.rageshake.crash.ui +package io.element.android.features.rageshake.test.crash -import io.element.android.features.rageshake.crash.CrashDataStore +import io.element.android.features.rageshake.api.crash.CrashDataStore import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow diff --git a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageShake.kt b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake/FakeRageShake.kt similarity index 87% rename from features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageShake.kt rename to features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake/FakeRageShake.kt index fbabdaac5d..d127c360cf 100644 --- a/features/rageshake/src/test/kotlin/io/element/android/features/rageshake/preferences/FakeRageShake.kt +++ b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake/FakeRageShake.kt @@ -14,11 +14,9 @@ * limitations under the License. */ -package io.element.android.features.rageshake.preferences +package io.element.android.features.rageshake.test.rageshake -import io.element.android.features.rageshake.rageshake.RageShake - -const val A_SENSITIVITY = 1f +import io.element.android.features.rageshake.api.rageshake.RageShake class FakeRageShake( private var isAvailableValue: Boolean = true diff --git a/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageshakeDataStore.kt b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake/FakeRageshakeDataStore.kt similarity index 91% rename from features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageshakeDataStore.kt rename to features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake/FakeRageshakeDataStore.kt index 517d587bec..7bf15e982a 100644 --- a/features/preferences/src/test/kotlin/io/element/android/features/preferences/root/FakeRageshakeDataStore.kt +++ b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/rageshake/FakeRageshakeDataStore.kt @@ -14,9 +14,9 @@ * limitations under the License. */ -package io.element.android.features.preferences.root +package io.element.android.features.rageshake.test.rageshake -import io.element.android.features.rageshake.rageshake.RageshakeDataStore +import io.element.android.features.rageshake.api.rageshake.RageshakeDataStore import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow diff --git a/appnav/src/test/kotlin/io/element/android/appnav/FakeScreenshotHolder.kt b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/screenshot/FakeScreenshotHolder.kt similarity index 87% rename from appnav/src/test/kotlin/io/element/android/appnav/FakeScreenshotHolder.kt rename to features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/screenshot/FakeScreenshotHolder.kt index a13acf1f1f..bb4d25737a 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/FakeScreenshotHolder.kt +++ b/features/rageshake/test/src/main/kotlin/io/element/android/features/rageshake/test/screenshot/FakeScreenshotHolder.kt @@ -14,10 +14,10 @@ * limitations under the License. */ -package io.element.android.appnav +package io.element.android.features.rageshake.test.screenshot import android.graphics.Bitmap -import io.element.android.features.rageshake.screenshot.ScreenshotHolder +import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder const val A_SCREENSHOT_URI = "file://content/uri" diff --git a/features/roomlist/.gitignore b/features/roomlist/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/features/roomlist/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/features/roomlist/api/build.gradle.kts b/features/roomlist/api/build.gradle.kts new file mode 100644 index 0000000000..1dae32144f --- /dev/null +++ b/features/roomlist/api/build.gradle.kts @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +plugins { + id("io.element.android-library") +} + +android { + namespace = "io.element.android.features.roomlist.api" +} + +dependencies { + implementation(projects.libraries.architecture) + implementation(projects.libraries.matrix.api) +} diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/api/RoomListEntryPoint.kt b/features/roomlist/api/src/main/kotlin/io/element/android/features/roomlist/api/RoomListEntryPoint.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/api/RoomListEntryPoint.kt rename to features/roomlist/api/src/main/kotlin/io/element/android/features/roomlist/api/RoomListEntryPoint.kt diff --git a/features/roomlist/consumer-rules.pro b/features/roomlist/consumer-rules.pro deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/features/roomlist/build.gradle.kts b/features/roomlist/impl/build.gradle.kts similarity index 88% rename from features/roomlist/build.gradle.kts rename to features/roomlist/impl/build.gradle.kts index 42818cd056..acabf3c232 100644 --- a/features/roomlist/build.gradle.kts +++ b/features/roomlist/impl/build.gradle.kts @@ -20,10 +20,11 @@ plugins { id("io.element.android-compose-library") alias(libs.plugins.anvil) alias(libs.plugins.ksp) + id("kotlin-parcelize") } android { - namespace = "io.element.android.features.roomlist" + namespace = "io.element.android.features.roomlist.impl" } anvil { @@ -31,18 +32,20 @@ anvil { } dependencies { - anvil(projects.anvilcodegen) implementation(projects.anvilannotations) - + anvil(projects.anvilcodegen) implementation(projects.libraries.core) implementation(projects.libraries.architecture) implementation(projects.libraries.matrix.api) implementation(projects.libraries.matrixui) implementation(projects.libraries.designsystem) implementation(projects.libraries.elementresources) + implementation(projects.libraries.testtags) implementation(projects.libraries.uiStrings) implementation(projects.libraries.dateformatter.api) implementation(libs.accompanist.placeholder) + api(projects.features.roomlist.api) + ksp(libs.showkase.processor) testImplementation(libs.test.junit) testImplementation(libs.coroutines.test) @@ -50,9 +53,7 @@ dependencies { testImplementation(libs.test.truth) testImplementation(libs.test.turbine) testImplementation(projects.libraries.matrix.test) - implementation(projects.libraries.dateformatter.test) + testImplementation(projects.libraries.dateformatter.test) androidTestImplementation(libs.test.junitext) - - ksp(libs.showkase.processor) } diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/DefaultRoomListEntryPoint.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/DefaultRoomListEntryPoint.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/DefaultRoomListEntryPoint.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/DefaultRoomListEntryPoint.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListEvents.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListEvents.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListEvents.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListEvents.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListNode.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListNode.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListNode.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListNode.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListPresenter.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListState.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListState.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListState.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListState.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListStateProvider.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomListTopBar.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomListTopBar.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomListTopBar.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomListTopBar.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/components/RoomSummaryRow.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummary.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryPlaceholders.kt diff --git a/features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt similarity index 100% rename from features/roomlist/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt rename to features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/model/RoomListRoomSummaryProvider.kt diff --git a/features/roomlist/src/test/kotlin/io/element/android/features/roomlist/RoomListPresenterTests.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt similarity index 68% rename from features/roomlist/src/test/kotlin/io/element/android/features/roomlist/RoomListPresenterTests.kt rename to features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt index 30b4c8c893..41914a1d4e 100644 --- a/features/roomlist/src/test/kotlin/io/element/android/features/roomlist/RoomListPresenterTests.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTests.kt @@ -14,31 +14,19 @@ * limitations under the License. */ -@file:OptIn(ExperimentalCoroutinesApi::class) - -package io.element.android.features.roomlist +package io.element.android.features.roomlist.impl import app.cash.molecule.RecompositionClock import app.cash.molecule.moleculeFlow import app.cash.turbine.test -import com.google.common.truth.Truth.assertThat -import io.element.android.features.roomlist.impl.RoomListEvents -import io.element.android.features.roomlist.impl.RoomListPresenter +import com.google.common.truth.Truth import io.element.android.features.roomlist.impl.model.RoomListRoomSummary import io.element.android.libraries.dateformatter.api.LastMessageFormatter +import io.element.android.libraries.dateformatter.test.FakeLastMessageFormatter import io.element.android.libraries.designsystem.components.avatar.AvatarData -import io.element.android.libraries.matrix.test.AN_AVATAR_URL -import io.element.android.libraries.matrix.test.AN_EXCEPTION -import io.element.android.libraries.matrix.test.A_MESSAGE -import io.element.android.libraries.matrix.test.A_ROOM_ID -import io.element.android.libraries.matrix.test.A_ROOM_NAME -import io.element.android.libraries.matrix.test.A_SESSION_ID -import io.element.android.libraries.matrix.test.A_USER_ID -import io.element.android.libraries.matrix.test.A_USER_NAME -import io.element.android.libraries.matrix.test.FakeMatrixClient +import io.element.android.libraries.matrix.test.* import io.element.android.libraries.matrix.test.room.FakeRoomSummaryDataSource import io.element.android.libraries.matrix.test.room.aRoomSummaryFilled -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import org.junit.Test @@ -54,13 +42,13 @@ class RoomListPresenterTests { presenter.present() }.test { val initialState = awaitItem() - assertThat(initialState.matrixUser).isNull() + Truth.assertThat(initialState.matrixUser).isNull() val withUserState = awaitItem() - assertThat(withUserState.matrixUser).isNotNull() - assertThat(withUserState.matrixUser!!.id).isEqualTo(A_USER_ID) - assertThat(withUserState.matrixUser!!.username).isEqualTo(A_USER_NAME) - assertThat(withUserState.matrixUser!!.avatarData.name).isEqualTo(A_USER_NAME) - assertThat(withUserState.matrixUser!!.avatarData.url).isEqualTo(AN_AVATAR_URL) + Truth.assertThat(withUserState.matrixUser).isNotNull() + Truth.assertThat(withUserState.matrixUser!!.id).isEqualTo(A_USER_ID) + Truth.assertThat(withUserState.matrixUser!!.username).isEqualTo(A_USER_NAME) + Truth.assertThat(withUserState.matrixUser!!.avatarData.name).isEqualTo(A_USER_NAME) + Truth.assertThat(withUserState.matrixUser!!.avatarData.url).isEqualTo(AN_AVATAR_URL) } } @@ -78,11 +66,11 @@ class RoomListPresenterTests { presenter.present() }.test { val initialState = awaitItem() - assertThat(initialState.matrixUser).isNull() + Truth.assertThat(initialState.matrixUser).isNull() val withUserState = awaitItem() - assertThat(withUserState.matrixUser).isNotNull() + Truth.assertThat(withUserState.matrixUser).isNotNull() // username fallback to user id value - assertThat(withUserState.matrixUser!!.username).isEqualTo(A_USER_ID.value) + Truth.assertThat(withUserState.matrixUser!!.username).isEqualTo(A_USER_ID.value) } } @@ -97,10 +85,10 @@ class RoomListPresenterTests { }.test { skipItems(1) val withUserState = awaitItem() - assertThat(withUserState.filter).isEqualTo("") + Truth.assertThat(withUserState.filter).isEqualTo("") withUserState.eventSink.invoke(RoomListEvents.UpdateFilter("t")) val withFilterState = awaitItem() - assertThat(withFilterState.filter).isEqualTo("t") + Truth.assertThat(withFilterState.filter).isEqualTo("t") } } @@ -120,13 +108,14 @@ class RoomListPresenterTests { skipItems(1) val withUserState = awaitItem() // Room list is loaded with 16 placeholders - assertThat(withUserState.roomList.size).isEqualTo(16) - assertThat(withUserState.roomList.all { it.isPlaceholder }).isTrue() + Truth.assertThat(withUserState.roomList.size).isEqualTo(16) + Truth.assertThat(withUserState.roomList.all { it.isPlaceholder }).isTrue() roomSummaryDataSource.postRoomSummary(listOf(aRoomSummaryFilled())) skipItems(1) val withRoomState = awaitItem() - assertThat(withRoomState.roomList.size).isEqualTo(1) - assertThat(withRoomState.roomList.first()).isEqualTo(aRoomListRoomSummary) + Truth.assertThat(withRoomState.roomList.size).isEqualTo(1) + Truth.assertThat(withRoomState.roomList.first()) + .isEqualTo(aRoomListRoomSummary) } } @@ -149,15 +138,16 @@ class RoomListPresenterTests { // Test filtering with result loadedState.eventSink.invoke(RoomListEvents.UpdateFilter(A_ROOM_NAME.substring(0, 3))) val withNotFilteredRoomState = awaitItem() - assertThat(withNotFilteredRoomState.filter).isEqualTo(A_ROOM_NAME.substring(0, 3)) - assertThat(withNotFilteredRoomState.roomList.size).isEqualTo(1) - assertThat(withNotFilteredRoomState.roomList.first()).isEqualTo(aRoomListRoomSummary) + Truth.assertThat(withNotFilteredRoomState.filter).isEqualTo(A_ROOM_NAME.substring(0, 3)) + Truth.assertThat(withNotFilteredRoomState.roomList.size).isEqualTo(1) + Truth.assertThat(withNotFilteredRoomState.roomList.first()) + .isEqualTo(aRoomListRoomSummary) // Test filtering without result withNotFilteredRoomState.eventSink.invoke(RoomListEvents.UpdateFilter("tada")) skipItems(1) // Filter update val withFilteredRoomState = awaitItem() - assertThat(withFilteredRoomState.filter).isEqualTo("tada") - assertThat(withFilteredRoomState.roomList).isEmpty() + Truth.assertThat(withFilteredRoomState.filter).isEqualTo("tada") + Truth.assertThat(withFilteredRoomState.roomList).isEmpty() } } @@ -178,23 +168,29 @@ class RoomListPresenterTests { skipItems(3) val loadedState = awaitItem() // check initial value - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isNull() + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange).isNull() // Test empty range loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(1, 0))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isNull() + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange).isNull() // Update visible range and check that range is transmitted to the SDK after computation loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(0, 0))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isEqualTo(IntRange(0, 20)) + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange) + .isEqualTo(IntRange(0, 20)) loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(0, 1))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isEqualTo(IntRange(0, 21)) + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange) + .isEqualTo(IntRange(0, 21)) loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(19, 29))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isEqualTo(IntRange(0, 49)) + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange) + .isEqualTo(IntRange(0, 49)) loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(49, 59))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isEqualTo(IntRange(29, 79)) + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange) + .isEqualTo(IntRange(29, 79)) loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(149, 159))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isEqualTo(IntRange(129, 179)) + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange) + .isEqualTo(IntRange(129, 179)) loadedState.eventSink.invoke(RoomListEvents.UpdateVisibleRange(IntRange(149, 259))) - assertThat(roomSummaryDataSource.latestSlidingSyncRange).isEqualTo(IntRange(129, 279)) + Truth.assertThat(roomSummaryDataSource.latestSlidingSyncRange) + .isEqualTo(IntRange(129, 279)) } } @@ -217,3 +213,4 @@ private val aRoomListRoomSummary = RoomListRoomSummary( avatarData = AvatarData(id = A_ROOM_ID.value, name = A_ROOM_NAME), isPlaceholder = false, ) + diff --git a/features/roomlist/proguard-rules.pro b/features/roomlist/proguard-rules.pro deleted file mode 100644 index 481bb43481..0000000000 --- a/features/roomlist/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/features/roomlist/src/androidTest/kotlin/io/element/android/features/roomlist/ExampleInstrumentedTest.kt b/features/roomlist/src/androidTest/kotlin/io/element/android/features/roomlist/ExampleInstrumentedTest.kt deleted file mode 100644 index e66201078b..0000000000 --- a/features/roomlist/src/androidTest/kotlin/io/element/android/features/roomlist/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2022 New Vector Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.element.android.features.roomlist - -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import org.junit.Assert.assertEquals -import org.junit.Test -import org.junit.runner.RunWith - -/** - * 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("io.element.android.features.roomlist.test", appContext.packageName) - } -} diff --git a/features/roomlist/src/main/AndroidManifest.xml b/features/roomlist/src/main/AndroidManifest.xml deleted file mode 100644 index 19db0c3d57..0000000000 --- a/features/roomlist/src/main/AndroidManifest.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - diff --git a/libraries/dateformatter/test/build.gradle.kts b/libraries/dateformatter/test/build.gradle.kts index afc7e66059..0364afcf00 100644 --- a/libraries/dateformatter/test/build.gradle.kts +++ b/libraries/dateformatter/test/build.gradle.kts @@ -24,7 +24,7 @@ android { namespace = "io.element.android.libraries.dateformatter.test" dependencies { - implementation(projects.libraries.dateformatter.api) + api(projects.libraries.dateformatter.api) api(libs.datetime) } } diff --git a/features/roomlist/src/test/kotlin/io/element/android/features/roomlist/FakeLastMessageFormatter.kt b/libraries/dateformatter/test/src/main/kotlin/io/element/android/libraries/dateformatter/test/FakeLastMessageFormatter.kt similarity index 94% rename from features/roomlist/src/test/kotlin/io/element/android/features/roomlist/FakeLastMessageFormatter.kt rename to libraries/dateformatter/test/src/main/kotlin/io/element/android/libraries/dateformatter/test/FakeLastMessageFormatter.kt index 0040b9f480..539da5e6ac 100644 --- a/features/roomlist/src/test/kotlin/io/element/android/features/roomlist/FakeLastMessageFormatter.kt +++ b/libraries/dateformatter/test/src/main/kotlin/io/element/android/libraries/dateformatter/test/FakeLastMessageFormatter.kt @@ -14,7 +14,7 @@ * limitations under the License. */ -package io.element.android.features.roomlist +package io.element.android.libraries.dateformatter.test import io.element.android.libraries.dateformatter.api.LastMessageFormatter diff --git a/plugins/src/main/kotlin/extension/DependencyHandleScope.kt b/plugins/src/main/kotlin/extension/DependencyHandleScope.kt index 1bd6048ea2..d2d84f835b 100644 --- a/plugins/src/main/kotlin/extension/DependencyHandleScope.kt +++ b/plugins/src/main/kotlin/extension/DependencyHandleScope.kt @@ -60,11 +60,11 @@ fun DependencyHandlerScope.allLibraries() { } fun DependencyHandlerScope.allFeatures() { - implementation(project(":features:onboarding")) - implementation(project(":features:login")) - implementation(project(":features:logout")) - implementation(project(":features:roomlist")) + implementation(project(":features:onboarding:impl")) + implementation(project(":features:login:impl")) + implementation(project(":features:logout:impl")) + implementation(project(":features:roomlist:impl")) implementation(project(":features:messages:impl")) - implementation(project(":features:rageshake")) - implementation(project(":features:preferences")) + implementation(project(":features:rageshake:impl")) + implementation(project(":features:preferences:impl")) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 60680c5eb6..55bc4c0ad9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -51,12 +51,6 @@ include(":libraries:dateformatter:test") include(":libraries:elementresources") include(":libraries:ui-strings") include(":libraries:testtags") -include(":features:onboarding") -include(":features:login") -include(":features:logout") -include(":features:roomlist") -include(":features:rageshake") -include(":features:preferences") include(":libraries:designsystem") include(":libraries:di") include(":tests:uitests") @@ -66,10 +60,24 @@ include(":libraries:architecture") include(":features:template") include(":libraries:androidutils") include(":samples:minimal") -include(":features:messages") -include(":features:messages:api") -include(":features:messages:impl") include(":libraries:encrypted-db") include(":libraries:session-storage:api") include(":libraries:session-storage:impl") include(":libraries:session-storage:impl-memory") + +include(":features:onboarding:api") +include(":features:onboarding:impl") +include(":features:logout:api") +include(":features:logout:impl") +include(":features:roomlist:api") +include(":features:roomlist:impl") +include(":features:rageshake:api") +include(":features:rageshake:impl") +include(":features:rageshake:test") +include(":features:preferences:api") +include(":features:preferences:impl") +include(":features:messages:api") +include(":features:messages:impl") +include(":features:login:api") +include(":features:login:impl") +