Skip to content

Commit 91c819f

Browse files
Merge branch 'dev' into release
2 parents e35e7bb + a00320a commit 91c819f

25 files changed

Lines changed: 1025 additions & 611 deletions

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
A0CABC282DEF33BC00154A44 /* Tun2SocksKitC in Frameworks */ = {isa = PBXBuildFile; productRef = A0CABC272DEF33BC00154A44 /* Tun2SocksKitC */; };
2525
E640D9F7888558C3BD23A668 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = AE9BD0D6942BB307941DBA0D /* GoogleService-Info.plist */; };
2626
F1D23AC02E83A529002FF2F6 /* IosDXcore.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1D23ABF2E83A528002FF2F6 /* IosDXcore.xcframework */; };
27-
F1D584A52E7B5D3B00076143 /* VpnPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D584A42E7B5D3B00076143 /* VpnPlugin.swift */; };
27+
F1D584A52E7B5D3B00076143 /* VPNPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1D584A42E7B5D3B00076143 /* VPNPlugin.swift */; };
2828
FE197567FA0C370D7A74D3F4 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCDDE16F3C4844CAA5A11A52 /* Pods_RunnerTests.framework */; };
2929
/* End PBXBuildFile section */
3030

@@ -100,7 +100,7 @@
100100
DCDDE16F3C4844CAA5A11A52 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
101101
F126793C97B47EFB321481A7 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
102102
F1D23ABF2E83A528002FF2F6 /* IosDXcore.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = IosDXcore.xcframework; sourceTree = "<group>"; };
103-
F1D584A42E7B5D3B00076143 /* VpnPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VpnPlugin.swift; sourceTree = "<group>"; };
103+
F1D584A42E7B5D3B00076143 /* VPNPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VPNPlugin.swift; sourceTree = "<group>"; };
104104
F363D13D253BC7A752C07D84 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
105105
/* End PBXFileReference section */
106106

