-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep old device inactive after a successful transfer.
- Loading branch information
1 parent
31e3e37
commit 45178b3
Showing
20 changed files
with
302 additions
and
43 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
60 changes: 60 additions & 0 deletions
60
...va/org/thoughtcrime/securesms/devicetransfer/olddevice/OldDeviceTransferLockedDialog.java
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,60 @@ | ||
package org.thoughtcrime.securesms.devicetransfer.olddevice; | ||
|
||
import android.app.Dialog; | ||
import android.os.Bundle; | ||
import android.view.Window; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.fragment.app.DialogFragment; | ||
import androidx.fragment.app.FragmentManager; | ||
|
||
import com.google.android.material.dialog.MaterialAlertDialogBuilder; | ||
|
||
import org.signal.core.util.logging.Log; | ||
import org.thoughtcrime.securesms.R; | ||
import org.thoughtcrime.securesms.keyvalue.SignalStore; | ||
import org.thoughtcrime.securesms.net.DeviceTransferBlockingInterceptor; | ||
|
||
/** | ||
* Blocking dialog shown on old devices after a successful transfer to prevent use unless | ||
* the user takes action to reactivate. | ||
*/ | ||
public final class OldDeviceTransferLockedDialog extends DialogFragment { | ||
|
||
private static final String TAG = Log.tag(OldDeviceTransferLockedDialog.class); | ||
private static final String FRAGMENT_TAG = "OldDeviceTransferLockedDialog"; | ||
|
||
public static void show(@NonNull FragmentManager fragmentManager) { | ||
if (fragmentManager.findFragmentByTag(FRAGMENT_TAG) != null) { | ||
Log.i(TAG, "Locked dialog already being shown"); | ||
return; | ||
} | ||
|
||
new OldDeviceTransferLockedDialog().show(fragmentManager, FRAGMENT_TAG); | ||
} | ||
|
||
@Override | ||
public void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setCancelable(false); | ||
} | ||
|
||
@Override | ||
public Dialog onCreateDialog(Bundle savedInstanceState) { | ||
MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(requireContext(), R.style.Signal_ThemeOverlay_Dialog_Rounded); | ||
dialogBuilder.setView(R.layout.old_device_transfer_locked_dialog_fragment) | ||
.setPositiveButton(R.string.OldDeviceTransferLockedDialog__done, (d, w) -> OldDeviceExitActivity.exit(requireActivity())) | ||
.setNegativeButton(R.string.OldDeviceTransferLockedDialog__cancel_and_activate_this_device, (d, w) -> onUnlockRequest()); | ||
|
||
Dialog dialog = dialogBuilder.create(); | ||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); | ||
|
||
return dialog; | ||
} | ||
|
||
private void onUnlockRequest() { | ||
SignalStore.misc().clearOldDeviceTransferLocked(); | ||
DeviceTransferBlockingInterceptor.getInstance().unblockNetwork(); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:width="328dp" | ||
android:height="230dp" | ||
android:viewportWidth="328" | ||
android:viewportHeight="230" | ||
tools:ignore="VectorRaster"> | ||
<path | ||
android:fillAlpha="0.1" | ||
android:fillColor="#fff" | ||
android:pathData="M164,115.39m-92.87,0a92.87,92.87 0,1 1,185.74 0a92.87,92.87 0,1 1,-185.74 0" | ||
android:strokeAlpha="0.1" /> | ||
<path | ||
android:fillColor="#848484" | ||
android:pathData="M95.73,61.58l-55.65,-0.21A14.58,14.58 0,0 0,25.53 75.92l-0.21,139.33a14.58,14.58 0,0 0,14.55 14.54l55.65,0.21a14.57,14.57 0,0 0,14.54 -14.54l0.21,-139.33A14.57,14.57 0,0 0,95.73 61.58ZM103.1,215.46a7.91,7.91 0,0 1,-7.8 7.79L39.66,223a7.91,7.91 0,0 1,-7.8 -7.79l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.8l55.65,0.21a7.91,7.91 0,0 1,7.79 7.8Z" /> | ||
<path | ||
android:fillColor="#121212" | ||
android:pathData="M103.1,215.46a7.91,7.91 0,0 1,-7.8 7.79L39.66,223a7.91,7.91 0,0 1,-7.8 -7.79l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.8l55.65,0.21a7.91,7.91 0,0 1,7.79 7.8Z" /> | ||
<path | ||
android:fillColor="#848484" | ||
android:pathData="M287.92,0.21 L232.27,0a14.57,14.57 0,0 0,-14.54 14.54l-0.21,139.33a14.57,14.57 0,0 0,14.54 14.55l55.65,0.21a14.57,14.57 0,0 0,14.54 -14.55l0.22,-139.33A14.58,14.58 0,0 0,287.92 0.21ZM295.3,154.08a7.92,7.92 0,0 1,-7.8 7.8l-55.65,-0.21a7.92,7.92 0,0 1,-7.8 -7.8l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.79L287.71,7a7.91,7.91 0,0 1,7.8 7.79Z" /> | ||
<path | ||
android:fillColor="#121212" | ||
android:pathData="M295.3,154.08a7.92,7.92 0,0 1,-7.8 7.8l-55.65,-0.21a7.92,7.92 0,0 1,-7.8 -7.8l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.79L287.71,7a7.91,7.91 0,0 1,7.8 7.79Z" /> | ||
<path | ||
android:fillColor="#919191" | ||
android:pathData="M239.61,21.01L282.52,21.01A1.73,1.73 0,0 1,284.25 22.74L284.25,22.74A1.73,1.73 0,0 1,282.52 24.47L239.61,24.47A1.73,1.73 0,0 1,237.88 22.74L237.88,22.74A1.73,1.73 0,0 1,239.61 21.01z" /> | ||
<path | ||
android:fillColor="#919191" | ||
android:pathData="M249.08,28.95L273.05,28.95A1.73,1.73 0,0 1,274.78 30.68L274.78,30.68A1.73,1.73 0,0 1,273.05 32.41L249.08,32.41A1.73,1.73 0,0 1,247.35 30.68L247.35,30.68A1.73,1.73 0,0 1,249.08 28.95z" /> | ||
<path | ||
android:fillColor="#919191" | ||
android:pathData="M233.81,51.71L285.75,51.71A3.01,3.01 0,0 1,288.76 54.72L288.76,57.5A3.01,3.01 0,0 1,285.75 60.51L233.81,60.51A3.01,3.01 0,0 1,230.8 57.5L230.8,54.72A3.01,3.01 0,0 1,233.81 51.71z" /> | ||
<path | ||
android:fillColor="#3a76f0" | ||
android:pathData="M233.81,138.97L285.75,138.97A3.01,3.01 0,0 1,288.76 141.98L288.76,146.49A3.01,3.01 0,0 1,285.75 149.5L233.81,149.5A3.01,3.01 0,0 1,230.8 146.49L230.8,141.98A3.01,3.01 0,0 1,233.81 138.97z" /> | ||
<path | ||
android:fillColor="#919191" | ||
android:pathData="M233.81,64.38L242.6,64.38A3.01,3.01 0,0 1,245.61 67.39L245.61,70.17A3.01,3.01 0,0 1,242.6 73.18L233.81,73.18A3.01,3.01 0,0 1,230.8 70.17L230.8,67.39A3.01,3.01 0,0 1,233.81 64.38z" /> | ||
<path | ||
android:fillColor="#919191" | ||
android:pathData="M252.7,64.38L285.76,64.38A3.01,3.01 0,0 1,288.77 67.39L288.77,70.17A3.01,3.01 0,0 1,285.76 73.18L252.7,73.18A3.01,3.01 0,0 1,249.69 70.17L249.69,67.39A3.01,3.01 0,0 1,252.7 64.38z" /> | ||
<path | ||
android:fillColor="#ffd624" | ||
android:pathData="M305.63,97.55l2.21,6a0.59,0.59 0,0 0,0.54 0.37,0.58 0.58,0 0,0 0.54,-0.37l2.22,-6a17.68,17.68 0,0 1,10.48 -10.48l6,-2.22a0.57,0.57 0,0 0,0.38 -0.54,0.58 0.58,0 0,0 -0.38,-0.54l-6,-2.21a17.67,17.67 0,0 1,-10.48 -10.49l-2.22,-6a0.57,0.57 0,0 0,-0.54 -0.38,0.58 0.58,0 0,0 -0.54,0.38l-2.21,6a17.68,17.68 0,0 1,-10.49 10.49l-6,2.21a0.58,0.58 0,0 0,-0.38 0.54,0.57 0.57,0 0,0 0.38,0.54l6,2.22A17.69,17.69 0,0 1,305.63 97.55Z" /> | ||
<path | ||
android:fillColor="#ffd624" | ||
android:pathData="M236.7,182.39l1.21,3.29a0.3,0.3 0,0 0,0.29 0.2,0.32 0.32,0 0,0 0.3,-0.2l1.21,-3.29a9.69,9.69 0,0 1,5.74 -5.74l3.28,-1.21a0.3,0.3 0,0 0,0.21 -0.29,0.32 0.32,0 0,0 -0.21,-0.3l-3.28,-1.21a9.69,9.69 0,0 1,-5.74 -5.74l-1.21,-3.28a0.31,0.31 0,0 0,-0.3 -0.21,0.3 0.3,0 0,0 -0.29,0.21l-1.21,3.28a9.69,9.69 0,0 1,-5.74 5.74l-3.29,1.21a0.33,0.33 0,0 0,-0.2 0.3,0.3 0.3,0 0,0 0.2,0.29l3.29,1.21A9.69,9.69 0,0 1,236.7 182.39Z" /> | ||
<path | ||
android:fillColor="#ffd624" | ||
android:pathData="M209.86,50.64l1.8,4.86a0.45,0.45 0,0 0,0.43 0.3,0.47 0.47,0 0,0 0.44,-0.3l1.79,-4.86a14.33,14.33 0,0 1,8.48 -8.48l4.85,-1.79a0.46,0.46 0,0 0,0 -0.87l-4.85,-1.79a14.33,14.33 0,0 1,-8.48 -8.48l-1.79,-4.86a0.47,0.47 0,0 0,-0.44 -0.3,0.45 0.45,0 0,0 -0.43,0.3l-1.8,4.86a14.31,14.31 0,0 1,-8.47 8.48l-4.86,1.79a0.47,0.47 0,0 0,0 0.87l4.86,1.79A14.31,14.31 0,0 1,209.86 50.64Z" /> | ||
<path | ||
android:fillColor="#3a76f0" | ||
android:pathData="M139.38,138.19a36.64,36.64 0,0 1,27.16 -13.51v11.94c0,1.65 1,2 2.13,0.88l21.9,-21.9a1.46,1.46 0,0 0,0.27 -0.41,1.27 1.27,0 0,0 0.09,-0.47 1.28,1.28 0,0 0,-0.09 -0.48,1.41 1.41,0 0,0 -0.27,-0.4l-21.9,-21.9c-1.17,-1.17 -2.13,-0.78 -2.13,0.88v11.93c-18.09,2.33 -26.95,15.07 -29.4,32.53C136.78,139.87 137.76,140.24 139.38,138.19Z" /> | ||
</vector> |
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,55 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:width="328dp" | ||
android:height="230dp" | ||
android:viewportWidth="328" | ||
android:viewportHeight="230" | ||
tools:ignore="VectorRaster"> | ||
<path | ||
android:fillAlpha="0.05" | ||
android:fillColor="#FF000000" | ||
android:pathData="M164,115.39m-92.87,0a92.87,92.87 0,1 1,185.74 0a92.87,92.87 0,1 1,-185.74 0" | ||
android:strokeAlpha="0.05" /> | ||
<path | ||
android:fillColor="#c6c6c6" | ||
android:pathData="M95.73,61.58l-55.65,-0.21A14.58,14.58 0,0 0,25.53 75.92l-0.21,139.33a14.58,14.58 0,0 0,14.55 14.54l55.65,0.21a14.57,14.57 0,0 0,14.54 -14.54l0.21,-139.33A14.57,14.57 0,0 0,95.73 61.58ZM103.1,215.46a7.91,7.91 0,0 1,-7.8 7.79L39.66,223a7.91,7.91 0,0 1,-7.8 -7.79l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.8l55.65,0.21a7.91,7.91 0,0 1,7.79 7.8Z" /> | ||
<path | ||
android:fillColor="#fff" | ||
android:pathData="M103.1,215.46a7.91,7.91 0,0 1,-7.8 7.79L39.66,223a7.91,7.91 0,0 1,-7.8 -7.79l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.8l55.65,0.21a7.91,7.91 0,0 1,7.79 7.8Z" /> | ||
<path | ||
android:fillColor="#c6c6c6" | ||
android:pathData="M287.92,0.21 L232.27,0a14.57,14.57 0,0 0,-14.54 14.54l-0.21,139.33a14.57,14.57 0,0 0,14.54 14.55l55.65,0.21a14.57,14.57 0,0 0,14.54 -14.55l0.22,-139.33A14.58,14.58 0,0 0,287.92 0.21ZM295.3,154.08a7.92,7.92 0,0 1,-7.8 7.8l-55.65,-0.21a7.92,7.92 0,0 1,-7.8 -7.8l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.79L287.71,7a7.91,7.91 0,0 1,7.8 7.79Z" /> | ||
<path | ||
android:fillColor="#fff" | ||
android:pathData="M295.3,154.08a7.92,7.92 0,0 1,-7.8 7.8l-55.65,-0.21a7.92,7.92 0,0 1,-7.8 -7.8l0.21,-139.33a7.92,7.92 0,0 1,7.8 -7.79L287.71,7a7.91,7.91 0,0 1,7.8 7.79Z" /> | ||
<path | ||
android:fillColor="#dbdbdb" | ||
android:pathData="M239.61,21.01L282.52,21.01A1.73,1.73 0,0 1,284.25 22.74L284.25,22.74A1.73,1.73 0,0 1,282.52 24.47L239.61,24.47A1.73,1.73 0,0 1,237.88 22.74L237.88,22.74A1.73,1.73 0,0 1,239.61 21.01z" /> | ||
<path | ||
android:fillColor="#dbdbdb" | ||
android:pathData="M249.08,28.95L273.05,28.95A1.73,1.73 0,0 1,274.78 30.68L274.78,30.68A1.73,1.73 0,0 1,273.05 32.41L249.08,32.41A1.73,1.73 0,0 1,247.35 30.68L247.35,30.68A1.73,1.73 0,0 1,249.08 28.95z" /> | ||
<path | ||
android:fillColor="#dbdbdb" | ||
android:pathData="M233.81,51.71L285.75,51.71A3.01,3.01 0,0 1,288.76 54.72L288.76,57.5A3.01,3.01 0,0 1,285.75 60.51L233.81,60.51A3.01,3.01 0,0 1,230.8 57.5L230.8,54.72A3.01,3.01 0,0 1,233.81 51.71z" /> | ||
<path | ||
android:fillColor="#3a76f0" | ||
android:pathData="M233.81,138.97L285.75,138.97A3.01,3.01 0,0 1,288.76 141.98L288.76,146.49A3.01,3.01 0,0 1,285.75 149.5L233.81,149.5A3.01,3.01 0,0 1,230.8 146.49L230.8,141.98A3.01,3.01 0,0 1,233.81 138.97z" /> | ||
<path | ||
android:fillColor="#dbdbdb" | ||
android:pathData="M233.81,64.38L242.6,64.38A3.01,3.01 0,0 1,245.61 67.39L245.61,70.17A3.01,3.01 0,0 1,242.6 73.18L233.81,73.18A3.01,3.01 0,0 1,230.8 70.17L230.8,67.39A3.01,3.01 0,0 1,233.81 64.38z" /> | ||
<path | ||
android:fillColor="#dbdbdb" | ||
android:pathData="M252.7,64.38L285.76,64.38A3.01,3.01 0,0 1,288.77 67.39L288.77,70.17A3.01,3.01 0,0 1,285.76 73.18L252.7,73.18A3.01,3.01 0,0 1,249.69 70.17L249.69,67.39A3.01,3.01 0,0 1,252.7 64.38z" /> | ||
<path | ||
android:fillColor="#ffd624" | ||
android:pathData="M305.63,97.55l2.21,6a0.59,0.59 0,0 0,0.54 0.37,0.58 0.58,0 0,0 0.54,-0.37l2.22,-6a17.68,17.68 0,0 1,10.48 -10.48l6,-2.22a0.57,0.57 0,0 0,0.38 -0.54,0.58 0.58,0 0,0 -0.38,-0.54l-6,-2.21a17.67,17.67 0,0 1,-10.48 -10.49l-2.22,-6a0.57,0.57 0,0 0,-0.54 -0.38,0.58 0.58,0 0,0 -0.54,0.38l-2.21,6a17.68,17.68 0,0 1,-10.49 10.49l-6,2.21a0.58,0.58 0,0 0,-0.38 0.54,0.57 0.57,0 0,0 0.38,0.54l6,2.22A17.69,17.69 0,0 1,305.63 97.55Z" /> | ||
<path | ||
android:fillColor="#ffd624" | ||
android:pathData="M236.7,182.39l1.21,3.29a0.3,0.3 0,0 0,0.29 0.2,0.32 0.32,0 0,0 0.3,-0.2l1.21,-3.29a9.69,9.69 0,0 1,5.74 -5.74l3.28,-1.21a0.3,0.3 0,0 0,0.21 -0.29,0.32 0.32,0 0,0 -0.21,-0.3l-3.28,-1.21a9.69,9.69 0,0 1,-5.74 -5.74l-1.21,-3.28a0.31,0.31 0,0 0,-0.3 -0.21,0.3 0.3,0 0,0 -0.29,0.21l-1.21,3.28a9.69,9.69 0,0 1,-5.74 5.74l-3.29,1.21a0.33,0.33 0,0 0,-0.2 0.3,0.3 0.3,0 0,0 0.2,0.29l3.29,1.21A9.69,9.69 0,0 1,236.7 182.39Z" /> | ||
<path | ||
android:fillColor="#ffd624" | ||
android:pathData="M209.86,50.64l1.8,4.86a0.45,0.45 0,0 0,0.43 0.3,0.47 0.47,0 0,0 0.44,-0.3l1.79,-4.86a14.33,14.33 0,0 1,8.48 -8.48l4.85,-1.79a0.46,0.46 0,0 0,0 -0.87l-4.85,-1.79a14.33,14.33 0,0 1,-8.48 -8.48l-1.79,-4.86a0.47,0.47 0,0 0,-0.44 -0.3,0.45 0.45,0 0,0 -0.43,0.3l-1.8,4.86a14.31,14.31 0,0 1,-8.47 8.48l-4.86,1.79a0.47,0.47 0,0 0,0 0.87l4.86,1.79A14.31,14.31 0,0 1,209.86 50.64Z" /> | ||
<path | ||
android:fillColor="#3a76f0" | ||
android:pathData="M139.38,138.19a36.64,36.64 0,0 1,27.16 -13.51v11.94c0,1.65 1,2 2.13,0.88l21.9,-21.9a1.46,1.46 0,0 0,0.27 -0.41,1.27 1.27,0 0,0 0.09,-0.47 1.28,1.28 0,0 0,-0.09 -0.48,1.41 1.41,0 0,0 -0.27,-0.4l-21.9,-21.9c-1.17,-1.17 -2.13,-0.78 -2.13,0.88v11.93c-18.09,2.33 -26.95,15.07 -29.4,32.53C136.78,139.87 137.76,140.24 139.38,138.19Z" /> | ||
</vector> |
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
Oops, something went wrong.