-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from rfcx/bug/fix-cached-endpoint
Add internet connection even cached endpoint is reached timeout
- Loading branch information
Showing
6 changed files
with
35 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/src/main/java/org/rfcx/incidents/util/ConnectivityUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.rfcx.incidents.util | ||
|
||
import android.content.Context | ||
import android.net.ConnectivityManager | ||
import android.net.NetworkCapabilities | ||
import android.os.Build | ||
|
||
class ConnectivityUtils(private val context: Context) { | ||
|
||
fun isNetworkAvailable(): Boolean { | ||
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | ||
val capabilities = cm.getNetworkCapabilities(cm.activeNetwork) | ||
capabilities != null && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED) | ||
} else { | ||
val activeNetworkInfo = cm.activeNetworkInfo | ||
activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
- Bug fixes | ||
- firebase messaging crashed fixed (newer version lib) | ||
- app crashed when open notification from bad connectivity | ||
- app crashed when preference is not initialized | ||
- app crashed when event start time is bigger than end time | ||
- sites are disappear when refresh with poor connection | ||
- Cannot load project and alerts when offline |