forked from Support/sp-hydra-veil-gui
Compare commits
No commits in common. "f7d792745a0210046c156999934f09be82c24284" and "db9553a0f5dcdbcf9f2243724def7991933c3625" have entirely different histories.
f7d792745a
...
db9553a0f5
4 changed files with 7 additions and 40 deletions
|
|
@ -107,6 +107,8 @@ def emergency_sync():
|
|||
# BEGIN PROGRAM
|
||||
# ============================================================================
|
||||
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# ASSETS FOLDER
|
||||
# ============================================================================
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ from PyQt6 import QtGui
|
|||
from PyQt6.QtCore import Qt, QTimer, QEvent
|
||||
|
||||
from core.Constants import Constants
|
||||
from core.infrastructure.global_state_coordinator import evaluate_state_on_startup
|
||||
from core.infrastructure.service_registry import ServiceLocator
|
||||
from core.controllers.ConfigurationController import ConfigurationController
|
||||
from core.controllers.ProfileController import ProfileController
|
||||
|
|
@ -910,10 +909,6 @@ class CustomWindow(QMainWindow):
|
|||
|
||||
|
||||
def start_ui(force_sync):
|
||||
worked = evaluate_state_on_startup()
|
||||
if worked.valid:
|
||||
core_logger.info("State evaluated.")
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
calculate_max_screensize(app)
|
||||
window = CustomWindow(force_sync=force_sync)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
from core.services.profiles.profile_connections import enable_profile #, disable_profile
|
||||
from core.controllers.ProfileController import ProfileController
|
||||
from core.models.Configuration import Configuration, ConnectionChoice
|
||||
from core.services.subscriptions.subscriptions_by_protocol import get_profile_subscription, start_new_payment_cycle, wipe_subscription
|
||||
from core.utils.check_if_time_lapsed import check_if_time_lapsed
|
||||
from core.services.subscriptions.subscriptions_by_protocol import get_profile_subscription, start_new_payment_cycle
|
||||
from core.models.enum_models import PaymentCategory
|
||||
from core.utils.type_checker import type_checker
|
||||
from core.models.Result import Result, ResultError
|
||||
|
|
@ -63,16 +62,6 @@ def navigate_to_new_sub_page() -> Result:
|
|||
return Result(valid=False, error_type=ResultError.NAVIGATE_TO, navigate_to="id", message="No subscription. Pick a payment method.")
|
||||
|
||||
|
||||
@register_action(ResultError.EXPIRED_SUB)
|
||||
def wipe_expired_subscription(profile_id: int) -> Result:
|
||||
"""Call core to wipe a subscription, then navigate to the billing page"""
|
||||
wiped = wipe_subscription(profile_id)
|
||||
if wiped.valid:
|
||||
return navigate_to_new_sub_page()
|
||||
else:
|
||||
return wiped
|
||||
|
||||
|
||||
def filter_subscription(profile_id: int) -> Result:
|
||||
"""Evaluate if this profile has a subscription that's ready to connect."""
|
||||
|
||||
|
|
@ -92,15 +81,6 @@ def filter_subscription(profile_id: int) -> Result:
|
|||
logger.info(f"Returning the error of start_result {start_result}")
|
||||
return start_result
|
||||
|
||||
expiration_date = subscription.expires_at
|
||||
if not expiration_date:
|
||||
# auto check tickets would be here.
|
||||
return navigate_to_new_sub_page()
|
||||
|
||||
expired = check_if_time_lapsed(expiration_date)
|
||||
if expired:
|
||||
return Result(valid=False, error_type=ResultError.EXPIRED_SUB, message="This subscription is expired, would you like to wipe it and get a new one?")
|
||||
|
||||
# has a valid sub:
|
||||
logger.info(f"Profile id {profile_id} has a valid subscription ready to go..")
|
||||
return Result(valid=True)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from core.infrastructure.global_state import ProfileStateRepository
|
||||
from core.controllers.ProfileController import ProfileController
|
||||
from core.controllers.SystemStateController import SystemStateController
|
||||
from core.models.system.SystemProfile import SystemProfile
|
||||
|
|
@ -22,16 +21,7 @@ def _system_state_profile_id():
|
|||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
def is_profile_enabled_for_gui(profile) -> bool:
|
||||
"""Checks Profile State Against in-memory Repo"""
|
||||
is_enabled = ProfileStateRepository().is_profile_active(profile.id)
|
||||
print(f"profile id: {profile.id} | Enabled: {is_enabled}")
|
||||
return is_enabled
|
||||
|
||||
|
||||
|
||||
# if isinstance(profile, SystemProfile) and _connection_code(profile) in SINGBOX_PROTOCOLS:
|
||||
# return _system_state_profile_id() == int(profile.id)
|
||||
# return ProfileController.is_enabled(profile)
|
||||
def is_profile_enabled_for_gui(profile):
|
||||
if isinstance(profile, SystemProfile) and _connection_code(profile) in SINGBOX_PROTOCOLS:
|
||||
return _system_state_profile_id() == int(profile.id)
|
||||
return ProfileController.is_enabled(profile)
|
||||
|
|
|
|||
Loading…
Reference in a new issue