diff --git a/app/src/main/java/org/bepass/oblivion/SplitTunnelOptionsAdapter.java b/app/src/main/java/org/bepass/oblivion/SplitTunnelOptionsAdapter.java index 701e6912..a0c57a80 100644 --- a/app/src/main/java/org/bepass/oblivion/SplitTunnelOptionsAdapter.java +++ b/app/src/main/java/org/bepass/oblivion/SplitTunnelOptionsAdapter.java @@ -41,6 +41,9 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) { case BLACKLIST: holder.blacklist.setChecked(true); break; + case PERMITTEDLIST: + holder.permittedList.setChecked(true); + break; } holder.showSystemApps.setOnCheckedChangeListener((buttonView, isChecked) -> settingsCallback.shouldShowSystemApps(isChecked)); holder.disabled.setOnCheckedChangeListener((buttonView, isChecked) -> { @@ -56,6 +59,13 @@ public void onBindViewHolder(@NonNull ViewHolder holder, int position) { } }); + holder.permittedList.setOnCheckedChangeListener((buttonView, isChecked) -> { + if (isChecked) { + settingsCallback.splitTunnelMode(SplitTunnelMode.PERMITTEDLIST); + FileManager.set("splitTunnelMode", SplitTunnelMode.PERMITTEDLIST.toString()); + } + + }); } @Override @@ -73,12 +83,14 @@ public static class ViewHolder extends RecyclerView.ViewHolder { SwitchMaterial showSystemApps; RadioButton disabled; RadioButton blacklist; + RadioButton permittedList; public ViewHolder(@NonNull View itemView) { super(itemView); showSystemApps = itemView.findViewById(R.id.showSystemApps); disabled = itemView.findViewById(R.id.disabled); blacklist = itemView.findViewById(R.id.blacklist); + permittedList = itemView.findViewById(R.id.permittedList); } } } \ No newline at end of file diff --git a/app/src/main/java/org/bepass/oblivion/enums/SplitTunnelMode.java b/app/src/main/java/org/bepass/oblivion/enums/SplitTunnelMode.java index c674e131..9ead8566 100644 --- a/app/src/main/java/org/bepass/oblivion/enums/SplitTunnelMode.java +++ b/app/src/main/java/org/bepass/oblivion/enums/SplitTunnelMode.java @@ -4,7 +4,8 @@ public enum SplitTunnelMode { DISABLED, - BLACKLIST; + BLACKLIST, + PERMITTEDLIST; public static SplitTunnelMode getSplitTunnelMode() { SplitTunnelMode splitTunnelMode; diff --git a/app/src/main/java/org/bepass/oblivion/service/OblivionVpnService.java b/app/src/main/java/org/bepass/oblivion/service/OblivionVpnService.java index 4f809d69..f8a392b1 100644 --- a/app/src/main/java/org/bepass/oblivion/service/OblivionVpnService.java +++ b/app/src/main/java/org/bepass/oblivion/service/OblivionVpnService.java @@ -626,11 +626,15 @@ private void configureVpnBuilder(VpnService.Builder builder) throws Exception { // Determine split tunnel mode SplitTunnelMode splitTunnelMode = SplitTunnelMode.getSplitTunnelMode(); - if (splitTunnelMode == SplitTunnelMode.BLACKLIST) { + if (splitTunnelMode != SplitTunnelMode.DISABLED) { Set splitTunnelApps = getSplitTunnelApps(); for (String packageName : splitTunnelApps) { try { - builder.addDisallowedApplication(packageName); + if (splitTunnelMode == SplitTunnelMode.BLACKLIST) + builder.addDisallowedApplication(packageName); + else if (splitTunnelMode == SplitTunnelMode.PERMITTEDLIST) + builder.addAllowedApplication(packageName); + } catch (PackageManager.NameNotFoundException ignored) { } } diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index b595f2fd..07b66708 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -306,7 +306,7 @@ android:layout_height="wrap_content" android:fontFamily="@font/shabnam" android:minWidth="100dp" - android:text="@string/blackList" + android:text="@string/blackWhiteList" android:textAlignment="viewEnd" android:textColor="@color/text_color" android:textSize="20sp" /> diff --git a/app/src/main/res/layout/activity_split_tunnel.xml b/app/src/main/res/layout/activity_split_tunnel.xml index 921df6e0..41d8c7f8 100644 --- a/app/src/main/res/layout/activity_split_tunnel.xml +++ b/app/src/main/res/layout/activity_split_tunnel.xml @@ -45,7 +45,7 @@ android:layout_centerVertical="true" android:layout_marginEnd="16dp" android:fontFamily="@font/shabnamlight" - android:text="@string/blackList" + android:text="@string/blackWhiteList" android:textColor="@color/text_color" android:textSize="24sp" tools:ignore="RelativeOverlap" diff --git a/app/src/main/res/layout/split_tunnel_options.xml b/app/src/main/res/layout/split_tunnel_options.xml index a800de98..f94d53ad 100644 --- a/app/src/main/res/layout/split_tunnel_options.xml +++ b/app/src/main/res/layout/split_tunnel_options.xml @@ -71,7 +71,7 @@ android:textSize="14sp" android:focusable="true" android:nextFocusUp="@id/disabled" - android:nextFocusDown="@id/showSystemApps" /> + android:nextFocusDown="@id/permittedList" /> + + + + #سگارو #یوسف_قبادی اینترنت برای همه، یا هیچکس - لیست سیاه + لیست سیاه/سفید غیرفعال در حالت غیرفعال، ترافیک تمامی برنامه‌ها از VPN عبور می‌کند. فعال @@ -92,4 +92,6 @@ بریتانیا ایالات متحده + مجاز + در حالت مجاز، فقط ترافیک برنامه های انتخاب شده از VPN عبور می کند. \ No newline at end of file diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 4a4bac26..b9a1a645 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -11,7 +11,7 @@ #Segaro #Yousef_Ghobadi Интернет для всех или ни для кого - Черный список + Черный/Белый список Отключено В режиме отключения весь трафик приложений проходит через VPN. Включено @@ -92,4 +92,6 @@ Великобритания Соединенные Штаты + Разрешено + В разрешенном режиме через VPN проходит только трафик выбранных приложений. \ No newline at end of file diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 5b9194c8..b4bb1441 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -11,7 +11,7 @@ #Segaro #Yousef_Ghobadi İnternet Herkes İçin, Ya Da Hiç Kimse İçin - Kara Liste + Kara/Beyaz Liste Devre Dışı Devre dışı modda, tüm uygulamaların trafiği VPN üzerinden geçer. Etkin @@ -92,4 +92,6 @@ Birleşik Krallık Birleşik Devletler + İzin verildi + İzin verilen modda yalnızca seçili uygulamaların trafiği VPN üzerinden geçer. \ No newline at end of file diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index aeff9aa7..a0e67143 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -11,7 +11,7 @@ #Segaro #Yousef_Ghobadi 互联网为所有人,或者无人 - 黑名单 + 黑/白名单 全局模式 在全局模式下,所有应用的流量都通过VPN。 绕行模式 @@ -92,5 +92,7 @@ 美国 选择语言 + 允许 + 在允许模式下,只有选定的应用程序的流量通过 VPN。 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c0eeb599..cd2e2a46 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -11,7 +11,7 @@ #Segaro #Yousef_Ghobadi Internet for All, or No One - Blacklist + Black/White list Disabled In disabled mode, traffic of all apps passes through VPN. Enabled @@ -131,4 +131,6 @@ IPv4 IPv6 + Permitted + In permitted mode, just traffic of selected apps pass through VPN.