Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: disable battery optimization #1214

Merged
merged 10 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# gem "rails"

gem "fastlane", "~> 2.214.0"
gem "fastlane", "~> 2.216.0"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
49 changes: 26 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.793.0)
aws-sdk-core (3.180.0)
aws-partitions (1.830.0)
aws-sdk-core (3.184.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sdk-kms (1.72.0)
aws-sdk-core (~> 3, >= 3.184.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.132.0)
aws-sdk-core (~> 3, >= 3.179.0)
aws-sdk-s3 (1.136.0)
aws-sdk-core (~> 3, >= 3.181.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
Expand All @@ -36,7 +36,7 @@ GEM
unf (>= 0.0.5, < 1.0.0)
dotenv (2.8.1)
emoji_regex (3.2.3)
excon (0.100.0)
excon (0.103.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -66,7 +66,7 @@ GEM
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.7)
fastlane (2.214.0)
fastlane (2.216.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -87,6 +87,7 @@ GEM
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
Expand All @@ -98,16 +99,17 @@ GEM
security (= 0.1.3)
simctl (~> 1.6.3)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
terminal-table (~> 3)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.6.1)
fastlane-plugin-firebase_app_distribution (0.7.4)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.46.0)
google-apis-androidpublisher_v3 (0.50.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
Expand All @@ -118,6 +120,8 @@ GEM
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
Expand All @@ -138,10 +142,9 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.7.0)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
Expand All @@ -152,9 +155,8 @@ GEM
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.1)
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.2)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
Expand All @@ -174,7 +176,7 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.17.0)
signet (0.18.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
Expand All @@ -183,8 +185,8 @@ GEM
CFPropertyList
naturally
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand All @@ -194,10 +196,10 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.8.2)
unicode-display_width (1.8.0)
unicode-display_width (2.4.2)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.22.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -210,11 +212,12 @@ GEM
xcpretty (~> 0.2, >= 0.0.7)

PLATFORMS
arm64-darwin-21
arm64-darwin-22

DEPENDENCIES
fastlane (~> 2.214.0)
fastlane (~> 2.216.0)
fastlane-plugin-firebase_app_distribution

BUNDLED WITH
2.4.17
2.4.20
1 change: 1 addition & 0 deletions wallet/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

