Commit Graph

411 Commits

Author SHA1 Message Date
Jason A. Donenfeld
53f8c8dbc4 build: remove bespoke signing config properties
Keys should be in HSMs anyway, and a setup like this does not easily
allow for that.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-06 17:16:29 +02:00
Jason A. Donenfeld
beb40ad09c ui: allow vetoing tunnel selection changes
These changes can happen at the wrong time, so we need to be able to
walk them back. Fixes:

Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
  at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1610)
  at androidx.fragment.app.FragmentManager.enqueueAction (FragmentManager.java:1650)
  at androidx.fragment.app.BackStackRecord.commitInternal (BackStackRecord.java:341)
  at androidx.fragment.app.BackStackRecord.commit (BackStackRecord.java:306)
  at androidx.fragment.app.FragmentManagerKt.commit$default (FragmentManager.kt:35)
  at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.kt:113)
  at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.kt:25)
  at com.wireguard.android.activity.BaseActivity$onCreate$1.invokeSuspend (BaseActivity.kt:44)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith (DispatchedContinuation.java:256)
  at kotlinx.coroutines.DispatchedTaskKt.resume (DispatchedTask.kt:177)
  at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core (CancellableContinuationImpl.kt:190)
  at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined (DispatchedTask.kt:190)
  at kotlinx.coroutines.DispatchedTaskKt.dispatch (DispatchedTask.kt:161)
  at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume (CancellableContinuationImpl.kt:397)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:431)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:420)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:328)
  at kotlinx.coroutines.ResumeAwaitOnCompletion.invoke (JobSupport.kt:1413)
  at kotlinx.coroutines.JobSupport.notifyHandlers (JobSupport.kt:368)
  at kotlinx.coroutines.JobSupport.notifyCompletion (JobSupport.kt:362)
  at kotlinx.coroutines.JobSupport.completeStateFinalization (JobSupport.kt:323)
  at kotlinx.coroutines.JobSupport.finalizeFinishingState (JobSupport.kt:240)
  at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath (JobSupport.kt:906)
  at kotlinx.coroutines.JobSupport.tryMakeCompleting (JobSupport.kt:863)
  at kotlinx.coroutines.JobSupport.makeCompleting$kotlinx_coroutines_core (JobSupport.kt:806)
  at kotlinx.coroutines.CompletableDeferredImpl.complete (CompletableDeferredImpl.java:92)
  at com.wireguard.android.model.TunnelManager$onTunnelsLoaded$1.invokeSuspend (TunnelManager.kt:120)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:8163)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:656)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:967)

Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
  at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1610)
  at androidx.fragment.app.FragmentManager.enqueueAction (FragmentManager.java:1650)
  at androidx.fragment.app.BackStackRecord.commitInternal (BackStackRecord.java:341)
  at androidx.fragment.app.BackStackRecord.commit (BackStackRecord.java:306)
  at androidx.fragment.app.FragmentManagerKt.commit$default (FragmentManager.kt:35)
  at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.kt:113)
  at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.kt:25)
  at com.wireguard.android.activity.BaseActivity$onCreate$1.invokeSuspend (BaseActivity.kt:44)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith (DispatchedContinuation.java:256)
  at kotlinx.coroutines.DispatchedTaskKt.resume (DispatchedTask.kt:177)
  at kotlinx.coroutines.CancellableContinuationImpl.parentCancelled$kotlinx_coroutines_core (CancellableContinuationImpl.kt:190)
  at kotlinx.coroutines.DispatchedTaskKt.resumeUnconfined (DispatchedTask.kt:190)
  at kotlinx.coroutines.DispatchedTaskKt.dispatch (DispatchedTask.kt:161)
  at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume (CancellableContinuationImpl.kt:397)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl (CancellableContinuationImpl.kt:431)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default (CancellableContinuationImpl.kt:420)
  at kotlinx.coroutines.CancellableContinuationImpl.resumeWith (CancellableContinuationImpl.kt:328)
  at kotlinx.coroutines.ResumeAwaitOnCompletion.invoke (JobSupport.kt:1413)
  at kotlinx.coroutines.JobSupport.notifyHandlers (JobSupport.kt:368)
  at kotlinx.coroutines.JobSupport.notifyCompletion (JobSupport.kt:362)
  at kotlinx.coroutines.JobSupport.completeStateFinalization (JobSupport.kt:323)
  at kotlinx.coroutines.JobSupport.finalizeFinishingState (JobSupport.kt:240)
  at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath (JobSupport.kt:906)
  at kotlinx.coroutines.JobSupport.tryMakeCompleting (JobSupport.kt:863)
  at kotlinx.coroutines.JobSupport.makeCompleting$kotlinx_coroutines_core (JobSupport.kt:806)
  at kotlinx.coroutines.CompletableDeferredImpl.complete (CompletableDeferredImpl.java:92)
  at com.wireguard.android.model.TunnelManager$onTunnelsLoaded$1.invokeSuspend (TunnelManager.kt:120)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:210)
  at android.os.Looper.loop (Looper.java:299)
  at android.app.ActivityThread.main (ActivityThread.java:8302)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:556)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1037)

