diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ae78527..c1b5372 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -2,7 +2,6 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.compose) alias(libs.plugins.hilt) - alias(libs.plugins.kotlin.parcelize) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.ksp) } @@ -115,7 +114,6 @@ dependencies { testImplementation(platform(libs.androidx.compose.bom)) testImplementation(libs.androidx.compose.ui.test.junit4) testImplementation(libs.androidx.navigation.testing) - testImplementation(libs.hilt.android.testing) testImplementation(libs.kotlin.test) testImplementation(libs.kotlinx.coroutines.test) testImplementation(libs.robolectric) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index a0c9508..836e53d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,22 +1,7 @@ --dontwarn org.bouncycastle.jsse.BCSSLParameters --dontwarn org.bouncycastle.jsse.BCSSLSocket --dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider --dontwarn org.conscrypt.Conscrypt$Version --dontwarn org.conscrypt.Conscrypt --dontwarn org.conscrypt.ConscryptHostnameVerifier --dontwarn org.openjsse.javax.net.ssl.SSLParameters --dontwarn org.openjsse.javax.net.ssl.SSLSocket --dontwarn org.openjsse.net.ssl.OpenJSSE - # Fix for Retrofit issue https://github.com/square/retrofit/issues/3751 -# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). +# Keep the generic signature of Call (R8 full mode strips signatures from non-kept items). +# Retrofit's own rules already keep Response and kotlin.coroutines.Continuation. -keep,allowobfuscation,allowshrinking interface retrofit2.Call --keep,allowobfuscation,allowshrinking class retrofit2.Response - -# With R8 full mode generic signatures are stripped for classes that are not -# kept. Suspend functions are wrapped in continuations where the type argument -# is used. --keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation # Keep DataStore fields -keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite* { diff --git a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt index f486a0b..7c93533 100644 --- a/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt +++ b/app/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/di/modules/NetModule.kt @@ -1,6 +1,5 @@ package com.nativeapptemplate.nativeapptemplatefree.di.modules -import androidx.tracing.trace import com.nativeapptemplate.nativeapptemplatefree.BuildConfig import com.nativeapptemplate.nativeapptemplatefree.NativeAppTemplateConstants import com.nativeapptemplate.nativeapptemplatefree.data.item_tag.ItemTagApi @@ -17,7 +16,6 @@ import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent import kotlinx.serialization.json.Json -import okhttp3.Call import okhttp3.MediaType.Companion.toMediaType import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor @@ -89,21 +87,6 @@ class NetModule { @Provides fun provideItemTagApi(retrofit: Retrofit): ItemTagApi = ItemTagApi.create(retrofit) - - @Provides - @Singleton - fun okHttpCallFactory(): Call.Factory = trace("NativeAppTemplateOkHttpClient") { - OkHttpClient.Builder() - .addInterceptor( - HttpLoggingInterceptor() - .apply { - if (BuildConfig.DEBUG) { - setLevel(HttpLoggingInterceptor.Level.BODY) - } - }, - ) - .build() - } } /** diff --git a/app/src/main/res/drawable/ic_placeholder_default.xml b/app/src/main/res/drawable/ic_placeholder_default.xml deleted file mode 100644 index 9fa327c..0000000 --- a/app/src/main/res/drawable/ic_placeholder_default.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml deleted file mode 100644 index 1084c24..0000000 --- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp deleted file mode 100644 index 791c41c..0000000 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp deleted file mode 100644 index 5e72c92..0000000 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp deleted file mode 100644 index 3d1622d..0000000 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp deleted file mode 100644 index e7b368d..0000000 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp deleted file mode 100644 index 7566abd..0000000 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index eafe212..b9522da 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -32,8 +32,6 @@ 端末の設定で変更 メールもこの言語で届きます。 ⚠️ インターネットに接続されていません - 手順 - 開く よろしいですか? 名前 名前を入力してください。 @@ -41,9 +39,6 @@ メールアドレスの形式が正しくありません。 パスワードを入力してください。 パスワードが正しくありません。 - 権限 - この操作を行う権限がありません。 - キャンセル OK 同意する @@ -83,7 +78,6 @@ 店舗を追加 店舗 店舗名 - 店舗名を入力してください。 店舗名が正しくありません。 店舗の説明が正しくありません。 名前は1〜%1$d文字で入力してください。 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7b70779..62980b4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -28,8 +28,6 @@ English 日本語 ⚠️ You aren’t connected to the internet - Instructions - Open Are you sure? Full Name Full name is required. @@ -37,9 +35,6 @@ Email is invalid. Password is required. Password is invalid. - Role - You are not authorized to perform this action. - Cancel OK Accept @@ -51,13 +46,13 @@ Forgot your password? - An email has been sent the email containing instructions for resetting your password." + An email with instructions for resetting your password has been sent. Send me reset password instructions Resend confirmation instructions Didn\'t receive confirmation instructions? - An email has been sent the email containing instructions for confirming your email address. + An email with instructions for confirming your email address has been sent. Update App @@ -78,7 +73,6 @@ Add Shop Shops Shop Name - Shop name is required. Shop name is invalid. Shop description is invalid. Name must be 1-%1$d characters. diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestCryptoModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestCryptoModule.kt deleted file mode 100644 index b89fd5d..0000000 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestCryptoModule.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.nativeapptemplate.nativeapptemplatefree.datastoreTest - -import com.google.crypto.tink.Aead -import com.google.crypto.tink.KeyTemplates -import com.google.crypto.tink.KeysetHandle -import com.google.crypto.tink.RegistryConfiguration -import com.google.crypto.tink.aead.AeadConfig -import com.nativeapptemplate.nativeapptemplatefree.di.modules.CryptoModule -import dagger.Module -import dagger.Provides -import dagger.hilt.components.SingletonComponent -import dagger.hilt.testing.TestInstallIn -import javax.inject.Singleton - -@Module -@TestInstallIn( - components = [SingletonComponent::class], - replaces = [CryptoModule::class], -) -internal object TestCryptoModule { - @Provides - @Singleton - fun providesAead(): Aead { - AeadConfig.register() - val keysetHandle = KeysetHandle.generateNew(KeyTemplates.get("AES256_GCM")) - return keysetHandle.getPrimitive(RegistryConfiguration.get(), Aead::class.java) - } -} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt deleted file mode 100644 index d9ed0bb..0000000 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/datastoreTest/TestDataStoreModule.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.nativeapptemplate.nativeapptemplatefree.datastoreTest - -import androidx.datastore.core.DataStore -import com.nativeapptemplate.nativeapptemplatefree.UserPreferences -import com.nativeapptemplate.nativeapptemplatefree.datastore.UserPreferencesSerializer -import com.nativeapptemplate.nativeapptemplatefree.di.modules.DataStoreModule -import dagger.Module -import dagger.Provides -import dagger.hilt.components.SingletonComponent -import dagger.hilt.testing.TestInstallIn -import javax.inject.Singleton - -@Module -@TestInstallIn( - components = [SingletonComponent::class], - replaces = [DataStoreModule::class], -) -internal object TestDataStoreModule { - @Provides - @Singleton - fun providesUserPreferencesDataStore( - serializer: UserPreferencesSerializer, - ): DataStore = InMemoryDataStore(serializer.defaultValue) -} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt deleted file mode 100644 index faed07f..0000000 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatcherModule.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.nativeapptemplate.nativeapptemplatefree.testing.di - -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import kotlinx.coroutines.test.TestDispatcher -import kotlinx.coroutines.test.UnconfinedTestDispatcher -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -internal object TestDispatcherModule { - @Provides - @Singleton - fun providesTestDispatcher(): TestDispatcher = UnconfinedTestDispatcher() -} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt deleted file mode 100644 index 32e0fe6..0000000 --- a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/testing/di/TestDispatchersModule.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.nativeapptemplate.nativeapptemplatefree.testing.di - -import com.nativeapptemplate.nativeapptemplatefree.di.modules.DispatchersModule -import com.nativeapptemplate.nativeapptemplatefree.network.Dispatcher -import com.nativeapptemplate.nativeapptemplatefree.network.NativeAppTemplateDispatchers -import dagger.Module -import dagger.Provides -import dagger.hilt.components.SingletonComponent -import dagger.hilt.testing.TestInstallIn -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.test.TestDispatcher - -@Module -@TestInstallIn( - components = [SingletonComponent::class], - replaces = [DispatchersModule::class], -) -internal object TestDispatchersModule { - @Provides - @Dispatcher(NativeAppTemplateDispatchers.IO) - fun providesIODispatcher(testDispatcher: TestDispatcher): CoroutineDispatcher = testDispatcher - - @Provides - @Dispatcher(NativeAppTemplateDispatchers.Default) - fun providesDefaultDispatcher( - testDispatcher: TestDispatcher, - ): CoroutineDispatcher = testDispatcher -} diff --git a/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SentInstructionsMessagesTest.kt b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SentInstructionsMessagesTest.kt new file mode 100644 index 0000000..b39fad3 --- /dev/null +++ b/app/src/test/kotlin/com/nativeapptemplate/nativeapptemplatefree/ui/app_root/SentInstructionsMessagesTest.kt @@ -0,0 +1,36 @@ +package com.nativeapptemplate.nativeapptemplatefree.ui.app_root + +import android.content.Context +import androidx.test.core.app.ApplicationProvider +import com.nativeapptemplate.nativeapptemplatefree.R +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner + +/** + * The alerts shown after Forgot Password and Resend Confirmation Instructions. The English text + * says what values-ja says: "パスワード再設定の案内を記載したメールを送信しました。" and + * "メールアドレスの確認方法を記載したメールを送信しました。" (an email with the instructions was sent). + * It used to read "An email has been sent the email containing ...", the reset one with a stray `"`. + */ +@RunWith(RobolectricTestRunner::class) +class SentInstructionsMessagesTest { + private val context = ApplicationProvider.getApplicationContext() + + @Test + fun sentResetPasswordInstruction_isOneCleanSentence() { + assertEquals( + "An email with instructions for resetting your password has been sent.", + context.getString(R.string.sent_reset_password_instruction), + ) + } + + @Test + fun sentConfirmationInstruction_isOneCleanSentence() { + assertEquals( + "An email with instructions for confirming your email address has been sent.", + context.getString(R.string.sent_confirmation_instruction), + ) + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 55cf119..6336585 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,7 +51,6 @@ androidx-navigation-testing = { group = "androidx.navigation", name = "navigatio androidx-profileinstaller = { group = "androidx.profileinstaller", name = "profileinstaller", version.ref = "androidxProfileinstaller" } androidx-tracing-ktx = { group = "androidx.tracing", name = "tracing-ktx", version.ref = "androidxTracing" } hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } -hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } junit = { group = "junit", name = "junit", version.ref = "junit4" } kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } diff --git a/model/build.gradle.kts b/model/build.gradle.kts index 479ec55..4e7234d 100644 --- a/model/build.gradle.kts +++ b/model/build.gradle.kts @@ -9,13 +9,6 @@ android { defaultConfig { minSdk = 26 - - buildTypes { - release { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") - } - } } kotlin { diff --git a/model/proguard-rules.pro b/model/proguard-rules.pro deleted file mode 100644 index 9b219a3..0000000 --- a/model/proguard-rules.pro +++ /dev/null @@ -1 +0,0 @@ --keep com.nativeapptemplate.nativeapptemplatefree.model.** \ No newline at end of file diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt index 7adcb5a..3622bdf 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Attributes.kt @@ -41,24 +41,9 @@ data class Attributes( @SerialName("account_name") val accountName: String? = null, - @SerialName("shopkeeper_id") - val shopkeeperId: String? = null, - @SerialName("shop_id") val shopId: String? = null, - @SerialName("owner_id") - val ownerId: String? = null, - - @SerialName("owner_name") - val ownerName: String? = null, - - @SerialName("is_admin") - val isAdmin: Boolean? = null, - - @SerialName("shops_count") - val shopsCount: Int? = null, - @SerialName("shop_name") val shopName: String? = null, diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt index fa498fe..b5bd0c1 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Data.kt @@ -14,8 +14,6 @@ data class Data( val meta: Meta? = null, val isOptionsRevealed: Boolean = false, ) : Parcelable { - fun getCreatedAt(): String = attributes?.createdAt ?: "" - fun getName(): String = attributes?.name ?: "" fun getState(): String? = attributes?.state diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt index 5149da5..3b24ca7 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/ItemTag.kt @@ -36,6 +36,4 @@ data class ItemTag( fun getShopName(): String = getData()?.getShopName() ?: "" fun getCompletedAt(): String? = getData()?.getCompletedAt() - - fun getCreatedAt(): String? = getData()?.getCreatedAt() } diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt index 6a53ce1..eb0c2bb 100644 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt +++ b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Relationships.kt @@ -7,8 +7,6 @@ import kotlinx.serialization.Serializable @Serializable @Parcelize data class Relationships( - val shopkeepers: Shopkeepers? = null, - val shop: Shop? = null, val shops: Shops? = null, diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt deleted file mode 100644 index 7c46a9b..0000000 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeeper.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.nativeapptemplate.nativeapptemplatefree.model - -import android.os.Parcelable -import kotlinx.parcelize.Parcelize -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -@Parcelize -data class Shopkeeper( - @SerialName("data") - var datum: Data? = null, - val meta: Meta? = null, - val included: List? = null, -) : Parcelable { - fun getData(): Data? { - if (included.isNullOrEmpty()) { - return datum - } - - return datum?.updateRelationships(included) - } - - fun getName(): String? = getData()?.getName() -} diff --git a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt b/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt deleted file mode 100644 index 990f7a2..0000000 --- a/model/src/main/kotlin/com/nativeapptemplate/nativeapptemplatefree/model/Shopkeepers.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.nativeapptemplate.nativeapptemplatefree.model - -import android.os.Parcelable -import kotlinx.parcelize.Parcelize -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -@Parcelize -data class Shopkeepers( - @SerialName("data") - val datum: List = emptyList(), - val included: List? = null, - val meta: Meta? = null, -) : Parcelable