Giter Site home page Giter Site logo

Comments (7)

ennioma avatar ennioma commented on May 27, 2024 2

Ok found it! Let me work on this and I'll let you know.

from arek.

ennioma avatar ennioma commented on May 27, 2024

Hi @multinerd,

You can update ArekCellVMServiceProgrammatically as follow:

`import Foundation
import arek

class ArekCellVMServiceProgrammatically {
static private var permissions = [
["popupDataTitle": "Media Library Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
["popupDataTitle": "Camera Access - PMAlertController", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
["popupDataTitle": "Location Always Access - native", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
["popupDataTitle": "Motion - PMAlertController", "allowButtonTitle": "Allow 👍🏼", "denyButtonTitle": "No! 👎🏼", "enableTitle": "Please!", "reEnableTitle": "Re-enable please!"],
]

static func numberOfVMs() -> Int {
    return self.permissions.count
}

static func buildVM(index: Int) -> ArekCellVM {
    let data = permissions[index]
    
    let configuration = ArekConfiguration(frequency: .OnceADay, presentInitialPopup: true, presentReEnablePopup: true)
    let initialPopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["enableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopuptType(index: index))
    let reenablePopupData = ArekPopupData(title: data["popupDataTitle"]!, message: data["reEnableTitle"]!, image: "", allowButtonTitle: data["allowButtonTitle"]!, denyButtonTitle: data["denyButtonTitle"]!, type: getPopuptType(index: index))
    
    let permission = getPermissionType(index: index, configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reenablePopupData)
    return ArekCellVM(permission: permission!, title: data["popupDataTitle"]!)
}

static private func getPopuptType(index: Int) -> ArekPopupType {
    switch index {
    case 0:
        return .native
    case 1:
        return .codeido
    case 2:
        return .native
    case 3:
        return .codeido
    default:
        return .native
    }
}

static private func getPermissionType(index: Int, configuration: ArekConfiguration, initialPopupData: ArekPopupData, reEnablePopupData: ArekPopupData) -> ArekPermissionProtocol? {
    
    switch index {
    case 0:
        return ArekMediaLibrary(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
    case 1:
        return ArekCamera(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
    case 2:
        return ArekLocationAlways(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
    case 3:
        return ArekMotion(configuration: configuration, initialPopupData: initialPopupData, reEnablePopupData: reEnablePopupData)
    default:
        return nil
    }
}

}
`

As you can see I've just appended another permission for you. You have to consider that this doesn't work on simulator.

Let me know if it works for you!

from arek.

multinerd avatar multinerd commented on May 27, 2024

Same thing on my side. it prompts for permission on app launch, so by the time i click the cell, i would have already burned my only ios request.

In other words, the framework is completely bypassed.

from arek.

ennioma avatar ennioma commented on May 27, 2024

Hi @multinerd,
I think I've fixed this issue in #91, could you please check if the new logic from that branch works for you?

from arek.

multinerd avatar multinerd commented on May 27, 2024

@ennioma I've moved over from the iOS project i was working on to a C# desktop version. Ill be able to test it this weekend and let you know.

from arek.

ennioma avatar ennioma commented on May 27, 2024

@multinerd In the meanwhile I've merged it to develop. So you can checkout it.

If everything is fine in the weekend I'll deliver another release.

from arek.

multinerd avatar multinerd commented on May 27, 2024

Sorry, i lost track. The latest in the develop branch seems to be working as expected.

from arek.

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.