Exception java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
  at androidx.fragment.app.FragmentManager.checkStateLoss (FragmentManager.java:1610)
  at androidx.fragment.app.FragmentManager.ensureExecReady (FragmentManager.java:1711)
  at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1754)
  at androidx.fragment.app.FragmentManager.popBackStackImmediate (FragmentManager.java:854)
  at androidx.fragment.app.FragmentManager.popBackStackImmediate (FragmentManager.java:778)
  at com.wireguard.android.activity.MainActivity.onSelectedTunnelChanged (MainActivity.kt:110)
  at com.wireguard.android.activity.BaseActivity.setSelectedTunnel (BaseActivity.kt:25)
  at com.wireguard.android.activity.BaseActivity$onCreate$1.invokeSuspend (BaseActivity.kt:44)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  at kotlinx.coroutines.EventLoop.processUnconfinedEvent (EventLoop.common.kt:69)
  at kotlinx.coroutines.DispatchedTaskKt.runUnconfinedEventLoop (DispatchedTask.kt:204)
  at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith (DispatchedContinuation.kt:282)
  at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable (Cancellable.kt:30)
  at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default (Cancellable.kt:25)
  at kotlinx.coroutines.CoroutineStart.invoke (CoroutineStart.java:110)
  at kotlinx.coroutines.AbstractCoroutine.start (AbstractCoroutine.kt:126)
  at kotlinx.coroutines.BuildersKt.launch$default (Builders.kt)
  at com.wireguard.android.model.TunnelManager.onTunnelsLoaded (TunnelManager.java:114)
  at com.wireguard.android.model.TunnelManager.access$onTunnelsLoaded (TunnelManager.java:40)
  at com.wireguard.android.model.TunnelManager$onCreate$1.invokeSuspend (TunnelManager.kt:104)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8757)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:571)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 17:08:47 +02:00
Jason A. Donenfeld
4bac284083 ui: don't use primary color on status bar < api 23
The primary color changes in night theme, and since there's no proper
mode for the status icons on those APIs, it looks bad.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 16:20:10 +02:00
Jason A. Donenfeld
eae9216fe4 ui: no need to manually recreate activities after night change
Since version 1.1.0, setDefaultNightMode now takes care of that. Also,
set the initial mode in a blocking fashion to prevent flashing white.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 16:03:54 +02:00
Jason A. Donenfeld
dc1860c74d ui: distinguish play store installs at runtime for reproducible builds
This change lets us use the same build for F-Droid, Play Store, self
builds, and elsewhere, which makes everything more easily publicly
verifiable, since the build system is reproducible. That means that all
APKs will have the same code and be completely interchangeable, no
matter where they come from.

