It was a good week, I migrated Girlfriend Plus and Boyfriend Plus to the new Android Billing Library, deleted a ton of unused code and made huge changes to the Story structure.


### Monday 8 March 2021
- [x] Watch this

I recall sleeping badly the night before this Monday, and started testing out my Billing V3 code on an Android device. It went quite badly, I repeatedly received a vague error message along the lines of "Something went wrong on our end". I got very pissed off at my Samsung Galaxy S7. It's not a good device for development. I went home early and watched videos and documentation about the Billing V3 Library.


### Tuesday 9 March 2021
- [x] Android: Buttons should gray out when disabled
- [x] Android: Put Payment code into it's own object.
- [x] Android: Use BillingHandler in BiographyActivity
- [x] Android: Use BillingHandler in ConversationListActivity
- [x] Android: remove startConnection() just start it in the constructor.
- [x] Android: Use BillingHandler in ConversationActivity
- [x] Android: Verify purchases work in BiographyActivity
- [x] Android: Verify purchases work in ConversationActivity
- [x] Android: App crashes when purchasing from the ConversationActivity
- [x] Android: Character should be unlocked if "You already own this item"
- [x] Android: Test billing changes on a real device.
- [x] Android: Enable BiographyActivity buttons if user cancels purchasing.
- [x] Android: Enable ConversationActivity buttons if user cancels purchasing.
- [x] Android: startConnection() and endConnection() ?
- [x] Android: Acknowledge purchases
- [x] Android: ConversationList activity should update when characters are purchased.
- [x] Android: Verify Characters unlock in ConversationListActivity

I started off Tuesday by searching up Pixel phones on Carousell. I found someone selling one for $890 HKD. I arranged to meet him at Mong Kok MTR station at lunch time. When he arrived I gave him $900 and he didn't have a $10 note, so he gave me $20 instead. Great success! With the new phone charging I decided to develop using the emulator, and was surprised to find out payment APIs were available. Things sure have changed since 2013. I was getting less errors, and was able to work through a lot of problems. It was a good day. The contract I signed with my shared office says I have to leave at 6 PM, but I was so focused I stayed until 8 PM.

Eventually I went home and coded a bit more at home, I got the app sort of working, but I wasn't 100% confident it was correct. So I decided to create a partial roll out of the new version. Except when I went through the release process I didn't think and clicked through to a 100% release. YOLO!


### Wednesday 10 March 2021 
- [x] Send PendingInteractions after a CREATE_USER_CHOICE message
- [x] Blog: Last week Review
- [x] API: Allow sending ConversationRead entities up the Websocket
- [x] Add supportedPlatforms to Story JSON
- [x] Add language to Story JSON
- [x] API: WsRegister   provide platform + language
- [x] API: WsLogin      provide platform + language
- [x] API: Send a message when the trial ends
- [x] API: Send a message when the story ends
- [x] API: Remove PostChoice Interaction
- [x] API: Remove LikePost Interaction
- [x] API: Remove CommentOnPost Interaction
- [x] API: Remove Post Interaction
- [x] API: Remove Choice interaction
- [x] API: Remove StartThread Interaction
- [x] API: Delete PostRoute.kt

I moved onto the server code, as I looked around the project I noticed a lot of Interactions that are not used and a lot of APIs that are never called. So I went on a deletion rampage.


### Thursday 11 March 2021 
- [x] Fix DEV issue, looks like a Story migration problem.
- [x] Migrate fields on story_json in the database.
- [x] Push to PROD
- [x] API: Story invalid if the final interaction is a Delay
- [x] API: Remove Room, all messages go into one room.
- [x] roomPicture as a top level story field
- [x] roomName as a top level story field
- [x] TODO: Refactor this, doesn't need to take in roomName and roomPicture
- [x] Remove roomId from ChatMessage
- [x] Remove roomId from ChatChoice
- [x] Remove description from ChatMessage
- [x] Remove roomId from ConversationRead
- [x] Remove roomId from UIConversation
- [x] Remove roomId from UpdateRoomPicture
- [x] Destroy the concept of a roomId

I broke the dev environment during my code deletion rampage, so I wrote a migration to fix the story data in dev. I ended up writing a Kotlin migration because the data I wanted to migrate was actually a JSON column.

Migrating JSON data in a SQL database. Gross.


### Friday 12 March 2021
- [x] Deploy to PROD
- [x] Remove the concept of StoryThreads
- [x] Remove threadId from UserChoice table
- [x] Simplify the models in UIDecision.kt
- [x] Fill out GetPreviousInteractionsTest
- [x] Fill out GetPendingInteractionsTest
- [x] Fill out GetInteractionsAfterTest
- [x] ChatChoice should not have a `title` property
- [x] Add sku to Story entities
- [x] Send out a ws message when UpdateRoomPicture triggers 
- [x] Send out a ws message when UpdateCharacterPicture triggers
- [x] JsonSubTypes.Type annotation can be chucked into the bin?
- [x] `sequenceId` renamed to `sequenceNumber`

More refactors really. Also during my code deletion rampage I deleted a bunch of tests. So I filled them back in.


### Saturday 13 March 2021
- [x] There are two types on WsMessages
- [x] What does this Jackson @JsonSubTypes do anyway?
- [x] Add storyId to UIChatRoom
- [x] Android: Test in PROD
- [x] Android: Test billing changes on a real device.
- [x] Android: Use token when opening websocket if available.
- [x] Send KA messages every 40 seconds
- [x] API: Only send down Android stories
- [x] API: Stories should have full URLs in content
A new crash that only effects Android 4 devices.

I start off by noticing a bunch of crashes on Android 4 devices. I look around discover OkHttp no longer supports Android 4 devices due to minimum SSL concerns. I read around and discover a few options:

  1. Use the 3.12.x branch of OkHttp.
  2. Increase the minSdkVersion of my app.
  3. Use some pro technique to grab TLS 1.2 support from Google Play.

Option #3 looked like a lot of work and I didn't really want to do it. Option #2 would cut out users from my app. A small amount of users, but I still didn't want to do that. Option #1 was pretty easy to do so that's what I did.