-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrated app to a forked version of wireguard-android to enable development work on features that require changes to the core lib, like #107 #104 #87 #52 #6 Improved first launch flow by change vpn permission to only launch on first tunnel start Changed to proper database seeding strategy Updated README to account for GitHub packages auth requirement Migrated from deprecated UI components and libs Bump versions
- Loading branch information
1 parent
500b85f
commit 2690ce2
Showing
27 changed files
with
286 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/src/main/java/com/zaneschepke/wireguardautotunnel/data/DatabaseCallback.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.zaneschepke.wireguardautotunnel.data | ||
|
||
import androidx.room.RoomDatabase | ||
import androidx.sqlite.db.SupportSQLiteDatabase | ||
import timber.log.Timber | ||
|
||
class DatabaseCallback : RoomDatabase.Callback() { | ||
override fun onCreate(db: SupportSQLiteDatabase) = db.run { | ||
// Notice non-ui thread is here | ||
beginTransaction() | ||
try { | ||
execSQL(Queries.createDefaultSettings()) | ||
Timber.i("Bootstrapping settings data") | ||
setTransactionSuccessful() | ||
} catch (e : Exception) { | ||
Timber.e(e) | ||
} finally { | ||
endTransaction() | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
app/src/main/java/com/zaneschepke/wireguardautotunnel/data/Queries.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.zaneschepke.wireguardautotunnel.data | ||
|
||
object Queries { | ||
fun createDefaultSettings() : String { | ||
return """ | ||
INSERT INTO Settings (is_tunnel_enabled, | ||
is_tunnel_on_mobile_data_enabled, | ||
trusted_network_ssids, | ||
default_tunnel, | ||
is_always_on_vpn_enabled, | ||
is_tunnel_on_ethernet_enabled, | ||
is_shortcuts_enabled, | ||
is_battery_saver_enabled, | ||
is_tunnel_on_wifi_enabled, | ||
is_kernel_enabled, | ||
is_restore_on_boot_enabled, | ||
is_multi_tunnel_enabled) | ||
VALUES | ||
('false', | ||
'false', | ||
'[trustedSSID1,trustedSSID2]', | ||
NULL, | ||
'false', | ||
'false', | ||
'false', | ||
'false', | ||
'false', | ||
'false', | ||
'false', | ||
'false') | ||
""".trimIndent() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/ActivityViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package com.zaneschepke.wireguardautotunnel.ui | ||
|
||
import androidx.lifecycle.ViewModel | ||
import com.zaneschepke.wireguardautotunnel.data.SettingsDao | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class ActivityViewModel | ||
@Inject | ||
constructor( | ||
private val settingsRepo: SettingsDao, | ||
) : ViewModel() {} | ||
constructor() : ViewModel() { | ||
|
||
} |
Oops, something went wrong.