-
Notifications
You must be signed in to change notification settings - Fork 61
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
Automatically resume shares on device start #178
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,11 @@ | |
package="info.varden.hauk"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> | ||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | ||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> | ||
|
||
|
||
<application | ||
android:allowBackup="true" | ||
|
@@ -45,14 +48,27 @@ | |
</activity> | ||
|
||
<receiver | ||
android:name=".global.Receiver" | ||
android:name=".global.ExportedReceiver" | ||
android:exported="true" | ||
tools:ignore="ExportedReceiver"> | ||
<intent-filter> | ||
<action android:name="info.varden.hauk.START_ALONE_THEN_SHARE_VIA" /> | ||
<action android:name="info.varden.hauk.START_ALONE_THEN_MAKE_TOAST" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<receiver | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm this one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My local patch was missing the receiver on built hence it was erroring out on reboot, my bad I'm using this snippet
and works fine in my testing on Android 13 |
||
android:name=".global.RebootReceiver" | ||
android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> | ||
|
||
<intent-filter> | ||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
<action android:name="android.intent.action.QUICKBOOT_POWERON" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
</intent-filter> | ||
|
||
</receiver> | ||
|
||
<receiver | ||
android:name=".notify.CopyLinkReceiver" | ||
android:exported="false"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package info.varden.hauk.global; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.widget.Toast; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.net.Proxy; | ||
import java.net.SocketAddress; | ||
|
||
import info.varden.hauk.Constants; | ||
import info.varden.hauk.R; | ||
import info.varden.hauk.global.ui.AuthorizationActivity; | ||
import info.varden.hauk.global.ui.DisplayShareDialogListener; | ||
import info.varden.hauk.global.ui.toast.GNSSStatusUpdateListenerImpl; | ||
import info.varden.hauk.global.ui.toast.SessionInitiationResponseHandlerImpl; | ||
import info.varden.hauk.global.ui.toast.ShareListenerImpl; | ||
import info.varden.hauk.http.ConnectionParameters; | ||
import info.varden.hauk.http.SessionInitiationPacket; | ||
import info.varden.hauk.http.security.CertificateValidationPolicy; | ||
import info.varden.hauk.manager.SessionManager; | ||
import info.varden.hauk.struct.AdoptabilityPreference; | ||
import info.varden.hauk.system.LocationPermissionsNotGrantedException; | ||
import info.varden.hauk.system.LocationServicesDisabledException; | ||
import info.varden.hauk.system.preferences.PreferenceManager; | ||
import info.varden.hauk.utils.DeprecationMigrator; | ||
import info.varden.hauk.utils.Log; | ||
import info.varden.hauk.utils.TimeUtils; | ||
// Reboot broadcast receiver for Hauk. If enabled resumes a share session if one exists on device restart | ||
public final class RebootReceiver extends BroadcastReceiver { | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
// Subsequent calls may result in data being read from preferences. We should ensure that | ||
// all deprecated preferences have been migrated before we continue. | ||
new DeprecationMigrator(context).migrate(); | ||
|
||
PreferenceManager prefs = new PreferenceManager(context); | ||
if(prefs.get(Constants.PREF_RESTART_ON_BOOT)) | ||
resumeShare(context,intent); | ||
} | ||
private void resumeShare(Context context, Intent intent) { | ||
Log.d("Trying to resume shares..."); | ||
new BroadcastSessionManager(context).resumeShares(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace this by rebasing see f5fb57c#diff-63272c98a6330850888e633b43ba4c9decee6431a115e0d2731564838eaa1d1dR7