It does this by removing the build-time branch for special Play Store
builds, and replacing it with a simple runtime check using the
PackageManager APIs that return the name of the installer. If the app is
installed by "com.android.vending", then it's a Play Store install.

It's possible to test this with:

    $ pm install -i com.android.vending path/to/package.apk

And it appears to work well.

One potential concern is that it's unclear whether the Play Store
reviewers install the app using utilities that set com.android.vending
like this. If not, that might be a problem. However, it looks like
various banking apps also use the installer package name check in the
same way, and refuse to start if it's not right. That suggests that it
would be impossible for Play Store reviewers to even review those
banking apps if they did not set com.android.vending properly.

Out of an abundance of caution, though, and in order to avoid a Play
Store suspension that's harder to appeal, I sent a support request
today (which just managed to fit exactly in the 1000 character limit):

    Hi,

    My app pays special attention to Google Play Store guidelines. For that
    reason, there is some code in the app that looks like this:

        if (BuildConfig.IS_GOOGLE_PLAY)
            ...
        else
            ...

    This means that I compile two versions of my app, one for Google Play,
    and another for other app stores. This has worked well for many years
    and it satisfies Google's policy requirements.

    However, compiling two versions of my app is a bit of a pain. Instead, I
    would like to do this check at runtime, with code like this:

        if (pm.getInstallSourceInfo(package).installingPackageName == "com.android.vending")
            ...
        else
            ...

    I have tested that this code works well, and I've installed my app with:

        $ pm install -i com.android.vending ui-release.apk

    This works and successfully satisfies the policy requirements.

    My question is how this works during the review process. Are reviewed
    apps installed with the necessary -i com.android.vending switch to make
    this work?

    Thanks.

They responded fairly quickly:

    Hi Jason,

    Thanks for contacting the Google Play team.

    Unfortunately I'm not able to comment on your planned implementation. If
    you think your app is in compliance, please submit your app for review.
    You may want to review the Developer Program Policies for additional
    policy guidance.

    We recommend reviewing the details listed in this blog post and update
    your app accordingly to comply with the changes.

    Thanks for your understanding and continued support.

    Regards,
    Mia
    Google Play Developer Support

So I'll interpret that as a, "if you think it's okay, submit it and see,
and then we'll let you know." So here we go. Hopefully if it is
rejected, the update will only be blocked, and I'll just revert this
commit and resubmit.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-05 13:54:23 +02:00
Jason A. Donenfeld
91a75b681d ui: always use MaterialAlertDialogBuilder
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 21:41:49 +02:00
Jason A. Donenfeld
0efdf0cdd7 strings: sync with crowdin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:54:29 +02:00
Jason A. Donenfeld
75efd13556 ui: don't create fake theme color attr
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
cd812b03cd ui: force dark theme in TV mode
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
794a2a1925 ui: use filled icon buttons in TV mode
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
75899594c3 ui: use real M3 themeing on TV
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
4944762d7c ui: redirect to play store if no file manager on tv
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
d6431db248 ui: detect tv framework stubs when getting content
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
b8f649d1cb ui: use ErrorMessages consistently
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 20:53:42 +02:00
Jason A. Donenfeld
9fa8ca8c77 ui: do not crash if tunnel preparation fails
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:31:52 +02:00
Jason A. Donenfeld
59da677c23 ui: do not OOM when leaving log window open for a while
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:31:52 +02:00
Jason A. Donenfeld
18a06b0a51 ui: show bottom sheet sync to prevent double add
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:31:52 +02:00
Jason A. Donenfeld
5e844bed5e ui: do not return to detail page when restoring state
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:31:52 +02:00
Jason A. Donenfeld
46bf98d7f6 ui: never access CREATOR directly
All of the parcelers have their own type prefix. So we have to actually
use the legit methods. This is a bit annoying, as there's no fully
compatible way across all API versions, so we have to branch.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:31:52 +02:00
Jason A. Donenfeld
3e9ddd8720 ui: never throw on link clicks
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:31:52 +02:00
Jason A. Donenfeld
a6f5eb0dd2 build: exclude extra kotlin cruft from release build
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-04-04 15:14:28 +02:00
Jason A. Donenfeld
c3c4cd05b1 ui: don't play with status and navigation colors on old APIs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 16:05:41 +02:00
Jason A. Donenfeld
58c19385a3 ui: do not allow double clicking fab to show menu twice
Exception java.lang.IllegalStateException:
  at androidx.fragment.app.FragmentStore.addFragment (FragmentStore.java:92)
  at androidx.fragment.app.FragmentManager.addFragment (FragmentManager.java:1481)
  at androidx.fragment.app.BackStackRecord.executeOps (BackStackRecord.java:387)
  at androidx.fragment.app.FragmentManager.executeOps (FragmentManager.java:1965)
  at androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1873)
  at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1823)
  at androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1760)
  at androidx.fragment.app.FragmentManager$5.run (FragmentManager.java:547)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:268)
  at android.app.ActivityThread.main (ActivityThread.java:8101)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:627)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:997)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 15:15:39 +02:00
