GithubHelp home page GithubHelp logo

Comments (7)

lawmicha avatar lawmicha commented on June 9, 2024

Hi @smediomike, can you clarify with which API calls you making?

In step 3. upload such picture to s3 storage, how do you upload the S3 picture, through Amplify.Storage.upload? And where/how is the mutation sent for the client to receive the subscription event?

from amplify-swift.

smediomike avatar smediomike commented on June 9, 2024

Hi @lawmicha

  1. Amplify.Publisher.create(Amplify.DataStore.observe(model))
  2. Amplify.Storage.uploadFile or Amplify.Storage.uploadData
  3. try await Amplify.DataStore.save(model)
  4. Received changes.mutationType "create" ==> this is correct on 2.29.2 which same to 2.17
  5. delete such content by API on client or on web and mask datastore one fileld to "deleted" status by the below iOS code:
     let s3Dict = [ "roomId" : room,
                         "s3_key_filename" : fileName as Any,
                         "s3_key" : content.s3_data as Any] as [String : Any]
       jsonDict = [ "variables" : s3Dict,
                             "query" : "mutation Mark_delete_cloud_backup_ImageVideo($s3_key: String!) {\n  mark_delete_cloud_backup_ImageVideo(s3_key: $s3_key) {\n    userId\n    album\n    dateAdded\n    dateBackup\n    dateModified\n    dateTaken\n    deviceId\n    duration\n    hash\n    height\n    id\n    isdeleted\n    localPath\n    mimeType\n    orientation\n    roomId\n    s3Data\n    size\n    title\n    tn1S3Data\n    tn2S3Data\n    type\n    width\n    createdAt\n    updatedAt\n    _version\n    _deleted\n    _lastChangedAt\n  }\n}\n"
            ] as [String : Any] 
var jsonData : Data? = nil;
        do {
            jsonData = try JSONSerialization.data(withJSONObject: jsonDict as Any, options: .prettyPrinted)
        }catch {
            
        }
            
        let request = RESTRequest(apiName:"dataStoreApi",path: nil, body: jsonData)
let data = try await Amplify.API.post(request: request)
            let str = String(decoding: data, as: UTF8.self)
            print("mark delete Success: \(str)")
  1. we can see this content is be deleted, but we can not receive changes.mutationType "update" event on 2.29.2, but 2.17 can receive

Note: this issue only happen iOS application go to background and then back to foreground. if application always keep in foreground, this issue will not happen.

I will check more whether we need to step #1 again if application go to background before. thanks for your help!

from amplify-swift.

smediomike avatar smediomike commented on June 9, 2024

Hi @lawmicha

add more information, I cancel old Subscription and add new Subscription after go to foreground, this issue still happen. BTW, once happen this issue, this "update" record will not be sync to local datastore till to re-start application.

from amplify-swift.

smediomike avatar smediomike commented on June 9, 2024

Hi @lawmicha
add more information, I rollback SDK version to 2.26.1; this issue will not happen.

from amplify-swift.

ruisebas avatar ruisebas commented on June 9, 2024

Hi @smediomike,

We've recently addressed an issue that was causing network-related problems in the latest version 2.33.3.
Would you mind please upgrading to this version and verifying if it also addresses your issue?

Thanks!

from amplify-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.