Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions android/app/src/main/kotlin/com/defyx/defyx/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class MainActivity : FlutterActivity() {
"setConnectionMethod" ->
setConnectionMethod(call.arguments as? Map<String, Any>, result)
"login" -> login(call.arguments as? Map<String, Any>, result)
"loginByCode" -> loginByCode(call.arguments as? Map<String, Any>, result)
else -> result.notImplemented()
}
} catch (e: Exception) {
Expand Down Expand Up @@ -474,6 +475,31 @@ class MainActivity : FlutterActivity() {
}
}
}

private fun loginByCode(args: Map<String, Any>?, result: MethodChannel.Result) {
CoroutineScope(Dispatchers.IO).launch {
try {
val code = args?.get("code") as? String
if (code.isNullOrEmpty()) {
withContext(Dispatchers.Main) {
result.error(
"INVALID_ARGUMENT",
"code is missing or empty",
null
)
}
return@launch
}
val loginResult = DefyxVpnService.getInstance().loginByCode(code)
result.success(loginResult)
} catch (e: Exception) {
Log.e("Login by code", "Login failed: ${e.message}", e)
withContext(Dispatchers.Main) {
result.error("LOGIN_ERROR", "Failed to login by code", e.localizedMessage)
}
}
}
}
}

class ProgressStreamHandler : EventChannel.StreamHandler, ProgressListener {
Expand Down
9 changes: 9 additions & 0 deletions android/app/src/main/kotlin/com/defyx/defyx/VpnService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -409,4 +409,13 @@ class DefyxVpnService : VpnService() {
""
}
}