Jason A. Donenfeld
354e1c0ed9 ui: remove unneeded @JvmStatic annotations
These are only needed on methods called from databindings, since those
compile to java.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 15:07:45 +02:00
Jason A. Donenfeld
02b9677a9c ui: add list selection highlight color for tablet
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 14:53:28 +02:00
Jason A. Donenfeld
82d26e61da ui: the button is not always blue with Material You
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 14:23:10 +02:00
Jason A. Donenfeld
a113770868 ui: use app resources instead of ctx for strings in callback
Exception java.lang.IllegalStateException:
  at androidx.fragment.app.Fragment.requireContext (Fragment.java:967)
  at com.wireguard.android.fragment.TunnelListFragment$tunnelFileImportResultLauncher$1$1.invokeSuspend (TunnelListFragment.kt:64)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
  at android.os.Handler.handleCallback (Handler.java:761)
  at android.os.Handler.dispatchMessage (Handler.java:98)
  at android.os.Looper.loop (Looper.java:156)
  at android.app.ActivityThread.main (ActivityThread.java:6617)
  at java.lang.reflect.Method.invoke
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:942)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:832)

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 13:54:06 +02:00
Jason A. Donenfeld
b734f44200 ui: use M3 theme for TV to prevent crash
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-30 13:40:05 +02:00
Jason A. Donenfeld
a0cba19645 strings: sync crowdin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-28 17:53:43 +02:00
Jason A. Donenfeld
d7ccbd92e5 ui: add log items in buffered batches
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-28 17:47:36 +02:00
Jason A. Donenfeld
2da80e8dee ui: color verbose logs the same as debug logs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-28 16:02:47 +02:00
Jason A. Donenfeld
450ef8ce1c ui: don't call getColor on already resolved attribute
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-28 16:02:47 +02:00
Jason A. Donenfeld
58e7b7a069 ui: bring back dark log viewer colors
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-28 16:02:47 +02:00
Harsh Shandilya
d354831c6a
ui: fix inconsistent style naming
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-28 17:42:35 +05:30
Harsh Shandilya
c7d1c4baba
ui: adjust log viewer text sizes
10sp is below the minimum 11sp recommended for readability

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-28 00:53:18 +05:30
Harsh Shandilya
76423ce868
ui: use M3 styles everywhere
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-28 00:51:47 +05:30
Jason A. Donenfeld
b37006ce2f ui: add possibility for themed icon
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-27 18:05:39 +02:00
Jason A. Donenfeld
b072130e37 ui: add list selection backgrounds
Harsh - feel free to replace this commit with something better. I'm sure
it's the most terrible way to do it.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-27 18:00:00 +02:00
Jason A. Donenfeld
54dfa7bdd7 ui: cancel actionmode when pressing back button
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-27 17:59:00 +02:00
Jason A. Donenfeld
e5a75307c2 ui: simplify actionmode cast
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-27 17:47:09 +02:00
Harsh Shandilya
4fcb8c4792 ui: introduce a fresh set of Material3 themes and migrate to them
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-27 16:10:24 +02:00
Harsh Shandilya
fb05b358c0
ui: use AndroidX BundleCompat for extracting parcelable
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-27 16:11:30 +05:30
Jason A. Donenfeld
f13624c58f ui: switch from SwitchMaterial to MaterialSwitch
This required some weird changes to prevent clipping on the top, because
apparently the new switch is a bit fatter.