<!-- dangerous permissions -->
<uses-permission android:name="android.permission.CAMERA" /> <!-- group: CAMERA -->
Expand Down
51 changes: 51 additions & 0 deletions wallet/res/drawable/ic_bolt_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="52dp"
android:height="53dp"
android:viewportWidth="52"
android:viewportHeight="53">
<path
android:pathData="M35.983,50.337L35.982,50.338C32.87,51.696 29.544,52.375 26,52.375C22.456,52.375 19.121,51.696 15.992,50.338L15.992,50.337C12.878,48.996 10.126,47.138 7.736,44.765C5.362,42.374 3.496,39.622 2.137,36.508C0.796,33.379 0.125,30.044 0.125,26.5C0.125,22.956 0.796,19.629 2.137,16.518C3.496,13.387 5.362,10.635 7.735,8.261L7.736,8.261C10.109,5.87 12.852,4.004 15.966,2.663L15.966,2.663C19.095,1.304 22.431,0.625 25.974,0.625C29.518,0.625 32.853,1.304 35.982,2.663L35.983,2.663C39.113,4.004 41.865,5.87 44.238,8.261L44.239,8.261C46.612,10.635 48.478,13.387 49.838,16.518L49.838,16.518C51.196,19.63 51.875,22.956 51.875,26.5C51.875,30.043 51.196,33.379 49.838,36.508C48.479,39.622 46.612,42.374 44.238,44.765C41.865,47.138 39.113,48.995 35.983,50.337Z"
android:strokeWidth="0.25"
android:strokeColor="#F0F1F2">
<aapt:attr name="android:fillColor">
<gradient
android:startX="26"
android:startY="0.5"
android:endX="26"
android:endY="52.5"
android:type="linear">
<item android:offset="0" android:color="#FFFDFDFD"/>
<item android:offset="1" android:color="#FFF7F6F6"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M25.999,49.156C22.854,49.156 19.916,48.568 17.186,47.393C14.455,46.218 12.053,44.593 9.979,42.52C7.906,40.446 6.281,38.044 5.106,35.313C3.948,32.566 3.369,29.628 3.369,26.5C3.369,23.372 3.948,20.443 5.106,17.712C6.281,14.964 7.897,12.554 9.953,10.48C12.027,8.389 14.429,6.764 17.16,5.606C19.907,4.431 22.845,3.844 25.973,3.844C29.119,3.844 32.056,4.431 34.787,5.606C37.517,6.764 39.919,8.389 41.993,10.48C44.084,12.554 45.717,14.964 46.893,17.712C48.068,20.443 48.655,23.372 48.655,26.5C48.655,29.628 48.068,32.566 46.893,35.313C45.735,38.044 44.119,40.446 42.045,42.52C39.971,44.593 37.561,46.218 34.813,47.393C32.065,48.568 29.127,49.156 25.999,49.156Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="26.012"
android:startY="3.844"
android:endX="26.012"
android:endY="49.156"
android:type="linear">
<item android:offset="0" android:color="#FF78C4F5"/>
<item android:offset="1" android:color="#FF31A3EF"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M19,27.719C19,27.521 19.085,27.311 19.256,27.088L28.21,15.908C28.374,15.698 28.551,15.57 28.742,15.524C28.939,15.478 29.113,15.498 29.264,15.583C29.421,15.662 29.53,15.793 29.589,15.977C29.654,16.161 29.638,16.378 29.539,16.627L26.604,24.606H32.169C32.38,24.606 32.55,24.671 32.682,24.803C32.813,24.928 32.879,25.085 32.879,25.276C32.879,25.479 32.793,25.689 32.623,25.906L23.669,37.096C23.505,37.299 23.324,37.424 23.127,37.47C22.937,37.522 22.763,37.506 22.605,37.421C22.454,37.342 22.346,37.211 22.28,37.027C22.221,36.843 22.241,36.623 22.339,36.367L25.274,28.388H19.709C19.499,28.388 19.328,28.326 19.197,28.201C19.066,28.07 19,27.909 19,27.719Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="25.943"
android:startY="14.556"
android:endX="25.943"
android:endY="37.914"
android:type="linear">
<item android:offset="0" android:color="#FFF4F5F5"/>
<item android:offset="1" android:color="#FFE7E7E7"/>
</gradient>
</aapt:attr>
</path>
</vector>
51 changes: 51 additions & 0 deletions wallet/res/drawable/ic_receive_payments.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="52dp"
android:height="53dp"
android:viewportWidth="52"
android:viewportHeight="53">
<path
android:pathData="M35.983,50.337L35.982,50.338C32.87,51.696 29.544,52.375 26,52.375C22.456,52.375 19.121,51.696 15.992,50.338L15.992,50.337C12.878,48.996 10.126,47.138 7.736,44.765C5.362,42.374 3.496,39.622 2.137,36.508C0.796,33.379 0.125,30.044 0.125,26.5C0.125,22.956 0.796,19.629 2.137,16.518C3.496,13.387 5.362,10.635 7.735,8.261L7.736,8.261C10.109,5.87 12.852,4.004 15.966,2.663L15.966,2.663C19.095,1.304 22.431,0.625 25.974,0.625C29.518,0.625 32.853,1.304 35.982,2.663L35.983,2.663C39.113,4.004 41.865,5.87 44.238,8.261L44.239,8.261C46.612,10.635 48.478,13.387 49.838,16.518L49.838,16.518C51.196,19.63 51.875,22.956 51.875,26.5C51.875,30.043 51.196,33.379 49.838,36.508C48.479,39.622 46.612,42.374 44.238,44.765C41.865,47.138 39.113,48.995 35.983,50.337Z"
android:strokeWidth="0.25"
android:strokeColor="#F0F1F2">
<aapt:attr name="android:fillColor">
<gradient
android:startX="26"
android:startY="0.5"
android:endX="26"
android:endY="52.5"
android:type="linear">
<item android:offset="0" android:color="#FFFDFDFD"/>
<item android:offset="1" android:color="#FFF7F6F6"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M25.999,49.156C22.854,49.156 19.916,48.568 17.186,47.393C14.455,46.218 12.053,44.593 9.979,42.52C7.906,40.446 6.281,38.044 5.106,35.313C3.948,32.566 3.369,29.628 3.369,26.5C3.369,23.372 3.948,20.443 5.106,17.712C6.281,14.964 7.897,12.554 9.953,10.48C12.027,8.389 14.429,6.764 17.16,5.606C19.907,4.431 22.845,3.844 25.973,3.844C29.119,3.844 32.056,4.431 34.787,5.606C37.517,6.764 39.919,8.389 41.993,10.48C44.084,12.554 45.717,14.964 46.893,17.712C48.068,20.443 48.655,23.372 48.655,26.5C48.655,29.628 48.068,32.566 46.893,35.313C45.735,38.044 44.119,40.446 42.045,42.52C39.971,44.593 37.561,46.218 34.813,47.393C32.065,48.568 29.127,49.156 25.999,49.156Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="26.012"
android:startY="3.844"
android:endX="26.012"
android:endY="49.156"
android:type="linear">
<item android:offset="0" android:color="#FF3DB878"/>
<item android:offset="1" android:color="#FF349F68"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M25.845,16.061C26.768,16.06 27.479,16.809 27.479,17.733V28.098H30.086C30.84,28.098 31.327,28.388 31.547,28.967C31.766,29.561 31.656,30.161 31.218,30.768L26.959,36.481C26.658,36.867 26.281,37.061 25.828,37.061C25.362,37.061 24.985,36.867 24.697,36.481L20.439,30.768C20,30.189 19.89,29.595 20.11,28.988C20.315,28.395 20.809,28.098 21.591,28.098H24.135V17.733C24.135,16.809 24.921,16.061 25.845,16.061V16.061Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="19.5"
android:startY="26.566"
android:endX="31.876"
android:endY="26.566"
android:type="linear">
<item android:offset="0" android:color="#FFF4F5F5"/>
<item android:offset="1" android:color="#FFE7E7E7"/>
</gradient>
</aapt:attr>
</path>
</vector>
51 changes: 51 additions & 0 deletions wallet/res/drawable/ic_transaction_received_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="52dp"
android:height="53dp"
android:viewportWidth="52"
android:viewportHeight="53">
<path
android:pathData="M35.983,50.337L35.982,50.338C32.87,51.696 29.544,52.375 26,52.375C22.456,52.375 19.121,51.696 15.992,50.338L15.992,50.337C12.878,48.996 10.126,47.138 7.736,44.765C5.362,42.374 3.496,39.622 2.137,36.508C0.796,33.379 0.125,30.044 0.125,26.5C0.125,22.956 0.796,19.629 2.137,16.518C3.496,13.387 5.362,10.635 7.735,8.261L7.736,8.261C10.109,5.87 12.852,4.004 15.966,2.663L15.966,2.663C19.095,1.304 22.431,0.625 25.974,0.625C29.518,0.625 32.853,1.304 35.982,2.663L35.983,2.663C39.113,4.004 41.865,5.87 44.238,8.261L44.239,8.261C46.612,10.635 48.478,13.387 49.838,16.518L49.838,16.518C51.196,19.63 51.875,22.956 51.875,26.5C51.875,30.043 51.196,33.379 49.838,36.508C48.479,39.622 46.612,42.374 44.238,44.765C41.865,47.138 39.113,48.995 35.983,50.337Z"
android:strokeWidth="0.25"
android:strokeColor="#F0F1F2">
<aapt:attr name="android:fillColor">
<gradient
android:startX="26"
android:startY="0.5"
android:endX="26"
android:endY="52.5"
android:type="linear">
<item android:offset="0" android:color="#FFFDFDFD"/>
<item android:offset="1" android:color="#FFF7F6F6"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M25.999,49.156C22.854,49.156 19.916,48.568 17.186,47.393C14.455,46.218 12.053,44.593 9.979,42.52C7.906,40.446 6.281,38.044 5.106,35.313C3.948,32.566 3.369,29.628 3.369,26.5C3.369,23.372 3.948,20.443 5.106,17.712C6.281,14.964 7.897,12.554 9.953,10.48C12.027,8.389 14.429,6.764 17.16,5.606C19.907,4.431 22.845,3.844 25.973,3.844C29.119,3.844 32.056,4.431 34.787,5.606C37.517,6.764 39.919,8.389 41.993,10.48C44.084,12.554 45.717,14.964 46.893,17.712C48.068,20.443 48.655,23.372 48.655,26.5C48.655,29.628 48.068,32.566 46.893,35.313C45.735,38.044 44.119,40.446 42.045,42.52C39.971,44.593 37.561,46.218 34.813,47.393C32.065,48.568 29.127,49.156 25.999,49.156Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="26.012"
android:startY="3.844"
android:endX="26.012"
android:endY="49.156"
android:type="linear">
<item android:offset="0" android:color="#FF3DB878"/>
<item android:offset="1" android:color="#FF349F68"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M25.845,16.061C26.768,16.06 27.479,16.809 27.479,17.733V28.098H30.086C30.84,28.098 31.327,28.388 31.547,28.967C31.766,29.561 31.656,30.161 31.218,30.768L26.959,36.481C26.658,36.867 26.281,37.061 25.828,37.061C25.362,37.061 24.985,36.867 24.697,36.481L20.439,30.768C20,30.189 19.89,29.595 20.11,28.988C20.315,28.395 20.809,28.098 21.591,28.098H24.135V17.733C24.135,16.809 24.921,16.061 25.845,16.061V16.061Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="19.5"
android:startY="26.566"
android:endX="31.876"
android:endY="26.566"
android:type="linear">
<item android:offset="0" android:color="#FFF4F5F5"/>
<item android:offset="1" android:color="#FFE7E7E7"/>
</gradient>
</aapt:attr>
</path>
</vector>
40 changes: 40 additions & 0 deletions wallet/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,44 @@
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_menu_row_arrow" />
</androidx.constraintlayout.widget.ConstraintLayout>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/battery_optimization"
style="@style/MenuRow.Internal">

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<TextView
android:id="@+id/battery_settings_title"
style="@style/MenuRowTitle.Internal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:text="@string/battery_optimization_title" />

