Loading app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ android { applicationId "foundation.e.apps" minSdkVersion 21 targetSdkVersion 27 versionCode 2 versionName "1.0.1" versionCode 3 versionName "1.1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { Loading app/src/main/AndroidManifest.xml +7 −24 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2019 e Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="foundation.e.apps" Loading @@ -38,18 +20,19 @@ android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name="foundation.e.apps.MainActivity"> <activity android:name=".settings.AppRequestActivity"></activity> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="foundation.e.apps.application.ApplicationActivity" /> <activity android:name="foundation.e.apps.categories.category.CategoryActivity" /> <activity android:name=".application.ApplicationActivity" /> <activity android:name=".categories.category.CategoryActivity" /> <service android:name="foundation.e.apps.applicationmanager.ApplicationManagerService" android:name=".applicationmanager.ApplicationManagerService" android:description="@string/service_description" android:exported="false" /> Loading @@ -63,9 +46,9 @@ android:resource="@xml/provider_paths" /> </provider> <activity android:name="foundation.e.apps.application.ApplicationDescriptionActivity" /> <activity android:name=".application.ApplicationDescriptionActivity" /> <activity android:name="foundation.e.apps.application.ScreenshotsActivity" android:name=".application.ScreenshotsActivity" android:theme="@style/FullScreenTheme" /> </application> Loading app/src/main/java/foundation/e/apps/api/AppDetailRequest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class AppDetailRequest(private val id: String) { fun request(callback: (Error?, FullData?) -> Unit) { try { val url = Constants.BASE_URL + "apps?action=app_detail&id=$id" val urlConnection = Common.createConnection(url) val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_GET) val result = reader.readValue<Result>(urlConnection.inputStream) urlConnection.disconnect() callback.invoke(null, result.app) Loading app/src/main/java/foundation/e/apps/api/AppRequestRequest.kt 0 → 100644 +57 −0 Original line number Diff line number Diff line /* Copyright (C) 2019 e Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.apps.api import foundation.e.apps.utils.Common import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Error import org.json.JSONObject import java.net.HttpURLConnection class AppRequestRequest { fun request(packageName: String, callback: (Error?) -> Unit) { val requestBody = JSONObject() requestBody.put("package_name", packageName) try { val url = Constants.BASE_URL + "app_suggestions" val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_POST) urlConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8") val outputStream = urlConnection.outputStream outputStream.write(requestBody.toString().toByteArray(charset("UTF-8"))) outputStream.close() when (urlConnection.responseCode) { HttpURLConnection.HTTP_OK -> callback.invoke(Error.NO_ERROR) HttpURLConnection.HTTP_BAD_REQUEST -> callback.invoke(Error.INVALID_PACKAGE_NAME) HttpURLConnection.HTTP_NOT_ACCEPTABLE -> callback.invoke(Error.PACKAGE_ALREADY_EXISTS) else -> callback.invoke(Error.UNKNOWN) } urlConnection.disconnect() } catch (e: Exception) { e.printStackTrace() callback.invoke(Error.findError(e)) } } } app/src/main/java/foundation/e/apps/api/HomeRequest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class HomeRequest { fun request(callback: (Error?, HomeResult?) -> Unit) { try { val url = Constants.BASE_URL + "apps?action=list_home" val urlConnection = Common.createConnection(url) val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_GET) val result = reader.readValue<HomeResult>(urlConnection.inputStream) urlConnection.disconnect() callback.invoke(null, result) Loading Loading
app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -10,8 +10,8 @@ android { applicationId "foundation.e.apps" minSdkVersion 21 targetSdkVersion 27 versionCode 2 versionName "1.0.1" versionCode 3 versionName "1.1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { Loading
app/src/main/AndroidManifest.xml +7 −24 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2019 e Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="foundation.e.apps" Loading @@ -38,18 +20,19 @@ android:roundIcon="@mipmap/ic_launcher" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name="foundation.e.apps.MainActivity"> <activity android:name=".settings.AppRequestActivity"></activity> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="foundation.e.apps.application.ApplicationActivity" /> <activity android:name="foundation.e.apps.categories.category.CategoryActivity" /> <activity android:name=".application.ApplicationActivity" /> <activity android:name=".categories.category.CategoryActivity" /> <service android:name="foundation.e.apps.applicationmanager.ApplicationManagerService" android:name=".applicationmanager.ApplicationManagerService" android:description="@string/service_description" android:exported="false" /> Loading @@ -63,9 +46,9 @@ android:resource="@xml/provider_paths" /> </provider> <activity android:name="foundation.e.apps.application.ApplicationDescriptionActivity" /> <activity android:name=".application.ApplicationDescriptionActivity" /> <activity android:name="foundation.e.apps.application.ScreenshotsActivity" android:name=".application.ScreenshotsActivity" android:theme="@style/FullScreenTheme" /> </application> Loading
app/src/main/java/foundation/e/apps/api/AppDetailRequest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ class AppDetailRequest(private val id: String) { fun request(callback: (Error?, FullData?) -> Unit) { try { val url = Constants.BASE_URL + "apps?action=app_detail&id=$id" val urlConnection = Common.createConnection(url) val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_GET) val result = reader.readValue<Result>(urlConnection.inputStream) urlConnection.disconnect() callback.invoke(null, result.app) Loading
app/src/main/java/foundation/e/apps/api/AppRequestRequest.kt 0 → 100644 +57 −0 Original line number Diff line number Diff line /* Copyright (C) 2019 e Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ package foundation.e.apps.api import foundation.e.apps.utils.Common import foundation.e.apps.utils.Constants import foundation.e.apps.utils.Error import org.json.JSONObject import java.net.HttpURLConnection class AppRequestRequest { fun request(packageName: String, callback: (Error?) -> Unit) { val requestBody = JSONObject() requestBody.put("package_name", packageName) try { val url = Constants.BASE_URL + "app_suggestions" val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_POST) urlConnection.setRequestProperty("Content-Type", "application/json; charset=UTF-8") val outputStream = urlConnection.outputStream outputStream.write(requestBody.toString().toByteArray(charset("UTF-8"))) outputStream.close() when (urlConnection.responseCode) { HttpURLConnection.HTTP_OK -> callback.invoke(Error.NO_ERROR) HttpURLConnection.HTTP_BAD_REQUEST -> callback.invoke(Error.INVALID_PACKAGE_NAME) HttpURLConnection.HTTP_NOT_ACCEPTABLE -> callback.invoke(Error.PACKAGE_ALREADY_EXISTS) else -> callback.invoke(Error.UNKNOWN) } urlConnection.disconnect() } catch (e: Exception) { e.printStackTrace() callback.invoke(Error.findError(e)) } } }
app/src/main/java/foundation/e/apps/api/HomeRequest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class HomeRequest { fun request(callback: (Error?, HomeResult?) -> Unit) { try { val url = Constants.BASE_URL + "apps?action=list_home" val urlConnection = Common.createConnection(url) val urlConnection = Common.createConnection(url, Constants.REQUEST_METHOD_GET) val result = reader.readValue<HomeResult>(urlConnection.inputStream) urlConnection.disconnect() callback.invoke(null, result) Loading