I think this actually looks a bit uglier than before, but it seems like
that's what Material design wants. Maybe we can improve it?

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-25 23:58:06 +01:00
Jason A. Donenfeld
497a60cc90 ui: bring back donation button
For Google Play Store builds, we'll display an alert box. This was
inspired by the discussion around StreetComplete; hopefully we'll have a
similar okay outcome.

Link: https://github.com/streetcomplete/streetcomplete/issues/3768
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-24 14:16:08 +01:00
Jason A. Donenfeld
8139e60094 strings: update from crowdin
This is after doing a rebuild on the crowdin side.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-24 14:12:21 +01:00
Harsh Shandilya
9dab67f3f1 ui: fix inconsistent toolbar color
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-24 14:12:21 +01:00
Harsh Shandilya
e342c9a28f ui: use Material switch component
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-24 14:12:21 +01:00
Jason A. Donenfeld
cf943b7119 ui: migrate to OnBackPressedDispatcher
This is compatible with Android 13's prediction-based back gesture
animation.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-24 14:12:21 +01:00
Harsh Shandilya
b7295cd56f build: raise target SDK to 33
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-24 14:12:21 +01:00
Jason A. Donenfeld
763d9a9f17 ui: set selected tunnel after creating fragments
I'm not sure why that comment (Samuel's) was there saying it was
necessary. Given it's been async for a long while, this wasn't
guaranteed anyway. So let's get rid of it and see what happens. Screen
rotation seems fine thus far.

Cc: Samuel Holland <samuel@sholland.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-24 14:12:21 +01:00
Jason A. Donenfeld
f3107e349c ui: switch from using launchWhenCreated to using repeatOnLifecycle
Apparently the former is deprecated.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-24 14:12:21 +01:00
Jason A. Donenfeld
caf2cded6e ui: simplify IME displaying in ConfigNamingDialogFragment
Also cleanup some event listener flow.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-24 14:12:21 +01:00
Harsh Shandilya
b44380c81a
ui: migrate to MenuProvider
AndroidX Activity 1.4.0 introduced the new lifecycle-dependent MenuProvider
APIs that supersede existing onCreateOptionsMenu-style menus.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-22 21:35:34 +05:30
Harsh Shandilya
35c8c10b7e
ui: address Parcelable API deprecations
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-22 21:35:34 +05:30
Harsh Shandilya
91227e445a
ui: address PackageManager API deprecations
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-22 21:35:34 +05:30
Harsh Shandilya
052ff060b1
gradle: use idiomatic task handling
- The hand-rolled clean task is not required

- Tasks should use configureEach to prevent eager evaluation

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-03-22 21:35:34 +05:30
Jason A. Donenfeld
3ab1f94514 tools: compile with latest NDK
The -mthumb -> -marm hack is unfortunate.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-22 15:02:54 +01:00
Jason A. Donenfeld
4d00c334b1 ui: set button text after loading app list in AppListDialogFragment
Otherwise, for lots of apps, the dialog shows before they're enumerated,
and the button text never gets set.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-22 15:02:54 +01:00
L.W.Reek
296295ab8a gradle: use same NDK for tunnel and UI
Fixes: 4f261560 ("gradle: force the use of an older NDK version")
Signed-off-by: L.W.Reek <syphyr@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-21 15:53:39 +01:00
L.W.Reek
d1237e2718 build: Google Play requires target API level 31 or higher
Fix build failure from lint check

