|
20 | 20 | * |
21 | 21 | */ |
22 | 22 |
|
23 | | -package io.phonk.server; |
| 23 | +package io.phonk; |
24 | 24 |
|
25 | 25 | import android.content.BroadcastReceiver; |
26 | 26 | import android.content.Context; |
27 | 27 | import android.content.Intent; |
| 28 | +import android.widget.Toast; |
28 | 29 |
|
29 | | -import io.phonk.MainActivity; |
30 | 30 | import io.phonk.gui.settings.UserPreferences; |
| 31 | +import io.phonk.helpers.PhonkAppHelper; |
| 32 | +import io.phonk.runner.AppRunnerActivity; |
| 33 | +import io.phonk.runner.base.models.Project; |
31 | 34 | import io.phonk.runner.base.utils.MLog; |
32 | 35 |
|
33 | | -public class PhonkBootReceiver extends BroadcastReceiver { |
| 36 | +public class BootReceiver extends BroadcastReceiver { |
34 | 37 |
|
35 | | - private static final String TAG = PhonkBootReceiver.class.getSimpleName(); |
| 38 | + private static final String TAG = BootReceiver.class.getSimpleName(); |
36 | 39 |
|
37 | 40 | @Override |
38 | 41 | public void onReceive(Context context, Intent intent) { |
39 | 42 | if ((boolean) UserPreferences.getInstance().get("launch_on_device_boot")) { |
40 | | - MLog.d(TAG, "launching Protocoder on boot"); |
41 | | - Intent in = new Intent(context, MainActivity.class); |
| 43 | + MLog.d(TAG, "launching PHONK on boot"); |
| 44 | + Intent in = new Intent(context, LauncherActivity.class); |
42 | 45 | in.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
43 | 46 | context.startActivity(in); |
44 | 47 | } |
| 48 | + |
| 49 | + String scriptToLaunch = (String) UserPreferences.getInstance().get("launch_script_on_boot"); |
| 50 | + |
| 51 | + if (!scriptToLaunch.isEmpty()) { |
| 52 | + // PhonkAppHelper.launchScript(context, new Project(scriptToLaunch)); |
| 53 | + |
| 54 | + Project p = new Project(scriptToLaunch); |
| 55 | + Intent newIntent = new Intent(context, AppRunnerActivity.class); |
| 56 | + newIntent.putExtra("projectName", p.getName()); |
| 57 | + newIntent.putExtra("projectFolder", p.getFolder()); |
| 58 | + newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| 59 | + context.startActivity(newIntent); |
| 60 | + } |
45 | 61 | } |
46 | 62 | } |
0 commit comments