Yuito-app-android/app/src/main/java/com/keylesspalace/tusky
Nik Clayton a5f479d79c
Fix saving changes to statuses when editing (#3103)
* Fix saving changes to statuses when editing

With the previous code backing out of a status editing operation where changes
had been made  (whether it was editing an existing status, a scheduled status,
or a draft) would prompt the user to save the changes as a new draft.

See https://github.com/tuskyapp/Tusky/issues/2704 and
https://github.com/tuskyapp/Tusky/issues/2705 for more detail.

The fix:

- Create an enum to represent the four different kinds of edits that can
  happen
  - Editing a new status (i.e., composing it for the first time)
  - Editing a posted status
  - Editing a draft
  - Editing a scheduled status

- Store this in ComposeOptions, and set it appropriately everywhere
  ComposeOptions is created.

- Check the edit kind when backing out of ComposeActivity, and use this to
  show one of three different dialogs as appropriate so the user can:
  - Save as new draft or discard changes
  - Continue editing or discard changes
  - Update existing draft or discard changes

Also fix ComposeViewModel.didChange(), which erroneously reported false if the
old text started with the new text (e.g., if the old text was "hello, world"
and it was edited to "hello", didChange() would not consider that to be a
change).

Fixes https://github.com/tuskyapp/Tusky/issues/2704,
https://github.com/tuskyapp/Tusky/issues/2705

* Use orEmpty extension function
2022-12-31 13:04:49 +01:00
..
adapter Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
appstore improve logout (#2579) 2022-06-20 16:45:54 +02:00
components Fix saving changes to statuses when editing (#3103) 2022-12-31 13:04:49 +01:00
db Add post editing capability (#2828) 2022-12-08 10:18:12 +01:00
di Add post editing capability (#2828) 2022-12-08 10:18:12 +01:00
entity Add post editing capability (#2828) 2022-12-08 10:18:12 +01:00
fragment Fix saving changes to statuses when editing (#3103) 2022-12-31 13:04:49 +01:00
interfaces Add view for browsing and unfollowing followed hashtags (#2794) 2022-12-01 19:24:27 +01:00
json use moshis Rfc3339DateJsonAdapter for json date parsing (#2584) 2022-06-16 18:51:35 +02:00
network Handoff media upload (#2947) 2022-12-29 19:58:23 +01:00
pager move AccountActivity and related classes to a new package (#2216) 2022-01-11 19:55:17 +01:00
receiver Handoff media upload (#2947) 2022-12-29 19:58:23 +01:00
service Handoff media upload (#2947) 2022-12-29 19:58:23 +01:00
settings 2952/proxy (#2961) 2022-12-07 19:29:18 +01:00
usecase Remove rxjava from API calls used by AccountViewModel::changeRelationship() (#3008) 2022-12-28 19:06:31 +01:00
util Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
view Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
viewdata Add support for moderation report notifications (#2887) 2022-12-01 20:11:55 +01:00
viewmodel Handle even more instance defaults (#2612) 2022-07-26 20:24:50 +02:00
AboutActivity.kt add ktlint plugin to project and apply default code style (#2209) 2021-06-28 21:13:24 +02:00
AccountListActivity.kt revert CompatExtensions (#2773) 2022-11-09 19:32:54 +01:00
AccountsInListFragment.kt migrate Lists from RxJava to Kotlin coroutines (#2537) 2022-05-18 18:45:35 +02:00
BaseActivity.java Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
BottomSheetActivity.kt Load goto social and microblog.pub urls in the app (#2945) 2022-12-03 12:16:17 +01:00
EditProfileActivity.kt Handle even more instance defaults (#2612) 2022-07-26 20:24:50 +02:00
FiltersActivity.kt Implement getFilters() without rxjava (#2990) 2022-12-07 19:30:53 +01:00
LicenseActivity.kt migrate `IOUtils` to Kotlin (#2763) 2022-11-07 20:10:06 +01:00
ListsActivity.kt Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
MainActivity.kt Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
SplashActivity.kt remove legacy notification channel cleanup (#2550) 2022-05-25 20:54:25 +02:00
StatusListActivity.kt Fix tests (#3022) 2022-12-08 09:58:58 +01:00
TabData.kt Replace the default federated timeline tab with the direct messages tab. (#2866) 2022-11-19 19:01:00 +01:00
TabPreferenceActivity.kt Api 33 support (#2719) 2022-11-04 19:22:38 +01:00
TuskyApplication.kt Convert util/{HttpHeaderLink,PairedList,TimestampUtils,ThemeUtils} to Kotlin (#3046) 2022-12-31 13:01:35 +01:00
ViewMediaActivity.kt Support a swipe down to dismiss video (#2879) 2022-12-05 14:33:38 +01:00