Signed-off-by: L.W.Reek <syphyr@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-21 15:53:39 +01:00
Jason A. Donenfeld
a26b7c594a strings: sync with crowdin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-21 15:47:26 +01:00
Jason A. Donenfeld
853e86e6d0 global: bump copyright date
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-21 15:41:11 +01:00
Jason A. Donenfeld
a386e3a3d2 build: update to gradle 7.4.2 and restructure lint block
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-03-21 15:35:00 +01:00
SlipkHunter
713947e432
gradle: adjust for and raise compileSdk to 33
Signed-off-by: SlipkHunter <abrito025@gmail.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-01-20 19:54:23 +05:30
Harsh Shandilya
f8690ca215
gradle: migrate to namespace attribute
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2023-01-20 19:37:41 +05:30
SlipkHunter
284ad03ebf ui: add barrier to fix detail fragment overlap
When listen port and MTU are hidden, we need a barrier here.

Signed-off-by: SlipkHunter <abrito025@gmail.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-07-07 15:35:10 +02:00
Harsh Shandilya
960bc99f5e
gradle: update AndroidX and Kotlin
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-06-15 12:51:37 +05:30
Harsh Shandilya
38cb184cf8
ui: reorder constraints to fix detail fragment overlap
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-05-26 06:50:00 +05:30
Harsh Shandilya
5d14caf3b2
ui: move default style to Material3 with Dynamic Colors
The TV theme has been kept as-is since Material You guidance around this
is a bit scarce at the moment.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-05-26 06:49:22 +05:30
Harsh Shandilya
81c571f0c7
ui: normalise icon tints and remove unused drawable
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-05-26 06:01:03 +05:30
Harsh Shandilya
1bb8a10633
ui: remove unnecessary boolean check
This check was added in 3c31c340d8 when the kernel module loader was
introduced into the app lifecycle, to avoid attempting to start a root shell
twice. When the module loader was removed in a03ad51622, this flag
was accidentally left in when it should have been deleted.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-05-26 06:01:02 +05:30
Vlad Loktionov
866fd35df5 ui: word wrap settings headers
Apparently some translations make this wrap, which is bad.

Signed-off-by: Vlad Loktionov <yobabay23@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-03-20 22:28:14 -06:00
Rin Patch
32a2ebb66f ui: exclude TunnelToggleActivity from recents
Fixes annoying behavior in quick settings widget, when you enable
the tunnel, try to switch to last used app, but instead it switches to
the toggle activity and turns the tunnel off.

Signed-off-by: Rin Patch <rin@patch.cx>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-03-20 22:28:07 -06:00
Harsh Shandilya
70d9a87d0d ui: make validity check from QR code image scanner static
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-03-06 10:48:15 -07:00
Nikita Pustovoi
0bd39309c8 ui: allow importing tunnel from an QR image stored on the device
Add a new feature to import a tunnel from a saved QR image, this feature
integrates into 'import from file' flow, however adds a condition, if
file is an image, attempt to parse it as QR image file.

My use case for this feature, is to allow easier sharing of tunnels to
family.  Scanning QR code is ok when you have an external display to
show it, but if you sent QR code to someone, there is no way to import
it in the app.  If you share a config file, that becomes way harder for
a non-technical person to import as now they need to find a file with
that name in the file picker etc etc, Where the images are very visible
in the file picker, and user can easily recognize it for import.

Testing:
- Click "+" blue button, try to import a valid `.conf` file - the
  'original' file flow should not be affected
- Click "+" blue button, try to import a valid QR code image - if QR
  code was parsed, then a new tunnel will be added.
- Click "+" blue button, try to import an invalid QR code image - Error
  message will be shown

