Skip to content

Commit aed1a48

Browse files
committed
Get rid of Realm
1 parent 344a63f commit aed1a48

Some content is hidden

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

51 files changed

+80
-1859
lines changed

HTTPShortcuts/app/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ plugins {
1313
id("kotlin-android")
1414
alias(libs.plugins.ksp)
1515
id("com.bugsnag.android.gradle")
16-
id("io.realm.kotlin")
1716
id("de.mobilej.unmock")
1817
id("com.google.dagger.hilt.android")
1918
alias(libs.plugins.compose.compiler)
@@ -279,7 +278,6 @@ dependencies {
279278
implementation(libs.androidx.splashscreen)
280279

281280
/* Database */
282-
implementation(libs.realm) // doomed, to be phased out 💔
283281
implementation(libs.room.runtime)
284282
implementation(libs.room.ktx)
285283
ksp(libs.room.compiler)

HTTPShortcuts/app/proguard-rules.pro

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
-keep class ch.rmy.android.http_shortcuts.data.models.** { *; }
2-
-keep class ch.rmy.android.http_shortcuts.data.realm.models.** { *; }
32
-keep class ch.rmy.android.http_shortcuts.import_export.models.** { *; }
43
-keep class ch.rmy.android.http_shortcuts.activities.contact.MetaData { *; }
54
-keep class ch.rmy.android.http_shortcuts.activities.execute.models.ExecutionParams { *; }

HTTPShortcuts/app/src/main/assets/acknowledgments.html

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,6 @@ <h2>QuickJS wrapper for Android/JVM</h2>
134134
Wrapper around QuickJS, providing a convenient way for Android developers to execute raw JavaScript inside their apps.<br>
135135
Licensed under Apache Version 2.0 by <a href="https://github.com/HarlonWang">Harlon Wang</a>
136136
</p>
137-
<h2>Realm</h2>
138-
<p>
139-
Realm is a mobile database<br>
140-
Licensed under Apache Version 2.0 by Realm
141-
</p>
142137
<h2>Reorderable</h2>
143138
<p>
144139
A simple library that allows you to reorder items in LazyColumn and LazyRow as well as Column and Row in Jetpack Compose with drag and drop.<br>

HTTPShortcuts/app/src/main/assets/docs/faq.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
<body id="root">
55
<h1>FAQ</h1><h2>This app is free and contains no ads. What's the catch?</h2><p>There is no catch. I'm a developer who one day realized he needed an app like this, built it, and then decided to share it. HTTP Shortcuts is essentially a one-man show, and I'm only working on it in my spare time. I'm doing it because I enjoy the project, which is why the app is completely free and will remain so. No ads, no tracking, no premium features, just a simple open-source app that aims to be useful.<p>If you want to show your support though, check out <a href=https://http-shortcuts.rmy.ch/support-me>this page</a>.<h2>Running shortcuts works from within the app, but not from the home screen. How do I fix it?</h2><p>This usually happens when Data Saver or Battery Saver is enabled, as those restrict how apps can use the network. Try disabling them or whitelisting the HTTP Shortcuts app.<p>It might also be that you need to enable the "Allow drawing over other apps" option. You'll find it in the app's Settings page in the Troubleshooting section.<h2>I don't like the blue arrow icon that overlays all my shortcuts on the home screen. Can I remove it?</h2><p>Unfortunately, this icon overlay is added by the Android system itself, not the app. There is a potential workaround though. Try adding a shortcut via your home screen's widget menu (usually accessed by long pressing on the home screen), and when prompted by the app about which method to use for placement, select the <em>Legacy</em> option. Please note that this may not always work, and if it doesn't then there really is no way to remove the icon overlay. Also note that this will prevent you from dynamically changing the name or icon of the shortcut, i.e., you'll need to remove and re-add it to the home screen manually if you change its name or icon.<p>Alternatively, you can use the <em>"Customizable Widget"</em> from your home screen's widgets menu. This widget looks a bit different from a regular shortcut and offers a few customization options.<p><a name=trigger-from-other-app></a><h2>Can I trigger a shortcut from another app?</h2><p>Most automation apps offer some way to trigger a shortcut directly. If that isn't an option you can instead trigger a shortcut by sending a <em>broadcast intent</em> with the following parameters:<ul><li>action: "ch.rmy.android.http_shortcuts.execute"<li>package name: "ch.rmy.android.http_shortcuts"<li>string extra "id" which holds the ID* of the shortcut you want to trigger</ul><p>Alternatively, you can invoke a shortcut via a deep-linking URL, which is particularly useful when you want to trigger a shortcut from a QR code or an NFC tag.<p>* You'll find the shortcut's ID as well as its deep-linking URL by long-pressing the shortcut and selecting <em>Show Info</em> from the menu.<p>See also the <a href=advanced.md#deep-link>documentation on deep-linking</a>.<h2>Can I send multiple requests with one shortcut?</h2><p>A normal shortcut corresponds to a single request. You can, however, have one shortcut trigger one or more other shortcuts. The easiest way to achieve that is by creating a <a href=shortcuts.md#multi-shortcut>"Multi-Shortcut"</a>, which allows you to pick one or more shortcuts which are then all triggered when the multi-shortcut itself is executed, one after the other.<p>In some cases using a Multi Shortcut might not be enough, e.g., when you want to trigger the same shortcut twice, want to trigger it only under certain conditions or if you want to pass variable values to it. In this case you can create a <a href=shortcuts.md#scripting-shortcut>"Scripting Shortcut"</a> instead and add one or more instances of the <a href=scripting.md#trigger-shortcut>"enqueueShortcut"</a> action to it. When creating or editing your scripting shortcut, open the section "Scripting" and then click the button "Add Code Snippet" underneath the textarea. In the dialog that opens select "Miscellaneous" and then "Enqueue Shortcut". This way, whenever you run your first shortcut, it will trigger the selected other one after it completed. See <a href=scripting.md#trigger-shortcut>the Scripting documentation</a> for more information.<h2>Can I schedule requests to be sent periodically or at a specific time?</h2><p>Currently the app only has basic functionality for running a shortcut repeatedly. When creating or editing the shortcut, go to the <em>Trigger & Execution Settings</em> section and look for the <em>Run repeatedly</em> dropdown at the bottom.<p>If you need more advanced or more precise scheduling, you can try to achieve that by combining the app with an automation app, such as Tasker or Macrodroid.<h2>Can I trigger a shortcut with text shared from another app? Can I share text (e.g. a link) into a shortcut?</h2><p>If you want to share text via an HTTP shortcut, you can do so like this:<ol><li>Open the app<li>Open the dropdown menu at the top right and select <em>Variables</em><li>Click the + button and select <em>Static Variable</em> as the variable type<li>Enter a name for the variable<li>**Tick the <em>Allow 'Share...'</em> checkbox<li>From the dropdown menu that appears below select which part of the shared text you want to handle: text, title, or both<li>Click the checkmark button at the top right to save your variable<li>Go back to the app's main screen<li>Click the + button to start creating a new shortcut or long press an existing shortcut and select <em>Edit</em> to open the shortcut editor<li>Find the input field for the place where you want to share the text as, e.g. the URL, the request body or a header. Click the <em>{}</em> button next to that field<li>Select the variable that you created earlier<li>Save the changes to your shortcut<li>You should now be able to share text from other apps (e.g. a URL from a browser) into the HTTP Shortcuts app and there select your shortcut as the share target. It will execute the shortcut and insert the shared text into where you put the variable placeholder.</ol><h2>Can I share files into a shortcut's request body?</h2><p>Yes, you can. You'll find information about this on the <a href=advanced.md#share-files>advanced features</a> page.<h2>Can I pass values from one shortcut to another?</h2><p>Yes, you can. To do so, you need to first create a <a href=variables.md>global variable</a> (of static type) to hold the value. You can then use the <a href=scripting.md>Scripting</a> feature to store a value into that variable from one of your shortcuts and then use or read out the value again in the other shortcut. To store a value into a variable, use the <a href=scripting.md#variables>setVariable</a> function.<p>If you use <a href=scripting.md#execute-shortcut>executeShortcut</a> to call another shortcut, you can also use the <a href=scripting.md#set-result>setResult</a> function to pass data back to the calling shortcut.<h2>How do I pass data from Tasker to HTTP Shortcuts?</h2><p>See the guide on <a href=advanced.md#integrate-with-tasker>integrating with Tasker</a>.<h2>In what order are variables resolved? Can I change the variable resolution order?</h2><p>Primarily, variables are resolved in the order in which they appear on the Variables screen. You can change this order by rearranging the variables there. If this is not sufficient, e.g. because you use the same variables in multiple shortcuts but want a different order per shortcut, there is a workaround you can do:<ol><li>In the shortcut editor, click on "Scripting"<li>In the "Run before Execution" field, add a line like the following, one for each variable that you want to use, in the desired order:</ol><pre><code class=language-js>getVariable("my_variable2");
66
getVariable("my_variable1");
7-
</code></pre><p>This will essentially override the resolution order.<h2>I hid one of my shortcuts and now I can't access it anymore. How do I make it visible again?</h2><p>If you go to the app's Settings screen, you'll find an option in the "Appearance" section which lets you configure whether hidden shortcuts should be visible or not. By default, hidden shortcuts will not be shown, but if you change this setting, the shortcuts will instead be visible but appear partially transparent.<p><a name=debugging></a><h2>Something's not working with my requests. Can I get more detailed information for debugging?</h2><p>The easiest way to get more details about the shortcuts that you're executing in the app is by going to the <em>Event History</em> screen. You will find it in the app's main menu under <em>Troubleshooting</em>. The Event History shows all recently triggered shortcuts, the HTTP requests that were sent out and the HTTP responses that were received, as well as all the (network) errors that have occurred.<p>Another way to get more information about the request and the response is by opening the <em>Response Handling</em> section when editing a shortcut and changing the <em>Display Type</em> to <em>Fullscreen Window</em> and then ticking the <em>Show Meta Information</em> checkbox. This will display the full response in a window, along with all response headers and some additional meta information.<p><a name=infinite-loops></a><h2>I accidentally created an infinite loop of shortcuts triggering other shortcuts, how do I stop it?</h2><p>First, force stop the app. Then, assuming you're viewing this page in a browser on the same device where you have the app installed, click this link: <a href=http-shortcuts://cancel-executions>CANCEL ALL EXECUTIONS</a>. The link will open the app but in a safe mode, where all scheduled shortcut executions are cancelled.<p><a name=permissions></a><h2>What does the app need all of these permissions for?</h2><p>See the <a href=permissions.md>Permissions</a> page for details.<p><a name=app-size></a><h2>Why is the app so big? Why does it use so much storage space?</h2><p>The app contains two large-ish binaries (i.e., 3rd party software components), one for its internal database (Realm) and one for the built-in JavaScript engine for the <a href=scripting.md>Scripting</a> feature. Each of those comes in different variants, one for each processor architecture type that the app supports. These are the main contributors to the app's size, and their size is outside of my control.<p>If you install the app from the Play Store, you will get a version of the app that only contains the binary variants that are needed by your device, i.e., the ones specific to your device's processor architecture, and it will therefore be significantly smaller in size.<p>If you install the app from an APK from the <a href=https://github.com/Waboodoo/HTTP-Shortcuts/releases>Releases Page</a>, you will see that there is an APK for each architecture, as well as a "universal" one which works for all architectures. If size is a concern to you make sure to pick the one suitable for your device. Don't worry, if you pick the wrong one it simply won't install or crash at startup. If this happens, just pick a different one or go with the universal one.<p>If you install the app from F-Droid, then unfortunately you won't get an architecture-specific variant, as that is currently not supported by F-Droid. As a result, the app you're installing will contain all the variants and therefore be 3 - 4 times larger than it needs to be.<h2>I would like to help translate the app. How can I contribute?</h2><p>First of all, thank you for even considering this. I appreciate the effort. You can join the translation project here: <a href=https://crowdin.com/project/http-shortcuts>HTTP Shortcuts on crowdin.com</a><p>If you encounter problems with the translation software or something is unclear, feel free to <a href=https://http-shortcuts.rmy.ch/contact>contact me</a>.<h2>Is this app also available on iOS?</h2><p>No, this app only exists for Android.<h2>I've sent an email with a question / bug report, but haven't heard back anything. What gives?</h2><p>I'm just one guy developing this app in my free time. Sometimes I don't regularly read my emails or I don't have the time to respond right away. Sometimes it may take weeks. Sorry about that. Most likely I'll get back to you eventually. Please be patient with me. If you don't hear from me after a month, I'm sorry, I might have forgotten. Feel free to reach out again if it is important.<h2>I love this app. How can I show my support?</h2><p>First of all, thank you. Second of all: I've created a <a href=https://http-shortcuts.rmy.ch/support-me>page</a> with a list of ways in which you can support this app.
7+
</code></pre><p>This will essentially override the resolution order.<h2>I hid one of my shortcuts and now I can't access it anymore. How do I make it visible again?</h2><p>If you go to the app's Settings screen, you'll find an option in the "Appearance" section which lets you configure whether hidden shortcuts should be visible or not. By default, hidden shortcuts will not be shown, but if you change this setting, the shortcuts will instead be visible but appear partially transparent.<p><a name=debugging></a><h2>Something's not working with my requests. Can I get more detailed information for debugging?</h2><p>The easiest way to get more details about the shortcuts that you're executing in the app is by going to the <em>Event History</em> screen. You will find it in the app's main menu under <em>Troubleshooting</em>. The Event History shows all recently triggered shortcuts, the HTTP requests that were sent out and the HTTP responses that were received, as well as all the (network) errors that have occurred.<p>Another way to get more information about the request and the response is by opening the <em>Response Handling</em> section when editing a shortcut and changing the <em>Display Type</em> to <em>Fullscreen Window</em> and then ticking the <em>Show Meta Information</em> checkbox. This will display the full response in a window, along with all response headers and some additional meta information.<p><a name=infinite-loops></a><h2>I accidentally created an infinite loop of shortcuts triggering other shortcuts, how do I stop it?</h2><p>First, force stop the app. Then, assuming you're viewing this page in a browser on the same device where you have the app installed, click this link: <a href=http-shortcuts://cancel-executions>CANCEL ALL EXECUTIONS</a>. The link will open the app but in a safe mode, where all scheduled shortcut executions are cancelled.<p><a name=permissions></a><h2>What does the app need all of these permissions for?</h2><p>See the <a href=permissions.md>Permissions</a> page for details.<h2>I would like to help translate the app. How can I contribute?</h2><p>First of all, thank you for even considering this. I appreciate the effort. You can join the translation project here: <a href=https://crowdin.com/project/http-shortcuts>HTTP Shortcuts on crowdin.com</a><p>If you encounter problems with the translation software or something is unclear, feel free to <a href=https://http-shortcuts.rmy.ch/contact>contact me</a>.<h2>Is this app also available on iOS?</h2><p>No, this app only exists for Android.<h2>I've sent an email with a question / bug report, but haven't heard back anything. What gives?</h2><p>I'm just one guy developing this app in my free time. Sometimes I don't regularly read my emails or I don't have the time to respond right away. Sometimes it may take weeks. Sorry about that. Most likely I'll get back to you eventually. Please be patient with me. If you don't hear from me after a month, I'm sorry, I might have forgotten. Feel free to reach out again if it is important.<h2>I love this app. How can I show my support?</h2><p>First of all, thank you. Second of all: I've created a <a href=https://http-shortcuts.rmy.ch/support-me>page</a> with a list of ways in which you can support this app.
88
</body>
99
</html>

HTTPShortcuts/app/src/main/kotlin/ch/rmy/android/http_shortcuts/Application.kt

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@ import android.content.Context
44
import androidx.hilt.work.HiltWorkerFactory
55
import androidx.work.Configuration
66
import ch.rmy.android.framework.extensions.GlobalLogger
7-
import ch.rmy.android.framework.extensions.logException
8-
import ch.rmy.android.http_shortcuts.data.realm.RealmToRoomMigration
97
import ch.rmy.android.http_shortcuts.logging.Logging
108
import ch.rmy.android.http_shortcuts.utils.DarkThemeHelper
119
import ch.rmy.android.http_shortcuts.utils.LocaleHelper
1210
import ch.rmy.android.http_shortcuts.utils.Settings
1311
import dagger.hilt.android.HiltAndroidApp
1412
import java.security.Security
1513
import javax.inject.Inject
16-
import kotlinx.coroutines.CoroutineScope
17-
import kotlinx.coroutines.Dispatchers
18-
import kotlinx.coroutines.flow.MutableStateFlow
19-
import kotlinx.coroutines.flow.asStateFlow
20-
import kotlinx.coroutines.launch
2114
import org.conscrypt.Conscrypt
2215

2316
@HiltAndroidApp
@@ -31,9 +24,6 @@ class Application : android.app.Application(), Configuration.Provider {
3124
@Inject
3225
lateinit var workerFactory: HiltWorkerFactory
3326

34-
@Inject
35-
lateinit var realmToRoomMigration: RealmToRoomMigration
36-
3727
override val workManagerConfiguration: Configuration by lazy {
3828
Configuration.Builder()
3929
.setWorkerFactory(workerFactory)
@@ -49,22 +39,14 @@ class Application : android.app.Application(), Configuration.Provider {
4939
Logging.initCrashReporting(context)
5040
GlobalLogger.registerLogging(Logging)
5141

52-
if (realmToRoomMigration.needsMigration()) {
53-
CoroutineScope(Dispatchers.IO).launch {
54-
try {
55-
realmToRoomMigration.migrate()
56-
} catch (e: Exception) {
57-
logException(e)
58-
_startupError.value = e.message ?: e.toString()
59-
}
60-
}
42+
if (!RealmMigrator.check(context)) {
43+
unmigratedRealmFound = true
6144
}
6245

6346
DarkThemeHelper.applyDarkThemeSettings(Settings(context).darkThemeSetting)
6447
}
6548

6649
companion object {
67-
private val _startupError = MutableStateFlow<String?>(null)
68-
val startupError = _startupError.asStateFlow()
50+
var unmigratedRealmFound = false
6951
}
7052
}

0 commit comments

Comments
 (0)