@@ -234,7 +234,7 @@
234234
97C146F01CF9000F007C117D /* Runner */ = {
235235
isa = PBXGroup;
236236
children = (
237-
F1D584A42E7B5D3B00076143 /* VpnPlugin.swift */,
237+
F1D584A42E7B5D3B00076143 /* VPNPlugin.swift */,
238238
A0CABC202DEF335D00154A44 /* AppDelegate.swift */,
239239
A0CABC1C2DEF334C00154A44 /* vpn_service.swift */,
240240
A0FE506B2DEF106E0019DB1D /* Runner.entitlements */,
@@ -522,7 +522,7 @@
522522
buildActionMask = 2147483647;
523523
files = (
524524
A0CABC212DEF335D00154A44 /* AppDelegate.swift in Sources */,
525-
F1D584A52E7B5D3B00076143 /* VpnPlugin.swift in Sources */,
525+
F1D584A52E7B5D3B00076143 /* VPNPlugin.swift in Sources */,
526526
A0CABC1D2DEF334C00154A44 /* vpn_service.swift in Sources */,
527527
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
528528
);

lib/app/advertise_director.dart

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:defyx_vpn/core/data/local/secure_storage/secure_storage.dart';
22
import 'package:defyx_vpn/core/data/local/secure_storage/secure_storage_const.dart';
33
import 'package:flutter_timezone/flutter_timezone.dart';
44
import 'package:flutter_riverpod/flutter_riverpod.dart';
5+
import 'package:flutter/foundation.dart';
56
import 'dart:math';
67

78
class AdvertiseDirector {
@@ -11,15 +12,22 @@ class AdvertiseDirector {
1112

1213
static Future<bool> shouldUseInternalAds(WidgetRef ref) async {
1314
final String currentTimeZone = await FlutterTimezone.getLocalTimezone();
15+
debugPrint('📍 Ad Manager - Current Timezone: $currentTimeZone');
1416

1517
final adversies =
1618
await ref.read(secureStorageProvider).readMap(apiAvertiseKey);
1719

1820
if (adversies['api_advertise'] != null) {
1921
final advertiseMap = adversies['api_advertise'] as Map<String, dynamic>;
20-
return advertiseMap.containsKey(currentTimeZone);
22+
final hasInternalAds = advertiseMap.containsKey(currentTimeZone);
23+
debugPrint('📍 Ad Manager - Has internal ads for timezone: $hasInternalAds');
24+
if (hasInternalAds) {
25+
debugPrint('📍 Ad Manager - Available timezones: ${advertiseMap.keys.toList()}');
26+
}
27+
return hasInternalAds;
2128
}
2229

30+
debugPrint('📍 Ad Manager - No advertise data found');
2331
return false;
2432
}
2533

@@ -35,6 +43,7 @@ class AdvertiseDirector {
3543

3644
static Future<Map<String, String>> getRandomCustomAd(WidgetRef ref) async {
3745
final String currentTimeZone = await FlutterTimezone.getLocalTimezone();
46+
debugPrint('📍 Ad Manager - Getting ad for timezone: $currentTimeZone');
3847

3948
final adversies =
4049
await ref.read(secureStorageProvider).readMap(apiAvertiseKey);
@@ -43,21 +52,27 @@ class AdvertiseDirector {
4352
final advertiseMap = adversies['api_advertise'] as Map<String, dynamic>;
4453
if (advertiseMap.containsKey(currentTimeZone)) {
4554
final adsData = advertiseMap[currentTimeZone] as List<dynamic>;
55+
debugPrint('📍 Ad Manager - Found ${adsData.length} ads for timezone');
4656
if (adsData.isNotEmpty) {
4757
final random = Random();
4858
final randomIndex = random.nextInt(adsData.length);
4959
final selectedAd = adsData[randomIndex] as List<dynamic>;
5060

5161
if (selectedAd.length >= 2) {
62+
debugPrint('📍 Ad Manager - Selected ad #$randomIndex');
5263
return {
5364
'imageUrl': selectedAd[0] as String,
5465
'clickUrl': selectedAd[1] as String,
5566
};
5667
}
5768
}
69+
} else {
70+
debugPrint('📍 Ad Manager - No ads for timezone: $currentTimeZone');
71+
debugPrint('📍 Ad Manager - Available timezones: ${advertiseMap.keys.toList()}');
5872
}
5973
}
6074

75+
debugPrint('📍 Ad Manager - Returning empty ad');
6176
// Return empty map - UI will handle showing "No ads available"
6277
return {'imageUrl': '', 'clickUrl': ''};
6378
}

lib/app/app.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:defyx_vpn/core/theme/app_theme.dart';
77
import 'package:defyx_vpn/modules/core/vpn.dart';
88
import 'package:defyx_vpn/modules/core/desktop_platform_handler.dart';
99
import 'package:defyx_vpn/modules/main/presentation/widgets/ump_service.dart';
10+
import 'package:defyx_vpn/shared/providers/language_provider.dart';
1011
import 'package:flutter/foundation.dart';
1112
import 'package:flutter/material.dart';
1213
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -87,9 +88,11 @@ class App extends ConsumerWidget {
8788

8889
Widget _buildApp(BuildContext context, WidgetRef ref) {
8990
final router = ref.watch(routerProvider);
90-
91+
final languageState = ref.watch(languageProvider);
9192
final designSize = _getDesignSize(context);
9293

94+
debugPrint('🌍 Building app with locale: ${languageState.language.locale}');
95+
9396
return ToastificationWrapper(
9497
config: ToastificationConfig(
9598
maxToastLimit: 1,
@@ -109,8 +112,7 @@ class App extends ConsumerWidget {
109112
routerConfig: router,
110113
builder: _appBuilder,
111114
debugShowCheckedModeBanner: false,
112-
// Force English locale (comment out to enable device language detection)
113-
locale: const Locale('en'),
115+
locale: languageState.language.locale,
114116
localizationsDelegates: const [
115117
AppLocalizations.delegate,
116118
GlobalMaterialLocalizations.delegate,
@@ -119,9 +121,7 @@ class App extends ConsumerWidget {
119121
],
120122
supportedLocales: const [
121123
Locale('en'),
122-
Locale('fa'),
123124
Locale('zh'),
124-
Locale('ru'),
125125
],
126126
);
127127
},

0 commit comments

Comments
 (0)