@@ -2,6 +2,8 @@ package io.github.sds100.keymapper.base.utils
2
2
3
3
import android.content.pm.PackageManager
4
4
import io.github.sds100.keymapper.base.R
5
+ import io.github.sds100.keymapper.base.purchasing.ProductId
6
+ import io.github.sds100.keymapper.base.purchasing.PurchasingError
5
7
import io.github.sds100.keymapper.base.utils.ui.ResourceProvider
6
8
import io.github.sds100.keymapper.common.utils.BuildUtils
7
9
import io.github.sds100.keymapper.common.utils.KMError
@@ -173,6 +175,39 @@ fun KMError.getFullMessage(resourceProvider: ResourceProvider): String {
173
175
KMError .InvalidBackup -> resourceProvider.getString(R .string.error_invalid_backup)
174
176
KMError .MalformedUrl -> resourceProvider.getString(R .string.error_malformed_url)
175
177
KMError .UiElementNotFound -> resourceProvider.getString(R .string.error_ui_element_not_found)
178
+
179
+ PurchasingError .PurchasingProcessError .Cancelled -> resourceProvider.getString(
180
+ R .string.purchasing_error_cancelled,
181
+ )
182
+
183
+ PurchasingError .PurchasingProcessError .NetworkError -> resourceProvider.getString(
184
+ R .string.purchasing_error_network,
185
+ )
186
+
187
+ PurchasingError .PurchasingProcessError .ProductNotFound -> resourceProvider.getString(
188
+ R .string.purchasing_error_product_not_found,
189
+ )
190
+
191
+ PurchasingError .PurchasingProcessError .StoreProblem -> resourceProvider.getString(
192
+ R .string.purchasing_error_store_problem,
193
+ )
194
+
195
+ PurchasingError .PurchasingProcessError .PaymentPending -> resourceProvider.getString(
196
+ R .string.purchasing_error_payment_pending,
197
+ )
198
+
199
+ PurchasingError .PurchasingProcessError .PurchaseInvalid -> resourceProvider.getString(
200
+ R .string.purchasing_error_purchase_invalid,
201
+ )
202
+
203
+ is PurchasingError .PurchasingProcessError .Unexpected -> message
204
+
205
+ is PurchasingError .ProductNotPurchased -> when (product) {
206
+ ProductId .ASSISTANT_TRIGGER -> resourceProvider.getString(R .string.purchasing_error_assistant_not_purchased_home_screen)
207
+ ProductId .FLOATING_BUTTONS -> resourceProvider.getString(R .string.purchasing_error_floating_buttons_not_purchased_home_screen)
208
+ }
209
+
210
+ PurchasingError .PurchasingNotImplemented -> resourceProvider.getString(R .string.purchasing_error_not_implemented)
176
211
else -> throw IllegalArgumentException (" Unknown error $this " )
177
212
}
178
213
}
0 commit comments