fun loginByCode(code: String): String {
return try {
Android.loginByCode(code)
} catch (e: Exception) {
log("Login by code failed: ${e.message}")
""
}
}
}
123 changes: 65 additions & 58 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,67 +42,67 @@ PODS:
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- Firebase/CoreOnly (12.17.0):
- FirebaseCore (~> 12.17.0)
- Firebase/Crashlytics (12.17.0):
- Firebase/CoreOnly (12.4.0):
- FirebaseCore (~> 12.4.0)
- Firebase/Crashlytics (12.4.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 12.17.0)
- firebase_analytics (12.4.6):
- FirebaseCrashlytics (~> 12.4.0)
- firebase_analytics (12.0.4):
- firebase_core
- FirebaseAnalytics (= 12.17.0)
- FirebaseAnalytics (= 12.4.0)
- Flutter
- firebase_core (4.13.0):
- Firebase/CoreOnly (= 12.17.0)
- firebase_core (4.2.1):
- Firebase/CoreOnly (= 12.4.0)
- Flutter
- firebase_crashlytics (5.2.7):
- Firebase/Crashlytics (= 12.17.0)
- firebase_crashlytics (5.0.5):
- Firebase/Crashlytics (= 12.4.0)
- firebase_core
- Flutter
- FirebaseAnalytics (12.17.0):
- FirebaseAnalytics/Default (= 12.17.0)
- FirebaseCore (~> 12.17.0)
- FirebaseInstallations (~> 12.17.0)
- FirebaseAnalytics (12.4.0):
- FirebaseAnalytics/Default (= 12.4.0)
- FirebaseCore (~> 12.4.0)
- FirebaseInstallations (~> 12.4.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- FirebaseAnalytics/Default (12.17.0):
- FirebaseCore (~> 12.17.0)
- FirebaseInstallations (~> 12.17.0)
- GoogleAppMeasurement/Default (= 12.17.0)
- FirebaseAnalytics/Default (12.4.0):
- FirebaseCore (~> 12.4.0)
- FirebaseInstallations (~> 12.4.0)
- GoogleAppMeasurement/Default (= 12.4.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- FirebaseCore (12.17.0):
- FirebaseCoreInternal (~> 12.17.0)
- FirebaseCore (12.4.0):
- FirebaseCoreInternal (~> 12.4.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Logger (~> 8.1)
- FirebaseCoreExtension (12.17.0):
- FirebaseCore (~> 12.17.0)
- FirebaseCoreInternal (12.17.0):
- FirebaseCoreExtension (12.4.0):
- FirebaseCore (~> 12.4.0)
- FirebaseCoreInternal (12.4.0):
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- FirebaseCrashlytics (12.17.0):
- FirebaseCore (~> 12.17.0)
- FirebaseInstallations (~> 12.17.0)
- FirebaseRemoteConfigInterop (~> 12.17.0)
- FirebaseSessions (~> 12.17.0)
- FirebaseCrashlytics (12.4.0):
- FirebaseCore (~> 12.4.0)
- FirebaseInstallations (~> 12.4.0)
- FirebaseRemoteConfigInterop (~> 12.4.0)
- FirebaseSessions (~> 12.4.0)
- GoogleDataTransport (~> 10.1)
- GoogleUtilities/Environment (~> 8.1)
- nanopb (~> 3.30910.0)
- PromisesObjC (~> 2.4)
- FirebaseInstallations (12.17.0):
- FirebaseCore (~> 12.17.0)
- FirebaseInstallations (12.4.0):
- FirebaseCore (~> 12.4.0)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
- PromisesObjC (~> 2.4)
- FirebaseRemoteConfigInterop (12.17.0)
- FirebaseSessions (12.17.0):
- FirebaseCore (~> 12.17.0)
- FirebaseCoreExtension (~> 12.17.0)
- FirebaseInstallations (~> 12.17.0)
- FirebaseRemoteConfigInterop (12.4.0)
- FirebaseSessions (12.4.0):
- FirebaseCore (~> 12.4.0)
- FirebaseCoreExtension (~> 12.4.0)
- FirebaseInstallations (~> 12.4.0)
- GoogleDataTransport (~> 10.1)
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/UserDefaults (~> 8.1)
Expand All @@ -122,28 +122,28 @@ PODS:
- Flutter
- Google-Mobile-Ads-SDK (~> 12.2.0)
- webview_flutter_wkwebview
- GoogleAdsOnDeviceConversion (3.6.1):
- GoogleAdsOnDeviceConversion (3.1.0):
- GoogleUtilities/Environment (~> 8.1)
- GoogleUtilities/Logger (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/Core (12.17.0):
- GoogleAppMeasurement/Core (12.4.0):
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/Default (12.17.0):
- GoogleAdsOnDeviceConversion (~> 3.6.0)
- GoogleAppMeasurement/Core (= 12.17.0)
- GoogleAppMeasurement/IdentitySupport (= 12.17.0)
- GoogleAppMeasurement/Default (12.4.0):
- GoogleAdsOnDeviceConversion (~> 3.1.0)
- GoogleAppMeasurement/Core (= 12.4.0)
- GoogleAppMeasurement/IdentitySupport (= 12.4.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
- "GoogleUtilities/NSData+zlib (~> 8.1)"
- nanopb (~> 3.30910.0)
- GoogleAppMeasurement/IdentitySupport (12.17.0):
- GoogleAppMeasurement/Core (= 12.17.0)
- GoogleAppMeasurement/IdentitySupport (12.4.0):
- GoogleAppMeasurement/Core (= 12.4.0)
- GoogleUtilities/AppDelegateSwizzler (~> 8.1)
- GoogleUtilities/MethodSwizzler (~> 8.1)
- GoogleUtilities/Network (~> 8.1)
Expand Down Expand Up @@ -187,6 +187,9 @@ PODS:
- nanopb/encode (3.30910.0)
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- PromisesObjC (2.4.1)
- PromisesSwift (2.4.1):
- PromisesObjC (= 2.4.1)
Expand Down Expand Up @@ -221,6 +224,7 @@ DEPENDENCIES:
- google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`)
- GoogleUserMessagingPlatform
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
Expand Down Expand Up @@ -280,6 +284,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/google_mobile_ads/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
sensors_plus:
:path: ".symlinks/plugins/sensors_plus/ios"
shared_preferences_foundation:
Expand All @@ -291,37 +297,38 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
app_tracking_transparency: 3d84f147f67ca82d3c15355c36b1fa6b66ca7c92
audioplayers_darwin: 835ced6edd4c9fc8ebb0a7cc9e294a91d99917d5
audioplayers_darwin: 4f9ca89d92d3d21cec7ec580e78ca888e5fb68bd
battery_plus: b42253f6d2dde71712f8c36fef456d99121c5977
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
Firebase: e8400c058702940d53f31fc0653e4e7a06332326
firebase_analytics: 4dc4986181e6f58d24f879716f175a53e837c914
firebase_core: c94f9efeed0ded590b7eecaf6110a374eb865d7a
firebase_crashlytics: 36d85edffd4bfd025c13025b0009f63754983536
FirebaseAnalytics: 652858a1424ca8c549b62261876814ff56dff650
FirebaseCore: 52d4512296984a44a8c8870c6494870fc7aeee2f
FirebaseCoreExtension: be2d62bfcf339c7dd94646d43d910aaf37fe17c1
FirebaseCoreInternal: 3b310521b34a51ce3a6c605e4618b9aef8f6c112
FirebaseCrashlytics: 33f4bb8b7140f1864a4db6b819edf36e6d2b1b0d
FirebaseInstallations: bd8e80f51d4c8bdc6c872011dede0b800c5b49ea
FirebaseRemoteConfigInterop: 785e617ae4cbc778eea97dde952b88fb934e11ff
FirebaseSessions: 83cf567ddcef20303eb85e003dfdbe030343ef8d
Firebase: f07b15ae5a6ec0f93713e30b923d9970d144af3e
firebase_analytics: 67fbdd9f3c04e55048024f3da21cfc36f05e56cf
firebase_core: f1aafb21c14f497e5498f7ffc4dc63cbb52b2594
firebase_crashlytics: c039028126cb45e32f4c217aa392408b0963d081
FirebaseAnalytics: 0fc2b20091f0ddd21bf73397cf8f0eb5346dc24f
FirebaseCore: bb595f3114953664e3c1dc032f008a244147cfd3
FirebaseCoreExtension: 7e1f7118ee970e001a8013719fb90950ee5e0018
FirebaseCoreInternal: d7f5a043c2cd01a08103ab586587c1468047bca6
FirebaseCrashlytics: a6ece278a837c7e88de2d9b5da0a3542f2342395
FirebaseInstallations: ae9f4902cb5bf1d0c5eaa31ec1f4e5495a0714e2
FirebaseRemoteConfigInterop: 1e31ec72b89c9924367c59bfb5ec9ab60d1d6766
FirebaseSessions: ba7c7a7ca8696a8d540eb3fe3800fbe98c79786d
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf
flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23
flutter_timezone: 7c838e17ffd4645d261e87037e5bebf6d38fe544
Google-Mobile-Ads-SDK: 1dfb0c3cb46c7e2b00b0f4de74a1e06d9ea25d67
google_mobile_ads: 535223588a6791b7a3cc3513a1bc7b89d12f3e62
GoogleAdsOnDeviceConversion: e3b71da24ff4cf01cf520756ac1c2b93c07b86ff
GoogleAppMeasurement: 2234668e2451f9da37b93dad7830e457600c008f
GoogleAdsOnDeviceConversion: e03a386840803ea7eef3fd22a061930142c039c1
GoogleAppMeasurement: 1e718274b7e015cefd846ac1fcf7820c70dc017d
GoogleDataTransport: a24e58982ab3ba2f64d79613e027fe7f57e88539
GoogleUserMessagingPlatform: befe603da6501006420c206222acd449bba45a9c
GoogleUtilities: 766ace00c6b10d8148408f329d10c4f051931850
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
PromisesObjC: 752c3227f599e3467650e47ea36f433eeb10c273
PromisesSwift: 217dea0fd5d2ad65222a109c48698add13cc1c5b
SDWebImage: e9fc87c1aab89a8ab1bbd74eba378c6f53be8abf
Expand Down
20 changes: 20 additions & 0 deletions ios/Runner/VPNPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class VpnPlugin: VpnStatusDelegate {
isVPNPrepared(result)
case "login":
login(call.arguments as? [String: Any], result)
case "loginByCode":
loginByCode(call.arguments as? [String: Any], result)
default:
result(FlutterMethodNotImplemented)
}
Expand Down Expand Up @@ -288,6 +290,24 @@ class VpnPlugin: VpnStatusDelegate {

}

private func loginByCode(_ arguments: [String: Any]?, _ result: @escaping FlutterResult) {
guard let args = arguments,
let code = args["code"] as? String
else {
result(
FlutterError(
code: "INVALID_ARGUMENTS", message: "Missing required parameters", details: nil)
)
return
}

goQueue.async {
let token = IosLoginByCode(code)
result(token)
}

}



private func getFlowLine(_ arguments: [String: Any]?, _ result: @escaping FlutterResult) {
Expand Down
25 changes: 24 additions & 1 deletion lib/common/components/button.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

enum AppButtonVariant { primary, secondary }
enum AppButtonVariant { primary, secondary, tertiary }

enum AppButtonSize { small, medium }

Expand Down Expand Up @@ -29,6 +29,7 @@ class AppButton extends StatelessWidget {
height: config.height,
child: ElevatedButton(
onPressed: isLoading ? null : onPressed,

style: ElevatedButton.styleFrom(
minimumSize: Size.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
Expand All @@ -40,6 +41,7 @@ class AppButton extends StatelessWidget {
disabledForegroundColor: _textColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.r),
side: BorderSide(color: _borderColor, width: 1),
),
),
child: AnimatedSwitcher(
Expand Down Expand Up @@ -77,6 +79,9 @@ class AppButton extends StatelessWidget {

case AppButtonVariant.secondary:
return const Color(0xFFEAEAEA);

case AppButtonVariant.tertiary:
return Colors.transparent;
}
}

Expand All @@ -87,6 +92,9 @@ class AppButton extends StatelessWidget {

case AppButtonVariant.secondary:
return const Color(0xFF4B4B4B);

case AppButtonVariant.tertiary:
return const Color(0xFF4B4B4B);
}
}

Expand All @@ -97,6 +105,21 @@ class AppButton extends StatelessWidget {

case AppButtonVariant.secondary:
return const Color(0xFF4B4B4B);
case AppButtonVariant.tertiary:
return const Color(0xFF9E9E9E);
}
}

Color get _borderColor {
switch (variant) {
case AppButtonVariant.primary:
return Colors.transparent;

case AppButtonVariant.secondary:
return Colors.transparent;

case AppButtonVariant.tertiary:
return const Color(0xFFEAEAEA);
}
}

Expand Down
Loading