Skip to content

Commit 669124d

Browse files
Merge pull request #225 from smswithoutborders/localize-chinese
Final changes
2 parents f17b11a + f2fc16e commit 669124d

50 files changed

Lines changed: 2039 additions & 317 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ android {
3737
"$projectDir/schemas".toString()]
3838
}
3939
}
40-
resourceConfigurations += ['en', 'fr', 'fa', 'es', 'tr', 'ar', 'de', 'sw']
40+
resourceConfigurations += ['en', 'fr', 'fa', 'es', 'tr', 'ar', 'de', 'sw', 'zh', 'ko', 'hi', 'sn']
4141

4242
manifestPlaceholders =
4343
['appAuthRedirectScheme': 'oauth.afkanerd.com']

app/src/main/java/com/example/sw0b_001/Modules/Helpers.kt

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -130,63 +130,4 @@ object Helpers {
130130
}
131131
}
132132

133-
fun triggerAccountRevoke(
134-
context: Context,
135-
// platform: AvailablePlatforms,
136-
account: StoredPlatformsEntity,
137-
onCompletedCallback: () -> Unit = {},
138-
onFailureCallback: (Exception) -> Unit = {}
139-
) {
140-
CoroutineScope(Dispatchers.IO).launch {
141-
val appContext = context.applicationContext
142-
var publishers: Publishers? = null
143-
try {
144-
val availablePlatform = Datastore.getDatastore(appContext)
145-
.availablePlatformsDao()
146-
.fetch(account.name!!)
147-
148-
if (availablePlatform == null) {
149-
throw IllegalStateException("Platform details not found for ${account.name}")
150-
}
151-
152-
val llt = Vaults.fetchLongLivedToken(appContext)
153-
if (llt.isEmpty()) {
154-
throw IllegalStateException("Cannot revoke without Long Lived Token.")
155-
}
156-
157-
publishers = Publishers(appContext)
158-
159-
val platformName = account.name!!
160-
val platformAccount = account.account!!
161-
162-
Log.i("Helpers", "Revoking ${availablePlatform.protocol_type} platform: $platformName ($platformAccount)")
163-
when(availablePlatform.protocol_type) {
164-
Platforms.ProtocolTypes.OAUTH2.type -> {
165-
publishers.revokeOAuthPlatforms(llt, platformName, platformAccount)
166-
}
167-
Platforms.ProtocolTypes.PNBA.type -> {
168-
publishers.revokePNBAPlatforms(llt, platformName, platformAccount)
169-
}
170-
else -> {
171-
Log.w("Helpers", "Unknown protocol type for revocation: ${availablePlatform.protocol_type}")
172-
173-
}
174-
}
175-
Log.d("Helpers", "Backend revocation successful for $platformName.")
176-
177-
178-
val deletedRows = Datastore.getDatastore(appContext).storedPlatformsDao()
179-
.delete(account.id)
180-
Log.d("Helpers", "Local platform deleted (Rows: $deletedRows) for ID: ${account.id}.")
181-
182-
withContext(Dispatchers.Main) { onCompletedCallback() }
183-
184-
} catch(e: Exception) {
185-
Log.e("Helpers", "Error during account revocation", e)
186-
withContext(Dispatchers.Main) { onFailureCallback(e) }
187-
} finally {
188-
publishers?.shutdown()
189-
}
190-
}
191-
}
192133
}

