ready check
This commit is contained in:
15 files changed
+135
-143
No files matched your search
+26
-13
@@ -1,15 +1,28 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
# macOS
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
|
||||
# Gradle and Android build output
|
||||
.gradle/
|
||||
build/
|
||||
*/build/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
captures/
|
||||
|
||||
# Local SDK, signing, and machine-specific files
|
||||
local.properties
|
||||
*.iml
|
||||
*.jks
|
||||
*.keystore
|
||||
keystore.properties
|
||||
|
||||
# Android Studio local state
|
||||
.idea/caches/
|
||||
.idea/libraries/
|
||||
.idea/modules.xml
|
||||
.idea/workspace.xml
|
||||
.idea/navEditor.xml
|
||||
.idea/assetWizardSettings.xml
|
||||
.idea/deploymentTargetSelector.xml
|
||||
.idea/deviceManager.xml
|
||||
.idea/shelf/
|
||||
Generated
-11
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DialogSelection />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
||||
Generated
-13
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DeviceTable">
|
||||
<option name="columnSorters">
|
||||
<list>
|
||||
<ColumnSorterState>
|
||||
<option name="column" value="Name" />
|
||||
<option name="order" value="ASCENDING" />
|
||||
</ColumnSorterState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,67 @@
|
||||
# Remaining
|
||||
|
||||
Remaining is an Android quota tracker for Iranian mobile and internet services. It stores account credentials locally, refreshes usage data in the background, and presents quota, expiry, refresh, and risk signals in the app and home-screen widgets.
|
||||
|
||||
## Features
|
||||
|
||||
- Tracks MCI, Jahan Nama / Webotel, and TCI Internet accounts.
|
||||
- Shows remaining traffic, package details, expiry risk, stale refreshes, captcha needs, and authentication errors.
|
||||
- Supports manual refresh, configurable background refresh intervals, low-data alerts, and app-wide theme settings.
|
||||
- Includes multiple home-screen widgets for account spotlight, provider mix, watchlist, refresh timeline, compact signal, and account matrix views.
|
||||
- Encrypts saved passwords, tokens, cookies, and session payloads with Android Keystore-backed AES-GCM.
|
||||
|
||||
This project is not affiliated with MCI, TCI, Jahan Nama, Webotel, or their parent companies.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Android Studio or the Android SDK command line tools.
|
||||
- JDK 17 or newer.
|
||||
- Android SDK platform for compile SDK 37.
|
||||
|
||||
## Build
|
||||
|
||||
From the repository root:
|
||||
|
||||
```sh
|
||||
./gradlew :app:assembleDebug
|
||||
```
|
||||
|
||||
Run local unit tests:
|
||||
|
||||
```sh
|
||||
./gradlew :app:testDebugUnitTest
|
||||
```
|
||||
|
||||
Run Android lint:
|
||||
|
||||
```sh
|
||||
./gradlew :app:lintDebug
|
||||
```
|
||||
|
||||
The first build may download Gradle, Android Gradle Plugin, Kotlin, Compose, Room, WorkManager, OkHttp, jsoup, and test dependencies.
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `app/src/main/java/net/rodakot/remaining/connectors`: provider-specific network clients and parsers.
|
||||
- `app/src/main/java/net/rodakot/remaining/data`: Room entities, DAO, settings, and account repository.
|
||||
- `app/src/main/java/net/rodakot/remaining/refresh`: WorkManager scheduling and notifications.
|
||||
- `app/src/main/java/net/rodakot/remaining/security`: local credential encryption.
|
||||
- `app/src/main/java/net/rodakot/remaining/ui`: Compose app, screens, theme, and UI helpers.
|
||||
- `app/src/main/java/net/rodakot/remaining/widget`: AppWidget providers, renderers, and widget configuration.
|
||||
- `docs`: observed provider API notes used by the connectors.
|
||||
|
||||
## Privacy And Security
|
||||
|
||||
- Credentials and session artifacts are stored only on the device and encrypted through Android Keystore.
|
||||
- App backup is disabled in the manifest, and backup/data-extraction rules exclude app data.
|
||||
- Do not commit `local.properties`, keystores, signing configs, real account credentials, API tokens, or generated build output.
|
||||
- The provider API documentation contains placeholders only. Replace examples with sanitized values if you update those docs.
|
||||
|
||||
## Publishing Checklist
|
||||
|
||||
Before pushing this repository publicly:
|
||||
|
||||
- Choose a license and add a `LICENSE` file if you want others to reuse or contribute to the code.
|
||||
- Review package name, app name, icon, and screenshots for your intended public identity.
|
||||
- Keep release signing material outside Git and document release signing separately if needed.
|
||||
- Run `./gradlew :app:testDebugUnitTest :app:lintDebug :app:assembleDebug`.
|
||||
@@ -1,24 +0,0 @@
|
||||
package net.rodakot.remaining
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("net.rodakot.remaining", appContext.packageName)
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,6 @@
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.Remaining.Starting"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<intent-filter>
|
||||
|
||||
@@ -14,7 +14,6 @@ import kotlin.math.absoluteValue
|
||||
|
||||
class NotificationHelper(private val context: Context) {
|
||||
fun ensureChannel() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return
|
||||
val channel = NotificationChannel(
|
||||
CHANNEL_ID,
|
||||
"Account alerts",
|
||||
@@ -37,8 +36,12 @@ class NotificationHelper(private val context: Context) {
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
.build()
|
||||
|
||||
NotificationManagerCompat.from(context)
|
||||
.notify(accountId.hashCode().absoluteValue, notification)
|
||||
try {
|
||||
NotificationManagerCompat.from(context)
|
||||
.notify(accountId.hashCode().absoluteValue, notification)
|
||||
} catch (exception: SecurityException) {
|
||||
// Notification permission may be revoked between the check and notify().
|
||||
}
|
||||
}
|
||||
|
||||
private fun canPostNotifications(): Boolean {
|
||||
|
||||
@@ -259,7 +259,7 @@ fun QuotaRing(
|
||||
progress: Float?,
|
||||
label: String,
|
||||
value: String,
|
||||
modifier: Modifier = Modifier.size(156.dp),
|
||||
modifier: Modifier = Modifier,
|
||||
accent: Color = MaterialTheme.colorScheme.primary
|
||||
) {
|
||||
val trackColor = MaterialTheme.colorScheme.surfaceContainerHighest
|
||||
|
||||
@@ -180,7 +180,12 @@ private fun EmptyDashboard(modifier: Modifier = Modifier, onAddAccount: () -> Un
|
||||
verticalArrangement = Arrangement.spacedBy(18.dp),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
QuotaRing(progress = null, label = "dashboard", value = "Ready")
|
||||
QuotaRing(
|
||||
progress = null,
|
||||
label = "dashboard",
|
||||
value = "Ready",
|
||||
modifier = Modifier.size(156.dp)
|
||||
)
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
Text(
|
||||
"Your usage command center",
|
||||
|
||||
@@ -60,8 +60,7 @@ fun WidgetGalleryScreen(
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val canPin = remember {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
AppWidgetManager.getInstance(context).isRequestPinAppWidgetSupported
|
||||
AppWidgetManager.getInstance(context).isRequestPinAppWidgetSupported
|
||||
}
|
||||
|
||||
RemainingBackground {
|
||||
@@ -118,17 +117,15 @@ fun WidgetGalleryScreen(
|
||||
accounts = accounts,
|
||||
canPin = canPin,
|
||||
onPin = {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountChartTileWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountChartTileWidgetProvider::class.java.name,
|
||||
ACCOUNT_CHART_TILE_CONFIGURE_REQUEST
|
||||
)
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountChartTileWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountChartTileWidgetProvider::class.java.name,
|
||||
ACCOUNT_CHART_TILE_CONFIGURE_REQUEST
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -137,17 +134,15 @@ fun WidgetGalleryScreen(
|
||||
accounts = accounts,
|
||||
canPin = canPin,
|
||||
onPin = {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountSpotlightWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountSpotlightWidgetProvider::class.java.name,
|
||||
ACCOUNT_SPOTLIGHT_CONFIGURE_REQUEST
|
||||
)
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
ComponentName(context, AccountSpotlightWidgetProvider::class.java),
|
||||
null,
|
||||
accountWidgetConfigureCallback(
|
||||
context,
|
||||
AccountSpotlightWidgetProvider::class.java.name,
|
||||
ACCOUNT_SPOTLIGHT_CONFIGURE_REQUEST
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -157,13 +152,11 @@ fun WidgetGalleryScreen(
|
||||
accounts = accounts,
|
||||
canPin = canPin,
|
||||
onPin = {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
type.componentName(context),
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
AppWidgetManager.getInstance(context).requestPinAppWidget(
|
||||
type.componentName(context),
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,4 @@
|
||||
<resources>
|
||||
<color name="remaining_splash_background">#0D1117</color>
|
||||
<color name="remaining_splash_icon_background">#151B23</color>
|
||||
<color name="remaining_primary">#8FD8FF</color>
|
||||
<color name="remaining_success">#3DDC84</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
</resources>
|
||||
@@ -1,13 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample backup rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/guide/topics/data/autobackup
|
||||
for details.
|
||||
Note: This file is ignored for devices older than API 31
|
||||
See https://developer.android.com/about/versions/12/backup-restore
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<full-backup-content>
|
||||
<!--
|
||||
<include domain="sharedpref" path="."/>
|
||||
<exclude domain="sharedpref" path="device.xml"/>
|
||||
-->
|
||||
<exclude domain="root" path="." />
|
||||
</full-backup-content>
|
||||
@@ -1,19 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Sample data extraction rules file; uncomment and customize as necessary.
|
||||
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
|
||||
for details.
|
||||
-->
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<data-extraction-rules>
|
||||
<cloud-backup>
|
||||
<!-- TODO: Use <include> and <exclude> to control what is backed up.
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
-->
|
||||
<exclude domain="root" path="." />
|
||||
</cloud-backup>
|
||||
<!--
|
||||
<device-transfer>
|
||||
<include .../>
|
||||
<exclude .../>
|
||||
<exclude domain="root" path="." />
|
||||
</device-transfer>
|
||||
-->
|
||||
</data-extraction-rules>
|
||||
@@ -1,17 +0,0 @@
|
||||
package net.rodakot.remaining
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -14,7 +14,7 @@ curl 'https://my.mci.ir/api/idm/v1/auth' \
|
||||
-H 'Referer: https://my.mci.ir' \
|
||||
-H 'platform: WEB' \
|
||||
-H 'version: 1.29.0' \
|
||||
--data-raw '{"username":"9123456789","credential":"xxxx","credential_type":"PASSWORD"}'
|
||||
--data-raw '{"username":"YOUR_MCI_USERNAME","credential":"YOUR_PASSWORD","credential_type":"PASSWORD"}'
|
||||
```
|
||||
|
||||
### response
|
||||
@@ -46,7 +46,7 @@ curl 'https://my.mci.ir/api/idm/v1/auth' \
|
||||
-H 'Referer: https://my.mci.ir' \
|
||||
-H 'platform: WEB' \
|
||||
-H 'version: 1.29.0' \
|
||||
--data-raw '{"username":"9123456789","credential_type":"REFRESH_TOKEN","credential":"eyJhbG..."}'
|
||||
--data-raw '{"username":"YOUR_MCI_USERNAME","credential_type":"REFRESH_TOKEN","credential":"eyJhbG..."}'
|
||||
```
|
||||
|
||||
### response
|
||||
|
||||
Reference in new issue
Block a user