Skip to content

Commit

Permalink
Add Localization Support for update message
Browse files Browse the repository at this point in the history
  • Loading branch information
appupgrade-dev committed Jan 15, 2023
1 parent 3cb0958 commit 614af85
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes will be documented in this file.

## [1.0.3] - 2023-01-16

* Add localization support for update message.

## [1.0.1] - 2023-01-12

* Update dependecies.

## [1.0.0] - 2023-01-10

* Hello World!.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ allprojects {
2. Add the dependency to your project
```groovy
dependencies {
implementation 'com.github.appupgrade-dev:app-upgrade-android-sdk:1.0.0'
implementation 'com.github.appupgrade-dev:app-upgrade-android-sdk:1.0.2'
}
```

Expand All @@ -61,6 +61,7 @@ val appInfo = AppInfo(
appVersion = "1.0.0",
platform = "android",
environment = "production"
appLanguage = "es" // Optional, used for localizing the update message.
)

//Optional
Expand All @@ -83,6 +84,7 @@ appUpgrade.checkForUpdates(this, xApiKey, appInfo, alertDialogConfig)
String appVersion = "1.0.0";
String platform = "android";
String environment = "production";
String appLanguage = "es"

AppInfo appInfo = new AppInfo(appId, appName, appVersion, platform, environment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
params["platform"] = appInfo.platform
params["environment"] = appInfo.environment

if (!appInfo.appLanguage.isNullOrEmpty()) {
params["app_language"] = appInfo.appLanguage
}

val call = appUpgradeApi.versionCheck(xApiKey, params)

call.enqueue(object : Callback<AppUpgradeResponse> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.appupgrade.app_upgrade_android_sdk.models

data class AlertDialogConfig(
val title: String?,
val updateButtonTitle: String?,
val laterButtonTitle: String?,
val title: String? = null,
val updateButtonTitle: String? = null,
val laterButtonTitle: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ data class AppInfo(
val appVersion: String,
val platform: String,
val environment: String,
val appLanguage: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.appupgrade.app_upgrade_android_sdk

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.appupgrade.app_upgrade_android_sdk.models.AlertDialogConfig
import com.appupgrade.app_upgrade_android_sdk.models.AppInfo

class MainActivity : AppCompatActivity() {
Expand All @@ -17,6 +18,7 @@ class MainActivity : AppCompatActivity() {
appVersion = "1.0.0",
platform = "android",
environment = "production",
appLanguage = "en"
)

AppUpgrade().checkForUpdates(this, xApiKey, appInfo);
Expand Down

0 comments on commit 614af85

Please sign in to comment.