Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/develop' into public
Browse files Browse the repository at this point in the history
# Conflicts:
#	weather-api/src/main/jni/Application.mk
  • Loading branch information
thewizrd committed Sep 16, 2024
2 parents c2cda1f + 0cbbacc commit 56ddf09
Show file tree
Hide file tree
Showing 191 changed files with 8,689 additions and 3,021 deletions.
12 changes: 7 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ android {

defaultConfig {
applicationId "com.thewizrd.simpleweather"
testApplicationId "com.thewizrd.simpleweather.test"
// Specifies the fully-qualified class name of the test instrumentation runner.
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 00, WearOS: 01)
versionCode 335900500
versionName "5.9.0"
// NOTE: Version Code Format (TargetSDK, Version Name, Build Number, Variant Code (Android: 0, WearOS: 1)
versionCode 345100040
versionName "5.10.0"

vectorDrawables {
useSupportLibrary true
Expand Down Expand Up @@ -168,13 +169,14 @@ dependencies {

fullgmsImplementation "com.google.android.gms:play-services-base:$gms_base_version"
fullgmsImplementation "com.google.android.gms:play-services-location:$gms_location_version"
fullgmsImplementation 'com.google.android.gms:play-services-maps:18.2.0'
fullgmsImplementation 'com.google.android.gms:play-services-maps:19.0.0'
fullgmsImplementation "com.google.android.gms:play-services-wearable:$gms_wearable_version"
fullgmsImplementation 'com.google.android.play:app-update-ktx:2.1.0'
fullgmsImplementation 'com.google.android.play:feature-delivery-ktx:2.1.0'
fullgmsImplementation 'com.google.android.play:review-ktx:2.0.1'
fullgmsImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$kotlinx_version"

nongmsImplementation 'org.osmdroid:osmdroid-android:6.1.18'
nongmsImplementation 'org.osmdroid:osmdroid-android:6.1.20'
}

if (getGradle().getStartParameter().getTaskRequests().toString().contains("Fullgms")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.thewizrd.simpleweather
package com.thewizrd.simpleweather.test

import android.content.Context
import android.content.SharedPreferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.thewizrd.simpleweather
package com.thewizrd.simpleweather.test

import android.content.Context
import android.content.SharedPreferences
Expand All @@ -23,6 +23,7 @@ import com.thewizrd.shared_resources.remoteconfig.WeatherProviderConfig
import com.thewizrd.shared_resources.utils.Coordinate
import com.thewizrd.shared_resources.utils.DateTimeUtils
import com.thewizrd.shared_resources.utils.JSONParser
import com.thewizrd.shared_resources.utils.LocaleUtils
import com.thewizrd.shared_resources.utils.ZoneIdCompat
import com.thewizrd.shared_resources.weatherdata.WeatherAPI
import com.thewizrd.shared_resources.weatherdata.WeatherProvider
Expand Down Expand Up @@ -572,6 +573,47 @@ class UnitTests {
}
}

@Throws(WeatherException::class)
@Test
fun getDWDWeather() {
runBlocking(Dispatchers.Default) {
val provider =
weatherModule.weatherManager.getWeatherProvider(WeatherAPI.DWD)
val weather =
getWeather(provider, Coordinate(52.52, 13.4)) // Berlin
assertTrue(weather.isValid && WeatherUiModel(weather).isValid)
}
}

@Throws(WeatherException::class)
@Test
fun getECCCWeather() {
runBlocking(Dispatchers.Default) {
val provider =
weatherModule.weatherManager.getWeatherProvider(WeatherAPI.ECCC)
val weather =
getWeather(provider, Coordinate(48.737, -91.984)) // Banning, ON
assertTrue(weather.isValid && WeatherUiModel(weather).isValid)
}
}

@Throws(WeatherException::class)
@Test
fun getECCCWeather_FR() {
runBlocking(Dispatchers.Default) {
val locale = LocaleUtils.getLocale()
LocaleUtils.setLocaleCode(Locale.CANADA_FRENCH.toLanguageTag())

val provider =
weatherModule.weatherManager.getWeatherProvider(WeatherAPI.ECCC)
val weather =
getWeather(provider, Coordinate(48.737, -91.984)) // Banning, ON
assertTrue(weather.isValid && WeatherUiModel(weather).isValid)
// Restore
LocaleUtils.setLocaleCode(locale.toLanguageTag())
}
}

@Test
fun moshiSerializeTest() {
JSONParser.deserializer<WeatherProviderConfig>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.thewizrd.simpleweather
package com.thewizrd.simpleweather.test

import android.content.Context
import android.content.SharedPreferences
Expand Down
10 changes: 5 additions & 5 deletions app/src/fullgms/java/com/thewizrd/simpleweather/extras/Extras.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fun SettingsFragment.IconsFragment.navigateUnsupportedIconPack() {
// Navigate to premium page
if (isPremiumSupported()) {
rootView.findNavController()
.navigate(`SettingsFragment$IconsFragmentDirections`.actionIconsFragmentToPremiumFragment())
.safeNavigate(`SettingsFragment$IconsFragmentDirections`.actionIconsFragmentToPremiumFragment())
} else {
showSnackbar(
Snackbar.make(
Expand All @@ -106,7 +106,7 @@ fun SettingsFragment.IconsFragment.navigateUnsupportedIconPack() {
}

fun enableAdditionalRefreshIntervals(): Boolean {
return extrasModule.isEnabled()
return extrasModule.isPremiumEnabled()
}

fun checkPremiumStatus() {
Expand All @@ -118,17 +118,17 @@ fun isPremiumSupported(): Boolean {
}

fun isRadarInteractionEnabled(): Boolean {
return extrasModule.isEnabled()
return extrasModule.isAtLeastProEnabled()
}

fun areNotificationExtrasEnabled(): Boolean {
return extrasModule.isEnabled()
return extrasModule.isAtLeastProEnabled()
}

fun SettingsFragment.createPremiumPreference(): Preference {
val premiumPref = Preference(requireContext()).apply {
title = context.getString(R.string.pref_title_premium)
summary = context.getString(R.string.message_premium_prompt)
summary = context.getString(R.string.pref_summary_premium)
setIcon(R.drawable.ic_star_24dp)
order = 0
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@file:JvmMultifileClass
@file:JvmName("PerfTrace")

package com.thewizrd.simpleweather.performance

import com.google.firebase.perf.metrics.Trace

class PerfTrace(private val name: String) {
private val trace = Trace.create(name)

fun startTrace() {
trace.start()
}

fun stopTrace() {
trace.stop()
}

fun putAttribute(name: String, value: String) {
trace.putAttribute(name, value)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.thewizrd.simpleweather.radar;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import com.google.android.gms.maps.GoogleMap;

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public class EmptyRadarViewProvider extends MapTileRadarViewProvider {
public EmptyRadarViewProvider(@NonNull Context context, @NonNull ViewGroup rootView) {
super(context, rootView);
}

@Override
public void onCreateView(@Nullable Bundle savedInstanceState) {
super.onCreateView(savedInstanceState);
if (getViewContainer().getChildCount() == 0) {
getViewContainer().addView(getMapView());
}
}

@Override
public void updateRadarView() {
getMapView().getMapAsync(this);
}

@Override
public void onMapReady(@NonNull GoogleMap googleMap) {
super.onMapReady(googleMap);
}
}
Loading

0 comments on commit 56ddf09

Please sign in to comment.