refactor: move db module init before injection and replace ApplicationContext db component access to static function to get the component

This commit is contained in:
Harris 2021-10-05 10:58:02 +11:00
parent d130ba5432
commit 91b876589a
2 changed files with 3 additions and 2 deletions

View File

@ -148,10 +148,10 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
@Override
public void onCreate() {
DatabaseModule.init(this);
super.onCreate();
Log.i(TAG, "onCreate()");
startKovenant();
DatabaseModule.init(this);
initializeSecurityProvider();
initializeLogging();
initializeCrashHandling();

View File

@ -44,6 +44,7 @@ import org.thoughtcrime.securesms.components.SearchToolbar;
import org.thoughtcrime.securesms.contacts.ContactSelectionListFragment;
import org.thoughtcrime.securesms.contacts.ContactSelectionListLoader.DisplayMode;
import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2;
import org.thoughtcrime.securesms.dependencies.DatabaseComponent;
import org.thoughtcrime.securesms.mms.PartAuthority;
import org.thoughtcrime.securesms.providers.BlobProvider;
import org.thoughtcrime.securesms.util.MediaUtil;
@ -249,7 +250,7 @@ public class ShareActivity extends PassphraseRequiredActionBarActivity
@Override
public void onContactSelected(String number) {
Recipient recipient = Recipient.from(this, Address.fromExternal(this, number), true);
long existingThread = ApplicationContext.getInstance(this).getDatabaseComponent().threadDatabase().getThreadIdIfExistsFor(recipient);
long existingThread = DatabaseComponent.get(this).threadDatabase().getThreadIdIfExistsFor(recipient);
createConversation(existingThread, recipient.getAddress(), DistributionTypes.DEFAULT);
}