Browse Source

Merge branch 'master' of git.lattuga.net:hacklabbo/Ilovexm24

d0c 7 years ago
parent
commit
15fe72c394
7 changed files with 74 additions and 16 deletions
  1. 18 1
      README.md
  2. BIN
      android-debug.apk
  3. 0 1
      config.xml
  4. 39 0
      hooks/after_prepare/030_remove_permissions.js
  5. 11 9
      www/js/query.js
  6. 3 3
      www/js/update.js
  7. 3 2
      www/js/util.js

+ 18 - 1
README.md

@@ -100,7 +100,24 @@ Error: CocoaPods was not found. Please install version 1.0.1 or greater from htt
 
 Occore installare `CocoaPods` come descritto sulla [documentazione del plugin](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#ios-details)
 
-    
+## Download ##
+
+## Google Play ##
+
+Solo per chi ha un account google. 
+
+Sconsigliamo l'installazione dal Google Play perche' google come multinazionale profila ogni tuo gusto e l'utilizza a scopo commerciale. In pratica ti tratta come merce per accaparrarsi profitto. Se ti e' possibile quindi utilizza fdroid.
+
+https://play.google.com/store/apps/details?id=xm24.digitigrafo.it
+
+## Repository Privato Fdroid ##
+
+Repository gestito da hacklabbo, non e' il repository fdroid ufficiale. 
+
+Per poter utilizzare questo repository devi comunque scaricare l'applicazione [fdroid](https://f-droid.org/) e aggiungere questo repository ed attivarlo nella configurazione dell'applicazaione. E' un operazione piuttosto semplice da effettuare.
+
+https://fdroid.hacklabbo.indivia.net/
+
 ## TODO, ISSUE e FEATURE ##
 
 Usiamo l'[issue tracker](https://git.lattuga.net/hacklabbo/Ilovexm24/issues) non il wiki.

BIN
android-debug.apk


+ 0 - 1
config.xml

@@ -32,7 +32,6 @@
         <preference name = "SplashScreenDelay" value="3000" />
         <preference name = "SplashMaintainAspectRatio" value="true" />
         <preference name = "SplashShowOnlyFirstTime" value="false" />
-        <preference name="AndroidPersistentFileLocation" value="Compatibility" />
     </platform>
     <platform name="ios">
         <allow-intent href="itms:*" />

+ 39 - 0
hooks/after_prepare/030_remove_permissions.js

@@ -0,0 +1,39 @@
+#!/usr/bin/env node
+
+//
+// This hook removes specific permissions from the AndroidManifest.xml
+// The AndroidManifest is re-generated during the prepare stage,
+// so this must be run on the "after_prepare" hook.
+//
+
+
+// Configure the permissions to be forcefully removed.
+// NOTE: These permissions will be removed regardless of how many plugins
+//       require the permission. You can check the permission is only required
+//       by the plugin you *think* needs it, by looking at the "count" shown in
+//       your /plugins/android.json file.
+//       If the count is more than 1, you should search through
+//       the /plugins//plugin.xml files for <uses-permission> tags.
+
+var permsToRm = [ "RECORD_AUDIO", "MODIFY_AUDIO_SETTINGS", "READ_PHONE_STATE" ];
+
+var fs = require('fs');
+var path = require('path');
+var rootdir = process.argv[2];
+var manifestFile = path.join(rootdir, "platforms/android/AndroidManifest.xml");
+
+fs.readFile( manifestFile, "utf8", function( err, data ) {
+    if (err)
+        return console.log( "Error reading AndroidManifest.xml", err );
+    
+    var result = data;
+    for(var i = 0; i < permsToRm.length; i++) {
+        var search = '<uses-permission android:name="android.permission.' + permsToRm[i] + '" />';
+        result = result.replace(search, '');
+    }
+
+    fs.writeFile( manifestFile, data, "utf8", function( err ){
+        if (err)
+            return console.log( "Error writing AndroidManifest.xml", err );
+    });
+} );

+ 11 - 9
www/js/query.js

@@ -1,6 +1,5 @@
 function myJsonCategory(Qcategory, div, addTagCategory) {
-    $.mobile.loading('show');
-    FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
+    FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
         var items = [];
         for (var i = 0; i < resultSet.rows.length; i++) {
             var val = JSON.parse(resultSet.rows.item(i).post);
@@ -83,7 +82,10 @@ var drawListPost = function(div, resultSet, position) {
     } else if(position == 'prepend'){
         ul.prependTo(div);
     }
-    $.mobile.loading('hide');
+    
+    setTimeout(function () {
+        $.mobile.loading('hide');
+    }, 1000);
 };
 
 var appendPostList = function(div, resultSet, categories, fallback) {
@@ -144,7 +146,7 @@ var getCategoryWhere = function(categories) {
 
 var POST = POST || {};
 POST.sql = {
-    init: "SELECT * FROM xm24_posts JOIN xm24_cats_to_posts USING(id) WHERE ",
+    init: "SELECT DISTINCT * FROM xm24_posts JOIN xm24_cats_to_posts USING(id) WHERE ",
     end : "ORDER BY date COLLATE NOCASE DESC LIMIT ?"
 };
 
@@ -195,7 +197,7 @@ function myJsonLastPage(div) {
     var firstTime = storage.getItem('db_lastnews_firsttime');
     if (firstTime != 'yes') {
         if (lastnewsDate) {
-            FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts WHERE date > ? ORDER BY date COLLATE NOCASE DESC LIMIT 40;", [lastnewsDate], function (resultSet) {
+            FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts WHERE date > ? ORDER BY date COLLATE NOCASE DESC LIMIT 40;", [lastnewsDate], function (resultSet) {
                 var items = [];
                 $(div).empty();
                 if (resultSet.rows.length > 0) {
@@ -232,7 +234,7 @@ function myJsonLastPage(div) {
 
 function myJsonCategoryPaginated(Qcategory, div, pageNumber) {
     $.mobile.loading('show');
-    FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
+    FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts WHERE category = ? ORDER BY date COLLATE NOCASE DESC;", [Qcategory], function (resultSet) {
         var items = [];
         $(div).empty();
         for (var i = 0; i < resultSet.rows.length; i++) {
@@ -313,7 +315,7 @@ function myJsonPost(Qid, div_title, div_content, _class) {
         table = EVENTS.table.single;
     }
 
-    FONTE.dbHandler.executeSql("SELECT * FROM " + table + " WHERE id = ?;", [Qid], function(resultSet) {
+    FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM " + table + " WHERE id = ?;", [Qid], function(resultSet) {
         if(!_class){
             drawPost(div_title, div_content, resultSet);
         } else {
@@ -325,7 +327,7 @@ function myJsonPost(Qid, div_title, div_content, _class) {
 function myJsonPage(Qid, div_title, div_content) {
     $.mobile.loading('show');
     var pageId = parseInt(Qid);
-    FONTE.dbHandler.executeSql("SELECT * FROM xm24_pages WHERE id = ?;", [pageId], function (resultSet) {
+    FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_pages WHERE id = ?;", [pageId], function (resultSet) {
         for (var i = 0; i < resultSet.rows.length; i++) {
             var data = resultSet.rows.item(i);
             var id = data.id;
@@ -342,7 +344,7 @@ function myJsonPage(Qid, div_title, div_content) {
 
 function myJsonRandomPost(div_title, div_content) {
     $.mobile.loading('show');
-    FONTE.dbHandler.executeSql("SELECT * FROM xm24_posts ORDER BY RANDOM() LIMIT 1;", [], function (resultSet) {
+    FONTE.dbHandler.executeSql("SELECT DISTINCT * FROM xm24_posts ORDER BY RANDOM() LIMIT 1;", [], function (resultSet) {
         for (var i = 0; i < resultSet.rows.length; i++) {
             var val = JSON.parse(resultSet.rows.item(i).post);
             var id = val.id;

+ 3 - 3
www/js/update.js

@@ -245,9 +245,9 @@ function getLastSinglePageRecur(url, pagenum, categories) {
                 });
             });
 
-            if (data.length == 0) {
-                renderLastNews(FONTE.contentListClass, categories);
-            }
+            // if (data.length === 0) {
+            //     renderLastNews(FONTE.contentListClass, categories);
+            // }
         },
         error: JSONErrorHandler
     });

+ 3 - 2
www/js/util.js

@@ -8,7 +8,7 @@ function initStorage() {
 }
 
 /*per network info*/
-function checkConnection(code, msgConnect) {
+function checkConnection(code, msgConnect, print) {
     var msgTitle = "Non sei connesso";
     msgConnect = msgConnect ||  "Occore essere connessi per poter ricevere i nuovi articoli";
 
@@ -23,7 +23,8 @@ function checkConnection(code, msgConnect) {
     states[Connection.CELL] = 'Cell generic connection';
     states[Connection.NONE] = 'No network connection';
     if (states[networkState] == 'Unknown connection' || states[networkState] == 'No network connection') {
-        toastr.warning(msgConnect, msgTitle);
+        if(! print)
+            toastr.warning(msgConnect, msgTitle);
         console.log(code);
         return false;
     } else {