Skip to content

Commit

Permalink
Refactor App to Jetpack Compose
Browse files Browse the repository at this point in the history
App Links: Jade Setup
Support Promos
Support HW WO
  • Loading branch information
angelix committed Nov 13, 2024
1 parent 4810e85 commit 0e7df5b
Show file tree
Hide file tree
Showing 771 changed files with 5,463 additions and 53,123 deletions.
8 changes: 8 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ production_debug:
entrypoint: [""]
stage: build
when: manual
cache:
policy: pull
artifacts:
name: "$CI_PROJECT_NAME-$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
expire_in: 7 days
Expand Down Expand Up @@ -147,6 +149,8 @@ gdk_commit:
tags:
- ga
when: manual
cache:
policy: pull
variables:
GDK_COMMIT: master
GIT_SUBMODULE_STRATEGY: recursive
Expand All @@ -167,6 +171,8 @@ build_google_play:
entrypoint: [""]
stage: build
when: manual
cache:
policy: pull
artifacts:
name: "$CI_PROJECT_NAME-$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
expire_in: 1 hour
Expand Down Expand Up @@ -205,6 +211,8 @@ unit_tests:
entrypoint: [""]
stage: test
needs: []
cache:
policy: pull
tags:
- ga
variables:
Expand Down
70 changes: 70 additions & 0 deletions .run/GreenAndroid.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="GreenAndroid" type="AndroidRunConfigurationType" factoryName="Android App">
<module name="Blockstream_Green.green.main" />
<option name="DEPLOY" value="true" />
<option name="DEPLOY_APK_FROM_BUNDLE" value="false" />
<option name="DEPLOY_AS_INSTANT" value="false" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ALL_USERS" value="false" />
<option name="ALWAYS_INSTALL_WITH_PM" value="false" />
<option name="CLEAR_APP_STORAGE" value="false" />
<option name="DYNAMIC_FEATURES_DISABLED_LIST" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="specific_activity" />
<option name="RESTORE_ENABLED" value="false" />
<option name="RESTORE_FILE" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="false" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="SELECTED_CLOUD_MATRIX_CONFIGURATION_ID" value="-1" />
<option name="SELECTED_CLOUD_MATRIX_PROJECT_ID" value="" />
<option name="DEBUGGER_TYPE" value="Java" />
<Auto>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Auto>
<Hybrid>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Hybrid>
<Java>
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Java>
<Native>
<option name="USE_JAVA_AWARE_DEBUGGER" value="false" />
<option name="SHOW_STATIC_VARS" value="true" />
<option name="WORKING_DIR" value="" />
<option name="TARGET_LOGGING_CHANNELS" value="lldb process:gdb-remote packets" />
<option name="SHOW_OPTIMIZED_WARNING" value="true" />
<option name="ATTACH_ON_WAIT_FOR_DEBUGGER" value="false" />
<option name="DEBUG_SANDBOX_SDK" value="false" />
</Native>
<Profilers>
<option name="ADVANCED_PROFILING_ENABLED" value="false" />
<option name="STARTUP_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_ENABLED" value="false" />
<option name="STARTUP_CPU_PROFILING_CONFIGURATION_NAME" value="Java/Kotlin Method Sample (legacy)" />
<option name="STARTUP_NATIVE_MEMORY_PROFILING_ENABLED" value="false" />
<option name="NATIVE_MEMORY_SAMPLE_RATE_BYTES" value="2048" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="com.blockstream.green.GreenActivity" />
<option name="SEARCH_ACTIVITY_IN_GLOBAL_SCOPE" value="false" />
<option name="SKIP_ACTIVITY_VALIDATION" value="false" />
<method v="2">
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
</component>
3 changes: 3 additions & 0 deletions base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ dependencies {
api(libs.androidx.startup.runtime)
api(libs.compose.material3)
api(libs.androidx.work.runtime.ktx)
api(libs.androidx.activity.compose)
api(libs.androidx.core.splashscreen)
api(libs.androidx.lifecycle.process)
/** ----------------------------------------------------------------------------------------- */

/** --- Countly ---------------------------------------------------------------------------- */
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ buildscript {
classpath(libs.android.gradle.plugin)
classpath(libs.kotlin.gradle.plugin)
classpath(libs.kotlin.serialization)
classpath(libs.navigation.safe.args.gradle.plugin)
}
}

Expand Down
4 changes: 1 addition & 3 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ kotlin {
/** --- Misc. ------------------------------------------------------------------------------ */
api(libs.sqldelight.coroutines.extensions)
api(libs.kmp.observableviewmodel)
api(libs.stately.concurrent.collections)
api(libs.uri.kmp)
api(libs.uuid)
api(libs.multiplatform.settings)
Expand All @@ -147,7 +146,7 @@ kotlin {
api(libs.ksoup.entites) // html entities
api(libs.kable.core)

implementation("com.juul.tuulbox:coroutines:8.0.0")
implementation(libs.tuulbox.coroutines)
/** ----------------------------------------------------------------------------------------- */
}

Expand Down Expand Up @@ -197,7 +196,6 @@ kotlin {
}

iosMain.dependencies {
implementation(libs.stately.common) // until this is fixed https://github.com/touchlab/Stately/issues/93
implementation(libs.sqldelight.native.driver)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ class JadeUsbDevice constructor(
), JadeDeviceApi by JadeDeviceApiImpl(), JadeDevice {

companion object : Loggable() {
const val VENDOR_JADE_A = 0x10c4
const val VENDOR_JADE_B = 0x1a86
private val VendorIds = listOf(0x10c4, 0x1a86, 0x0403, 0x303a)

private fun hasSuportedVendorId(usbDevice: UsbDevice): Boolean {
val vId = usbDevice.vendorId
return (vId == VENDOR_JADE_A ||
vId == VENDOR_JADE_B)
return VendorIds.any { vId == it }
}

fun fromUsbDevice(deviceManager: DeviceManagerAndroid, usbDevice: UsbDevice): JadeUsbDevice? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ actual val platformModule: Module = module {
AndroidKeystore(androidContext())
} binds (arrayOf(GreenKeystore::class))

single<BluetoothManager> { BluetoothManager(androidContext(), get()) }
single<BluetoothAdapter?> { (androidContext().getSystemService(Context.BLUETOOTH_SERVICE) as? android.bluetooth.BluetoothManager)?.adapter }
single<BluetoothManager> { BluetoothManager(androidContext(), null) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private fun Context.getLocationManagerOrNull() =
private fun Context.isLocationEnabledOrNull(): Boolean? =
getLocationManagerOrNull()?.let(LocationManagerCompat::isLocationEnabled)

actual class BluetoothManager(val context: Context, val bluetoothAdapter: BluetoothAdapter?) {
actual class BluetoothManager constructor(val context: Context, val bluetoothAdapter: BluetoothAdapter?) {
private val scope = CoroutineScope(context = Dispatchers.Default)

private val blePermissionsUpdate = MutableSharedFlow<Unit>(replay = 1).also {
Expand Down Expand Up @@ -87,7 +87,7 @@ actual class BluetoothManager(val context: Context, val bluetoothAdapter: Blueto
private val hasPermissions
get() = BLE_PERMISSIONS.all { ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED }

fun permissionsGranted() {
actual fun permissionsGranted() {
blePermissionsUpdate.tryEmit(Unit)
}

Expand Down
Loading

0 comments on commit 0e7df5b

Please sign in to comment.