Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Jul 24, 2024
1 parent d352e53 commit 0227f51
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 108 deletions.
10 changes: 5 additions & 5 deletions example/ios/xmtpreactnativesdkexample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
LastUpgradeCheck = 1130;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = FY4NZR34Z3;
DevelopmentTeam = 65GVVS9K6W;
LastSwiftMigration = 1250;
};
A6A5DB842A00551E001DF8C2 = {
Expand Down Expand Up @@ -408,7 +408,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = xmtpreactnativesdkexample/xmtpreactnativesdkexample.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = FY4NZR34Z3;
DEVELOPMENT_TEAM = 65GVVS9K6W;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
Expand All @@ -424,7 +424,7 @@
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = expo.modules.xmtpreactnativesdk.example;
PRODUCT_BUNDLE_IDENTIFIER = cvoell.modules.xmtpreactnativesdk.example;
PRODUCT_NAME = xmtpreactnativesdkexample;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -441,7 +441,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = xmtpreactnativesdkexample/xmtpreactnativesdkexample.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = FY4NZR34Z3;
DEVELOPMENT_TEAM = 65GVVS9K6W;
INFOPLIST_FILE = xmtpreactnativesdkexample/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -452,7 +452,7 @@
"-lc++",
);
OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE";
PRODUCT_BUNDLE_IDENTIFIER = expo.modules.xmtpreactnativesdk.example;
PRODUCT_BUNDLE_IDENTIFIER = cvoell.modules.xmtpreactnativesdk.example;
PRODUCT_NAME = xmtpreactnativesdkexample;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
158 changes: 79 additions & 79 deletions example/ios/xmtpreactnativesdkexample/Info.plist
Original file line number Diff line number Diff line change
@@ -1,82 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>xmtp-react-native-sdk-example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>expo.modules.xmtpreactnativesdk.example</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string>The app accesses your camera to let you attach photos as messages.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to access your microphone</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>The app accesses your photos to let you attach them as messages.</string>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>xmtp-react-native-sdk-example</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>expo.modules.xmtpreactnativesdk.example</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSCameraUsageDescription</key>
<string>The app accesses your camera to let you attach photos as messages.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Allow $(PRODUCT_NAME) to access your microphone</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>The app accesses your photos to let you attach them as messages.</string>
<key>UILaunchStoryboardName</key>
<string>SplashScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIRequiresFullScreen</key>
<false/>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
62 changes: 46 additions & 16 deletions example/src/tests/groupPermissionsTests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { permissionPolicySet } from 'xmtp-react-native-sdk'
import { Test, assert, createClients } from './test-utils'
import { PermissionPolicySet } from 'xmtp-react-native-sdk/lib/types/PermissionPolicySet'

import { Test, assert, createClients } from './test-utils'

