Skip to content

Commit

Permalink
Initialize global context before MainApp.onCreate()
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Narkiewicz <hello@ezaquarii.com>
  • Loading branch information
ezaquarii committed Apr 15, 2019
1 parent d544fa5 commit 0c0e485
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ dependencies {
// dependencies for app building
implementation 'androidx.multidex:multidex:2.0.1'
// implementation project('nextcloud-android-library')
genericImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
gplayImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
genericImplementation 'com.github.nextcloud:android-library:1.4.0'
gplayImplementation 'com.github.nextcloud:android-library:1.4.0'
versionDevImplementation 'com.github.nextcloud:android-library:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/com/owncloud/android/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,17 @@ public class MainApp extends MultiDexApplication implements
@SuppressWarnings("unused")
private boolean mBound;

/**
* Temporary hack
*/
private static void initGlobalContext(Context context) {
mContext = context;
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
initGlobalContext(this);
DaggerAppComponent.builder()
.application(this)
.build()
Expand All @@ -188,7 +196,6 @@ public void onCreate() {
uploadsStorageManager
)
);
MainApp.mContext = getApplicationContext();

new SecurityUtils();
DisplayUtils.useCompatVectorIfNeeded();
Expand Down

0 comments on commit 0c0e485

Please sign in to comment.