Skip to content

Commit

Permalink
CHANGELOG: Fix providers
Browse files Browse the repository at this point in the history
  • Loading branch information
DHD2280 committed Apr 23, 2024
1 parent 6017a45 commit 675ac9c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 63 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

<provider
android:name=".weather.WeatherContentProvider"
android:authorities="it.dhd.oxygencustomizer.provider"
android:authorities="it.dhd.oxygencustomizer.weatherprovider"
android:exported="true" />

<receiver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@

public class UpdateFragment extends Fragment {
public static final String MOD_NAME = "OxygenCustomizer";
public static final String MAGISK_UPDATE_DIR = "/data/adb/modules_update";
public static final String MAGISK_MODULES_DIR = "/data/adb/modules";
private static final String updateRoot = String.format("%s/%s", MAGISK_UPDATE_DIR, MOD_NAME);

public static final String UPDATES_CHANNEL_ID = "Updates";
private static final String stableUpdatesURL = "https://raw.githubusercontent.com/DHD2280/Oxygen-Customizer/stable/latestStable.json";
Expand All @@ -75,8 +72,6 @@ public class UpdateFragment extends Fragment {
static boolean betaUpdate = BuildConfig.VERSION_NAME.toLowerCase().contains("beta");
HashMap<String, Object> latestVersion = null;
private String downloadedFilePath;
private static final String updateDir = String.format("%s/%s", MAGISK_UPDATE_DIR, MOD_NAME);
private static final String moduleDir = String.format("%s/%s", MAGISK_MODULES_DIR, MOD_NAME);

final BroadcastReceiver downloadCompletionReceiver = new BroadcastReceiver() {

Expand All @@ -87,7 +82,6 @@ public void onReceive(Context context, Intent intent) {


boolean successful = false;
Log.d("UpdateFragment", "onReceive: " + intent.getAction());
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction()) && intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1) == downloadID) {
try (Cursor downloadData = downloadManager.query(
new DownloadManager.Query()
Expand All @@ -97,7 +91,6 @@ public void onReceive(Context context, Intent intent) {
int uriColIndex = downloadData.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI);

File downloadedFile = new File(URI.create(downloadData.getString(uriColIndex)));
Log.d("UpdateFragment", "downloadedFile = " + downloadData.getString(uriColIndex));

if (downloadedFile.exists()) {
downloadedFilePath = new File(URI.create(downloadData.getString(uriColIndex))).getAbsolutePath();
Expand Down Expand Up @@ -157,7 +150,6 @@ public View onCreateView(
}

private void installApk(String downloadPath) {
Log.d("UpdateFragment", "installApk: " + downloadPath);
Intent promptInstall = new Intent(Intent.ACTION_VIEW).setDataAndType(
FileProvider.getUriForFile(getContext(), BuildConfig.APPLICATION_ID + ".provider", new File(downloadPath)),
"application/vnd.android.package-archive");
Expand Down Expand Up @@ -250,7 +242,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
{
BtnText = R.string.reinstall_word;
}
enable = true; //stable version is ALWAYS flashable, so that user can revert from canary or repair installation
enable = true; //stable version is ALWAYS flashable, so that user can revert from beta or repair installation
} else {
if (latestCode > currentVersionCode || (currentVersionType == 1)) {
enable = true;
Expand All @@ -267,8 +259,6 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {

binding.updateChannelRadioGroup.setOnCheckedChangeListener(onCheckChangedListener);

binding.packageTypeRadioGroup.setOnCheckedChangeListener((radioGroup, i) -> onCheckChangedListener.onCheckedChanged(view.findViewById(R.id.updateChannelRadioGroup), 0));

binding.updateBtn.setOnClickListener(view1 -> {
if (rebootPending) {
Shell.cmd("reboot");
Expand All @@ -284,12 +274,6 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
}
});

if (currentVersionType == 1) {
((RadioButton) view.findViewById(R.id.fullTypeID)).setChecked(true);
} else {
((RadioButton) view.findViewById(R.id.XposedTypeID)).setChecked(true);
}

if (currentVersionName.toLowerCase().contains("beta")) {
((RadioButton) view.findViewById(R.id.betaID)).setChecked(true);
} else {
Expand Down Expand Up @@ -323,7 +307,6 @@ public void startDownload(String zipURL, int versionNumber) {

//noinspection ConstantConditions
if (getContext() != null) {
Log.d("UpdateFragment", "startDownload: " + downloadID);
getContext().registerReceiver(downloadCompletionReceiver, filters, RECEIVER_EXPORTED);
}
}
Expand All @@ -340,8 +323,6 @@ public void notifyInstall() {
return;
}

Log.d("UpdateFragment", "notifyInstall: " + downloadedFilePath);

Intent notificationIntent = new Intent(getContext(), MainActivity.class);
notificationIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
notificationIntent.setAction(Intent.ACTION_RUN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class WeatherContentProvider extends ContentProvider {
COLUMN_ICON_PACK
};

public static final String AUTHORITY = "it.dhd.oxygencustomizer.provider";
public static final String AUTHORITY = "it.dhd.oxygencustomizer.weatherprovider";

private static final UriMatcher sUriMatcher;
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ private void updateWeather() {
if (w != null) {
Config.setWeatherData(w, WeatherUpdateService.this);
WeatherContentProvider.updateCachedWeatherInfo(WeatherUpdateService.this);
Log.d(TAG, "Weather updated updateCachedWeatherInfo");
//WeatherAppWidgetProvider.updateAllWidgets(WeatherUpdateService.this);
// we are outa here
break;
Expand All @@ -287,6 +288,7 @@ private void updateWeather() {
} finally {
if (w == null) {
// error
if (DEBUG) Log.d(TAG, "error updating weather");
Config.setUpdateError(WeatherUpdateService.this, true);
}
// send broadcast that something has changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ public class OmniJawsClient {
private static final boolean DEBUG = true;
public static final String SERVICE_PACKAGE = BuildConfig.APPLICATION_ID;
public static final Uri WEATHER_URI
= Uri.parse("content://it.dhd.oxygencustomizer.provider/weather");
= Uri.parse("content://it.dhd.oxygencustomizer.weatherprovider/weather");
public static final Uri SETTINGS_URI
= Uri.parse("content://it.dhd.oxygencustomizer.provider/settings");
= Uri.parse("content://it.dhd.oxygencustomizer.weatherprovider/settings");
public static final Uri CONTROL_URI
= Uri.parse("content://it.dhd.oxygencustomizer.provider/control");
= Uri.parse("content://it.dhd.oxygencustomizer.weatherprovider/control");

private static final String ICON_PACKAGE_DEFAULT = BuildConfig.APPLICATION_ID;
private static final String ICON_PREFIX_DEFAULT = "google";
Expand Down
39 changes: 1 addition & 38 deletions app/src/main/res/layout/update_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,43 +75,6 @@ PixelXper https://github.com/siavash79/PixelXpert/blob/stable/app/src/main/res/l
android:textColor="?attr/colorOnSurface" />
</RadioGroup>

<com.google.android.material.textview.MaterialTextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="@string/update_type_title"
android:textColor="?attr/colorOnSurface"
android:textStyle="bold"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/updateChannelRadioGroup"
app:layout_constraintTop_toBottomOf="@+id/updateChannelRadioGroup" />

<RadioGroup
android:id="@+id/packageTypeRadioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/textView3"
app:layout_constraintTop_toBottomOf="@+id/textView3">

<RadioButton
android:id="@+id/fullTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/full_type"
android:textColor="?attr/colorOnSurface" />

<RadioButton
android:id="@+id/XposedTypeID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/xposed_type"
android:textColor="?attr/colorOnSurface" />
</RadioGroup>

<com.google.android.material.textview.MaterialTextView
android:id="@+id/latestVersionTitleID"
Expand All @@ -122,7 +85,7 @@ PixelXper https://github.com/siavash79/PixelXpert/blob/stable/app/src/main/res/l
android:textColor="?attr/colorOnSurface"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/packageTypeRadioGroup" />
app:layout_constraintTop_toBottomOf="@+id/updateChannelRadioGroup" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/latestVersionValueID"
Expand Down

0 comments on commit 675ac9c

Please sign in to comment.