<TextView
android:id="@+id/battery_settings_subtitle"
style="@style/Overline.Medium.Secondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/battery_settings_title"
app:layout_constraintTop_toBottomOf="@id/battery_settings_title"
android:text="@string/battery_optimization_subtitle_unrestricted" />

</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
style="@style/MenuRowArrow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_menu_row_arrow" />
</androidx.constraintlayout.widget.ConstraintLayout>

</LinearLayout>
11 changes: 11 additions & 0 deletions wallet/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,15 @@
<string name="tap_to_paste">Tap the address from the clipboard to paste it</string>
<string name="not_dash_address">Not a valid Dash Address or URL request</string>
<string name="send_to_address">Send to Address</string>

<!-- Battery Optimization-->
<string name="battery_optimization_title">Battery optimization</string>
<string name="battery_optimization_subtitle_optimized">Optimized</string>
<string name="battery_optimization_subtitle_unrestricted">Unrestricted</string>

<string name="battery_optimization_dialog_optimized_title">Let Dash Wallet run in the background?</string>
<string name="battery_optimization_dialog_message_optimized">This app is configured to stop running after not being visible for some time.\n\nThis will result in not receiving payment notifications until the app returns to the foreground.\n\nWe recommend allowing this app to run in the background by setting battery optimization to \"Not Optimized\" or \"Unrestricted.\"\n\nDon\'t worry, we will always mind your battery usage.</string>
<string name="battery_optimization_dialog_unrestricted_title">Do you want to receive payments in the background?</string>
<string name="battery_optimization_dialog_message_not_optimized">This app is configured to continue running after not being visible for some time.\n\nWe suggest allowing this app to always stay up-to-date with the blockchain, even in the background.\n\nDon\'t worry, we will always mind your battery usage.</string>
<string name="battery_optimization_dialog_button_change">Open Settings</string>
</resources>
Loading
Loading