app/src/main/java/com/example/sw0b_001/ui/appbars/AboutAppBar.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fun AboutAppBar(
4949
IconButton(onClick = { navController.popBackStack() }) {
5050
Icon(
5151
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
52-
contentDescription = "Back"
52+
contentDescription = stringResource(R.string.back)
5353
)
5454
}
5555
},
@@ -67,7 +67,7 @@ fun AboutAppBar(
6767
Spacer(modifier = Modifier.width(4.dp))
6868
Icon(
6969
imageVector = Icons.Filled.BugReport,
70-
contentDescription = "Report Bug/Feedback"
70+
contentDescription = stringResource(R.string.report_bug_feedback)
7171
)
7272

7373

app/src/main/java/com/example/sw0b_001/ui/appbars/BottomNavBar.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fun BottomNavBar(
3232
NavigationBarItem(
3333
icon = { Icon(
3434
Icons.Filled.Home,
35-
contentDescription = "Recents",
35+
contentDescription = stringResource(R.string.recents),
3636
modifier = Modifier.size(20.dp)
3737
) },
3838
label = {
@@ -59,7 +59,7 @@ fun BottomNavBar(
5959
NavigationBarItem(
6060
icon = { Icon(
6161
Icons.Filled.PhoneAndroid,
62-
contentDescription = "Platforms",
62+
contentDescription = stringResource(R.string.platforms),
6363
modifier = Modifier.size(20.dp)
6464
) },
6565
label = { Text(
@@ -83,7 +83,7 @@ fun BottomNavBar(
8383
NavigationBarItem(
8484
icon = { Icon(
8585
Icons.Filled.Inbox,
86-
contentDescription = "Inbox",
86+
contentDescription = stringResource(R.string.inbox),
8787
modifier = Modifier.size(20.dp)
8888
) },
8989
label = { Text(
@@ -106,7 +106,7 @@ fun BottomNavBar(
106106
NavigationBarItem(
107107
icon = { Icon(
108108
Icons.Filled.Public,
109-
contentDescription = "Countries",
109+
contentDescription = stringResource(R.string.countries),
110110
modifier = Modifier.size(20.dp)
111111
) },
112112
label = { Text(

app/src/main/java/com/example/sw0b_001/ui/appbars/GatewayClientAppBar.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fun GatewayClientsAppBar(
5050
}) {
5151
Icon(
5252
imageVector = Icons.Filled.Refresh,
53-
contentDescription = "Menu"
53+
contentDescription = stringResource(R.string.menu)
5454
)
5555
}
5656
},

app/src/main/java/com/example/sw0b_001/ui/appbars/RecentAppBar.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ fun RecentAppBar(
8484
IconButton(onClick = onToggleSearch) {
8585
Icon(
8686
imageVector = Icons.Filled.Search,
87-
contentDescription = "Search"
87+
contentDescription = stringResource(R.string.search)
8888
)
8989
}
9090
}
9191

9292
IconButton(onClick = { showMenu = !showMenu }) {
9393
Icon(
9494
imageVector = Icons.Filled.MoreVert,
95-
contentDescription = "Menu"
95+
contentDescription = stringResource(R.string.menu)
9696
)
9797
}
9898
DropdownMenu(
@@ -159,7 +159,7 @@ fun RecentAppBar(
159159
}) {
160160
Icon(
161161
imageVector = Icons.Filled.Close,
162-
contentDescription = "Close Search"
162+
contentDescription = stringResource(R.string.close_search)
163163
)
164164
}
165165
}

app/src/main/java/com/example/sw0b_001/ui/appbars/RelayAppBar.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ import androidx.compose.runtime.Composable
1919
import androidx.compose.ui.Alignment
2020
import androidx.compose.ui.Modifier
2121
import androidx.compose.ui.platform.LocalContext
22+
import androidx.compose.ui.res.stringResource
2223
import androidx.compose.ui.text.font.FontWeight
2324
import androidx.compose.ui.tooling.preview.Preview
2425
import androidx.compose.ui.unit.dp
2526
import androidx.navigation.NavController
27+
import com.example.sw0b_001.R
2628
import com.example.sw0b_001.ui.theme.AppTheme
2729

2830
@OptIn(ExperimentalMaterial3Api::class)
@@ -38,7 +40,7 @@ fun RelayAppBar(
3840
IconButton(onClick = {navController.popBackStack()}) {
3941
Icon(
4042
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
41-
contentDescription = "Back"
43+
contentDescription = stringResource(R.string.back)
4244
)
4345
}
4446
},
@@ -48,7 +50,7 @@ fun RelayAppBar(
4850
}) {
4951
Icon(
5052
imageVector = Icons.Filled.Edit,
51-
contentDescription = "Edit",
53+
contentDescription = stringResource(R.string.edit),
5254
tint = MaterialTheme.colorScheme.onBackground
5355
)
5456
}
@@ -57,7 +59,7 @@ fun RelayAppBar(
5759
}) {
5860
Icon(
5961
imageVector = Icons.Filled.Delete,
60-
contentDescription = "Delete",
62+
contentDescription = stringResource(R.string.delete),
6163
tint = MaterialTheme.colorScheme.error
6264
)
6365
}

app/src/main/java/com/example/sw0b_001/ui/components/LanguageSelectionPopup.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ fun LanguageSelectionPopup(
4343
LanguageOption(stringResource(R.string.spanish), "es"),
4444
LanguageOption(stringResource(R.string.german), "de"),
4545
LanguageOption(stringResource(R.string.swahili), "sw"),
46-
LanguageOption(stringResource(R.string.turkish), "tr")
46+
LanguageOption(stringResource(R.string.turkish), "tr"),
47+
LanguageOption(stringResource(R.string.chinese), "zh"),
48+
LanguageOption(stringResource(R.string.korean), "ko"),
49+
LanguageOption(stringResource(R.string.hindi), "hi"),
50+
LanguageOption(stringResource(R.string.shona), "sn"),
4751
)
4852

4953
var selectedLanguageCode by remember { mutableStateOf(currentLanguageCode) }
@@ -56,7 +60,7 @@ fun LanguageSelectionPopup(
5660
.padding(16.dp)
5761
) {
5862
Text(
59-
text = "Select Language",
63+
text = stringResource(R.string.select_language),
6064
style = MaterialTheme.typography.titleMedium,
6165
fontWeight = FontWeight.Bold,
6266
color = MaterialTheme.colorScheme.onSurface

app/src/main/java/com/example/sw0b_001/ui/components/OnboardingNextButton.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ import androidx.compose.material3.Text
1515
import androidx.compose.runtime.Composable
1616
import androidx.compose.ui.Alignment
1717
import androidx.compose.ui.Modifier
18+
import androidx.compose.ui.res.stringResource
1819
import androidx.compose.ui.tooling.preview.Preview
1920
import androidx.compose.ui.unit.dp
21+
import com.example.sw0b_001.R
2022
import com.example.sw0b_001.ui.theme.AppTheme
2123

2224

@@ -37,7 +39,7 @@ fun OnboardingNextButton(onNext: () -> Unit, nextButtonText: String) {
3739
Text(text = nextButtonText, color = MaterialTheme.colorScheme.onPrimary)
3840
Icon(
3941
imageVector = Icons.AutoMirrored.Filled.ArrowForward,
40-
contentDescription = "Continue",
42+
contentDescription = stringResource(R.string.continue_text),
4143
modifier = Modifier
4244
.size(40.dp),
4345
tint = MaterialTheme.colorScheme.onPrimary
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.example.sw0b_001.ui.features
2+
3+
import androidx.annotation.DrawableRes
4+
import androidx.annotation.StringRes
5+
import com.example.sw0b_001.R
6+
7+
data class FeatureInfo(
8+
val id: String, // Unique ID for this feature (e.g. "alias_auth_v1", "new_theme_picker_v1")
9+
@StringRes val titleRes: Int,
10+
@StringRes val descriptionRes: Int,
11+
@DrawableRes val iconRes: Int? = null,
12+
)
13+
14+
object AppFeatures {
15+
val ALL_FEATURES = listOf(
16+
FeatureInfo(
17+
id = "oauth_token_storage_device_setting_info_alert",
18+
titleRes = R.string.new_feature_title,
19+
descriptionRes = R.string.oauth_token_storage_device_setting_info,
20+
iconRes = R.drawable.relaysms_icon_default_shape
21+
),
22+
23+
)
24+
}

0 commit comments

Comments
 (0)