before_code stringlengths 14 465k | reviewer_comment stringlengths 16 64.5k | after_code stringlengths 9 467k | diff_context stringlengths 0 97k | file_path stringlengths 5 226 | comment_line int32 0 26 | language stringclasses 37
values | quality_score float32 0.07 1 | comment_type stringclasses 9
values | comment_length int32 16 64.5k | before_lines int32 1 17.2k | after_lines int32 1 12.1k | is_negative bool 2
classes | pr_title stringlengths 1 308 | pr_number int32 1 299k | repo_name stringclasses 533
values | repo_stars int64 321 419k | repo_language stringclasses 27
values | reviewer_username stringlengths 0 39 | author_username stringlengths 2 39 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
# Arrange
requester_membership_user = MagicMock(spec=OrgMember)
requester_membership_user.org_id = org_id
requester_membership_user.user_id = current_user_id
requester_membership_user.role_id = member_role.id
with (
patch(
'server.services.org... | No issues found. | # Arrange
requester_membership_user = MagicMock(spec=OrgMember)
requester_membership_user.org_id = org_id
requester_membership_user.user_id = current_user_id
requester_membership_user.role_id = member_role.id
with (
patch(
'server.services.org... | @@ -179,7 +179,7 @@ async def test_get_members_succeeds_returns_paginated_data(
assert data.items[0].user_id == str(current_user_id)
assert data.items[0].email == 'test@example.com'
assert data.items[0].role_id == 1
- assert data.items[0].role_name == 'owner'
+ ... | enterprise/tests/unit/server/services/test_org_member_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | refactor(backend): rename orgmemberresponse.role_name to role | 12,914 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
agent: str | None = None
default_max_iterations: int | None = None
security_analyzer: str | None = None
confirmation_mode: bool | None = None
default_llm_model: str | None = None
default_llm_api_key_for_byor: str | None = None
default_llm_base_url: str | None = None
remote_runtime_resour... | No issues found. | agent: str | None = None
default_max_iterations: int | None = None
security_analyzer: str | None = None
confirmation_mode: bool | None = None
default_llm_model: str | None = None
default_llm_api_key_for_byor: str | None = None
default_llm_base_url: str | None = None
remote_runtime_resour... | @@ -214,6 +214,7 @@ class OrgPage(BaseModel):
items: list[OrgResponse]
next_page_id: str | None = None
+ current_org_id: str | None = None
class OrgUpdate(BaseModel): | enterprise/server/routes/org_models.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | refactor(backend): include current_org_id in organization list response | 12,915 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
mock_request = Request(scope={'type': 'http'})
mock_request._base_url = URL('http://test.com/')
mock_billing_session = MagicMock()
mock_billing_session.status = 'in_progress'
mock_billing_session.user_id = 'mock_user'
with (
patch('server.routes.billing.session_maker') as mock_session_... | No issues found. | mock_request = Request(scope={'type': 'http'})
mock_request._base_url = URL('http://test.com/')
mock_billing_session = MagicMock()
mock_billing_session.status = 'in_progress'
mock_billing_session.user_id = 'mock_user'
with (
patch('server.routes.billing.session_maker') as mock_session_... | @@ -291,7 +291,7 @@ async def test_success_callback_stripe_incomplete():
@pytest.mark.asyncio
async def test_success_callback_success():
- """Test successful payment completion and credit update (bonus already granted)."""
+ """Test successful payment completion and credit update."""
mock_request = Reque... | enterprise/tests/unit/test_billing.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Mention free MiniMax usage and drop free credits | 12,918 | All-Hands-AI/OpenHands | 55,974 | Python | malhotra5 | |
isPending: false,
isSuccess: false,
isError: false,
isIdle: true,
reset: vi.fn(),
status: "idle",
} as unknown as ReturnType<typeof useLogout>;
vi.mocked(useShouldShowUserFeaturesModule.useShouldShowUserFeatures).mockReturnValue(true);
vi.mocked(useConfigModule.useConfig... | No issues found. | isPending: false,
isSuccess: false,
isError: false,
isIdle: true,
reset: vi.fn(),
status: "idle",
} as unknown as ReturnType<typeof useLogout>;
vi.mocked(useShouldShowUserFeaturesModule.useShouldShowUserFeatures).mockReturnValue(true);
vi.mocked(useConfigModule.useConfig... | @@ -0,0 +1,113 @@
+import { describe, expect, it, vi, beforeEach } from "vitest";
+import { renderHook, waitFor } from "@testing-library/react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import React from "react";
+import { useGitUser } from "#/hooks/query/use-git-user";
+import { useL... | frontend/__tests__/hooks/use-git-user.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | Fix: Logout on 401 error in useGitUser; downgrade provider error to warning | 12,935 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
mock_key_record.user_id = user_id
# Simulate timezone-naive datetime as returned from database (future date)
mock_key_record.expires_at = datetime.now() + timedelta(days=1) # No UTC timezone
mock_key_record.id = 1
mock_session.query.return_value.filter.return_value.first.return_value = (
mo... | No issues found. | mock_key_record.user_id = user_id
# Simulate timezone-naive datetime as returned from database (future date)
mock_key_record.expires_at = datetime.now() + timedelta(days=1) # No UTC timezone
mock_key_record.id = 1
mock_session.query.return_value.filter.return_value.first.return_value = (
mo... | @@ -265,17 +265,17 @@ async def test_list_api_keys(
# Verify
mock_get_user.assert_called_once_with(user_id)
assert len(result) == 2
- assert result[0]['id'] == 1
- assert result[0]['name'] == 'Key 1'
- assert result[0]['created_at'] == now
- assert result[0]['last_used_at'] == now
- assert... | enterprise/tests/unit/test_api_key_store.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Add type hints and use model objects in api_keys.py endpoints | 12,939 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
enable_jira: false,
enable_jira_dc: false,
enable_linear: false,
},
});
renderUserContextMenu({ type: "member", onClose: vi.fn });
await waitFor(() => {
// Other nav items should still be visible
expect(screen.getByText("SETTINGS$NAV_USER")).toBe... | No issues found. | enable_jira: false,
enable_jira_dc: false,
enable_linear: false,
},
});
renderUserContextMenu({ type: "member", onClose: vi.fn });
await waitFor(() => {
// Other nav items should still be visible
expect(screen.getByText("SETTINGS$NAV_USER")).toBe... | @@ -85,8 +85,8 @@ vi.mock("react-i18next", async () => {
useTranslation: () => ({
t: (key: string) => {
const translations: Record<string, string> = {
- "ORG$SELECT_ORGANIZATION_PLACEHOLDER": "Please select an organization",
- "ORG$PERSONAL_WORKSPACE": "Personal Workspace",
+ ... | frontend/__tests__/components/features/user/user-context-menu.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | refactor(frontend): update wording for the organization UI | 12,952 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import { Trans, useTranslation } from "react-i18next";
import { OrgModal } from "#/components/shared/modals/org-modal";
import { I18nKey } from "#/i18n/declaration";
interface ConfirmRemoveMemberModalProps {
onConfirm: () => void;
onCancel: () => void;
memberEmail: string;
isLoading?: boolean;
}
export functi... | No issues found. | import { Trans, useTranslation } from "react-i18next";
import { OrgModal } from "#/components/shared/modals/org-modal";
import { I18nKey } from "#/i18n/declaration";
interface ConfirmRemoveMemberModalProps {
onConfirm: () => void;
onCancel: () => void;
memberEmail: string;
isLoading?: boolean;
}
export functi... | @@ -1,12 +1,5 @@
import { Trans, useTranslation } from "react-i18next";
-import {
- BaseModalDescription,
- BaseModalTitle,
-} from "#/components/shared/modals/confirmation-modals/base-modal";
-import { ModalBackdrop } from "#/components/shared/modals/modal-backdrop";
-import { ModalBody } from "#/components/shared/... | frontend/src/components/features/org/confirm-remove-member-modal.tsx | 0 | TypeScript | 1 | none | 16 | 43 | 43 | true | refactor(frontend): enhance the organization members page user interface | 12,957 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
# Call session_maker without arguments
result = session_maker()
# Verify the inner session maker was called without arguments
mock_inner_session_maker.assert_called_once_with()
assert result == mock_session
@patch('enterprise.storage.database._get_db_session_injector')
... | No issues found. | # Call session_maker without arguments
result = session_maker()
# Verify the inner session maker was called without arguments
mock_inner_session_maker.assert_called_once_with()
assert result == mock_session
@patch('enterprise.storage.database._get_db_session_injector')
... | @@ -0,0 +1,99 @@
+"""Tests for the enterprise storage.database module.
+
+These tests verify that the session_maker function properly forwards
+keyword arguments to the underlying session maker for backward compatibility.
+"""
+
+from unittest.mock import MagicMock, patch
+
+
+class TestSessionMaker:
+ """Test cases... | enterprise/tests/unit/storage/test_database.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix session_maker to accept kwargs for backward compatibility | 12,960 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
)
)
session.add(
Feedback(
id='mock-feedback-id',
version='1.0',
email='user@all-hands.dev',
polarity='positive',
permissions='public',
trajectory=[],
)
)
s... | No issues found. | )
)
session.add(
Feedback(
id='mock-feedback-id',
version='1.0',
email='user@all-hands.dev',
polarity='positive',
permissions='public',
trajectory=[],
)
)
s... | @@ -15,6 +15,7 @@
from storage.feedback import Feedback
from storage.github_app_installation import GithubAppInstallation
from storage.org import Org
+from storage.org_invitation import OrgInvitation # noqa: F401
from storage.org_member import OrgMember
from storage.role import Role
from storage.stored_conversat... | enterprise/tests/unit/conftest.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | fix(backend): unable to delete an organization after inviting at least one member | 12,993 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
mswServer.use(
wsLink.addEventListener("connection", ({ client, server }) => {
server.connect();
// Send the mock budget error event after connection
client.send(JSON.stringify(mockBudgetErrorEvent));
}),
);
// Render with all providers
renderWithPr... | No issues found. | mswServer.use(
wsLink.addEventListener("connection", ({ client, server }) => {
server.connect();
// Send the mock budget error event after connection
client.send(JSON.stringify(mockBudgetErrorEvent));
}),
);
// Render with all providers
renderWithPr... | @@ -9,7 +9,10 @@ import {
} from "vitest";
import { screen, waitFor, render, cleanup } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { createMockAgentErrorEvent } from "#/mocks/mock-ws-helpers";
+import {
+ createMockAgentErrorEvent,
+ createMockCo... | frontend/__tests__/posthog-tracking.test.tsx | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | fix: detect team/org-level budget errors in error banner | 13,003 | All-Hands-AI/OpenHands | 55,974 | Python | amanape | |
"""Add session_api_key_hash to v1_remote_sandbox table
Revision ID: 097
Revises: 096
Create Date: 2025-02-24 00:00:00.000000
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = '097'
down_revision: Union[str, None] = '096'
b... | No issues found. | """Add session_api_key_hash to v1_remote_sandbox table
Revision ID: 097
Revises: 096
Create Date: 2025-02-24 00:00:00.000000
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = '097'
down_revision: Union[str, None] = '096'
b... | @@ -0,0 +1,41 @@
+"""Add session_api_key_hash to v1_remote_sandbox table
+
+Revision ID: 097
+Revises: 096
+Create Date: 2025-02-24 00:00:00.000000
+
+"""
+
+from typing import Sequence, Union
+
+import sqlalchemy as sa
+from alembic import op
+
+# revision identifiers, used by Alembic.
+revision: str = '097'
+down_rev... | enterprise/migrations/versions/097_add_session_api_key_hash_to_v1_remote_sandbox.py | 0 | Python | 1 | none | 16 | 42 | 42 | true | Optimize get_sandbox_by_session_api_key with hash lookup | 13,019 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
mcp_servers[server_name] = server_config
_logger.debug(
f'Added custom SSE server: {server_name} for {sse_server.url}'
)
def _add_custom_shttp_servers(
self, mcp_servers: dict[str, Any], shttp_servers: list
) -> None:
"""Add custom SHTTP MCP s... | No issues found. | mcp_servers[server_name] = server_config
_logger.debug(
f'Added custom SSE server: {server_name} for {sse_server.url}'
)
def _add_custom_shttp_servers(
self, mcp_servers: dict[str, Any], shttp_servers: list
) -> None:
"""Add custom SHTTP MCP s... | @@ -417,15 +417,13 @@ async def _get_live_conversation_info(
conversation_info = _conversation_info_type_adapter.validate_python(data)
conversation_info = [c for c in conversation_info if c]
return conversation_info
- except httpx.HTTPStatusError as exc:
- # The ... | openhands/app_server/app_conversation/live_status_app_conversation_service.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Make logs quieter. | 13,042 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
from fastapi import APIRouter, Query
from openhands.app_server.config import depends_sandbox_spec_service
from openhands.app_server.sandbox.sandbox_spec_models import (
SandboxSpecInfo,
SandboxSpecInfoPage,
)
from openhands.app_server.sandbox.sandbox_spec_service import (
SandboxSpecService,
)
from openha... | No issues found. |
from fastapi import APIRouter, Query
from openhands.app_server.config import depends_sandbox_spec_service
from openhands.app_server.sandbox.sandbox_spec_models import (
SandboxSpecInfo,
SandboxSpecInfoPage,
)
from openhands.app_server.sandbox.sandbox_spec_service import (
SandboxSpecService,
)
from openha... | @@ -12,8 +12,15 @@
from openhands.app_server.sandbox.sandbox_spec_service import (
SandboxSpecService,
)
-
-router = APIRouter(prefix='/sandbox-specs', tags=['Sandbox'])
+from openhands.server.dependencies import get_dependencies
+
+# We use the get_dependencies method here to signal to the OpenAPI docs that thi... | openhands/app_server/sandbox/sandbox_spec_router.py | 0 | Python | 1 | none | 16 | 51 | 51 | true | Fix api key access | 13,064 | All-Hands-AI/OpenHands | 55,974 | Python | tofarr | |
SETTINGS_FORM$SAVE_LABEL = "SETTINGS_FORM$SAVE_LABEL",
SETTINGS_FORM$CLOSE_LABEL = "SETTINGS_FORM$CLOSE_LABEL",
SETTINGS_FORM$CANCEL_LABEL = "SETTINGS_FORM$CANCEL_LABEL",
SETTINGS_FORM$END_SESSION_LABEL = "SETTINGS_FORM$END_SESSION_LABEL",
SETTINGS_FORM$CHANGING_WORKSPACE_WARNING_MESSAGE = "SETTINGS_FORM$CHAN... | No issues found. | SETTINGS_FORM$SAVE_LABEL = "SETTINGS_FORM$SAVE_LABEL",
SETTINGS_FORM$CLOSE_LABEL = "SETTINGS_FORM$CLOSE_LABEL",
SETTINGS_FORM$CANCEL_LABEL = "SETTINGS_FORM$CANCEL_LABEL",
SETTINGS_FORM$END_SESSION_LABEL = "SETTINGS_FORM$END_SESSION_LABEL",
SETTINGS_FORM$CHANGING_WORKSPACE_WARNING_MESSAGE = "SETTINGS_FORM$CHAN... | @@ -767,6 +767,7 @@ export enum I18nKey {
AUTH$RECAPTCHA_BLOCKED = "AUTH$RECAPTCHA_BLOCKED",
AUTH$LETS_GET_STARTED = "AUTH$LETS_GET_STARTED",
AUTH$INVITATION_PENDING = "AUTH$INVITATION_PENDING",
+ AUTH$BITBUCKET_SIGNUP_DISABLED = "AUTH$BITBUCKET_SIGNUP_DISABLED",
COMMON$TERMS_OF_SERVICE = "COMMON$TERMS_OF_... | frontend/src/i18n/declaration.ts | 0 | TypeScript | 1 | none | 16 | 51 | 51 | true | feat(frontend): display Bitbucket signup disabled message on login page | 13,100 | All-Hands-AI/OpenHands | 55,974 | Python | hieptl | |
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.sh... | I think using `then` is more conventional than `let`.
```
.then(
if (onClick != null) {
Modifier.clickable(role = Role.Button, onClick = onClick)
} else {
Modifier
}
)
``` | import androidx.compose.ui.res.painterResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.sh... | @@ -22,41 +22,46 @@ import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.compose.components.TextH60
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocketcasts.compose.theme
-import au.com.shiftyjelly.... | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/components/DividerSubTitle.kt | 26 | Kotlin | 0.929 | style | 210 | 51 | 51 | false | Recommendations: Add similar shows section header when Podroll exists | 3,998 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | geekygecko |
echo "$message"
}
job_type="$2"
case "$job_type" in
"validation")
# We should skip if changes are limited to documentation, tooling, non-code files, and localization files
PATTERNS=("${COMMON_PATTERNS[@]}" "**/strings.xml")
if pr_changed_files --all-match "${PATTERNS[@]}"; then
show_skip_message ... | It _should_ be possible to make the "must be either" a bit more robust by defining vars for each case
```bash
VALIDATION="validation"
BUILD="build"
LINT="lint"
job_type="$2"
case "$job_type" in
$VALIDATION)
# We should skip if changes are limited to documentation, tooling, non-code files, and localiza... | local job_type=$1
local message="Skipped ${BUILDKITE_LABEL:-Job} - no relevant files changed"
local context="skip-$(echo "${BUILDKITE_LABEL:-$job_type}" | sed -E -e 's/[^[:alnum:]]+/-/g' | tr A-Z a-z)"
echo "$message" | buildkite-agent annotate --style "info" --context "$context"
echo "$message"
}
job_type=... | @@ -0,0 +1,73 @@
+#!/bin/bash -eu
+
+# Usage: should-skip-job.sh --job-type [validation|build|lint]
+# --job-type validation: For jobs like unit/instrumented tests, manifest validation…
+# Skip when changes are limited to documentation, tooling, non-code files, and localization files
+# --job-type lint: For jobs do... | .buildkite/commands/should-skip-job.sh | 26 | Shell | 1 | style | 997 | 31 | 36 | false | [Tooling] Skip jobs if there are no relevant code changes | 4,002 | Automattic/pocket-casts-android | 1,688 | Kotlin | mokagio | iangmaia |
#!/bin/bash -eu
if .buildkite/commands/should-skip-job.sh --job-type build; then
exit 0
fi
"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh"
echo "--- :rubygems: Setting up Gems"
install_gems
echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- ⚙️ Building rel... | What do you think of using this:
```suggestion
if "$(dirname "${BASH_SOURCE[0]}")/should-skip-job.sh --job-type build; then
```
I like it because it makes the path relative. I doubt we'll ever want to move the files from where they are, but I like that we _could_, seems like a good practice to have. | #!/bin/bash -eu
if "$(dirname "${BASH_SOURCE[0]}")/should-skip-job.sh" --job-type build; then
exit 0
fi
"$(dirname "${BASH_SOURCE[0]}")/restore-cache.sh"
echo "--- :rubygems: Setting up Gems"
install_gems
echo "--- :closed_lock_with_key: Installing Secrets"
bundle exec fastlane run configure_apply
echo "--- ⚙️... | @@ -1,5 +1,9 @@
#!/bin/bash -eu
+if .buildkite/commands/should-skip-job.sh --job-type build; then | .buildkite/commands/assemble-release-apk.sh | 3 | Shell | 1 | suggestion | 308 | 20 | 20 | false | [Tooling] Skip jobs if there are no relevant code changes | 4,002 | Automattic/pocket-casts-android | 1,688 | Kotlin | mokagio | iangmaia |
"Gemfile"
"Gemfile.lock"
"gradle/**"
"version.properties"
)
# Check if arguments are valid
if [ -z "${1:-}" ] || [ "$1" != "--job-type" ] || [ -z "${2:-}" ]; then
echo "Error: Must specify --job-type [validation|build|lint]"
buildkite-agent step cancel
exit 15
fi
# Function to display skip message and c... | This could be ~~simplified~~ condensed as
```suggestion
echo "$message" | tee >(buildkite-agent annotate --style "info" --context "$context")
```
I tried a version locally, albeit not with the Buildkite agent. | "Gemfile"
"Gemfile.lock"
"gradle/**"
"version.properties"
)
# Define constants for job types
VALIDATION="validation"
BUILD="build"
LINT="lint"
# Check if arguments are valid
if [ -z "${1:-}" ] || [ "$1" != "--job-type" ] || [ -z "${2:-}" ]; then
echo "Error: Must specify --job-type [$VALIDATION|$BUILD|$LINT... | @@ -0,0 +1,73 @@
+#!/bin/bash -eu
+
+# Usage: should-skip-job.sh --job-type [validation|build|lint]
+# --job-type validation: For jobs like unit/instrumented tests, manifest validation…
+# Skip when changes are limited to documentation, tooling, non-code files, and localization files
+# --job-type lint: For jobs do... | .buildkite/commands/should-skip-job.sh | 26 | Shell | 0.857 | suggestion | 219 | 51 | 51 | false | [Tooling] Skip jobs if there are no relevant code changes | 4,002 | Automattic/pocket-casts-android | 1,688 | Kotlin | mokagio | iangmaia |
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au... | 💡 you could just start the expression with `(if (elevation > 0.dp) Modifier.shadow(elevation, tooltipShape) else Modifier).clip(...)` | import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au... | @@ -0,0 +1,320 @@
+package au.com.shiftyjelly.pocketcasts.compose.components
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.heig... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/components/Tooltip2.kt | 26 | Kotlin | 0.571 | suggestion | 133 | 51 | 51 | false | Add tooltip component | 4,010 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
val anchorHeight = density.run { AnchorHeight.toPx() }
val anchorWidth = density.run { CornerAnchorWidth.toPx() }
moveTo(shapeSize.width - anchorWidth, shapeSize.height - anchorHeight)
addCornerAnchor(scale, flipVertically = true)
}
private fun bottomLeftAnchor(
shapeSi... | Wake up, Neo. The Matrix has you.
JK -- these numbers look a bit intimidating. Isn't there a better way to get the anchor path?
It's just a wild idea, but can't we define a vector drawable resource and transform its path somehow? 🤔 | val tipWidth = density.run { CornerTipWidth.toPx() }
moveTo(shapeSize.width - tipWidth, shapeSize.height - tipHeight)
addCornerTip(scale, flipVertically = true)
}
private fun bottomLeftTip(
shapeSize: Size,
density: Density,
) = Path().apply {
val scale = de... | @@ -0,0 +1,320 @@
+package au.com.shiftyjelly.pocketcasts.compose.components
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.heig... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/components/Tooltip2.kt | 26 | Kotlin | 0.5 | suggestion | 235 | 51 | 51 | false | Add tooltip component | 4,010 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
import au.com.shiftyjelly.pocketcasts.discover.extensions.updateSubscribeButtonIcon
import au.com.shiftyjelly.pocketcasts.servers.model.DiscoverPodcast
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import au.com.shiftyjelly.pocketcasts.localization.R as LR
private val differ: DiffUtil.ItemCallback<Any> = object... | 💡 adding line breaks so each argument would have its own dedicated line would improve readability a lot imo. | import au.com.shiftyjelly.pocketcasts.discover.extensions.updateSubscribeButtonIcon
import au.com.shiftyjelly.pocketcasts.servers.model.DiscoverPodcast
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme
import au.com.shiftyjelly.pocketcasts.localization.R as LR
private val differ: DiffUtil.ItemCallback<Any> = object... | @@ -32,7 +32,7 @@ private val differ: DiffUtil.ItemCallback<Any> = object : DiffUtil.ItemCallback<
}
}
-internal class CarouselListRowAdapter(var pillText: String?, val theme: Theme, val onPodcastClicked: ((DiscoverPodcast, String?, Boolean) -> Unit), val onPodcastSubscribe: ((DiscoverPodcast, String?) -> Unit)... | modules/features/discover/src/main/java/au/com/shiftyjelly/pocketcasts/discover/view/CarouselListRowAdapter.kt | 26 | Kotlin | 0.357 | suggestion | 108 | 51 | 51 | false | Recommendation run analytics | 4,021 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | geekygecko |
RegionSelectFragment.Listener,
TopScrollable {
@Inject lateinit var settings: Settings
@Inject lateinit var staticServiceManager: StaticServiceManagerImpl
@Inject lateinit var analyticsTracker: AnalyticsTracker
private val viewModel: DiscoverViewModel by viewModels()
private var adapter:... | ⛏️ formatting seems a bit weird to me with that line end, i usually lean towards putting each argument to new lines for a more pleasing reading experience | RegionSelectFragment.Listener,
TopScrollable {
@Inject lateinit var settings: Settings
@Inject lateinit var staticServiceManager: StaticServiceManagerImpl
@Inject lateinit var analyticsTracker: AnalyticsTracker
private val viewModel: DiscoverViewModel by viewModels()
private var adapter:... | @@ -67,32 +70,33 @@ class DiscoverFragment :
adapter?.enablePageTracking(enable = true)
}
- override fun onPodcastClicked(podcast: DiscoverPodcast, listUuid: String?, isFeatured: Boolean) {
- val fragment = PodcastFragment.newInstance(podcastUuid = podcast.uuid, fromListUuid = listUuid, source... | modules/features/discover/src/main/java/au/com/shiftyjelly/pocketcasts/discover/view/DiscoverFragment.kt | 26 | Kotlin | 0.357 | style | 154 | 51 | 51 | false | Recommendation run analytics | 4,021 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | geekygecko |
val listUuid: String?
get() = arguments?.getString(ARG_LIST_UUID)
private val inferredId: String
get() = arguments?.getString(ARG_INFERRED_ID) ?: NetworkLoadableList.Companion.NONE
val sourceUrl: String?
get() = arguments?.getString(ARG_SOURCE_URL)
val shareUrl: String?
... | ⛏️ again, formatting could be improved | val listUuid: String?
get() = arguments?.getString(ARG_LIST_UUID)
private val inferredId: String
get() = arguments?.getString(ARG_INFERRED_ID) ?: NetworkLoadableList.Companion.NONE
val sourceUrl: String?
get() = arguments?.getString(ARG_SOURCE_URL)
val shareUrl: String?
... | @@ -118,22 +120,19 @@ open class PodcastGridListFragment : BaseFragment(), Toolbar.OnMenuItemClickList
protected val viewModel: PodcastListViewModel by viewModels()
val onPodcastClicked: (DiscoverPodcast) -> Unit = { podcast ->
- listUuid?.let {
- analyticsTracker.track(AnalyticsEvent.DISC... | modules/features/discover/src/main/java/au/com/shiftyjelly/pocketcasts/discover/view/PodcastGridListFragment.kt | 26 | Kotlin | 0.143 | suggestion | 39 | 51 | 51 | false | Recommendation run analytics | 4,021 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | geekygecko |
analyticsEvent = AnalyticsEvent.DISCOVER_LIST_PODCAST_TAPPED,
podcastUuid = podcastUuid,
listId = listId,
listDate = listDate,
)
}
fun AnalyticsTracker.discoverListPodcastSubscribed(podcastUuid: String, listId: String?, listDate: String?) {
discoverListPodcastEvent(
anal... | ⛏️ could be `listDate.orEmpty()` | analyticsEvent = AnalyticsEvent.DISCOVER_LIST_PODCAST_TAPPED,
podcastUuid = podcastUuid,
listId = listId,
listDate = listDate,
)
}
fun AnalyticsTracker.discoverListPodcastSubscribed(podcastUuid: String, listId: String?, listDate: String?) {
discoverListPodcastEvent(
anal... | @@ -0,0 +1,59 @@
+package au.com.shiftyjelly.pocketcasts.analytics
+
+fun AnalyticsTracker.discoverListShowAllTapped(listId: String, listDate: String) {
+ discoverListEvent(
+ analyticsEvent = AnalyticsEvent.DISCOVER_LIST_SHOW_ALL_TAPPED,
+ listId = listId,
+ listDate = listDate,
+ )
+}
+
+fu... | modules/services/analytics/src/main/java/au/com/shiftyjelly/pocketcasts/analytics/AnalyticsTrackerExtensions.kt | 26 | Kotlin | 0.286 | suggestion | 32 | 30 | 30 | false | Recommendation run analytics | 4,021 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | geekygecko |
.build()
WorkManager.getInstance(context).enqueueUniquePeriodicWork(
"daily_re_engagement_check",
ExistingPeriodicWorkPolicy.UPDATE,
notificationWork,
)
}
override suspend fun setupTrendingAndRecommendationsNotifications() {
TrendingAndRe... | I could be misunderstanding this. Each time the app starts, would this cause it to be rescheduled into the future? | .setInitialDelay(initialDelay, TimeUnit.MILLISECONDS)
.addTag(TAG_REENGAGEMENT)
.build()
WorkManager.getInstance(context).enqueueUniquePeriodicWork(
TAG_REENGAGEMENT,
ExistingPeriodicWorkPolicy.UPDATE,
notificationWork,
)
}
... | @@ -74,4 +76,32 @@ class NotificationSchedulerImpl @Inject constructor(
notificationWork,
)
}
+
+ override suspend fun setupTrendingAndRecommendationsNotifications() {
+ TrendingAndRecommendationsNotificationType.values.forEachIndexed { index, notification ->
+ val initia... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationSchedulerImpl.kt | 26 | Kotlin | 0.429 | question | 114 | 38 | 50 | false | [Notifications Revamp] Trending and Recommendations | 4,026 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | sztomek |
analyticsTracker.track(
AnalyticsEvent.SETTINGS_NOTIFICATIONS_TRENDING_AND_RECOMMENDATIONS_TOGGLED,
mapOf("enabled" to preference.isEnabled),
)
if (preference.isEnabled) {
notificationSche... | Can we avoid such function naming? `ViewModel` doesn't have a lifecycle so `onResumed()` doesn't relate to it. I think being explicit with something like `checkNotificationPermission()` is clearer. | analyticsTracker.track(AnalyticsEvent.SETTINGS_DAILY_REMINDERS_ADVANCED_SETTINGS_TAPPED)
}
is NotificationPreferenceType.EnableRecommendations -> {
preferenceRepository.setPreference(preference)
analyticsTracker.track(
... | @@ -143,6 +151,12 @@ internal class NotificationsSettingsViewModel @Inject constructor(
analyticsTracker.track(AnalyticsEvent.SETTINGS_NOTIFICATIONS_SHOWN)
}
+ internal fun onResumed() { | modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/notifications/NotificationsSettingsViewModel.kt | 26 | Kotlin | 0.571 | bug | 197 | 51 | 51 | false | [Notifications Revamp] Add settings banner | 4,032 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
title = TextResource.fromText("Play over notifications"),
value = PlayOverNotificationSetting.DUCK,
displayValue = TextResource.fromText("Duck"),
options = emptyList(),
... | To reduce the number of previews I typically use theme parameter for a screen with all it's content like banner shown, etc. And then just single-themed previews for all other scenarios. What do you think? | preferences = listOf(
NotificationPreferenceType.NotifyMeOnNewEpisodes(
title = TextResource.fromText("Notify me"),
isEnabled = false,
),
),
... | @@ -94,6 +107,51 @@ private fun PreviewNotificationSettingsScreen(@PreviewParameter(ThemePreviewPara
AppTheme(themeType) {
NotificationsSettingsScreen(
state = NotificationsSettingsViewModel.State(
+ areSystemNotificationsEnabled = true,
+ categories = listOf(
+ ... | modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/notifications/NotificationsSettingsScreen.kt | 26 | Kotlin | 0.5 | question | 204 | 51 | 51 | false | [Notifications Revamp] Add settings banner | 4,032 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
internal fun NotificationsSettingsScreen(
state: NotificationsSettingsViewModel.State,
onPreferenceChanged: (NotificationPreferenceType) -> Unit,
onAdvancedSettingsClicked: (type: NotificationPreferenceType) -> Unit,
onSelectRingtoneClicked: (String?) -> Unit,
onSelectPodcastsClicked: () -> Unit,
... | There's only one other place in the app where we use `stickyHeader` and I don't see it being mentioned in the designs for this screen. Could you confirm if it should be sticky? |
@OptIn(ExperimentalFoundationApi::class)
@Composable
internal fun NotificationsSettingsScreen(
state: NotificationsSettingsViewModel.State,
onPreferenceChanged: (NotificationPreferenceType) -> Unit,
onAdvancedSettingsClicked: (type: NotificationPreferenceType) -> Unit,
onSelectRingtoneClicked: (String?... | @@ -48,40 +52,49 @@ internal fun NotificationsSettingsScreen(
bottomShadow = true,
onNavigationClick = onBackPressed,
)
+ LazyColumn(
+ contentPadding = PaddingValues(bottom = bottomInset),
+ ) {
+ if (!state.areSystemNotificationsEnabled) {
+ ... | modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/notifications/NotificationsSettingsScreen.kt | 26 | Kotlin | 0.571 | question | 176 | 51 | 51 | false | [Notifications Revamp] Add settings banner | 4,032 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
sealed interface NotificationType {
val notificationId: Int
val subcategory: String
@get:StringRes
val titleRes: Int
@get:StringRes
val messageRes: Int?
@get:PluralsRes
val messagePluralRes: Int?
fun formattedMessage(context: Context, count: Int = 0): String {
messagePlur... | This could be changed to `buildList()` to avoid creation of a new collection after every plus sign. | sealed interface NotificationType {
val notificationId: Int
val subcategory: String
@get:StringRes
val titleRes: Int
@get:StringRes
val messageRes: Int?
@get:PluralsRes
val messagePluralRes: Int?
fun formattedMessage(context: Context, count: Int = 0): String {
messagePlur... | @@ -43,7 +44,7 @@ sealed interface NotificationType {
companion object {
fun fromSubCategory(subCategory: String): NotificationType? {
- val allSupportedNotifications = OnboardingNotificationType.values + ReEngagementNotificationType.values + TrendingAndRecommendationsNotificationType.values
... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationType.kt | 26 | Kotlin | 0.429 | suggestion | 99 | 51 | 51 | false | [Notifications Revamp] New features and tips | 4,044 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
override suspend fun doWork(): Result {
val subcategory = inputData.getString(SUBCATEGORY) ?: return Result.failure()
val type = NotificationType.fromSubCategory(subcategory) ?: return Result.failure()
if (!type.isSettingsToggleOn(settings)) {
return Result.failure()
}
... | This could be changed to a `suspend` function with using `await()` instead of `blockingGet()`. It doesn't **really** matter here since worker is executed on the background thread anyway but avoiding blocking is a good habit to have. | private val suggestedFoldersManager: SuggestedFoldersManager,
) : CoroutineWorker(context, params) {
override suspend fun doWork(): Result {
val subcategory = inputData.getString(SUBCATEGORY) ?: return Result.failure()
val type = NotificationType.fromSubCategory(subcategory) ?: return Result.fa... | @@ -52,13 +54,25 @@ class NotificationWorker @AssistedInject constructor(
return Result.success()
}
+ private fun shouldSchedule(type: NotificationType): Boolean {
+ return when (type) {
+ is NewFeaturesAndTipsNotificationType.SmartFolders -> podcastManager.getSubscribedPodcastUuids... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationWorker.kt | 26 | Kotlin | 0.786 | suggestion | 232 | 51 | 51 | false | [Notifications Revamp] New features and tips | 4,044 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
val now = clock.instant().toEpochMilli()
val next4PM = calculateBase4PM(now)
return next4PM - now
}
/**
* Calculates the delay until the next trending and recommendations worker should be triggered.
* The worker is set to run 2 times a week and around 4pm a given day.
* @... | This change is from the patch I think? | val now = clock.instant().toEpochMilli()
val next4PM = calculateBase4PM(now)
return next4PM - now
}
/**
* Calculates the delay until the next trending and recommendations worker should be triggered.
* The worker is set to run 2 times a week and around 4pm a given day.
* @... | @@ -69,6 +69,8 @@ class NotificationDelayCalculator @Inject constructor(
fun calculateDelayForNewFeatures() = calculateBase4PM(clock.instant().toEpochMilli())
+ fun calculateDelayForOffers() = TimeUnit.SECONDS.toMillis(10L) | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationDelayCalculator.kt | 26 | Kotlin | 0.143 | question | 38 | 43 | 49 | false | [Notifications Revamp] Offers notifications | 4,047 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
@StringRes textRes: Int,
) {
TextP40(
text = stringResource(textRes),
color = MaterialTheme.theme.colors.support05,
modifier = Modifier.padding(top = 8.dp),
)
}
@Composable
fun EmailField(
email: String,
enabled: Boolean,
isError: Boolean,
modifier: Modifier = Modifi... | This fixed the error:
```
'enum class AutofillType : Enum<AutofillType>' is deprecated.
``` | @StringRes textRes: Int,
) {
TextP40(
text = stringResource(textRes),
color = MaterialTheme.theme.colors.support05,
modifier = Modifier.padding(top = 8.dp),
)
}
@Composable
fun EmailField(
email: String,
enabled: Boolean,
isError: Boolean,
modifier: Modifier = Modifi... | @@ -130,18 +124,18 @@ fun EmailField(
email: String,
enabled: Boolean,
isError: Boolean,
+ modifier: Modifier = Modifier,
placeholder: String = stringResource(LR.string.profile_email_address),
onUpdateEmail: (String) -> Unit,
imeAction: ImeAction = ImeAction.Next,
onImeAction: () -... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/components/EmailAndPasswordFields.kt | 26 | Kotlin | 0.714 | suggestion | 94 | 51 | 51 | false | Upgrade Compose to 2025.05.01 | 4,049 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | geekygecko |
listener?.onPlayerBottomSheetSlide(bottomSheet, slideOffset)
animations?.forEach { it.onSlide(slideOffset) }
}
override fun onStateChanged(bottomSheet: View, newState: Int) {
settings.updatePlayerOrUpNextBottomSheetState(newState)
... | ```suggestion
behavior.state = if (velocityY > 0f) {
``` | listener?.onPlayerBottomSheetSlide(bottomSheet, slideOffset)
animations?.forEach { it.onSlide(slideOffset) }
}
override fun onStateChanged(bottomSheet: View, newState: Int) {
settings.updatePlayerOrUpNextBottomSheetState(newState)
... | @@ -217,6 +223,22 @@ class PlayerBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
}
}
+ private fun createPreFlingInterceptor(
+ behavior: BottomSheetBehavior<*>,
+ ) = object : PreFlingInterceptor {
+ override fun shouldInterceptFlingGesture(velocityX: Float, vel... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/PlayerBottomSheet.kt | 26 | Kotlin | 0.571 | suggestion | 70 | 51 | 51 | false | Decrease hide sensitivity of Player's bottom sheet | 4,052 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | MiSikora |
}
override fun onSkipForwardClicked() {
listener?.onSkipForwardClicked()
}
override fun onPlayerClicked() {
openPlayer()
}
override fun onUpNextClicked() {
listener?.onUpNextClicked()
}... | 💡 cast is not necessery here, but for the `setPreflingInterceptor` call:
| }
override fun onSkipForwardClicked() {
listener?.onSkipForwardClicked()
}
override fun onPlayerClicked() {
openPlayer()
}
override fun onUpNextClicked() {
listener?.onUpNextClicked()
}... | @@ -96,6 +98,10 @@ class PlayerBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
sheetBehavior = BottomSheetBehavior.from(this).apply {
val callback = createBottomSheetCallback(rootView = parent as CoordinatorLayout)
addBottomSheetCallback(callback)
+
+ v... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/PlayerBottomSheet.kt | 26 | Kotlin | 0.5 | suggestion | 74 | 51 | 51 | false | Decrease hide sensitivity of Player's bottom sheet | 4,052 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
/**
* [BottomSheetBehavior] that has a support for detecting nested scrolling in [ViewPager2].
*
* See [GitHub issue](https://github.com/Automattic/pocket-casts-android/issues/1752) for more context.
*/
open class ViewPag... | ```suggestion
return if (shouldDisableFling) {
preFlingInterceptor?.onFlingIntercepted(velocityX, velocityY)
false
} else {
super.onNestedPreFling(coordinatorLayout, child, target, velocityX, velocityY)
}
``` | import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
/**
* [BottomSheetBehavior] that has a support for detecting nested scrolling in [ViewPager2].
*
* See [GitHub issue](https://github.com/Automattic/pocket-casts-android/issues/1752) for more context.
*/
open class ViewPag... | @@ -20,6 +21,22 @@ open class ViewPager2AwareBottomSheetBehavior<V : View> @JvmOverloads constructo
context: Context,
attrs: AttributeSet? = null,
) : BottomSheetBehavior<V>(context, attrs) {
+ private var preFlingInterceptor: PreFlingInterceptor? = null
+
+ fun setPreFlingInterceptor(interceptor: PreF... | modules/services/views/src/main/java/com/google/android/material/bottomsheet/ViewPager2AwareBottomSheetBehavior.kt | 26 | Kotlin | 0.857 | suggestion | 275 | 51 | 51 | false | Decrease hide sensitivity of Player's bottom sheet | 4,052 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | MiSikora |
return object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) {
// remove bottom navigation view
listener?.onPlayerBottomSheetSlide(bottomSheet, slideOffset)
animations?.forEach { it.onSlide(s... | ❓ just wondering how you came up with this arbitrary number? Was it a trial-and-error method? |
return object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(bottomSheet: View, slideOffset: Float) {
// remove bottom navigation view
listener?.onPlayerBottomSheetSlide(bottomSheet, slideOffset)
animations?.forEach { it.onSlide(s... | @@ -217,6 +223,22 @@ class PlayerBottomSheet @JvmOverloads constructor(context: Context, attrs: Attri
}
}
+ private fun createPreFlingInterceptor(
+ behavior: BottomSheetBehavior<*>,
+ ) = object : PreFlingInterceptor {
+ override fun shouldInterceptFlingGesture(velocityX: Float, vel... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/PlayerBottomSheet.kt | 26 | Kotlin | 0.357 | question | 93 | 51 | 51 | false | Decrease hide sensitivity of Player's bottom sheet | 4,052 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.ViewCompat
import androidx.core.view.forEach
import androidx.core.view.get
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
/**
* [BottomSheetBehavior] ... | 💡 `return` could be hoisted to the `if` statement:
` return if (shouldDisableFling) { ... false } else { super.onNested... }` | import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.view.ViewCompat
import androidx.core.view.forEach
import androidx.core.view.get
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
/**
* [BottomSheetBehavior] ... | @@ -20,6 +21,22 @@ open class ViewPager2AwareBottomSheetBehavior<V : View> @JvmOverloads constructo
context: Context,
attrs: AttributeSet? = null,
) : BottomSheetBehavior<V>(context, attrs) {
+ private var preFlingInterceptor: PreFlingInterceptor? = null
+
+ fun setPreFlingInterceptor(interceptor: PreF... | modules/services/views/src/main/java/com/google/android/material/bottomsheet/ViewPager2AwareBottomSheetBehavior.kt | 26 | Kotlin | 0.571 | suggestion | 127 | 51 | 51 | false | Decrease hide sensitivity of Player's bottom sheet | 4,052 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
}
@JsonClass(generateAdapter = true)
data class PodcastInfo(
@field:Json(name = "uuid") val uuid: String,
@field:Json(name = "url") val url: String?,
@field:Json(name = "title") val title: String?,
@field:Json(name = "author") val author: String?,
@field:Json(name = "description") val description: ... | 💡 could be substantiated with `.orEmpty()` here and above/below | }
@JsonClass(generateAdapter = true)
data class PodcastInfo(
@field:Json(name = "uuid") val uuid: String,
@field:Json(name = "url") val url: String?,
@field:Json(name = "title") val title: String?,
@field:Json(name = "author") val author: String?,
@field:Json(name = "description") val description: ... | @@ -57,9 +55,7 @@ data class PodcastInfo(
podcast.title = title ?: ""
podcast.author = author ?: ""
podcast.podcastCategory = category ?: ""
- if (FeatureFlag.isEnabled(Feature.PODCAST_HTML_DESCRIPTION)) {
- podcast.podcastHtmlDescription = descriptionHtml ?: ""
- }
+... | modules/services/servers/src/main/java/au/com/shiftyjelly/pocketcasts/servers/podcast/PodcastResponse.kt | 26 | Kotlin | 0.429 | suggestion | 63 | 51 | 51 | false | Remove old feature flags | 4,064 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
)
Spacer(
modifier = Modifier.width(4.dp),
)
Text(
text = ad.title,
color = colors.titleLabel,
fontSize = 12.sp,
lineHeight = 12.sp,
fontWeight = FontWeight.SemiBold,
letterSpacing = 0.sp,
)
... | ⛏️ should be `TouchTargetSize` | .padding(horizontal = 4.dp, vertical = 2.dp),
)
Spacer(
modifier = Modifier.width(4.dp),
)
Text(
text = ad.title,
color = colors.titleLabel,
fontSize = 12.sp,
lineHeight = 12.sp,
fontWeight = FontWe... | @@ -0,0 +1,289 @@
+package au.com.shiftyjelly.pocketcasts.compose.ad
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.indication
+import androidx.compose... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/ad/AdBanner.kt | 26 | Kotlin | 0.286 | suggestion | 30 | 51 | 51 | false | Add ad banner component | 4,075 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
)
}
val horionztalOffset = -ContentPadding.calculateRightPadding(LocalLayoutDirection.current)
val verticalOffsset = ContentPadding.calculateTopPadding()
OverflowMenuInteractionBox(
interactionSource = interactionSource,
onC... | ⛏️ i think we should add 5dp bottom padding here:

| .semantics { hideFromAccessibility() },
)
}
val horizontalOffset = -ContentPadding.calculateRightPadding(LocalLayoutDirection.current)
val verticalOffset = ContentPadding.calculateTopPadding()
OverflowMenuInteractionBox(
... | @@ -0,0 +1,289 @@
+package au.com.shiftyjelly.pocketcasts.compose.ad
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.indication
+import androidx.compose... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/ad/AdBanner.kt | 26 | Kotlin | 0.429 | suggestion | 170 | 51 | 51 | false | Add ad banner component | 4,075 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
) {
val context = LocalContext.current
val theme = MaterialTheme.theme
CoilImage(
imageRequest = remember(context, theme.isDark, ad.imageUrl) {
PocketCastsImageRequestFactory(context).createForFileOrUrl(ad.imageUrl)... | ⛏️ maybe we should add 4dp top padding?

|
) {
val context = LocalContext.current
val theme = MaterialTheme.theme
CoilImage(
imageRequest = remember(context, theme.isDark, ad.imageUrl) {
PocketCastsImageRequestFactory(context).createForFileOrUrl(ad.imageUrl)... | @@ -0,0 +1,289 @@
+package au.com.shiftyjelly.pocketcasts.compose.ad
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.indication
+import androidx.compose... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/ad/AdBanner.kt | 26 | Kotlin | 0.429 | suggestion | 160 | 51 | 51 | false | Add ad banner component | 4,075 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
Column(
verticalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxHeight()
.weight(1f),
) {
Text(
text = ad.ctaText,
... | ⛏️ maybe we should add a bit left padding to prevent ripple to overlap the text:

| Column(
verticalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxHeight()
.weight(1f)
.padding(vertical = 4.dp),
) {
Text(
... | @@ -0,0 +1,289 @@
+package au.com.shiftyjelly.pocketcasts.compose.ad
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.indication
+import androidx.compose... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/ad/AdBanner.kt | 26 | Kotlin | 0.429 | suggestion | 201 | 51 | 51 | false | Add ad banner component | 4,075 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
PocketCastsImageRequestFactory(context).createForFileOrUrl(ad.imageUrl)
},
title = stringResource(LR.string.ad_image),
showTitle = false,
corners = 4.dp,
modifier = Modifier.size(86.dp),
... | ❓ maybe we should also set `maxLines` and `overflow`
Since these ads are dynamic and we should consider increased font sizes, there could be scenarios when the app renders this text in more than 4 lines... and that would probably look a bit off? Just an idea | PocketCastsImageRequestFactory(context).createForFileOrUrl(ad.imageUrl)
},
title = stringResource(LR.string.ad_image),
showTitle = false,
corners = 4.dp,
modifier = Modifier.size(86.dp),
... | @@ -0,0 +1,289 @@
+package au.com.shiftyjelly.pocketcasts.compose.ad
+
+import androidx.compose.foundation.Image
+import androidx.compose.foundation.background
+import androidx.compose.foundation.border
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.indication
+import androidx.compose... | modules/services/compose/src/main/java/au/com/shiftyjelly/pocketcasts/compose/ad/AdBanner.kt | 26 | Kotlin | 0.786 | bug | 260 | 51 | 51 | false | Add ad banner component | 4,075 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
.widthIn(max = 320.dp),
) {
Tooltip(
title = stringResource(LR.string.podcasts_sort_by_tooltip_title),
body = stringResource(LR.string.podcasts_sort_by_tooltip_message),
... | 💡 maybe logging the exception would be useful later | .offset { IntOffset(x = -8.dp.roundToPx(), y = toolbarY - 8.dp.roundToPx()) }
.widthIn(max = 320.dp),
) {
Tooltip(
title = stringResource(LR.string.podcasts_sort_by_tooltip... | @@ -589,11 +664,22 @@ class PodcastsFragment :
viewModel.onTooltipClosed()
}
+ private fun openAd(ad: BlazeAd) {
+ runCatching {
+ val intent = Intent(Intent.ACTION_VIEW, ad.ctaUrl.toUri())
+ startActivity(intent)
+ } | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcasts/PodcastsFragment.kt | 26 | Kotlin | 0.429 | suggestion | 51 | 51 | 51 | false | Display ads in the podcasts page | 4,076 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
val widthPx = UiUtil.getWindowWidthPx(context)
if (orientation == lastOrientationRefreshed && lastWidthPx == widthPx) return
// screen has rotated, redraw the grid to the right size
setupGridView()
lastOrientationRefreshed = orientation
lastWidthPx = widthPx
}
... | 💡 maybe `ads.firstOrNull()?.let` would be more fitting | val orientation = resources.configuration.orientation
val widthPx = UiUtil.getWindowWidthPx(context)
if (orientation == lastOrientationRefreshed && lastWidthPx == widthPx) return
// screen has rotated, redraw the grid to the right size
setupGridView()
lastOrientationRef... | @@ -454,10 +485,30 @@ class PodcastsFragment :
val folderUuid = folderUuid
binding.emptyView.setContentWithViewCompositionStrategy {
+ val ads by viewModel.activeAds.collectAsState()
+
AppTheme(themeType = theme.activeTheme) {
Column(
- mod... | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcasts/PodcastsFragment.kt | 26 | Kotlin | 0.5 | suggestion | 54 | 51 | 51 | false | Display ads in the podcasts page | 4,076 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
title = "Recommendations",
defaultValue = BuildConfig.DEBUG,
tier = FeatureTier.Free,
hasFirebaseRemoteFlag = true,
hasDevToggle = true,
),
NOTIFICATIONS_REVAMP(
key = "notifications_revamp",
title = "Notifications Revamp",
defaultValue = BuildConf... | nice 😅 long-lived easter eggs :D | title = "Recommendations",
defaultValue = BuildConfig.DEBUG,
tier = FeatureTier.Free,
hasFirebaseRemoteFlag = true,
hasDevToggle = true,
),
NOTIFICATIONS_REVAMP(
key = "notifications_revamp",
title = "Notifications Revamp",
defaultValue = BuildConf... | @@ -133,31 +133,31 @@ enum class Feature(
// This is set of features used only for testing purposes.
TEST_FREE_FEATURE(
- key = "test_free_feautre",
+ key = "test_free_feature", | modules/services/utils/src/main/java/au/com/shiftyjelly/pocketcasts/utils/featureflag/Feature.kt | 26 | Kotlin | 0.071 | suggestion | 33 | 51 | 51 | false | Allow to observe feature flags | 4,082 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
package au.com.shiftyjelly.pocketcasts.ui
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.net.Uri
import android.os.Build
import android.os.Bundle
im... | ⛏️ typo: `requestPortraitOrientation()` | getString(LR.string.bookmark_updated, result.title)
} else {
getString(LR.string.bookmark_added, result.title)
}
val action = View.OnClickListener {
showPlayerBookmarks()
}
Snackbar.make(view, snackbarMessage, Snackbar.LENGTH_LONG)
... | @@ -1774,4 +1776,11 @@ class MainActivity :
addFragment(SettingsFragment())
addFragment(ExportSettingsFragment())
}
+
+ @SuppressLint("SourceLockedOrientationActivity")
+ private fun requestPortiraitOrientation() { | app/src/main/java/au/com/shiftyjelly/pocketcasts/ui/MainActivity.kt | 26 | Kotlin | 0.214 | nitpick | 39 | 1,778 | 32 | false | Force portait orientation for devices with smallest size below 600dp | 4,083 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
AppTheme(theme.activeTheme) {
Box(
contentAlignment = Alignment.Center,
modifier = Modifier.padding(16.dp),
) {
PlayerVisuals(
state = state,
player = player,
... | 👏 Nice one, the animations are snappy as well 👍 | startActivity(intent)
} catch (e: ActivityNotFoundException) {
Timber.e(e)
UiUtil.displayAlertError(requireContext(), getString(LR.string.player_open_url_failed, chapterUrl), null)
... | @@ -226,13 +242,36 @@ class PlayerHeaderFragment : BaseFragment(), PlayerClickListener {
private fun setupArtworkSectionComposeView() {
binding?.artworkSectionComposeView?.setContentWithViewCompositionStrategy {
val state by remember { playerVisualsStateFlow() }.collectAsState(PlayerVisualsSt... | modules/features/player/src/main/java/au/com/shiftyjelly/pocketcasts/player/view/PlayerHeaderFragment.kt | 26 | Kotlin | 0.071 | suggestion | 48 | 51 | 51 | false | Display ads in the player | 4,086 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
alias(libs.plugins.compose.compiler)
}
android {
namespace = "au.com.shiftyjelly.pocketcasts.ads"
buildFeatures {
... | ⛏️ right now we don't use `viewBindings` in this module | plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)
alias(libs.plugins.compose.compiler)
}
android {
namespace = "au.com.shiftyjelly.pocketcasts.ads"
buildFeatures {
... | @@ -0,0 +1,37 @@
+plugins {
+ alias(libs.plugins.android.library)
+ alias(libs.plugins.kotlin.android)
+ alias(libs.plugins.kotlin.parcelize)
+ alias(libs.plugins.ksp)
+ alias(libs.plugins.hilt)
+ alias(libs.plugins.compose.compiler)
+}
+
+android {
+ namespace = "au.com.shiftyjelly.pocketcasts.ads... | modules/features/ads/build.gradle.kts | 14 | Kotlin | 0.429 | suggestion | 55 | 38 | 38 | false | Launch onboarding from ads | 4,089 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
import javax.inject.Inject
@AndroidEntryPoint
class HelpFragment : BaseFragment(), HasBackstack {
@Inject
lateinit var settings: Settings
private var webView: WebView? = null
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle... | We need to account for previously used `settings.bottomInset`. Otherwise content will be obstructed by the mini player when it is available.
<img width="745" alt="Screenshot 2025-06-11 at 15 29 26" src="https://github.com/user-attachments/assets/96ff99d6-ff65-43ef-bfe1-8af86efa51b8" />
| import au.com.shiftyjelly.pocketcasts.views.helper.HasBackstack
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
@AndroidEntryPoint
class HelpFragment : BaseFragment(), HasBackstack {
@Inject
lateinit var settings: Settings
private var webView: WebView? = null
override fun onCr... | @@ -44,35 +39,36 @@ class HelpFragment : BaseFragment(), HasBackstack {
savedInstanceState: Bundle?,
) = content {
AppThemeWithBackground(theme.activeTheme) {
- val bottomPadding by settings.bottomInset.collectAsState(0)
+ val density = LocalDensity.current
+ val ... | modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/HelpFragment.kt | 26 | Kotlin | 0.643 | suggestion | 291 | 51 | 51 | false | Resolve keyboard blocking WebView input fields in Help & Feedback page | 4,109 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | joashrajin |
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.settings.status.StatusFragment
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModePan
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModeResize
import au.com.shiftyjelly.pocketcasts.ui.he... | There's nothing wrong with this but `WindowInsets` already provides API for getting padding. `WindowInsets.ime.asPaddingValues().calculateBottomPadding()`. | import au.com.shiftyjelly.pocketcasts.compose.AppThemeWithBackground
import au.com.shiftyjelly.pocketcasts.preferences.Settings
import au.com.shiftyjelly.pocketcasts.settings.status.StatusFragment
import au.com.shiftyjelly.pocketcasts.ui.extensions.setupKeyboardModePan
import au.com.shiftyjelly.pocketcasts.ui.extension... | @@ -44,35 +39,36 @@ class HelpFragment : BaseFragment(), HasBackstack {
savedInstanceState: Bundle?,
) = content {
AppThemeWithBackground(theme.activeTheme) {
- val bottomPadding by settings.bottomInset.collectAsState(0)
+ val density = LocalDensity.current
+ val ... | modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/HelpFragment.kt | 26 | Kotlin | 0.5 | bug | 155 | 51 | 51 | false | Resolve keyboard blocking WebView input fields in Help & Feedback page | 4,109 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | joashrajin |
}
}
@Composable
private fun TranscriptLine(
entryIndex: Int,
entry: TranscriptEntry,
searchState: SearchState,
theme: TranscriptTheme,
modifier: Modifier = Modifier,
) {
val entryText = entry.text()
val searchHighlights = remember(entryIndex, entryText, searchState) {
val search... | ⛏️ no need to deconstruct the pair here if you would reconstruct it later for `hightlightCoordinates` | }
}
}
@Composable
private fun TranscriptLine(
entryIndex: Int,
entry: TranscriptEntry,
searchState: SearchState,
theme: TranscriptTheme,
modifier: Modifier = Modifier,
) {
val entryText = entry.text()
val searchHighlights = remember(entryIndex, entryText, searchState) {
... | @@ -59,14 +62,37 @@ internal fun TranscriptLines(
@Composable
private fun TranscriptLine(
+ entryIndex: Int,
entry: TranscriptEntry,
- colors: TranscriptColors,
+ searchState: SearchState,
+ theme: TranscriptTheme,
modifier: Modifier = Modifier,
) {
+ val entryText = entry.text()
+ val ... | modules/features/transcripts/src/main/kotlin/au/com/shiftyjelly/pocketcasts/transcripts/ui/TranscriptLines.kt | 26 | Kotlin | 0.5 | suggestion | 101 | 51 | 51 | false | Add transcripts highlighting to the new UI | 4,118 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
style = entry.textStyle(),
color = theme.text,
modifier = modifier,
)
}
private fun TranscriptEntry.text() = when (this) {
is TranscriptEntry.Text -> value
is TranscriptEntry.Speaker -> name
}
private fun TranscriptEntry.textStyle() = when (this) {
is TranscriptEntry.Text -> Si... | ⛏️ i think it's already granted that `end` cannot be `<0` at this point.
instead of doing these many checks maybe you could use rephrase the body to a single expression:
`return start < end && start >= 0 && (start .. end).contains(maxLength)` | }
addStyle(style, startIndex, endIndex)
}
},
style = entry.textStyle(),
color = theme.text,
modifier = modifier,
)
}
private fun TranscriptEntry.text() = when (this) {
is TranscriptEntry.Text -> value
is TranscriptEntry.Speaker -> ... | @@ -86,12 +112,24 @@ private fun TranscriptEntry.padding() = when (this) {
is TranscriptEntry.Speaker -> SpeakerPadding
}
-internal val RobotoSerifFontFamily = FontFamily(Font(R.font.roboto_serif))
+private fun isValidHighlightRange(start: Int, end: Int, maxLength: Int): Boolean {
+ if (start > end) {
+ ... | modules/features/transcripts/src/main/kotlin/au/com/shiftyjelly/pocketcasts/transcripts/ui/TranscriptLines.kt | 26 | Kotlin | 0.643 | suggestion | 248 | 51 | 51 | false | Add transcripts highlighting to the new UI | 4,118 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
val searchDefaultSpanStyle: SpanStyle,
val searchHighlightSpanStyle: SpanStyle,
) {
companion object {
internal val RobotoSerifFontFamily = FontFamily(Font(R.font.roboto_serif))
fun default(colors: ThemeColors) = TranscriptTheme(
background = colors.primaryUi01,
text... | ⛏️ this .2 alpha seems a bit too subtle to me on some themes | val searchDefaultSpanStyle: SpanStyle,
val searchHighlightSpanStyle: SpanStyle,
) {
companion object {
internal val RobotoSerifFontFamily = FontFamily(Font(R.font.roboto_serif))
fun default(colors: ThemeColors) = TranscriptTheme(
background = colors.primaryUi01,
text... | @@ -0,0 +1,65 @@
+package au.com.shiftyjelly.pocketcasts.transcripts.ui
+
+import androidx.compose.material.MaterialTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.SpanStyle
+import androidx.compose.u... | modules/features/transcripts/src/main/kotlin/au/com/shiftyjelly/pocketcasts/transcripts/ui/TranscriptTheme.kt | 26 | Kotlin | 0.214 | suggestion | 60 | 48 | 50 | false | Add transcripts highlighting to the new UI | 4,118 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
}
}
}
}
viewModel.castConnected.observe(viewLifecycleOwner) { castConnected ->
adapter?.castConnected = castConnected
}
viewLifecycleOwner.lifecycleScope.launch {
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.Stat... | There's no need to include such comments. It is obvious what the code does here. If you want to include one it's better to explain why such a check exists. But it should be combined with the comment below to a single comment. | }
}
}
}
viewModel.castConnected.observe(viewLifecycleOwner) { castConnected ->
adapter?.castConnected = castConnected
}
viewLifecycleOwner.lifecycleScope.launch {
viewLifecycleOwner.repeatOnLifecycle(Lifecycle.Stat... | @@ -1158,22 +1158,26 @@ class PodcastFragment : BaseFragment() {
* Episode search needs at least a page worth of space under the search box so the user can see the results below.
*/
private fun addPaddingForEpisodeSearch(episodes: List<PodcastEpisode>) {
- val rowCount = episodes.size
v... | modules/features/podcasts/src/main/java/au/com/shiftyjelly/pocketcasts/podcasts/view/podcast/PodcastFragment.kt | 26 | Kotlin | 0.5 | suggestion | 225 | 51 | 51 | false | Remove bottom padding with empty episode list | 4,121 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | HenrikBacher |
private fun updateProgress(downloadProgressUpdate: DownloadProgressUpdate) {
launch(Dispatchers.Main) {
progressUpdates[downloadProgressUpdate.episodeUuid] = downloadProgressUpdate
progressUpdateRelay.toSerialized().onNext(downloadProgressUpdate)
}
}
override fun beg... | Why is the `Main` dispatcher needed here? | private fun updateProgress(downloadProgressUpdate: DownloadProgressUpdate) {
launch(Dispatchers.Main) {
progressUpdates[downloadProgressUpdate.episodeUuid] = downloadProgressUpdate
progressUpdateRelay.toSerialized().onNext(downloadProgressUpdate)
}
}
override fun beg... | @@ -114,128 +114,137 @@ class DownloadManagerImpl @Inject constructor(
override fun beginMonitoringWorkManager(context: Context) {
val workManager = WorkManager.getInstance(context)
- val episodeFlowable = episodeManager.findDownloadingEpisodesRxFlowable()
- .distinctUntilChanged { t1,... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/download/DownloadManagerImpl.kt | 26 | Kotlin | 0.214 | question | 41 | 51 | 51 | false | Fix app state after migration | 4,130 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
package au.com.shiftyjelly.pocketcasts.repositories.notification
interface NotificationScheduler {
fun setupOnboardingNotifications()
suspend fun setupReEngagementNotification()
suspend fun setupTrendingAndRecommendationsNotifications()
suspend fun setupNewFeaturesAndTipsNotifications()
suspend fun... | I think `list` is a bit generic name since it is in the type itself. Could you change it to `tags`? | package au.com.shiftyjelly.pocketcasts.repositories.notification
interface NotificationScheduler {
fun setupOnboardingNotifications()
suspend fun setupReEngagementNotification()
suspend fun setupTrendingAndRecommendationsNotifications()
suspend fun setupNewFeaturesAndTipsNotifications()
suspend fun... | @@ -11,4 +11,5 @@ interface NotificationScheduler {
fun cancelScheduledTrendingAndRecommendationsNotifications()
fun cancelScheduledNewFeaturesAndTipsNotifications()
fun cancelScheduledOffersNotifications()
+ fun cancelScheduledWorksByTag(list: List<String>) | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationScheduler.kt | 14 | Kotlin | 0.571 | question | 99 | 16 | 16 | false | Disable recommendations notifications for users not signed in | 4,133 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
val type = NotificationType.fromSubCategory(subcategory) ?: return Result.failure()
if (!type.isSettingsToggleOn(settings)) {
return Result.failure()
}
if (notificationManager.hasUserInteractedWithFeature(type) || !shouldSchedule(type)) {
return Result.failure(... | Can be expressed as
```kotlin
userManager.getSignInState().awaitFirstOrNull()?.isSignedIn == true
``` |
val type = NotificationType.fromSubCategory(subcategory) ?: return Result.failure()
if (!type.isSettingsToggleOn(settings)) {
return Result.failure()
}
if (notificationManager.hasUserInteractedWithFeature(type) || !shouldSchedule(type)) {
return Result.failure(... | @@ -58,6 +61,10 @@ class NotificationWorker @AssistedInject constructor(
private suspend fun shouldSchedule(type: NotificationType): Boolean {
return when (type) {
+ is TrendingAndRecommendationsNotificationType.Recommendations -> {
+ val isSignedIn = userManager.getSignInState... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationWorker.kt | 26 | Kotlin | 0.929 | suggestion | 106 | 51 | 51 | false | Disable recommendations notifications for users not signed in | 4,133 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
package au.com.shiftyjelly.pocketcasts.settings.notificationstesting
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
im... | Thanks for adding this page, it will make testing much easier. I wonder if there is some minor tweaks we could make to improve the UI. Feel free to leave this until a later PR.
- Add a toolbar
- Remove the indent on `SettingRadioDialogRow` with `indent = false`
- Give it a default value so it looks selectable
... | package au.com.shiftyjelly.pocketcasts.settings.notificationstesting
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
imp... | @@ -0,0 +1,280 @@
+package au.com.shiftyjelly.pocketcasts.settings.notificationstesting | modules/features/settings/src/main/java/au/com/shiftyjelly/pocketcasts/settings/notificationstesting/NotificationsTestingPage.kt | 1 | Kotlin | 0.643 | nitpick | 614 | 26 | 26 | false | Collapse player when opening a deeplink | 4,150 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | sztomek |
import app.cash.turbine.test
import au.com.shiftyjelly.pocketcasts.models.db.dao.UserCategoryVisitsDao
import au.com.shiftyjelly.pocketcasts.models.entity.UserCategoryVisits
import au.com.shiftyjelly.pocketcasts.repositories.lists.ListRepository
import au.com.shiftyjelly.pocketcasts.servers.model.DiscoverCategory
impo... | I'm not sure I understand the need for this rule. This rule is generally necessary for `ViewModel`s because of the problematic `viewModelScope` property, which enforces `Dispatchers.Main`.
In this case, however, the rule doesn't help on its own with the test It would be simpler to just use:
```kotlin
private va... |
import app.cash.turbine.test
import au.com.shiftyjelly.pocketcasts.models.db.dao.UserCategoryVisitsDao
import au.com.shiftyjelly.pocketcasts.models.entity.UserCategoryVisits
import au.com.shiftyjelly.pocketcasts.repositories.lists.ListRepository
import au.com.shiftyjelly.pocketcasts.servers.model.DiscoverCategory
impo... | @@ -23,6 +23,9 @@ internal class CategoriesManagerTest {
@get:Rule
val featureFlagRule = InMemoryFeatureFlagRule()
+ @get:Rule
+ val coroutineRule = MainCoroutineRule() | modules/services/repositories/src/test/java/au/com/shiftyjelly/pocketcasts/repositories/categories/CategoriesManagerTest.kt | 26 | Kotlin | 0.857 | suggestion | 426 | 51 | 51 | false | Fix flaky tests in `CategoriesManagerTest` | 4,199 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import au.com.shiftyjelly.pocketcasts.compose.components.TextH10
import au.com.shiftyjelly.pocketcasts.compose.components.TextH40
import au.com.shiftyjelly.pocketcasts.compose.images.SubscriptionBadge
import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvider
import au.com.shiftyjelly.pocketcas... | Shouldn't this be a part of the header? | import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import au.com.shiftyjelly.pocketcasts.account.onboarding.components.UpgradePlanRow
import au.com.shiftyjelly.pocketcasts.account.onboarding.upgrade.OnboardingUpgradeHelper.PrivacyPolicy
import au.com.shiftyjelly.pocketcasts.a... | @@ -0,0 +1,249 @@
+package au.com.shiftyjelly.pocketcasts.account.onboarding.upgrade
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.143 | question | 39 | 51 | 51 | false | [Onboarding] Upgrade Screen skeleton | 4,204 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
onClosePressed: () -> Unit,
onSubscribePressed: () -> Unit,
modifier: Modifier = Modifier,
) {
val plans = listOf(
SubscriptionPlan.PlusYearlyPreview,
SubscriptionPlan.PlusMonthlyPreview,
)
var selectedPlan by remember { mutableStateOf(plans[0]) }
Box(modifier = modifier.ba... | ```suggestion
contentDescription = stringResource(LR.string.close),
``` | import au.com.shiftyjelly.pocketcasts.ui.theme.Theme.ThemeType
import kotlinx.coroutines.launch
import au.com.shiftyjelly.pocketcasts.localization.R as LR
@Composable
fun OnboardingUpgradeScreen(
onClosePress: () -> Unit,
onSubscribePress: () -> Unit,
modifier: Modifier = Modifier,
) {
val plans = list... | @@ -0,0 +1,249 @@
+package au.com.shiftyjelly.pocketcasts.account.onboarding.upgrade
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.571 | suggestion | 93 | 51 | 51 | false | [Onboarding] Upgrade Screen skeleton | 4,204 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
) {
val selectedOnboardingPlan = remember(selectedPlan) { OnboardingSubscriptionPlan.create(selectedPlan) }
Column(modifier = modifier) {
SubscriptionBadge(
iconRes = selectedOnboardingPlan.badgeIconRes,
shortNameRes = selectedOnboardingPlan.shortNameRes,
backgroundC... | This `Column` might be redundant. | SubscriptionBadge(
iconRes = selectedOnboardingPlan.badgeIconRes,
shortNameRes = selectedOnboardingPlan.shortNameRes,
backgroundColor = Color.Black,
textColor = Color.White,
modifier = Modifier
.wrapContentWi... | @@ -0,0 +1,249 @@
+package au.com.shiftyjelly.pocketcasts.account.onboarding.upgrade
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.214 | suggestion | 33 | 51 | 51 | false | [Onboarding] Upgrade Screen skeleton | 4,204 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
}
}
}
}
@Composable
private fun FeaturesContent(
features: ContentPage.Features,
onCtaClicked: () -> Unit,
) {
LazyColumn {
items(features.features.size) {
UpgradeFeatureItem(
item = features.features[it],
iconColor = MaterialTheme... | Using `FadedLazyColumn` instead would add a smoother edge effect when content doesn't fit. | val pagerState = rememberPagerState(initialPage = 0) { pages.size }
val coroutineScope = rememberCoroutineScope()
VerticalPager(state = pagerState, modifier = Modifier.fillMaxSize()) { page ->
when (val currentPage = pages[page]) {
is UpgradePagerContent.Features -> F... | @@ -208,29 +261,51 @@ private fun UpgradeContent(
@Composable
private fun FeaturesContent(
- onClicked: (() -> Unit)? = null,
+ features: ContentPage.Features,
+ onCtaClicked: () -> Unit,
) {
- Box(
- contentAlignment = Alignment.Center,
- modifier = Modifier
- .fillMaxWidth()
... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.429 | suggestion | 90 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
pages: List<ContentPage>,
modifier: Modifier = Modifier,
) {
Column(modifier = modifier) {
val pagerState = rememberPagerState(initialPage = 0) { pages.size }
val coroutineScope = rememberCoroutineScope()
VerticalPager(state = pagerState, modifier = Modifier.fillMaxSize()) { page ->
... | ```suggestion
onCtaClicked = { coroutineScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + 1) } },
``` | }
}
}
private sealed interface UpgradePagerContent {
val showCta: Boolean
data class Features(val features: List<UpgradeFeatureItem>, override val showCta: Boolean) : UpgradePagerContent
data class TrialSchedule(val timelineItems: List<UpgradeTrialItem>, override val showCta: Boolean) : Upgrad... | @@ -177,29 +228,31 @@ private fun UpgradeHeader(
}
}
+sealed interface ContentPage {
+ val showCta: Boolean
+
+ data class Features(val features: List<UpgradeFeatureItem>, override val showCta: Boolean) : ContentPage
+ data class TrialSchedule(val timelineItems: List<UpgradeTrialItem>, override val sho... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.714 | suggestion | 144 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
val coroutineScope = rememberCoroutineScope()
VerticalPager(state = pagerState, modifier = Modifier.fillMaxSize()) { page ->
when (val currentPage = pages[page]) {
is ContentPage.Features -> FeaturesContent(
features = currentPage,
onCt... | ```suggestion
onCtaClicked = { coroutineScope.launch { pagerState.animateScrollToPage(pagerState.currentPage + 1) } },
``` | val showCta: Boolean
data class Features(val features: List<UpgradeFeatureItem>, override val showCta: Boolean) : UpgradePagerContent
data class TrialSchedule(val timelineItems: List<UpgradeTrialItem>, override val showCta: Boolean) : UpgradePagerContent
}
@Composable
private fun UpgradeContent(
pages... | @@ -177,29 +228,31 @@ private fun UpgradeHeader(
}
}
+sealed interface ContentPage {
+ val showCta: Boolean
+
+ data class Features(val features: List<UpgradeFeatureItem>, override val showCta: Boolean) : ContentPage
+ data class TrialSchedule(val timelineItems: List<UpgradeTrialItem>, override val sho... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.714 | suggestion | 144 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
}
}
}
}
@Composable
private fun ScheduleContent(
trialSchedule: ContentPage.TrialSchedule,
onCtaClicked: () -> Unit,
) {
LazyColumn {
item {
UpgradeTrialTimeline(
items = trialSchedule.timelineItems,
)
}
if (trialSchedu... | Here `FadedLazyColumn` could be used as well. | item = features.features[it],
iconColor = MaterialTheme.theme.colors.primaryText01,
textColor = MaterialTheme.theme.colors.secondaryText02,
)
}
if (features.showCta) {
item {
TextP40(
text = strin... | @@ -208,29 +261,51 @@ private fun UpgradeContent(
@Composable
private fun FeaturesContent(
- onClicked: (() -> Unit)? = null,
+ features: ContentPage.Features,
+ onCtaClicked: () -> Unit,
) {
- Box(
- contentAlignment = Alignment.Center,
- modifier = Modifier
- .fillMaxWidth()
... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.286 | suggestion | 45 | 44 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
onCtaClicked: () -> Unit,
) {
LazyColumn {
items(features.features.size) {
UpgradeFeatureItem(
item = features.features[it],
iconColor = MaterialTheme.theme.colors.primaryText01,
textColor = MaterialTheme.theme.colors.secondaryText02,
... | This should to be wrapped in `Column`, split into separate items, or changed into top padding of the `TextP40`. |
is UpgradePagerContent.TrialSchedule -> ScheduleContent(
trialSchedule = currentPage,
onCtaClick = { coroutineScope.launch { pagerState.animateScrollToPage(pages.size - page) } },
)
}
}
}
}
@Composable
private fun Features... | @@ -208,29 +261,51 @@ private fun UpgradeContent(
@Composable
private fun FeaturesContent(
- onClicked: (() -> Unit)? = null,
+ features: ContentPage.Features,
+ onCtaClicked: () -> Unit,
) {
- Box(
- contentAlignment = Alignment.Center,
- modifier = Modifier
- .fillMaxWidth()
... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.571 | suggestion | 111 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
private fun ScheduleContent(
trialSchedule: ContentPage.TrialSchedule,
onCtaClicked: () -> Unit,
) {
LazyColumn {
item {
UpgradeTrialTimeline(
items = trialSchedule.timelineItems,
)
}
if (trialSchedule.showCta) {
item {
... | This should to be wrapped in `Column`, split into separate items, or changed into top padding of the `TextP40`. | item {
TextP40(
text = stringResource(LR.string.onboarding_upgrade_features_trial_schedule),
modifier = Modifier.padding(top = 24.dp)
.clickable { onCtaClick() },
color = MaterialTheme.theme.colors.primaryInt... | @@ -208,29 +261,51 @@ private fun UpgradeContent(
@Composable
private fun FeaturesContent(
- onClicked: (() -> Unit)? = null,
+ features: ContentPage.Features,
+ onCtaClicked: () -> Unit,
) {
- Box(
- contentAlignment = Alignment.Center,
- modifier = Modifier
- .fillMaxWidth()
... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.571 | suggestion | 111 | 38 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
interface UpgradeFeatureItem {
@get:DrawableRes
val image: Int
@get:StringRes
val title: Int
val isYearlyFeature: Boolean
val isMonthlyFeature: Boolean
}
enum class PlusUpgradeFeatureItem(
override val image: Int,
override val title: Int,
) : UpgradeFeatureItem {
BannerAds(
... | There is a problem with this approach. Once `title` property is computed it will never change its value based on the feature flag regardless of its value. `title` has to be moved out of the constructor and change to be a `computed` property. | interface UpgradeFeatureItem {
@get:DrawableRes
val image: Int
@StringRes
fun title(): Int
val isYearlyFeature: Boolean
val isMonthlyFeature: Boolean
}
enum class PlusUpgradeFeatureItem(
override val image: Int,
) : UpgradeFeatureItem {
BannerAds(
image = IR.drawable.ic_remov... | @@ -32,35 +32,67 @@ enum class PlusUpgradeFeatureItem(
},
Folders(
image = IR.drawable.ic_plus_feature_folder,
- title = LR.string.onboarding_plus_feature_folders_title,
+ title = if (FeatureFlag.isEnabled(Feature.NEW_ONBOARDING_UPGRADE)) { | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/UpgradeFeatureItem.kt | 26 | Kotlin | 0.643 | suggestion | 241 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
.wrapContentHeight(),
)
Spacer(modifier = Modifier.height(24.dp))
TextH10(
text = stringResource(LR.string.onboarding_upgrade_generic_title),
color = MaterialTheme.theme.colors.primaryText01,
)
}
}
sealed interface ContentPage {
val showCt... | The type name feels not right. `ContentPage` suggests something like a Composable UI component. I think it can also be `private`. | showCta = false,
),
)
}
}
Variants.VARIANT_TRIAL_TIMELINE -> {
add(
UpgradePagerContent.TrialSchedule(
timelineItems = UpgradeTrialItem.getPreviewItems(),
showCta ... | @@ -177,29 +228,31 @@ private fun UpgradeHeader(
}
}
+sealed interface ContentPage { | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.643 | suggestion | 129 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.com... | Maybe move it to be inside the `companion object` of the `UpgradeTrialItem` type. Having top level `previewItems()` function is a bit ambiguous. | import androidx.compose.ui.layout.Placeable
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.... | @@ -30,13 +31,33 @@ import au.com.shiftyjelly.pocketcasts.compose.preview.ThemePreviewParameterProvi
import au.com.shiftyjelly.pocketcasts.compose.theme
import au.com.shiftyjelly.pocketcasts.ui.theme.Theme.ThemeType
import au.com.shiftyjelly.pocketcasts.images.R as IR
+import au.com.shiftyjelly.pocketcasts.localizat... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/components/UpgradeTrialTimeline.kt | 26 | Kotlin | 0.714 | suggestion | 144 | 51 | 51 | false | [Onboarding] Connect screen content | 4,205 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
private sealed interface UpgradePagerContent {
val showCta: Boolean
data class Features(val features: List<UpgradeFeatureItem>, override val showCta: Boolean) : UpgradePagerContent
data class TrialSchedule(val timelineItems: List<UpgradeTrialItem>, override val showCta: Boolean) : UpgradePagerContent
}
@... | This has a bit of jarring effect when used. `animateScrollToItem` would help with that. |
private sealed interface UpgradePagerContent {
val showCta: Boolean
data class Features(val features: List<UpgradeFeatureItem>, override val showCta: Boolean) : UpgradePagerContent
data class TrialSchedule(val timelineItems: List<UpgradeTrialItem>, override val showCta: Boolean) : UpgradePagerContent
}
@... | @@ -253,19 +253,30 @@ private fun UpgradeContent(
pages: List<UpgradePagerContent>,
modifier: Modifier = Modifier,
) {
- Column(modifier = modifier) {
- val pagerState = rememberPagerState(initialPage = 0) { pages.size }
- val coroutineScope = rememberCoroutineScope()
- VerticalPager(... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.429 | suggestion | 87 | 51 | 51 | false | [Onboarding] Use `FadingLazyColumn` instead of `VerticalPager` for content | 4,237 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
private fun UpgradeContent(
pages: List<UpgradePagerContent>,
modifier: Modifier = Modifier,
) {
val coroutineScope = rememberCoroutineScope()
val listState = rememberLazyListState()
FadedLazyColumn(
modifier = modifier,
state = listState,
) {
itemsIndexed(pages) { index,... | This logic isn't quite right. If there are 2 pages, the results will be:
* Page 0: `2 - 0` → `2`. There is no page 2, but it will scroll to the last item because `scrollToItem` has graceful logic.
* Page 1: `2 - 1` → `1`. It doesn't scrolls anywhere because the page scrolls to itself.
We need something like `val... | private fun UpgradeContent(
pages: List<UpgradePagerContent>,
modifier: Modifier = Modifier,
) {
val coroutineScope = rememberCoroutineScope()
val listState = rememberLazyListState()
FadedLazyColumn(
modifier = modifier,
state = listState,
) {
itemsIndexed(pages) { index,... | @@ -253,19 +253,30 @@ private fun UpgradeContent(
pages: List<UpgradePagerContent>,
modifier: Modifier = Modifier,
) {
- Column(modifier = modifier) {
- val pagerState = rememberPagerState(initialPage = 0) { pages.size }
- val coroutineScope = rememberCoroutineScope()
- VerticalPager(... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.643 | suggestion | 359 | 51 | 51 | false | [Onboarding] Use `FadingLazyColumn` instead of `VerticalPager` for content | 4,237 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
modifier: Modifier = Modifier,
) {
val coroutineScope = rememberCoroutineScope()
val listState = rememberLazyListState()
FadedLazyColumn(
modifier = modifier,
state = listState,
) {
itemsIndexed(pages) { index, page ->
when (page) {
is UpgradePager... | It could be extracted to a separate lambda and reused across different items.
```kotlin
val scrollToNext = {
// Function body
}
onCtaClick = scrollToNext
``` | modifier: Modifier = Modifier,
) {
val coroutineScope = rememberCoroutineScope()
val listState = rememberLazyListState()
FadedLazyColumn(
modifier = modifier,
state = listState,
) {
itemsIndexed(pages) { index, page ->
val scrollToNext: () -> Unit = {
... | @@ -253,19 +253,30 @@ private fun UpgradeContent(
pages: List<UpgradePagerContent>,
modifier: Modifier = Modifier,
) {
- Column(modifier = modifier) {
- val pagerState = rememberPagerState(initialPage = 0) { pages.size }
- val coroutineScope = rememberCoroutineScope()
- VerticalPager(... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/OnboardingUpgradeScreen.kt | 26 | Kotlin | 0.786 | refactor | 169 | 51 | 51 | false | [Onboarding] Use `FadingLazyColumn` instead of `VerticalPager` for content | 4,237 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
) {
Image(
painter = painterResource(IR.drawable.ic_checkmark_small),
colorFilter = ColorFilter.tint(MaterialTheme.theme.colors.primaryUi01),
contentDescription = null,
modifier = Modifier
.fillMaxSize()
... | ⚠️ When dealing with prices we should do all the manipulations using `BigDecimal` functions. Conversion to `Float` should be done only at the end for the UI purposes.
It doesn't matter much in this instance but it is a bad practice to use floating-point arithmetic when dealing with money as it can lead to rounding e... | painter = painterResource(IR.drawable.ic_checkmark_small),
colorFilter = ColorFilter.tint(MaterialTheme.theme.colors.primaryUi01),
contentDescription = null,
modifier = Modifier
.fillMaxSize()
.padding(5.dp),
... | @@ -274,43 +276,48 @@ private fun CheckMark(
}
}
-private val SubscriptionPlan.Base.pricePerMonth: Float
+private val SubscriptionPlan.pricePerMonth: Float
get() {
val pricePerMonth = when (billingCycle) {
- BillingCycle.Monthly -> pricingPhase.price.amount
- BillingCycle.Yea... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/components/SubscriptionPlanRow.kt | 26 | Kotlin | 0.786 | suggestion | 326 | 51 | 51 | false | [Onboarding] Wire up read data and logic | 4,240 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
width = 1.dp,
color = MaterialTheme.theme.colors.primaryIcon02,
shape = CircleShape,
),
)
}
}
private val SubscriptionPlan.pricePerMonth: Float
get() {
val pricePerMonth = when (billingCycle) {
BillingCycle.Monthly -> recur... | 🛑 I missed it earlier during the code review but this calculation isn't right for price per week.
20.99 PLN per month / 4 = 5.25 PLN
20.99 PLN per month * 12 / 52 = 4.84 PLN
I made the same mistake [here](https://github.com/Automattic/pocket-casts-android/pull/3908#discussion_r2049756216). | shape = CircleShape,
),
)
}
}
private val SubscriptionPlan.pricePerMonth: Float
get() {
val pricePerMonth = when (billingCycle) {
BillingCycle.Monthly -> recurringPrice.amount
BillingCycle.Yearly -> recurringPrice.amount / monthsInYear
... | @@ -274,43 +276,48 @@ private fun CheckMark(
}
}
-private val SubscriptionPlan.Base.pricePerMonth: Float
+private val SubscriptionPlan.pricePerMonth: Float
get() {
val pricePerMonth = when (billingCycle) {
- BillingCycle.Monthly -> pricingPhase.price.amount
- BillingCycle.Yea... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/components/SubscriptionPlanRow.kt | 26 | Kotlin | 0.571 | suggestion | 297 | 51 | 51 | false | [Onboarding] Wire up read data and logic | 4,240 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
)
}
} else {
Box(
modifier = modifier.border(
width = 1.dp,
color = MaterialTheme.theme.colors.primaryIcon02,
shape = CircleShape,
),
)
}
}
private val SubscriptionPlan.pricePerMonth: Float
get() {
... | 🛑 `recurringPrice` should never be `null`. Allowing it to be nullable can lead to inconsistent UI and UX if there are issues in our offer mapping logic or in the Play Console configuration.
There are a few possible solutions, but the most sensible one is to move `recurringPrice` to be a property of `SubscriptionPla... | } else {
Box(
modifier = modifier.border(
width = 1.dp,
color = MaterialTheme.theme.colors.primaryIcon02,
shape = CircleShape,
),
)
}
}
private val SubscriptionPlan.pricePerMonth: Float
get() {
val pricePerMonth... | @@ -274,43 +276,48 @@ private fun CheckMark(
}
}
-private val SubscriptionPlan.Base.pricePerMonth: Float
+private val SubscriptionPlan.pricePerMonth: Float
get() {
val pricePerMonth = when (billingCycle) {
- BillingCycle.Monthly -> pricingPhase.price.amount
- BillingCycle.Yea... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/components/SubscriptionPlanRow.kt | 26 | Kotlin | 1 | suggestion | 717 | 51 | 51 | false | [Onboarding] Wire up read data and logic | 4,240 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
api(libs.androidx.appcompat)
api(libs.androidx.cardview)
api(libs.androidx.recyclerview)
api(libs.androidx.viewpager)
api(libs.dagger.hilt.android)
api(libs.flexbox)
api(libs.material)
api(libs.rx2.java)
api(projects.modules.features.podcasts)
api(projects.modules.services.anal... | Do we need to keep this commented out library included? |
api(libs.androidx.appcompat)
api(libs.androidx.cardview)
api(libs.androidx.recyclerview)
api(libs.androidx.viewpager)
api(libs.dagger.hilt.android)
api(libs.flexbox)
api(libs.material)
api(libs.rx2.java)
api(projects.modules.features.podcasts)
api(projects.modules.services.anal... | @@ -37,9 +37,16 @@ dependencies {
api(projects.modules.services.views)
api(projects.modules.services.compose)
+ implementation(platform(libs.compose.bom))
+
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.preference.ktx)
+ ... | modules/features/filters/build.gradle.kts | 26 | Kotlin | 0.214 | question | 55 | 45 | 44 | false | Add Playlists onboarding flow | 4,242 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
package au.com.shiftyjelly.pocketcasts.repositories.notification
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Bundle
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTracker... | ℹ️ Both `context` and `intent` cannot be `null` in the `BroadcastReceiver`. They just aren't marked with any annotations in the platform code. | package au.com.shiftyjelly.pocketcasts.repositories.notification
import android.content.BroadcastReceiver
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import androidx.core.content.IntentCompat
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 18 | Kotlin | 0.643 | suggestion | 142 | 43 | 43 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Bundle
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTracker
import dagger.hilt.android.AndroidEntryPoint
import javax.inject... | ⚠️ Is there a reason we're accepting a nullable `Context?` here if we just return early when it's `null`? It might make more sense to require a non-null `Context` instead. |
import android.content.BroadcastReceiver
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import androidx.core.content.IntentCompat
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTracker
import dag... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 26 | Kotlin | 0.714 | suggestion | 171 | 51 | 51 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
event = AnalyticsEvent.NOTIFICATION_OPENED,
properties = mapOf(
"type" to it.analyticsType,
"category" to CATEGORY_DEEP_LINK,
),
)
val target = it.toIntent(context)
tryLaunchIntent(target, context... | ❓ Could you prefix those with our package name? Just to avoid any potential namespace conflicts and make it easier to debug in the future when inspecting intents. | }
companion object {
private const val ACTION_REVAMP_NOTIFICATION_OPENED = "au.com.shiftyjelly.pocketcasts.ACTION_REVAMPED_NOTIFICATION_OPENED"
private const val EXTRA_REVAMPED_TYPE = "au.com.shiftyjelly.pocketcasts.extras.revamped.notification.type"
private const val EXTRA_CATEGORY = "... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 26 | Kotlin | 0.571 | bug | 162 | 51 | 35 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTracker
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import timber.log.Timber
@AndroidEntryPoint
class NotificationOpenReceiver : BroadcastReceiver() {
@Inject
lateinit var analyticsTracker: AnalyticsTracker
override fun o... | ```suggestion
properties = mapOf("category" to category),
``` | import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsTracker
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import timber.log.Timber
@AndroidEntryPoint
class NotificationOpenReceiver : BroadcastReceiver() {
@Inject
late... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 26 | Kotlin | 0.571 | suggestion | 75 | 51 | 51 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
if (context == null || category == null) return
analyticsTracker.track(
event = AnalyticsEvent.NOTIFICATION_OPENED,
properties = buildMap {
put("category", category)
},
)
val originalIntent = Intent().apply {
intent.extras... | 🛑 It can potentially lead to crashes. Use `IntentCompat.getParcelableExtra()` instead. | val category = intent.getStringExtra(EXTRA_CATEGORY) ?: return
analyticsTracker.track(
event = AnalyticsEvent.NOTIFICATION_OPENED,
properties = mapOf(
"category" to category,
),
)
val originalIntent = Intent().apply {
flag... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 26 | Kotlin | 0.429 | bug | 86 | 51 | 51 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
@AndroidEntryPoint
class NotificationOpenReceiver : BroadcastReceiver() {
@Inject
lateinit var analyticsTracker: AnalyticsTracker
override fun onReceive(context: Context?, intent: Intent?) {
when (intent?.action) {
ACTION_REVAMP_NOTIFICATION_OPENED -> handleRevampedNotificationOpen(int... | ❓ I'm a bit unclear on what this code is doing. Is it copying the original `intent` and then replacing `action`, `flags`, and `component` with the ones from the extras? If that's the goal, I think there might be a simpler way to express it. But I might be misunderstanding the intention here.
```kotlin
Intent(inte... | import timber.log.Timber
@AndroidEntryPoint
class NotificationOpenReceiver : BroadcastReceiver() {
@Inject
lateinit var analyticsTracker: AnalyticsTracker
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
ACTION_REVAMP_NOTIFICATION_OPENED -> handleRevamp... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 26 | Kotlin | 0.857 | suggestion | 625 | 51 | 51 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
intent.removeExtra(it)
}
EXTRA_ORIGINAL_FLAGS -> {
flags = intent.getIntExtra(it, 0)
intent.removeExtra(it)
}
EXTRA_ORIGINAL_COMPONENT -> {
co... | ⚠️ Same nullability pattern is used here. I know we have quite a bit of this in the legacy parts of the codebase, but we should really try to avoid it going forward.
If a function or class can't operate with a `null` value, it probably shouldn't accept `null` in the first place. Instead, the caller should handle th... | }
putExtras(intent)
removeExtra(EXTRA_CATEGORY)
removeExtra(EXTRA_ORIGINAL_COMPONENT)
}
tryLaunchIntent(originalIntent, context)
}
private fun handleRevampedNotificationOpen(intent: Intent, context: Context) {
val subCategory = intent.getS... | @@ -0,0 +1,143 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import au.com.shiftyjelly.pocketcasts.analytics.AnalyticsEvent
+import au.com.shiftyjelly.pocketcasts.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiver.kt | 26 | Kotlin | 0.786 | bug | 542 | 51 | 51 | false | Add missing `notification_open` event | 4,261 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
import au.com.shiftyjelly.pocketcasts.models.entity.SmartPlaylist
import au.com.shiftyjelly.pocketcasts.models.entity.SmartPlaylist.Companion.SYNC_STATUS_NOT_SYNCED
import au.com.shiftyjelly.pocketcasts.models.type.PlaylistEpisodeSortType
import au.com.... | This is just for testing, right? As if the user isn't signed in, we can delete the row. | import au.com.shiftyjelly.pocketcasts.models.entity.PodcastEpisode
import au.com.shiftyjelly.pocketcasts.models.entity.SmartPlaylist
import au.com.shiftyjelly.pocketcasts.models.entity.SmartPlaylist.Companion.SYNC_STATUS_NOT_SYNCED
import au.com.shiftyjelly.pocketcasts.models.type.PlaylistEpisodeSortType
import au.com.... | @@ -29,6 +30,9 @@ abstract class PlaylistDao {
@Query("SELECT * FROM smart_playlists WHERE manual = 0 AND deleted = 0 AND draft = 0 ORDER BY sortPosition ASC")
abstract fun observeSmartPlaylists(): Flow<List<SmartPlaylist>>
+ @Query("UPDATE smart_playlists SET deleted = 1, syncStatus = ${SYNC_STATUS_NOT_... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/PlaylistDao.kt | 26 | Kotlin | 0.286 | suggestion | 88 | 51 | 51 | false | Add swipe to delete playlists | 4,267 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
PlaylistPreviewRow(
playlist = playlist,
showDivider = index != uiState.playlists.lastIndex,
onDelete = { onDelete(playlist) },
modifier = Modifier.animateItem(),
)
}
}
}
}
@Composabl... | ❓ what is the advantage of using this instead of setting the `style` prop on the `Text`? | playlist = playlist,
showDivider = index != uiState.playlists.lastIndex,
onDelete = { onDelete(playlist) },
modifier = Modifier.animateItem(),
)
}
}
}
}
@Composable
private fun Toolbar(
onCreateP... | @@ -0,0 +1,197 @@
+package au.com.shiftyjelly.pocketcasts.playlists
+
+import androidx.compose.animation.AnimatedVisibility
+import androidx.compose.animation.expandVertically
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.shrinkVertically
+import... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/PlaylistsPage.kt | 26 | Kotlin | 0.429 | question | 89 | 51 | 51 | false | Add playlists page bottom and top content | 4,269 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
) {
item {
Spacer(
Modifier.height(
if (FeatureFlag.isEnabled(Feature.NEW_ONBOARDING_UPGRADE)) {
0.dp
} else {
16.dp
... | 💡 We have `AnimatedNonNullVisibility` that you could use to avoid `null` in the content lambda. | ) {
item {
Spacer(
Modifier.height(
if (FeatureFlag.isEnabled(Feature.NEW_ONBOARDING_UPGRADE)) {
0.dp
} else {
16.dp
... | @@ -165,34 +166,38 @@ internal fun AccountDetailsPage(
.then(if (state.isAutomotive) Modifier.padding(top = 32.dp) else Modifier),
)
}
- when (bannerState) {
- is ProfileUpgradeBannerState.OldProfileUpgradeBannerState -... | modules/features/profile/src/main/java/au/com/shiftyjelly/pocketcasts/profile/AccountDetailsPage.kt | 26 | Kotlin | 0.571 | suggestion | 95 | 51 | 51 | false | [Onboarding] Update Account details page | 4,274 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import androidx.core.view.forEach
import androidx.core.view.get
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
/**
* [BottomSheetBehavior] that has a support for detecting nested scrolling in [ViewPager2].
*
* See [GitHub issue](http... | ```suggestion
false
``` | import androidx.core.view.forEach
import androidx.core.view.get
import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
/**
* [BottomSheetBehavior] that has a support for detecting nested scrolling in [ViewPager2].
*
* See [GitHub issue](http... | @@ -20,6 +21,22 @@ open class ViewPager2AwareBottomSheetBehavior<V : View> @JvmOverloads constructo
context: Context,
attrs: AttributeSet? = null,
) : BottomSheetBehavior<V>(context, attrs) {
+ private var preFlingInterceptor: PreFlingInterceptor? = null
+
+ fun setPreFlingInterceptor(interceptor: PreF... | modules/services/views/src/main/java/com/google/android/material/bottomsheet/ViewPager2AwareBottomSheetBehavior.kt | 26 | Kotlin | 0.429 | suggestion | 37 | 51 | 51 | false | Add resistance to dismissing playlist sheet | 4,297 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | MiSikora |
val spannable = getSummaryText(formatter, tintColor, showDuration = false, context)
spannable.toAnnotatedString()
}
}
@Composable
private fun PodcastEpisode.rememberTimeLeftText(): String {
val context = LocalContext.current
return remember(playedUpToMs, durationMs, isInProgress, context) {... | I believe this is the same as not using the episode status rule? In the current Filters create page, it would not be toggled on if this were the user's option. I wonder if this means the rule shouldn't be listed. | spannable.toAnnotatedString()
}
}
@Composable
private fun PodcastEpisode.rememberTimeLeftText(): String {
val context = LocalContext.current
return remember(playedUpToMs, durationMs, isInProgress, context) {
TimeHelper.getTimeLeft(playedUpToMs, durationMs.toLong(), isInProgress, context).te... | @@ -548,7 +548,41 @@ private fun AppliedRules.description(ruleType: RuleType) = when (ruleType) {
null -> null
}
- RuleType.EpisodeStatus -> TODO()
+ RuleType.EpisodeStatus -> {
+ if (episodeStatus != null) {
+ when {
+ episodeStatus.unplayed -> when {
+ ... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/create/SmartPlaylistPreviewPage.kt | 26 | Kotlin | 0.5 | suggestion | 213 | 51 | 51 | false | Control episode status rule | 4,302 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth(),
) {
Spacer(
modifier = Modifier.height(toolbarTopPadding + toolbarHeight + artworkTopPadding),
)
Crossfade(
targetSt... | :pick: our `TextH20` is quite similar in many props, you'd only need to override `lineHeight` and `fontWeigt`? | horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth(),
) {
Spacer(
modifier = Modifier.height(toolbarTopPadding + toolbarHeight + artworkTopPadding),
)
Crossfade(
targetState = podcasts,
... | @@ -90,9 +110,40 @@ internal fun PlaylistHeader(
)
}
}
- // Temporary empty space
Spacer(
- modifier = Modifier.height(100.dp),
+ modifier = Modifier.height(20.dp),
+ )
+ Text( | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/PlaylistHeader.kt | 26 | Kotlin | 0.5 | question | 110 | 51 | 51 | false | Display playlist's metadata | 4,335 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
animationSpec = artworkCrossfadeSpec,
) { podcasts ->
if (podcasts != null) {
PlaylistArtwork(
podcasts = podcasts,
artworkSize = artworkSize,
)
} else {
... | 💡 maybe you could `remember` this string creation to save some processor cycles | ) { podcasts ->
if (podcasts != null) {
PlaylistArtwork(
podcasts = podcasts,
artworkSize = artworkSize,
)
} else {
Spacer(
modifier = Modifier.... | @@ -90,9 +110,40 @@ internal fun PlaylistHeader(
)
}
}
- // Temporary empty space
Spacer(
- modifier = Modifier.height(100.dp),
+ modifier = Modifier.height(20.dp),
+ )
+ Text(
+ ... | modules/features/filters/src/main/java/au/com/shiftyjelly/pocketcasts/playlists/PlaylistHeader.kt | 26 | Kotlin | 0.429 | suggestion | 79 | 51 | 51 | false | Display playlist's metadata | 4,335 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | MiSikora |
isSelected: Boolean,
onClick: () -> Unit,
rowConfig: RowConfig,
modifier: Modifier = Modifier,
) {
Box(
modifier = modifier.fillMaxWidth(),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.clip(RoundedCornerShape(8.dp))
.ba... | ❓ I don't understand this change. Why do we enable clicks on an already selected element. | private fun SubscriptionPlanRow(
plan: SubscriptionPlan,
isSelected: Boolean,
onClick: () -> Unit,
rowConfig: RowConfig,
modifier: Modifier = Modifier,
) {
Box(
modifier = modifier.fillMaxWidth(),
) {
Row(
modifier = Modifier
.fillMaxWidth()
... | @@ -167,7 +169,6 @@ private fun SubscriptionPlanRow(
},
)
.clickable(
- enabled = !isSelected, | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/components/SubscriptionPlanRow.kt | 26 | Kotlin | 0.286 | suggestion | 89 | 51 | 51 | false | [Onboarding] Accessibility & Talkback | 4,341 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.uni... | ```suggestion
private const val WIDTH_DP = 202
```
I don't think the app should mention Figma, the rest of the app doesn't. | import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.uni... | @@ -60,20 +64,23 @@ private data class AnimationParams(
val rotationOffset: Int,
)
+private const val FIGMA_WIDTH_DP = 202 | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/upgrade/contextual/Bookmarks.kt | 26 | Kotlin | 0.786 | suggestion | 124 | 51 | 51 | false | [Onboarding] Animation updates | 4,354 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | sztomek |
import androidx.compose.ui.unit.dp
import androidx.core.graphics.createBitmap
import androidx.core.graphics.set
import com.google.zxing.BarcodeFormat
import com.google.zxing.EncodeHintType
import com.google.zxing.qrcode.QRCodeWriter
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import kotlinx.coroutines.D... | 💡 this and the `LaunchedEffect` could be replaced with a single `produceState<QrState>`
https://developer.android.com/develop/ui/compose/side-effects | import com.google.zxing.BarcodeFormat
import com.google.zxing.EncodeHintType
import com.google.zxing.qrcode.QRCodeWriter
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import timber.log.Timber
private sealed class QrState {
object ... | @@ -0,0 +1,118 @@
+package au.com.shiftyjelly.pocketcasts.compose
+
+import android.graphics.Bitmap
+import android.graphics.Color
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.DisposableEffect
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+impo... | automotive/src/main/java/au/com/shiftyjelly/pocketcasts/compose/QrPainter.kt | 26 | Kotlin | 0.571 | suggestion | 150 | 51 | 51 | false | Adds Automotive fallback QR code for URL handling | 4,362 | Automattic/pocket-casts-android | 1,688 | Kotlin | sztomek | geekygecko |
package au.com.shiftyjelly.pocketcasts.repositories.notification
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.IntentCompat
import au.com.shiftyjelly.pocketcasts.ana... | ⚠️ If this Activity is intended to be a transparent bootstrap, we should declare its theme in the Manifest as `android:theme="@android:style/Theme.NoDisplay"` and move all the logic to `onCreate()`. This theme ensures that there is no UI available for the Activity, and `onCreate()` must call `finish()`. | package au.com.shiftyjelly.pocketcasts.repositories.notification
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.IntentCompat
import au.com.shiftyjelly.pocketcasts.ana... | @@ -0,0 +1,119 @@
+package au.com.shiftyjelly.pocketcasts.repositories.notification
+
+import android.content.ComponentName
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
+import androidx.core.content.IntentCompat
+import au.com.... | modules/services/repositories/src/main/java/au/com/shiftyjelly/pocketcasts/repositories/notification/NotificationOpenReceiverActivity.kt | 16 | Kotlin | 0.643 | style | 304 | 41 | 41 | false | Fix notifications don't open | 4,365 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
package au.com.shiftyjelly.pocketcasts.transcripts.di
import au.com.shiftyjelly.pocketcasts.sharing.SharingClient
import au.com.shiftyjelly.pocketcasts.transcripts.TranscriptSharingClient
import au.com.shiftyjelly.pocketcasts.transcripts.asTranscriptClient
import dagger.Module
import dagger.Provides
import dagger.hilt... | Oops I copied this and forgot to rename it. | package au.com.shiftyjelly.pocketcasts.transcripts.di
import au.com.shiftyjelly.pocketcasts.sharing.SharingClient
import au.com.shiftyjelly.pocketcasts.transcripts.TranscriptSharingClient
import au.com.shiftyjelly.pocketcasts.transcripts.asTranscriptClient
import dagger.Module
import dagger.Provides
import dagger.hilt... | @@ -12,5 +12,5 @@ import dagger.hilt.components.SingletonComponent
@InstallIn(SingletonComponent::class)
object TranscriptsModule {
@Provides
- fun storySharingClient(client: SharingClient): TranscriptSharingClient = client.asTranscriptClient()
+ fun transcriptSharingClient(client: SharingClient): Transcri... | modules/features/transcripts/src/main/kotlin/au/com/shiftyjelly/pocketcasts/transcripts/di/TranscriptsModule.kt | 15 | Kotlin | 0.143 | suggestion | 44 | 17 | 17 | false | Adds a feature flag for share transcripts | 4,373 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | geekygecko |
import androidx.room.Transaction
import androidx.room.Upsert
import au.com.shiftyjelly.pocketcasts.models.db.helper.PodcastBookmark
import au.com.shiftyjelly.pocketcasts.models.db.helper.ProfileBookmark
import au.com.shiftyjelly.pocketcasts.models.entity.Bookmark
import au.com.shiftyjelly.pocketcasts.models.type.SyncSt... | Would it be good to use the variable you created `AppDatabase.SQLITE_BIND_ARG_LIMIT`? | import androidx.room.Transaction
import androidx.room.Upsert
import au.com.shiftyjelly.pocketcasts.models.db.AppDatabase
import au.com.shiftyjelly.pocketcasts.models.db.helper.PodcastBookmark
import au.com.shiftyjelly.pocketcasts.models.db.helper.ProfileBookmark
import au.com.shiftyjelly.pocketcasts.models.entity.Bookm... | @@ -16,9 +18,22 @@ abstract class BookmarkDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
abstract suspend fun insert(bookmark: Bookmark)
+ @Upsert
+ abstract suspend fun upsertAll(bookmarks: Collection<Bookmark>)
+
@Query("DELETE FROM bookmarks WHERE uuid = :uuid")
abstract suspend f... | modules/services/model/src/main/java/au/com/shiftyjelly/pocketcasts/models/db/dao/BookmarkDao.kt | 26 | Kotlin | 0.429 | question | 85 | 51 | 51 | false | Sync bookmarks using Protobuf | 4,394 | Automattic/pocket-casts-android | 1,688 | Kotlin | geekygecko | MiSikora |
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import au.com.shiftyjelly.pocketcasts.localization.R as LR
@HiltViewModel
class OnboardingInterestsViewModel @Inject constructor(
private val categoriesManager: CategoriesManager,
) : ViewModel() {
private val _state = MutableStateFlow(
... | ⚠️ This is an erroneous pattern when communicating between UI and ViewModel. It can lead to memory leaks, missing events, or even crashes. See this code:
```kotlin
viewModelScope.launch {
longOperation()
}
uiCallback()
```
When this code is triggered and the UI is destroyed while `longOperation` is running... | import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import au.com.shiftyjelly.pocketcasts.localization.R as LR
@HiltViewModel
class OnboardingInterestsViewModel @Inject constructor(
private val categoriesManager: CategoriesManager,
) : ViewModel() {
private val _state = MutableStateFlow(
... | @@ -29,7 +29,11 @@ class OnboardingInterestsViewModel @Inject constructor(
fetchCategories()
}
- fun skipSelection() {
+ fun skipSelection(doWhenFinished: () -> Unit) {
+ viewModelScope.launch {
+ categoriesManager.setInterestCategories(emptySet())
+ doWhenFinished()
+... | modules/features/account/src/main/java/au/com/shiftyjelly/pocketcasts/account/onboarding/recommendations/OnboardingInterestsViewModel.kt | 26 | Kotlin | 1 | bug | 1,139 | 51 | 51 | false | [Onboarding] Respect user's interests on Recommendations | 4,417 | Automattic/pocket-casts-android | 1,688 | Kotlin | MiSikora | sztomek |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.