-
-
Notifications
You must be signed in to change notification settings - Fork 876
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4f2cc0
commit 409d8b7
Showing
32 changed files
with
3,912 additions
and
111 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...roid/src/main/java/com/baseflow/permissionhandler/ApplicationInfoFlagsFlutterApiImpl.java
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,66 @@ | ||
package com.baseflow.permissionhandler; | ||
|
||
import android.content.pm.PackageManager.ApplicationInfoFlags; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.baseflow.instancemanager.InstanceManager; | ||
import com.baseflow.permissionhandler.PermissionHandlerPigeon.ApplicationInfoFlagsFlutterApi; | ||
|
||
import java.util.UUID; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** | ||
* Flutter API implementation for `ApplicationInfoFlags`. | ||
* | ||
* <p>This class may handle adding native instances that are attached to a Dart instance or passing | ||
* arguments of callbacks methods to a Dart instance. | ||
*/ | ||
public class ApplicationInfoFlagsFlutterApiImpl { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
private final ApplicationInfoFlagsFlutterApi api; | ||
|
||
/** | ||
* Constructs a {@link ApplicationInfoFlagsFlutterApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public ApplicationInfoFlagsFlutterApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, | ||
@NonNull InstanceManager instanceManager | ||
) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
api = new ApplicationInfoFlagsFlutterApi(binaryMessenger); | ||
} | ||
|
||
/** | ||
* Stores the `ApplicationInfoFlags` instance and notifies Dart to create and store a new | ||
* `ApplicationInfoFlags` instance that is attached to this one. If `instance` has already been | ||
* added, this method does nothing. | ||
*/ | ||
public void create(@NonNull ApplicationInfoFlags instance) { | ||
if (!instanceManager.containsInstance(instance)) { | ||
final UUID applicationInfoFlagsInstanceUuid = instanceManager.addHostCreatedInstance(instance); | ||
api.create(applicationInfoFlagsInstanceUuid.toString(), reply -> {}); | ||
} | ||
} | ||
|
||
/** | ||
* Disposes of the `ApplicationInfoFlags` instance in the instance manager and notifies Dart to | ||
* do the same. If `instance` was already disposed, this method does nothing. | ||
*/ | ||
public void dispose(ApplicationInfoFlags instance) { | ||
final UUID applicationInfoFlagsInstanceUuid = instanceManager.getIdentifierForStrongReference(instance); | ||
if (applicationInfoFlagsInstanceUuid != null) { | ||
api.dispose(applicationInfoFlagsInstanceUuid.toString(), reply -> {}); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...android/src/main/java/com/baseflow/permissionhandler/ApplicationInfoFlagsHostApiImpl.java
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,53 @@ | ||
package com.baseflow.permissionhandler; | ||
|
||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.RequiresApi; | ||
|
||
import com.baseflow.instancemanager.InstanceManager; | ||
import com.baseflow.permissionhandler.PermissionHandlerPigeon.ApplicationInfoFlagsHostApi; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** | ||
* Host API implementation for `ApplicationInfoFlags`. | ||
* | ||
* <p>This class may handle instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class ApplicationInfoFlagsHostApiImpl implements ApplicationInfoFlagsHostApi { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
private final ApplicationInfoFlagsFlutterApiImpl flutterApi; | ||
|
||
/** | ||
* Constructs an {@link ApplicationInfoFlagsHostApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public ApplicationInfoFlagsHostApiImpl( | ||
@NonNull ApplicationInfoFlagsFlutterApiImpl flutterApi, | ||
@NonNull BinaryMessenger binaryMessenger, | ||
@NonNull InstanceManager instanceManager | ||
) { | ||
this.flutterApi = flutterApi; | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
} | ||
|
||
@RequiresApi(api = Build.VERSION_CODES.TIRAMISU) | ||
@NonNull | ||
@Override | ||
public String of(@NonNull Long value) { | ||
final PackageManager.ApplicationInfoFlags flags = PackageManager.ApplicationInfoFlags.of(value); | ||
flutterApi.create(flags); | ||
return instanceManager.getIdentifierForStrongReference(flags).toString(); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...ndroid/src/main/java/com/baseflow/permissionhandler/ComponentInfoFlagsFlutterApiImpl.java
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,66 @@ | ||
package com.baseflow.permissionhandler; | ||
|
||
import android.content.pm.PackageManager.ComponentInfoFlags; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.baseflow.instancemanager.InstanceManager; | ||
import com.baseflow.permissionhandler.PermissionHandlerPigeon.ComponentInfoFlagsFlutterApi; | ||
|
||
import java.util.UUID; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** | ||
* Flutter API implementation for `ComponentInfoFlags`. | ||
* | ||
* <p>This class may handle adding native instances that are attached to a Dart instance or passing | ||
* arguments of callbacks methods to a Dart instance. | ||
*/ | ||
public class ComponentInfoFlagsFlutterApiImpl { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
private final ComponentInfoFlagsFlutterApi api; | ||
|
||
/** | ||
* Constructs a {@link ComponentInfoFlagsFlutterApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public ComponentInfoFlagsFlutterApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, | ||
@NonNull InstanceManager instanceManager | ||
) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
api = new ComponentInfoFlagsFlutterApi(binaryMessenger); | ||
} | ||
|
||
/** | ||
* Stores the `ComponentInfoFlags` instance and notifies Dart to create and store a new | ||
* `ComponentInfoFlags` instance that is attached to this one. If `instance` has already been | ||
* added, this method does nothing. | ||
*/ | ||
public void create(@NonNull ComponentInfoFlags instance) { | ||
if (!instanceManager.containsInstance(instance)) { | ||
final UUID componentInfoFlagsInstanceUuid = instanceManager.addHostCreatedInstance(instance); | ||
api.create(componentInfoFlagsInstanceUuid.toString(), reply -> {}); | ||
} | ||
} | ||
|
||
/** | ||
* Disposes of the `ComponentInfoFlags` instance in the instance manager and notifies Dart to do | ||
* the same. If `instance` was already disposed, this method does nothing. | ||
*/ | ||
public void dispose(ComponentInfoFlags instance) { | ||
final UUID componentInfoFlagsInstanceUuid = instanceManager.getIdentifierForStrongReference(instance); | ||
if (componentInfoFlagsInstanceUuid != null) { | ||
api.dispose(componentInfoFlagsInstanceUuid.toString(), reply -> {}); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...d/android/src/main/java/com/baseflow/permissionhandler/ComponentInfoFlagsHostApiImpl.java
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,53 @@ | ||
package com.baseflow.permissionhandler; | ||
|
||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.RequiresApi; | ||
|
||
import com.baseflow.instancemanager.InstanceManager; | ||
import com.baseflow.permissionhandler.PermissionHandlerPigeon.ComponentInfoFlagsHostApi; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** | ||
* Host API implementation for `ComponentInfoFlags`. | ||
* | ||
* <p>This class may handle instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class ComponentInfoFlagsHostApiImpl implements ComponentInfoFlagsHostApi { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
private final ComponentInfoFlagsFlutterApiImpl flutterApi; | ||
|
||
/** | ||
* Constructs an {@link ComponentInfoFlagsHostApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public ComponentInfoFlagsHostApiImpl( | ||
@NonNull ComponentInfoFlagsFlutterApiImpl flutterApi, | ||
@NonNull BinaryMessenger binaryMessenger, | ||
@NonNull InstanceManager instanceManager | ||
) { | ||
this.flutterApi = flutterApi; | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
} | ||
|
||
@RequiresApi(api = Build.VERSION_CODES.TIRAMISU) | ||
@NonNull | ||
@Override | ||
public String of(@NonNull Long value) { | ||
final PackageManager.ComponentInfoFlags flags = PackageManager.ComponentInfoFlags.of(value); | ||
flutterApi.create(flags); | ||
return instanceManager.getIdentifierForStrongReference(flags).toString(); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
.../android/src/main/java/com/baseflow/permissionhandler/PackageInfoFlagsFlutterApiImpl.java
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,66 @@ | ||
package com.baseflow.permissionhandler; | ||
|
||
import android.content.pm.PackageManager.PackageInfoFlags; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.baseflow.instancemanager.InstanceManager; | ||
import com.baseflow.permissionhandler.PermissionHandlerPigeon.PackageInfoFlagsFlutterApi; | ||
|
||
import java.util.UUID; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** | ||
* Flutter API implementation for `PackageInfoFlags`. | ||
* | ||
* <p>This class may handle adding native instances that are attached to a Dart instance or passing | ||
* arguments of callbacks methods to a Dart instance. | ||
*/ | ||
public class PackageInfoFlagsFlutterApiImpl { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
private final PackageInfoFlagsFlutterApi api; | ||
|
||
/** | ||
* Constructs a {@link PackageInfoFlagsFlutterApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public PackageInfoFlagsFlutterApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, | ||
@NonNull InstanceManager instanceManager | ||
) { | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
api = new PackageInfoFlagsFlutterApi(binaryMessenger); | ||
} | ||
|
||
/** | ||
* Stores the `PackageInfoFlags` instance and notifies Dart to create and store a new | ||
* `PackageInfoFlags` instance that is attached to this one. If `instance` has already been | ||
* added, this method does nothing. | ||
*/ | ||
public void create(@NonNull PackageInfoFlags instance) { | ||
if (!instanceManager.containsInstance(instance)) { | ||
final UUID packageInfoFlagsInstanceUuid = instanceManager.addHostCreatedInstance(instance); | ||
api.create(packageInfoFlagsInstanceUuid.toString(), reply -> {}); | ||
} | ||
} | ||
|
||
/** | ||
* Disposes of the `PackageInfoFlags` instance in the instance manager and notifies Dart to do | ||
* the same. If `instance` was already disposed, this method does nothing. | ||
*/ | ||
public void dispose(PackageInfoFlags instance) { | ||
final UUID packageInfoFlagsInstanceUuid = instanceManager.getIdentifierForStrongReference(instance); | ||
if (packageInfoFlagsInstanceUuid != null) { | ||
api.dispose(packageInfoFlagsInstanceUuid.toString(), reply -> {}); | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...oid/android/src/main/java/com/baseflow/permissionhandler/PackageInfoFlagsHostApiImpl.java
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,53 @@ | ||
package com.baseflow.permissionhandler; | ||
|
||
import android.content.pm.PackageManager; | ||
import android.os.Build; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.RequiresApi; | ||
|
||
import com.baseflow.instancemanager.InstanceManager; | ||
import com.baseflow.permissionhandler.PermissionHandlerPigeon.PackageInfoFlagsHostApi; | ||
|
||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** | ||
* Host API implementation for `PackageInfoFlags`. | ||
* | ||
* <p>This class may handle instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class PackageInfoFlagsHostApiImpl implements PackageInfoFlagsHostApi { | ||
// To ease adding additional methods, this value is added prematurely. | ||
@SuppressWarnings({"unused", "FieldCanBeLocal"}) | ||
private final BinaryMessenger binaryMessenger; | ||
|
||
private final InstanceManager instanceManager; | ||
|
||
private final PackageInfoFlagsFlutterApiImpl flutterApi; | ||
|
||
/** | ||
* Constructs an {@link PackageInfoFlagsHostApiImpl}. | ||
* | ||
* @param binaryMessenger used to communicate with Dart over asynchronous messages | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public PackageInfoFlagsHostApiImpl( | ||
@NonNull PackageInfoFlagsFlutterApiImpl flutterApi, | ||
@NonNull BinaryMessenger binaryMessenger, | ||
@NonNull InstanceManager instanceManager | ||
) { | ||
this.flutterApi = flutterApi; | ||
this.binaryMessenger = binaryMessenger; | ||
this.instanceManager = instanceManager; | ||
} | ||
|
||
@RequiresApi(api = Build.VERSION_CODES.TIRAMISU) | ||
@NonNull | ||
@Override | ||
public String of(@NonNull Long value) { | ||
final PackageManager.PackageInfoFlags flags = PackageManager.PackageInfoFlags.of(value); | ||
flutterApi.create(flags); | ||
return instanceManager.getIdentifierForStrongReference(flags).toString(); | ||
} | ||
} |
Oops, something went wrong.