Signed-off-by: Nikita Pustovoi <deishelon@gmail.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-03-06 10:48:15 -07:00
Marcel Joss
d626e23210
ui: add margin on empty list text
Signed-off-by: Marcel Joss <marceljoss@hotmail.ch>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-01-17 11:51:27 +05:30
Harsh Shandilya
342ed5e259
ui: make when statements exhaustive everywhere
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2022-01-08 15:30:12 +05:30
Jason A. Donenfeld
bf84e26a86 global: bump copyright year
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-10-29 16:47:12 +02:00
Jason A. Donenfeld
a03ad51622 tunnel: remove kernel module downloader
Nathan Chance dropped the ball repeatedly and never maintained this in a
consistent way that anybody could use. With Android 12 out now, just
drop it all together. A bummer, but I don't see much of a choice.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-10-29 16:42:36 +02:00
Harsh Shandilya
447b06ec2c
ui: fix and silence lint errors
- The `copied_to_clipboard` translation for Farsi does not include
the placeholder, so it has been removed.

- A couple lints that are errors but we cannot particularly do anything about
were downgraded to warnings.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-10-28 03:19:56 +05:30
Harsh Shandilya
836c367499
gradle: upgrade AndroidX dependencies
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-10-28 03:19:55 +05:30
Harsh Shandilya
15cb99a41f
strings: sync translations
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-10-27 18:56:52 +05:30
Harsh Shandilya
fae74dd3ca
ui: upgrade zxing-android-embedded
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-10-25 22:42:39 +05:30
Jason A. Donenfeld
f6d175b774 strings: sync with crowdin
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-09-26 20:05:35 -06:00
Jason A. Donenfeld
3935a369b8 ui,tunnel: support DNS search domains
wg-quick has supported this for a while, but not the config layer, and
not the Go backend, so wire this all up.

Requested-by: Alexis Geoffrey <alexis.geoffrey97@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-09-25 22:22:09 -06:00
Harsh Shandilya
29bb93cdf7
gradle: update property set with AGP 7 experimental flags
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-07-29 12:30:07 +05:30
Harsh Shandilya
a8b2fc15de
strings: sync translations
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-07-29 11:21:24 +05:30
Harsh Shandilya
f699d9cf9a
build: switch to modern plugin application layout
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-07-29 10:12:04 +05:30
Harsh Shandilya
2730e75474
ui: mark app_name string as untranslatable
WireGuard is a brand name that should not be localized.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-07-29 10:11:34 +05:30
Jason A. Donenfeld
fe61522f2a tunnel: retry DNS resolution for 10 seconds
This has several problems: 1) it blocks the main thread; 2) it doesn't
distinguish between a permanent error and a transient one; 3) the 10
seconds is hard coded; 4) there's no way for the user to cancel it.

We'll have to improve this.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-05-26 18:07:28 +02:00
Harsh Shandilya
24ded8070f
build: upgrade AndroidX dependencies
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-05-19 01:33:06 +05:30
Jason A. Donenfeld
94ecb13d2f ui: update datastore and rework api
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-05-06 17:02:28 +02:00
Jason A. Donenfeld
6008efcd95 ui: remove hack for broken kotlin compiler
Seems like things are finally fixed.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-05-06 16:22:58 +02:00
Harsh Shandilya
e71c84a785
ui: replace deprecated string operations
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-05-05 16:56:56 +05:30
Harsh Shandilya
8e9b2c6f05
ui: abstract out theme attributes to reduce overlap
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-21 17:17:42 +05:30
Harsh Shandilya
9ace8dd928
strings: replace three dots with ellipsis character
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-21 17:17:42 +05:30
Harsh Shandilya
8f727903f3
ui: remove unnecessary v21 styles override
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-21 17:17:42 +05:30
Harsh Shandilya
b6aa09bc19
strings: remove invalid translation from Farsi
copied_to_clipboard is a format string and must have a format specifier

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-21 17:17:41 +05:30
Harsh Shandilya
782550318a
ui: remove some more non-null assertions on binding fields
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-21 17:17:41 +05:30
Harsh Shandilya
d02543639b
ui: reduce size of QS tile drawable
This will be rendered on an even smaller scale on devices, but
400dp x 400dp was simply too big and could cause performance issues.

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
2021-04-21 17:17:38 +05:30