Skip to content

Commit

Permalink
add extension badge for addons
Browse files Browse the repository at this point in the history
  • Loading branch information
mcleinman committed Dec 23, 2024
1 parent 679218a commit b1e6bcc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/message_try_firefox_extension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"id": "message_try_firefox_extension.24",
"title": "vpn.tryFirefoxExtension.title",
"subtitle": "vpn.tryFirefoxExtension.subtitle",
"badge": "new_update",
"badge": "extension",
"blocks": [
{
"id": "c_1",
Expand Down
2 changes: 2 additions & 0 deletions src/addons/addonmessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ void AddonMessage::setBadge(const QString& badge) {
m_badge = Survey;
} else if (badge == "subscription") {
m_badge = Subscription;
} else if (badge == "extension") {
m_badge = Extension;
} else {
logger.error() << "Unsupported badge type" << badge;
}
Expand Down
3 changes: 2 additions & 1 deletion src/addons/addonmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class AddonMessage final : public Addon {
NewUpdate,
WhatsNew,
Survey,
Subscription
Subscription,
Extension
};
Q_ENUM(Badge)

Expand Down
3 changes: 3 additions & 0 deletions src/translations/strings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@ inAppMessaging:
subscriptionBadge:
value: Subscription
comment: A badge shown in a message signifying that this message contains information about the user's subscription
extensionBadge:
value: Extension
comment: A badge shown in a message signifying that this message contains information about a Firefox browser extension

devices:
countLabel:
Expand Down
7 changes: 7 additions & 0 deletions src/ui/screens/messaging/ViewMessage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ MZViewBase {
return badgeInfo.surveyBadge
case MZAddonMessage.Subscription:
return badgeInfo.subscriptionBadge
case MZAddonMessage.Extension:
return badgeInfo.subscriptionBadge
}
}

Expand Down Expand Up @@ -139,6 +141,11 @@ MZViewBase {
'badgeTextColor': MZTheme.colors.normalLevelMain,
'badgeBackgroundColor': MZTheme.colors.normalLevelBackground
};
property var extensionBadge: {
'badgeText': MZI18n.InAppMessagingSubscriptionBadge,
'badgeTextColor': MZTheme.colors.normalLevelMain,
'badgeBackgroundColor': MZTheme.colors.normalLevelBackground
};
}
}
}
Expand Down

0 comments on commit b1e6bcc

Please sign in to comment.