Feature Pack with bug fixes for V2

This commit is contained in:
Ujwal223
2026-06-13 13:06:25 +05:45
parent 39b6545e4a
commit b7c8120496
41 changed files with 453 additions and 414 deletions
+10 -9
View File
@@ -27,12 +27,12 @@ class AppLockService extends ChangeNotifier {
final _auth = LocalAuthentication();
// ─── Mode toggles ──────────────────────────────────────────
bool _lockAppWide = false; // locks the whole app on start / bg timeout
bool _lockMessages = false; // locks only the DMs tab
bool _lockAppWide = false; // locks the whole app on start / bg timeout
bool _lockMessages = false; // locks only the DMs tab
// ─── Settings ──────────────────────────────────────────────
bool _scramble = false;
bool _bioEnabled = true;
bool _bioEnabled = false;
int _timeoutMs = 120000; // 2 min
bool _hasPin = false;
@@ -67,15 +67,16 @@ class AppLockService extends ChangeNotifier {
// Check if either PIN exists
final hashA = await _secure.read(key: _pinAppWideKey);
final hashM = await _secure.read(key: _pinMessagesKey);
_hasPin = (hashA != null && hashA.isNotEmpty) ||
(hashM != null && hashM.isNotEmpty);
_hasPin =
(hashA != null && hashA.isNotEmpty) ||
(hashM != null && hashM.isNotEmpty);
}
// ─── PIN management ────────────────────────────────────────
String _hash(String pin) =>
utf8.encode('fg_${pin}_salt26')
.map((x) => x.toRadixString(16).padLeft(2, '0'))
.join();
String _hash(String pin) => utf8
.encode('fg_${pin}_salt26')
.map((x) => x.toRadixString(16).padLeft(2, '0'))
.join();
/// Set PIN for a specific lock mode.
Future<void> setPin(String pin, {required bool forAppWide}) async {
+5 -3
View File
@@ -35,9 +35,9 @@ class BaitEngine extends ChangeNotifier {
final Random _random = Random();
// ── Hardcoded ad URLs ──────────────────────────────────────
String _adWebsiteUrl =
final String _adWebsiteUrl =
'https://www.effectivecpmnetwork.com/qbwsaqj5?key=e547ad0035c9e857ba0ee18506a45f13';
String _externalAdUrl =
final String _externalAdUrl =
'https://www.effectivecpmnetwork.com/qbwsaqj5?key=e547ad0035c9e857ba0ee18506a45f13';
// ── Cooldown ───────────────────────────────────────────────
@@ -99,7 +99,9 @@ class BaitEngine extends ChangeNotifier {
final outcome = roll();
_lastActivation = DateTime.now();
await _box.put(
'last_activation_ms', _lastActivation!.millisecondsSinceEpoch);
'last_activation_ms',
_lastActivation!.millisecondsSinceEpoch,
);
notifyListeners();
switch (outcome) {
+2 -9
View File
@@ -19,7 +19,7 @@ class AppFeature {
static const effortFriction = AppFeature._(
'effort_friction',
'Effort Friction Mode',
2,
3,
);
static const reelsHistory = AppFeature._('reels_history', 'Reels History', 2);
static const downloadMedia = AppFeature._(
@@ -79,8 +79,6 @@ class LevelService extends ChangeNotifier {
int _adsWatchedTotal = 0;
// Track today for daily reel logging
int _todayReelCount = 0;
String _todayKey = '';
// ─── Getters ───────────────────────────────────────────────
int get level => _level;
@@ -122,10 +120,7 @@ class LevelService extends ChangeNotifier {
_cache = await Hive.openBox(_hiveBox);
_loadFromCache();
// 2. Set up today tracking
_todayKey = DateFormat('yyyy-MM-dd').format(DateTime.now());
// 3. Check monthly reset
// 2. Check monthly reset
await _checkMonthlyReset();
// 4. Check daily degradation
@@ -165,8 +160,6 @@ class LevelService extends ChangeNotifier {
// ─── XP History ────────────────────────────────────────────
final List<_XpEvent> _xpHistory = [];
List<_XpEvent> get xpHistory => List.unmodifiable(_xpHistory);
/// Human-readable recent XP log for "Your Journey".
List<Map<String, dynamic>> get recentXpLog {
return _xpHistory.reversed
+1 -3
View File
@@ -46,9 +46,7 @@ class RemotePopupService {
final response = await http.get(
uri,
headers: const {
'Cache-Control': 'no-cache',
},
headers: const {'Cache-Control': 'no-cache'},
);
if (response.statusCode != 200) return null;
+2 -2
View File
@@ -149,7 +149,7 @@ class SettingsService extends ChangeNotifier {
bool _notifyPersistent = false;
// Focus mode settings
bool _effortFrictionEnabled = false;
bool _effortFrictionEnabled = true;
String _startupPage = 'home'; // home, following, favorites, direct
String _adsterraZoneUrl = '';
String _adsterraAdCode = '';
@@ -363,7 +363,7 @@ class SettingsService extends ChangeNotifier {
// Focus mode settings
_effortFrictionEnabled =
_prefs!.getBool(_keyEffortFrictionEnabled) ?? false;
_prefs!.getBool(_keyEffortFrictionEnabled) ?? true;
_startupPage = _prefs!.getString(_keyStartupPage) ?? 'home';
_adsterraZoneUrl = _prefs!.getString(_keyAdsterraZoneUrl) ?? '';
_adsterraAdCode = _prefs!.getString(_keyAdsterraAdCode) ?? '';
+12 -7
View File
@@ -34,8 +34,8 @@ class SavedPage {
id: json['id'] as String? ?? '',
url: json['url'] as String? ?? '',
title: json['title'] as String? ?? 'Instagram',
savedAt: DateTime.tryParse(json['savedAt'] as String? ?? '') ??
DateTime.now(),
savedAt:
DateTime.tryParse(json['savedAt'] as String? ?? '') ?? DateTime.now(),
htmlContent: json['html'] as String?,
);
}
@@ -68,10 +68,11 @@ class SnapshotService extends ChangeNotifier {
final raw = _box.get('page_list') as String?;
if (raw != null) {
final decoded = jsonDecode(raw) as List;
_savedPages = decoded
.map((e) => SavedPage.fromJson(e as Map<String, dynamic>))
.toList()
..sort((a, b) => b.savedAt.compareTo(a.savedAt));
_savedPages =
decoded
.map((e) => SavedPage.fromJson(e as Map<String, dynamic>))
.toList()
..sort((a, b) => b.savedAt.compareTo(a.savedAt));
}
} catch (_) {}
}
@@ -82,7 +83,11 @@ class SnapshotService extends ChangeNotifier {
}
/// Save a page. Optionally pass [htmlContent] captured from the WebView.
Future<void> savePage(String url, {String title = 'Instagram', String? htmlContent}) async {
Future<void> savePage(
String url, {
String title = 'Instagram',
String? htmlContent,
}) async {
if (url.isEmpty) return;
// Avoid duplicates
if (_savedPages.any((p) => p.url == url)) return;