diff --git a/.gitignore b/.gitignore
index 39fb081..09b993d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,7 @@
*.iml
.gradle
/local.properties
-/.idea/workspace.xml
-/.idea/libraries
+/.idea
.DS_Store
/build
/captures
diff --git a/README.md b/README.md
index 77e4913..95f832a 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
-# Teleposter
+# Teleposter for Telegra.ph BETA
-This app is a completely independent wrapper made for Telegra.ph.
+Disclaimer: This wrapper is NOT an official wrapper and do not attempt to represent Telegram or Telegra.ph in any way.
-With this app it's very easy to create and share posts directly to Telegram.
+This app is a completely independent wrapper made for Telegra.ph, a new and simple publishing platform, made for easy sharing of articles and other stuff. With this app it's very easy to create and share these posts to any app.
-These posts are marked with "Instant View" and are able to open "instantly" in Telegram. If you don't believe how fast that is, try yourself!
+For more information aboout Telegra.ph visit https://telegram.org/blog/instant-view
-Telegra.ph is quite similar to Medium.com.
+Please take care, that this app might be unstable due to it's early development state!
## LICENSE
diff --git a/apks/0.3.apk b/apks/0.3.apk
new file mode 100644
index 0000000..629e1a6
Binary files /dev/null and b/apks/0.3.apk differ
diff --git a/app/build.gradle b/app/build.gradle
index 39ed736..4d81234 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,8 +8,8 @@ android {
applicationId "telegra.ph"
minSdkVersion 9
targetSdkVersion 25
- versionCode 2
- versionName "0.2 beta"
+ versionCode 3
+ versionName "0.3 beta"
resConfigs "en"
}
buildTypes {
@@ -29,4 +29,5 @@ android {
dependencies {
compile 'com.android.support:appcompat-v7:25.0.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
+ compile 'com.github.delight-im:Android-AdvancedWebView:v3.0.0'
}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 8b13789..5b15fb2 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1 +1,2 @@
-
+-keep class * extends android.webkit.WebChromeClient { *; }
+-dontwarn im.delight.android.webview.**
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 01e09a2..4f389ec 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -3,6 +3,7 @@
package="telegra.ph">
+
= Build.VERSION_CODES.JELLY_BEAN) {
- allowFileAccessFromFileURLs = true
- }
- // Add Database support
- databaseEnabled = true
- domStorageEnabled = true
- // Add Cache support
- setAppCacheEnabled(true)
+ webView?.setListener(this, this)
+
+ webView?.apply {
+ setMixedContentAllowed(true)
+ setCookiesEnabled(true)
+ setThirdPartyCookiesEnabled(true)
+ addPermittedHostname("telegra.ph")
}
- // Set WebViewClient
- webView?.setWebViewClient(object : WebViewClient() {
- @SuppressWarnings("deprecation")
- override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
- return urlAllowed(url)
- }
+ webView?.settings?.apply {
- @TargetApi(Build.VERSION_CODES.N)
- override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
- return urlAllowed(request.url.toString())
- }
- })
-
- // Set WebChromeClient
- webView?.setWebChromeClient(object : WebChromeClient() {
-
- })
+ }
// Check if app is opened to show special page
var urlToLoad = TELEGRAPH
@@ -61,7 +38,42 @@ class MainActivity : AppCompatActivity() {
// Load URL
webView?.loadUrl(urlToLoad)
+ }
+ override fun onPageFinished(url: String?) {
+ }
+
+ override fun onPageStarted(url: String?, favicon: Bitmap?) {
+ }
+
+ override fun onPageError(errorCode: Int, description: String?, failingUrl: String?) {
+ }
+
+ override fun onDownloadRequested(url: String?, suggestedFilename: String?, mimeType: String?, contentLength: Long, contentDisposition: String?, userAgent: String?) {
+ }
+
+ override fun onExternalPageRequest(url: String?) {
+ AdvancedWebView.Browsers.openUrl(this, url)
+ }
+
+ override fun onResume() {
+ super.onResume()
+ webView?.onResume()
+ }
+
+ override fun onPause() {
+ webView?.onPause()
+ super.onPause()
+ }
+
+ override fun onDestroy() {
+ webView?.onDestroy()
+ super.onDestroy()
+ }
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ webView?.onActivityResult(requestCode, resultCode, data)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
@@ -71,7 +83,7 @@ class MainActivity : AppCompatActivity() {
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
- when (item.itemId) {
+ return when (item.itemId) {
R.id.share -> {
val shareIntent = Intent()
shareIntent.action = Intent.ACTION_SEND
@@ -79,13 +91,10 @@ class MainActivity : AppCompatActivity() {
shareIntent.putExtra(Intent.EXTRA_TITLE, webView?.title)
shareIntent.putExtra(Intent.EXTRA_TEXT, webView?.url)
startActivity(Intent.createChooser(shareIntent, getString(R.string.share)))
- return true
+ true
}
- else -> return super.onOptionsItemSelected(item)
+ else -> super.onOptionsItemSelected(item)
}
}
- // Extra methods
- private fun urlAllowed(url: String) = url.contains("telegra.ph")
-
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index cf44c4d..c66fd09 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,5 +1,6 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f3bdd8b..f2bad2e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -14,5 +14,6 @@ allprojects {
repositories {
jcenter()
mavenCentral()
+ maven { url "https://jitpack.io" }
}
}
\ No newline at end of file