Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
Keep Dexter constructor as it was in order to reduce the previous cha…
Browse files Browse the repository at this point in the history
…ngeset. (#109)
  • Loading branch information
untalfranfernandez authored Jan 25, 2017
1 parent 04cf8aa commit b0966d7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dexter/src/main/java/com/karumi/dexter/Dexter.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ private static void initialize(Context context) {
if (instance == null) {
AndroidPermissionService androidPermissionService = new AndroidPermissionService();
IntentProvider intentProvider = new IntentProvider();
instance = new DexterInstance(androidPermissionService, intentProvider);
instance = new DexterInstance(context, androidPermissionService, intentProvider);
} else {
instance.setContext(context);
}
instance.setContext(context);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion dexter/src/main/java/com/karumi/dexter/DexterInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ final class DexterInstance {
private Activity activity;
private MultiplePermissionsListener listener = EMPTY_LISTENER;

DexterInstance(AndroidPermissionService androidPermissionService,
DexterInstance(Context context, AndroidPermissionService androidPermissionService,
IntentProvider intentProvider) {
this.androidPermissionService = androidPermissionService;
this.intentProvider = intentProvider;
Expand All @@ -67,6 +67,7 @@ final class DexterInstance {
this.isRequestingPermission = new AtomicBoolean();
this.rationaleAccepted = new AtomicBoolean();
this.isShowingNativeDialog = new AtomicBoolean();
setContext(context);
}

void setContext(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
Context mockApplicationContext = mock(Context.class);
when(context.getApplicationContext()).thenReturn(mockApplicationContext);
asyncExecutor = new AsyncExecutor();
dexter = new DexterInstance(androidPermissionService, intentProvider);
dexter.setContext(context);
dexter = new DexterInstance(context, androidPermissionService, intentProvider);
}

@Test(expected = DexterException.class) public void onNoPermissionCheckedThenThrowException() {
Expand Down

0 comments on commit b0966d7

Please sign in to comment.