Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ internal class DenyAllForTCFBridge(
assert(name == call.method)
val argsMap = call.arguments as Map<*, *>
val unsavedPurposeLIDecisions = (argsMap["unsavedPurposeLIDecisions"] as? Map<Int, Boolean>)
val unsavedVendorLIDecisions = (argsMap["unsavedVendorLIDecisions"] as? Map<Int, Boolean>)
val consents = usercentrics.instance.denyAllForTCF(
fromLayer = TCFDecisionUILayer.valueOf(argsMap["fromLayer"] as String),
consentType = UsercentricsConsentType.valueOf(argsMap["consentType"] as String),
unsavedPurposeLIDecisions = unsavedPurposeLIDecisions
unsavedPurposeLIDecisions = unsavedPurposeLIDecisions,
unsavedVendorLIDecisions = unsavedVendorLIDecisions
)
result.success(consents.map { it.serialize() })
}
Expand Down
1 change: 1 addition & 0 deletions example/test/fake_usercentrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class FakeUsercentrics extends UsercentricsPlatform {
required UsercentricsConsentType consentType,
required TCFDecisionUILayer fromLayer,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
}) {
throw UnimplementedError();
}
Expand Down
3 changes: 2 additions & 1 deletion ios/Classes/Bridge/DenyAllForTCFBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ struct DenyAllForTCFBridge : MethodBridge {
let fromLayer = TCFDecisionUILayer.initialize(from: argsDict["fromLayer"])!
let consentType = UsercentricsConsentType.initialize(from: argsDict["consentType"])!
let unsavedPurposeLIDecisions = (argsDict["unsavedPurposeLIDecisions"] as? [Int: Bool])?.asKotlinIntBooleanDict()
let consents = usercentrics.shared.denyAllForTCF(fromLayer: fromLayer, consentType: consentType, unsavedPurposeLIDecisions: unsavedPurposeLIDecisions)
let unsavedVendorLIDecisions = (argsDict["unsavedVendorLIDecisions"] as? [Int: Bool])?.asKotlinIntBooleanDict()
let consents = usercentrics.shared.denyAllForTCF(fromLayer: fromLayer, consentType: consentType, unsavedPurposeLIDecisions: unsavedPurposeLIDecisions, unsavedVendorLIDecisions: unsavedVendorLIDecisions)
result(consents.map { $0.serialize() })
}
}
4 changes: 4 additions & 0 deletions lib/src/internal/bridge/deny_all_for_tcf_bridge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ abstract class DenyAllForTCFBridge {
required TCFDecisionUILayer fromLayer,
required UsercentricsConsentType consentType,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
});
}

Expand All @@ -26,6 +27,7 @@ class MethodChannelDenyAllForTCF extends DenyAllForTCFBridge {
required TCFDecisionUILayer fromLayer,
required UsercentricsConsentType consentType,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
}) async {
final result = await channel.invokeMethod(
_name,
Expand All @@ -34,6 +36,8 @@ class MethodChannelDenyAllForTCF extends DenyAllForTCFBridge {
'consentType': ConsentTypeSerializer.serialize(consentType),
if (unsavedPurposeLIDecisions != null)
'unsavedPurposeLIDecisions': unsavedPurposeLIDecisions,
if (unsavedVendorLIDecisions != null)
'unsavedVendorLIDecisions': unsavedVendorLIDecisions,
},
);
return (result as List)
Expand Down
2 changes: 2 additions & 0 deletions lib/src/internal/platform/method_channel_usercentrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,15 @@ class MethodChannelUsercentrics extends UsercentricsPlatform {
required UsercentricsConsentType consentType,
required TCFDecisionUILayer fromLayer,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
}) async {
await _ensureIsReady();
return await denyAllForTCFBridge.invoke(
channel: _channel,
fromLayer: fromLayer,
consentType: consentType,
unsavedPurposeLIDecisions: unsavedPurposeLIDecisions,
unsavedVendorLIDecisions: unsavedVendorLIDecisions,
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/platform/usercentrics_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ abstract class UsercentricsPlatform {
required UsercentricsConsentType consentType,
required TCFDecisionUILayer fromLayer,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
});

Future<List<UsercentricsServiceConsent>> saveDecisions({
Expand Down
3 changes: 3 additions & 0 deletions lib/src/usercentrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,18 @@ class Usercentrics {

/// Deny all services and TCF.
/// - The [unsavedPurposeLIDecisions] is an optional map of purpose IDs to their legitimate interest decisions that have not yet been saved.
/// - The [unsavedVendorLIDecisions] is an optional map of vendor IDs to their legitimate interest decisions that have not yet been saved.
static Future<List<UsercentricsServiceConsent>> denyAllForTCF({
required TCFDecisionUILayer fromLayer,
required UsercentricsConsentType consentType,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
}) =>
_delegate.denyAllForTCF(
consentType: consentType,
fromLayer: fromLayer,
unsavedPurposeLIDecisions: unsavedPurposeLIDecisions,
unsavedVendorLIDecisions: unsavedVendorLIDecisions,
);

/// Save service decisions.
Expand Down
1 change: 1 addition & 0 deletions test/platform/fake_usercentrics_platform.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class FakeUsercentricsPlatform extends UsercentricsPlatform {
required UsercentricsConsentType consentType,
required TCFDecisionUILayer fromLayer,
Map<int, bool>? unsavedPurposeLIDecisions,
Map<int, bool>? unsavedVendorLIDecisions,
}) {
denyAllForTCFFromLayerArgument = fromLayer;
denyAllForTCFConsentTypeArgument = consentType;
Expand Down
Loading