Commit Graph

8 Commits

Author SHA1 Message Date
Nik Clayton 710e209e34
refactor: Ongoing work to remove the `activeAccount` idiom (#964)
Continue the work to remove the "activeAccount" idiom.

- Uses a new PachliAccount type through most of the app. This holds
information that was previously accessed separately (e.g., content
filters, lists) in one place. The information is loaded when the app
launches or the active account switches.

- Fetching data when the account is switched / loaded simplifies error
handling, as more code can now assume the data has already been loaded.
If it hasn't the code path is simply unreachable.

- This opens up the possibility of "acting as one account while logged
in as another". E.g., have two accounts, and be logged in to one account
and boost a post you've seen from your other account.

- Add a database migration to populate existing accounts with default
data when the user updates the app.

- Refactor code that used those list and filter repositories to get the
data from the PachliAccount instead. New local and remote data sources
are implemented, and the list and filter repositories mediate between
those sources.

- Start a ViewModel for MainActivity, which includes:
  - Sending user actions as UiAction objects
  - Providing a flow of uiState for MainActivity to react to
  - Remove most uses of SharedPreferencesRepository from MainActivity
  - Show messages about errors that occur when logging in

- Refactor intent routing in MainActivity to make the logic clearer.

- Add new `core.data` types to push more `core.network` types out of the
UI code
  - `core.data.model.MastodonList` for `core.network.model.MastoList`
  - `core.data.model.Server` for `core.network.model.Server`

- Continue the work to send the Pachli account ID to the code that uses
it.
  - Most view models now get the account ID via assisted injection.
- QueuedMedia now includes the AccountEntity so it can operate with any
account. Modify the `uploadMedia` API call to include explicit
authentication details.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-13 11:45:16 +01:00
Nik Clayton 0d5d118267
refactor: Move AccountManager to core.data.repository (#976) 2024-10-03 21:28:01 +02:00
Nik Clayton af58de5a8f
refactor: Enable core library desugaring as build convention logic (#480)
Once desugaring is enabled it needs to be enabled for up/down the
dependency chain, so enable it in the shared configuration defined by
the build convention code.

Highlighted a failing test that wasn't being run, so fix that too.
2024-02-29 09:43:44 +01:00
Nik Clayton 54d7888316
feat: Include extra logs in error reports from orange release builds (#414)
Release builds normally strip out all logging to reduce the number of
disk writes and reduce UI jank.

These logs would still be useful in user error reports from orange
builds. To preseve them:

- Implement a simple `RingBuffer`.

- Create `TreeRing`, a `Timber` `Tree` logger that logs to a
`RingBuffer` instance in orange release builds.

- Create `TreeRingCollector`, called when ACRA reports are generated,
which includes the contents of the ring buffer in the report.

- Enable desugaring to allow the use of java.time libraries on older
Android versions.

- Disable ProGuard obfuscation of class names as the obfuscation adds
additional de-obfuscation steps when handling error reports from users.
2024-02-04 15:17:46 +01:00
Nik Clayton 1488c13c42
feat: Allow the user to send an error report without a crash (#406)
Getting error reports with logs of strange behaviour is useful even if
the app doesn't crash.

Move crash reporting in to `core.activity`, and provide a menu option
(in orange builds) to trigger a non-fatal crash report that is handled
the same way (i.e., sent by e-mail) as a regular crash report.

`BaseActivity` has to be able to create and handle menus, so adjust
subclasses to call the superclass when necessary.

Update `tools/mvstring` to be able to move strings between different
flavour directories, not just `main`.
2024-02-02 15:34:31 +01:00
Nik Clayton 86d800b1c8
refactor: Modularise "about" activities (#405)
Continue modularisation by moving activities in the "About" feature to a
new `feature.about` module.

Implement `feature.about:
- Move `AboutActivity`, `LicenseActivity`, and `PrivacyPolicyActivity`
here.
- Update `markdown2resource` plugin to work with libraries

Implement `core.data`:
- Types and repositories used through the app
- Move `InstanceInfo` and `InstanceInfoRepository` here so they are
available to `feature.about`.

Implement `core.ui`:
- App-specific views, spans, and other UI content
- Move `ClickableSpanTextView` and `NoUnderlineURLSpan` here so they are
available to `feature.about`.
2024-02-02 15:14:31 +01:00
Nik Clayton 7bf015432d
refactor: Remove unnecesary parcelize plugin import (#407) 2024-02-02 15:12:55 +01:00
Nik Clayton f0fc0fd530
refactor: Modularise core activity classes, (#393)
Continue modularisation by moving core activity classes that almost all
activities depende on to a `core.activity` module. This includes
core "helper" classes as well.

Implement core.activity:
- Contains BaseActivity, BottomSheetActivity
- Contains LinkHelper and other utility classes used by activities

Implement core.common.extensions:
- Move ViewBindingExtensions and ViewExtensions here

Implement core.common.util:
- Move BlurHashDecoder and VersionName here

Implement core.designsystem:
- Holds common resources (animations, colours, drawables, etc) used
  through the app
- Import "core.designsystem.R as DR" through the app to distinguish
  from the module's own resources

Implement feature.login:
- Move the LoginActivity and related code/resources to its own module

Implement tools/mvstring
- Moves string resources (and all translations) from one module to
  another
2024-01-30 11:37:00 +01:00