-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apollo: Release source code for 51.1
- Loading branch information
Showing
131 changed files
with
1,977 additions
and
1,139 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
44 changes: 44 additions & 0 deletions
44
android/apollo/src/main/java/io/muun/apollo/data/debug/HeapDumper.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,44 @@ | ||
package io.muun.apollo.data.debug | ||
|
||
import android.app.Application | ||
import android.os.Debug | ||
import io.muun.apollo.data.external.Globals | ||
import timber.log.Timber | ||
import java.io.IOException | ||
|
||
/** | ||
* Utility class to help the debug and analysis of OutOfMemoryError (OOM) and memory leaks. Meant | ||
* to be used ONLY for DEBUG builds. | ||
*/ | ||
object HeapDumper { | ||
|
||
private lateinit var application: Application | ||
|
||
//uncaught exceptions | ||
private var defaultUncaughtExceptionHandler: Thread.UncaughtExceptionHandler? = null | ||
|
||
@JvmStatic | ||
fun init(application: Application) { | ||
if (Globals.INSTANCE.isDebugBuild) { | ||
this.application = application | ||
defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler() | ||
Thread.setDefaultUncaughtExceptionHandler(customUncaughtExceptionHandler) | ||
} | ||
} | ||
|
||
// OOM handler listener | ||
private val customUncaughtExceptionHandler = Thread.UncaughtExceptionHandler { thread, ex -> | ||
if (ex is OutOfMemoryError) { | ||
try { | ||
Timber.i("DumpHprofData: Starting...") | ||
Debug.dumpHprofData("${application.filesDir.absolutePath}/apollo-oom-dump.hprof") | ||
} catch (e: IOException) { | ||
Timber.i("DumpHprofData: Error: $e. Cause: $ex") | ||
} | ||
Timber.i("DumpHprofData: Success") | ||
} | ||
|
||
//call the default exception handler | ||
defaultUncaughtExceptionHandler?.uncaughtException(thread, ex) | ||
} | ||
} |
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
3 changes: 3 additions & 0 deletions
3
android/apollo/src/main/java/io/muun/apollo/data/debug/LappClientError.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,3 @@ | ||
package io.muun.apollo.data.debug | ||
|
||
class LappClientError(override val message: String) : RuntimeException() |
2 changes: 1 addition & 1 deletion
2
...presentation/ui/debug/SimpleHttpClient.kt → ...uun/apollo/data/debug/SimpleHttpClient.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
69 changes: 38 additions & 31 deletions
69
...io/muun/apollo/data/external/Globals.java → ...a/io/muun/apollo/data/external/Globals.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,112 +1,119 @@ | ||
package io.muun.apollo.data.external; | ||
package io.muun.apollo.data.external | ||
|
||
import org.bitcoinj.core.NetworkParameters; | ||
import org.bitcoinj.core.NetworkParameters | ||
|
||
abstract class Globals { | ||
|
||
public abstract class Globals { | ||
companion object { | ||
|
||
/** | ||
* This will be initialized in the UI application code, since it depends on Android build | ||
* configurations. | ||
*/ | ||
public static Globals INSTANCE; | ||
/** | ||
* This will be initialized in the UI application code, since it depends on Android build | ||
* configurations. | ||
*/ | ||
lateinit var INSTANCE: Globals | ||
} | ||
|
||
/** | ||
* Get the Application Id (previously package name) of the app. Identifies the app on the | ||
* device, its unique in the Google Play store. | ||
*/ | ||
public abstract String getApplicationId(); | ||
abstract val applicationId: String | ||
|
||
/** | ||
* Get whether the current build a debuggable build. | ||
*/ | ||
public abstract boolean isDebugBuild(); | ||
abstract val isDebugBuild: Boolean | ||
|
||
/** | ||
* Get the build type of the current build. | ||
*/ | ||
public abstract String getBuildType(); | ||
abstract val buildType: String | ||
|
||
/** | ||
* Get the legacy build type of the current build. It is now deprecated in favour of | ||
* {@link Globals#getBuildType()}. | ||
* [Globals.buildType]. | ||
*/ | ||
public abstract String getOldBuildType(); | ||
abstract val oldBuildType: String | ||
|
||
/** | ||
* Get the version code of the current build (e.g 1004). | ||
*/ | ||
public abstract int getVersionCode(); | ||
abstract val versionCode: Int | ||
|
||
/** | ||
* Get the version name of the current build (e.g 50.4). | ||
*/ | ||
public abstract String getVersionName(); | ||
abstract val versionName: String | ||
|
||
/** | ||
* Get the version name of the current build (e.g 50.4). | ||
*/ | ||
public abstract String getDeviceName(); | ||
abstract val deviceName: String | ||
|
||
/** | ||
* Get the model name of the device where app is running. | ||
*/ | ||
public abstract String getDeviceModel(); | ||
abstract val deviceModel: String | ||
|
||
/** | ||
* Get the manufacturer name of the device where app is running. | ||
*/ | ||
public abstract String getDeviceManufacturer(); | ||
abstract val deviceManufacturer: String | ||
|
||
/** | ||
* Get the fingerprint of the device where app is running. | ||
*/ | ||
public abstract String getFingerprint(); | ||
abstract val fingerprint: String | ||
|
||
/** | ||
* Get the hardware name of the device where app is running. | ||
*/ | ||
public abstract String getHardware(); | ||
abstract val hardware: String | ||
|
||
/** | ||
* Get the bootloader name of the device where app is running. | ||
*/ | ||
public abstract String getBootloader(); | ||
abstract val bootloader: String | ||
|
||
/** | ||
* Get the bitcoin network specs/parameters of the network this build is using. | ||
*/ | ||
public abstract NetworkParameters getNetwork(); | ||
abstract val network: NetworkParameters | ||
|
||
/** | ||
* Get the hostname of this app's deeplink. | ||
*/ | ||
public abstract String getMuunLinkHost(); | ||
abstract val muunLinkHost: String | ||
|
||
/** | ||
* Get the path of this app's "Verify" deeplink. | ||
*/ | ||
public abstract String getVerifyLinkPath(); | ||
abstract val verifyLinkPath: String | ||
|
||
/** | ||
* Get the path of this app's "Authorize" deeplink. | ||
*/ | ||
public abstract String getAuthorizeLinkPath(); | ||
abstract val authorizeLinkPath: String | ||
|
||
/** | ||
* Get the path of this app's "Confirm" deeplink. | ||
*/ | ||
public abstract String getConfirmLinkPath(); | ||
abstract val confirmLinkPath: String | ||
|
||
/** | ||
* Get the path of this app's "Authorize RC Login" deeplink. | ||
*/ | ||
public abstract String getRcLoginAuthorizePath(); | ||
abstract val rcLoginAuthorizePath: String | ||
|
||
/** | ||
* Get Lapp's URL. | ||
*/ | ||
abstract val lappUrl: String | ||
|
||
/** | ||
* Get whether the current build is a release build. | ||
*/ | ||
public boolean isReleaseBuild() { | ||
return getBuildType().equals("release"); | ||
} | ||
} | ||
val isReleaseBuild: Boolean | ||
get() = buildType == "release" | ||
|
||
} |
Oops, something went wrong.