2025-12-01

This commit is contained in:
2026-03-17 14:58:51 -06:00
parent 183e865f8b
commit 4b82b57113
6846 changed files with 954887 additions and 162606 deletions
@@ -70,7 +70,11 @@ def build_no_internet_notification(cTB) -> None:
"Please connect to the internet to continue using the Poliigon "
"Addon."
)
cTB.notify.create_no_internet(tooltip=msg)
notice = cTB.notify.create_no_internet(tooltip=msg, auto_enqueue=False)
# Bypass sending a view signal, to avoid excessive calls,
# but don't marked as clicked so we can still see that engagement.
notice.viewed = True
cTB.notify.enqueue_notice(notice)
def build_no_refresh_notification(cTB) -> None:
@@ -120,17 +124,6 @@ def build_restart_notification(cTB) -> None:
)
def build_survey_notification(cTB) -> None:
cTB.notify.create_survey(
is_free_user=cTB.is_free_user(),
tooltip=_t("Share your feedback so we can improve this addon for you"),
free_survey_url=URLS_BLENDER["survey_free"],
active_survey_url=URLS_BLENDER["survey_subscribed"],
label=_t("Let us know"),
# on_dismiss_callable=None
)
def get_datetime_now():
return datetime.datetime.now(datetime.timezone.utc)
@@ -151,31 +144,23 @@ def add_survey_notification(cTB) -> bool:
# DISABLE this very function we are in.
cTB.f_add_survey_notifcation_once = lambda: None
if not cTB._any_local_assets():
# Do not bother users, who haven't downloaded anything, yet
return False
survey_prefill = "{addon};{dcc};{user_type}".format(
addon=cTB._api.version_str,
dcc=cTB._api.software_version,
user_type="0" if cTB.is_free_user() else "1"
)
survey_url = URLS_BLENDER["survey"].format(survey_prefill)
already_asked = "last_nps_ask" in cTB.settings
already_opened = "last_nps_open" in cTB.settings
if already_asked or already_opened:
# Never bother the user twice
return False
cTB.check_for_survey_notice(
free_user_url=survey_url,
plan_user_url=survey_url,
interval=7,
label=_t("Let us know"),
tooltip=_t("Share your feedback so we can improve this addon for you"),
auto_enqueue=True
)
# 7 day period starts after first local assets got detected
time_now = get_datetime_now()
if "first_local_asset" not in cTB.settings:
cTB.settings["first_local_asset"] = time_now.timestamp()
return True
ts_first_local = cTB.settings["first_local_asset"]
time_first_local = datetime.datetime.fromtimestamp(
ts_first_local, datetime.timezone.utc)
time_since = time_now - time_first_local
if time_since.days < 7:
return False
build_survey_notification(cTB)
cTB.settings["last_nps_ask"] = time_now.timestamp()
cTB.settings["last_nps_ask"] = get_datetime_now().timestamp()
return True