Skip to content

Commit 9d3f02a

Browse files
committed
add base
1 parent 2b169ec commit 9d3f02a

File tree

18 files changed

+1465
-83
lines changed

18 files changed

+1465
-83
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ OmidVPN is a simple, lightweight, and secure OpenVPN client for Android that all
3434
- 📱 **Modern UI**: Clean and intuitive user interface built with Flutter
3535
- 🎯 **Easy to Use**: Simple one-tap connection to VPN servers
3636

37-
## 📋 Requirements
38-
39-
- Android 5.0 (Lollipop) or higher
40-
- Internet connection for downloading server lists
41-
4237
## 🚀 Installation
4338

4439
1. Download the latest APK from the [Releases](https://github.com/code3-dev/OmidVPN/releases) page
@@ -69,9 +64,11 @@ OmidVPN respects your privacy. We do not:
6964
- [x] Cache servers
7065
- [x] Remove cache if click on refresh icon
7166
- [x] Connect to VPN
67+
- [x] Complete theme settings
68+
- [x] Add settings page
69+
- [x] Add privacy policy
7270
- [ ] Auto connect (in future)
7371
- [ ] Bypass apps (in future)
74-
- [ ] Select theme (in future)
7572
- [ ] Select API proxy (in future)
7673

7774
## 👤 Author

android/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939

4040
defaultConfig {
4141
applicationId = "com.pira.omid"
42-
minSdk = 21
42+
minSdk = 24
4343
targetSdk = flutter.targetSdkVersion
4444
versionCode = flutter.versionCode
4545
versionName = flutter.versionName

android/app/src/main/kotlin/com/pira/omid/MainActivity.kt

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ class MainActivity: FlutterActivity() {
3535
"checkNotificationPermission" -> {
3636
result.success(checkNotificationPermission())
3737
}
38-
"requestNotificationPermission" -> {
39-
requestNotificationPermission()
40-
result.success(null)
38+
"requestNotificationPermissionInApp" -> {
39+
result.success(requestNotificationPermissionInApp())
40+
}
41+
"openAppSettingsForNotifications" -> {
42+
openAppSettings()
43+
result.success(true)
4144
}
4245
else -> result.notImplemented()
4346
}
@@ -66,27 +69,20 @@ class MainActivity: FlutterActivity() {
6669
return NotificationManagerCompat.from(this).areNotificationsEnabled()
6770
}
6871

69-
// Request notification permission
70-
private fun requestNotificationPermission() {
71-
if (!checkNotificationPermission()) {
72-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
73-
showNotificationPermissionDialog()
74-
} else {
75-
showNotificationPermissionDialog()
76-
}
72+
// Request notification permission in app (returns true if already granted or if requested successfully)
73+
private fun requestNotificationPermissionInApp(): Boolean {
74+
if (checkNotificationPermission()) {
75+
return true
76+
}
77+
78+
// For Android 13+ (Tiramisu), we need to request the permission
79+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
80+
// We can't request permission directly, need to open settings
81+
return false
82+
} else {
83+
// For older versions, permission is usually granted by default
84+
return true
7785
}
78-
}
79-
80-
// Show dialog to request notification permission
81-
private fun showNotificationPermissionDialog() {
82-
AlertDialog.Builder(this)
83-
.setTitle("Notification Permission Required")
84-
.setMessage("This app needs notification permission to show VPN connection status. Please enable notifications in app settings.")
85-
.setPositiveButton("Open Settings") { _: DialogInterface, _: Int ->
86-
openAppSettings()
87-
}
88-
.setNegativeButton("Later", null)
89-
.show()
9086
}
9187

9288
// Open app settings

0 commit comments

Comments
 (0)