-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from gunyu1019/develop
v1.2.0 Release!
- Loading branch information
Showing
55 changed files
with
2,274 additions
and
691 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/java/kr/yhs/traffic/BaseEncryptedSharedPreference.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package kr.yhs.traffic | ||
|
||
import android.content.Context | ||
import android.content.SharedPreferences | ||
import androidx.security.crypto.EncryptedSharedPreferences | ||
import androidx.security.crypto.MasterKey | ||
|
||
open class BaseEncryptedSharedPreference(private val context: Context) { | ||
lateinit var masterKey: MasterKey | ||
|
||
fun getPreferences(filename: String): SharedPreferences = | ||
EncryptedSharedPreferences.create( | ||
context, filename, masterKey, | ||
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV, | ||
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM | ||
) | ||
|
||
fun masterKeyBuild() { | ||
masterKey = MasterKey.Builder(context) | ||
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM) | ||
.build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...in/java/kr/yhs/traffic/ui/pages/Screen.kt → app/src/main/java/kr/yhs/traffic/Screen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kr.yhs.traffic.ui.pages | ||
package kr.yhs.traffic | ||
|
||
const val STATION_TYPE = "stationType" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package kr.yhs.traffic | ||
|
||
import android.os.Bundle | ||
import androidx.activity.compose.setContent | ||
import androidx.fragment.app.FragmentActivity | ||
import androidx.wear.tiles.TileService | ||
import kr.yhs.traffic.ui.ComposeSettingTile | ||
import kr.yhs.traffic.utils.ClientBuilder | ||
import kr.yhs.traffic.utils.TrafficClient | ||
|
||
class SettingTileActivity: FragmentActivity() { | ||
var client: TrafficClient? = null | ||
private val sharedPreference = BaseEncryptedSharedPreference(this) | ||
|
||
fun getPreferences(filename: String) = sharedPreference.getPreferences(filename) | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
sharedPreference.masterKeyBuild() | ||
val clickableId = intent.getStringExtra(TileService.EXTRA_CLICKABLE_ID) | ||
val stationTileType = StationTileType::class.sealedSubclasses.filter { | ||
it.objectInstance?.id == clickableId | ||
}[0].objectInstance | ||
|
||
val clientBuilder = ClientBuilder() | ||
clientBuilder.httpClient = clientBuilder.httpClientBuild() | ||
|
||
val retrofit = clientBuilder.build() | ||
client = retrofit.create(TrafficClient::class.java) | ||
|
||
setContent { | ||
ComposeSettingTile(this, stationTileType!!).Content() | ||
} | ||
} | ||
} |
Oops, something went wrong.