From ee972de33181ee1717e375f9b45d96a8af07e8ba Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Tue, 9 Jul 2024 13:45:27 +0900 Subject: [PATCH 1/6] mod: pass language code properly when do genshin impact check-in --- .../croissant/data/api/dao/GenshinImpactCheckInService.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt b/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt index cd953ecf..6cec80c4 100644 --- a/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt +++ b/data/src/main/kotlin/com/joeloewi/croissant/data/api/dao/GenshinImpactCheckInService.kt @@ -5,16 +5,15 @@ import com.skydoves.sandwich.ApiResponse import retrofit2.http.Body import retrofit2.http.Header import retrofit2.http.POST +import retrofit2.http.Query import java.util.Locale interface GenshinImpactCheckInService { @POST("event/sol/sign") suspend fun attend( + @Query("lang") language: String = Locale.getDefault().toLanguageTag().lowercase(), @Header("Cookie") cookie: String, - @Body params: Map = mapOf( - "act_id" to "e202102251931481", - "lang" to Locale.getDefault().toLanguageTag().lowercase() - ) + @Body params: Map = mapOf("act_id" to "e202102251931481") ): ApiResponse } \ No newline at end of file From 21caff0045511f29cdd04e62ea231c2379110186 Mon Sep 17 00:00:00 2001 From: joeloewi7178 Date: Tue, 9 Jul 2024 15:55:51 +0900 Subject: [PATCH 2/6] mod: use custom coroutine scope instead of process lifecycle scope mod: inject dependencies by resolving requested class (initializer) add: file header and its settings --- .idea/file.template.settings.xml | 8 ++++ .idea/fileTemplates/includes/File Header.java | 16 +++++++ .../com/joeloewi/croissant/di/EntryPoints.kt | 44 +++++++------------ .../croissant/initializer/CoilInitializer.kt | 8 ++-- .../NotificationChannelInitializer.kt | 9 ++-- .../initializer/WorkManagerInitializer.kt | 16 +++++-- .../croissant/receiver/AlarmReceiver.kt | 14 +++--- .../croissant/receiver/MigrationHelper.kt | 9 ++-- .../receiver/ResinStatusWidgetProvider.kt | 11 ++--- .../receiver/TimeZoneChangedReceiver.kt | 9 ++-- .../croissant/data/di/CoroutineScopeModule.kt | 36 +++++++++++++++ .../croissant/data/di/NetworkEntryPoint.kt | 41 +++++++++++++++++ .../initializer/SandwichCustomInitializer.kt | 20 ++++----- 13 files changed, 175 insertions(+), 66 deletions(-) create mode 100644 .idea/file.template.settings.xml create mode 100644 .idea/fileTemplates/includes/File Header.java create mode 100644 data/src/main/kotlin/com/joeloewi/croissant/data/di/CoroutineScopeModule.kt create mode 100644 data/src/main/kotlin/com/joeloewi/croissant/data/di/NetworkEntryPoint.kt diff --git a/.idea/file.template.settings.xml b/.idea/file.template.settings.xml new file mode 100644 index 00000000..d8cf7e7b --- /dev/null +++ b/.idea/file.template.settings.xml @@ -0,0 +1,8 @@ + + + + +