Tribr_multi_image module


#1

We use this module currently and it looks like it’s crashing our app on iOS 12 with all the latest framework updates. I saw it’s been deprecated as well. Is it possible for you to fix it for iOS 12 or should we discontinue use?


#2

We renamed this module when we updated it for the release of the v2.8.x platform.

You can now find it here:

https://trigger.io/modules/gallery/current/

Should get you up and running:

Step #1

"gallery": {
    "version": "2.1",
    "config": { }
}

Step #2

Rename all usages of forge.tribr_multi_image.getImages to forge.gallery.getImages


#3

Thanks for the quick reply Antoine!


#4

I implemented the changes described above. The gallery feature still doesn’t work in the Simulator 12.1 or 13.1. After I try to attach the images the app freezes in 12.1 and fails to display or save the images in 13.1.

These are some relevant messages from the console:

[DEBUG] Native call: {
    callid = "C5E1702D-F473-4FE9-AF67-62DCE2A34ACE";
    method = "request.httpx";
    params =     {
        boundary = F7AB9F30ADFE4D26A694FEAD80FB69FF;
        data = "";
        fileUploadMethod = multipart;
        files =         (
                        {
                type = image;
                uri = "assets-library://asset/asset.JPG?id=B84E8479-475C-4727-A4A4-B77AA9980897&ext=JPG";
            }
        );
        headers =         {
            Accept = "*/*";
            "Content-Type" = "multipart/form-data; boundary=F7AB9F30ADFE4D26A694FEAD80FB69FF";
        };
        password = "<null>";
        progress = "A43A28BF-A157-4C98-949C-03FE28557108";
        timeout = 18000000;
        type = POST;
        url = "https://secure.kidreports.co.nz/data/uploadMedia?type=PHOTO&token=tSx5CQPXPq945Cq8JFcrcHtbKeszm2jHH966sA6d7gzxKjnBzRgN752fEbrbpqWq7kjTQNbXNahR2gzmBEbnRm53MG2cTTKezP7p3MaySkwhGjzYZgPcMTEbGn4mRzhP&key=b5eeecfe-3591-479e-d520-69e5ad05a80c";
        usernam<…>

[DEBUG] ForgeURLSchemeHandler::startURLSchemeTask -&gt; content://forge-content/?uri=assets-library&lt;decode: mismatch for [%3A] got [STRING private sz:191]&gt;&lt;decode: missing data&gt;&lt;decode: missing data&gt;asset&lt;decode: missing data&gt;asset.JPG&lt;decode: missing data&gt;id&lt;decode: missing data&gt;B84E8479-475C-4727-A4A4-B77AA9980897&lt;decode: missing data&gt;xt&lt;decode: missing data&gt;JPG&amp;type=image&amp;

[DEBUG] Native call: {
    callid = "F6D7D886-5E3E-4F1A-A01D-8631481700BF";
    method = "file.remove";
    params =     {
        type = image;
        uri = "assets-library://asset/asset.JPG?id=B84E8479-475C-4727-A4A4-B77AA9980897&ext=JPG";
    };
}

[DEBUG] Native call: {
    callid = "A59019D3-1F1C-4F8D-9571-97AACA789040";
    method = "logging.log";
    params =     {
        level = 20;
        message = "[FORGE] 'Error removing file:[object Object]'";
    };
}

[INFO] [FORGE] 'Error removing file:[object Object]'

[DEBUG] Returned to javascript: {
    callid = "F6D7D886-5E3E-4F1A-A01D-8631481700BF";
    content =     {
        message = "Not a deletable file";
        subtype = "<null>";
        type = "BAD_INPUT";
    };
    status = error;
}

Do you have any thoughts about what is the problem?


#5

From the logs it looks like the issue might also be with the request or file module.

Could you please post an excerpt from the code that’s causing the error?


#6
      image: function (cb, params) {
    if (useDefaultImage) {
      this.oldImage(cb, params);
    } else {
      var p = params || {};
      //$prefs.current.getMedia = true;
      forge.notification.confirm($translate.instant('imageSourceTitle'), $translate.instant('imageSourceBody'),
        $translate.instant('imageSourceGallery'), $translate.instant('imageSourceCamera'),
        function (userClickedYes) {
          if (userClickedYes) {
            forge.gallery.getImages(function (files) {
              var total = files.length;
              var count = 0;
              var urls = [];
              _.each(files, function (file) {
                forge.file.URL(file, function (url) {
                  url = forge.httpd.normalize(url);
                  urls.push(url);
                  count++;
                  if ( count == total ) {
                    //alert("calling evdetails cb");
                    cb(null, files, urls);
                  }
                });
              });
            });
          } else {
            _self.oldImageFromCamera(cb, params);
          }
        });
    }

#7

From the logs it looks like, at some point, you’re also doing a call to the request and file modules with the urls.

I assume it’s the cb(null, files, urls); callback you’re invoking - can you post an excerpt of that callback as well?


#8
      $native.image(function (err, files, urls) {
    if (err) {
      //alert(err);
      console.log(err);
      $appstate.msg($translate.instant("ErrorSavingPhoto"), true, "danger");
    } else {
      _.each(urls, function(url) {
        $native.saveToLibrary(url);  
      })
      
      $appstate.nav.goHome();
    }
  }, _.extend({source:'camera'}, $facility.getImageParameters()));
};


      saveToLibrary: function (url) {
    forge.file.saveURL(url, function (f) {
        console.log("saved file:" + f)
      },
      function (err) {
        console.log(err);
      });

  }

#9

Not seeing the code that’s calling into forge.request but can you try bumping your gallery module version to v2.1 and see if that makes a difference?

Changelog for v2.1

  • Fixed: App freezes when selecting images on pre iOS 13 devices
  • Fixed: Images contain no data on iOS 13

#10

The new gallery module version v2.1 solved the problem. Thanks.