export const groupPermissionsTests: Test[] = []
let counter = 1
function test(name: string, perform: () => Promise<boolean>) {
Expand Down Expand Up @@ -540,14 +540,44 @@ test('can create a group with custom permissions', async () => {
await alix.conversations.syncGroups()
const alixGroup = (await alix.conversations.listGroups())[0]
const permissions = await alixGroup.permissionPolicySet()
assert(permissions.addMemberPolicy === customPermissionsPolicySet.addMemberPolicy, `permissions.addMemberPolicy should be ${customPermissionsPolicySet.addMemberPolicy} but was ${permissions.addMemberPolicy}`)
assert(permissions.removeMemberPolicy === customPermissionsPolicySet.removeMemberPolicy, `permissions.removeMemberPolicy should be ${customPermissionsPolicySet.removeMemberPolicy} but was ${permissions.removeMemberPolicy}`)
assert(permissions.addAdminPolicy === customPermissionsPolicySet.addAdminPolicy, `permissions.addAdminPolicy should be ${customPermissionsPolicySet.addAdminPolicy} but was ${permissions.addAdminPolicy}`)
assert(permissions.removeAdminPolicy === customPermissionsPolicySet.removeAdminPolicy, `permissions.removeAdminPolicy should be ${customPermissionsPolicySet.removeAdminPolicy} but was ${permissions.removeAdminPolicy}`)
assert(permissions.updateGroupNamePolicy === customPermissionsPolicySet.updateGroupNamePolicy, `permissions.updateGroupNamePolicy should be ${customPermissionsPolicySet.updateGroupNamePolicy} but was ${permissions.updateGroupNamePolicy}`)
assert(permissions.updateGroupDescriptionPolicy === customPermissionsPolicySet.updateGroupDescriptionPolicy, `permissions.updateGroupDescriptionPolicy should be ${customPermissionsPolicySet.updateGroupDescriptionPolicy} but was ${permissions.updateGroupDescriptionPolicy}`)
assert(permissions.updateGroupImagePolicy === customPermissionsPolicySet.updateGroupImagePolicy, `permissions.updateGroupImagePolicy should be ${customPermissionsPolicySet.updateGroupImagePolicy} but was ${permissions.updateGroupImagePolicy}`)
assert(permissions.updateGroupPinnedFrameUrlPolicy === customPermissionsPolicySet.updateGroupPinnedFrameUrlPolicy, `permissions.updateGroupPinnedFrameUrlPolicy should be ${customPermissionsPolicySet.updateGroupPinnedFrameUrlPolicy} but was ${permissions.updateGroupPinnedFrameUrlPolicy}`)
assert(
permissions.addMemberPolicy === customPermissionsPolicySet.addMemberPolicy,
`permissions.addMemberPolicy should be ${customPermissionsPolicySet.addMemberPolicy} but was ${permissions.addMemberPolicy}`
)
assert(
permissions.removeMemberPolicy ===
customPermissionsPolicySet.removeMemberPolicy,
`permissions.removeMemberPolicy should be ${customPermissionsPolicySet.removeMemberPolicy} but was ${permissions.removeMemberPolicy}`
)
assert(
permissions.addAdminPolicy === customPermissionsPolicySet.addAdminPolicy,
`permissions.addAdminPolicy should be ${customPermissionsPolicySet.addAdminPolicy} but was ${permissions.addAdminPolicy}`
)
assert(
permissions.removeAdminPolicy ===
customPermissionsPolicySet.removeAdminPolicy,
`permissions.removeAdminPolicy should be ${customPermissionsPolicySet.removeAdminPolicy} but was ${permissions.removeAdminPolicy}`
)
assert(
permissions.updateGroupNamePolicy ===
customPermissionsPolicySet.updateGroupNamePolicy,
`permissions.updateGroupNamePolicy should be ${customPermissionsPolicySet.updateGroupNamePolicy} but was ${permissions.updateGroupNamePolicy}`
)
assert(
permissions.updateGroupDescriptionPolicy ===
customPermissionsPolicySet.updateGroupDescriptionPolicy,
`permissions.updateGroupDescriptionPolicy should be ${customPermissionsPolicySet.updateGroupDescriptionPolicy} but was ${permissions.updateGroupDescriptionPolicy}`
)
assert(
permissions.updateGroupImagePolicy ===
customPermissionsPolicySet.updateGroupImagePolicy,
`permissions.updateGroupImagePolicy should be ${customPermissionsPolicySet.updateGroupImagePolicy} but was ${permissions.updateGroupImagePolicy}`
)
assert(
permissions.updateGroupPinnedFrameUrlPolicy ===
customPermissionsPolicySet.updateGroupPinnedFrameUrlPolicy,
`permissions.updateGroupPinnedFrameUrlPolicy should be ${customPermissionsPolicySet.updateGroupPinnedFrameUrlPolicy} but was ${permissions.updateGroupPinnedFrameUrlPolicy}`
)

// Verify that bo can not update the pinned frame even though they are a super admin
try {
Expand All @@ -556,7 +586,7 @@ test('can create a group with custom permissions', async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
// expected
}
}

// Verify that alix can update the group description
await alixGroup.updateGroupDescription('new description')
Expand Down Expand Up @@ -596,14 +626,14 @@ test('creating a group with invalid permissions should fail', async () => {

// Bo creates a group with Alix and Caro
try {
const boGroup = await bo.conversations.newGroupCustomPermissions(
await bo.conversations.newGroupCustomPermissions(
[alix.address, caro.address],
customPermissionsPolicySet
)
assert(false, 'Group creation should fail')
customPermissionsPolicySet
)
assert(false, 'Group creation should fail')
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (error) {
// expected
}
return true
})

2 changes: 1 addition & 1 deletion example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('can make a MLS V3 client', async () => {
233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64,
166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145,
])
const client = await Client.createRandom({
await Client.createRandom({
env: 'local',
appVersion: 'Testing/0.0.0',
enableV3: true,
Expand Down
7 changes: 3 additions & 4 deletions example/src/tests/tests.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { sha256 } from '@noble/hashes/sha256'
import { FramesClient } from '@xmtp/frames-client'
import { content, invitation, signature as signatureProto } from '@xmtp/proto'
import { content, invitation } from '@xmtp/proto'
import { createHmac } from 'crypto'
import ReactNativeBlobUtil from 'react-native-blob-util'
import Config from 'react-native-config'
import { TextEncoder, TextDecoder } from 'text-encoding'
import { createWalletClient, custom, PrivateKeyAccount, toHex } from 'viem'
import { PrivateKeyAccount } from 'viem'
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
import { DecodedMessage } from 'xmtp-react-native-sdk/lib/DecodedMessage'

import { Test, assert, createClients, delayToPropogate } from './test-utils'
import { Test, assert, delayToPropogate } from './test-utils'
import {
Query,
JSContentCodec,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { DecodedMessage } from './DecodedMessage'
import { Group } from './Group'
import { CreateGroupOptions } from './types/CreateGroupOptions'
import { EventTypes } from './types/EventTypes'
import { PermissionPolicySet } from './types/PermissionPolicySet'
import { ConversationContext } from '../XMTP.types'
import * as XMTPModule from '../index'
import { ContentCodec } from '../index'
import { getAddress } from '../utils/address'
import { PermissionPolicySet } from './types/PermissionPolicySet'

export default class Conversations<
ContentTypes extends ContentCodec<any>[] = [],
Expand Down Expand Up @@ -189,7 +189,7 @@ export default class Conversations<
)
}

/**
/**
* Creates a new group with custom permissions.
*
* This method creates a new group with the specified peer addresses and options.
Expand All @@ -199,7 +199,7 @@ export default class Conversations<
* @param {CreateGroupOptions} opts - The options to use for the group.
* @returns {Promise<Group<ContentTypes>>} A Promise that resolves to a Group object.
*/
async newGroupCustomPermissions(
async newGroupCustomPermissions(
peerAddresses: string[],
permissionPolicySet: PermissionPolicySet,
opts?: CreateGroupOptions | undefined
Expand Down

0 comments on commit 0227f51

Please sign in to comment.